Пример #1
0
    handler_id = None

    def test_deploy(self):
        global handler_id
        def handler(message):
            if message.body == "started":
                tu.test_complete()
        handler_id = EventBus.register_handler("test-handler", False, handler)
        conf = {'foo' : 'bar'}
        vertx.deploy_verticle("core/deploy/child.py", conf)

    def test_undeploy(self):
        global handler_id
        def handler(message):
            if message.body == "stopped":
                tu.test_complete()
        handler_id = EventBus.register_handler("test-handler", False, handler)
        conf = {'foo' : 'bar'}
        def deploy_handler(id):
            vertx.undeploy_verticle(id)
        vertx.deploy_verticle("core/deploy/child.py", conf, handler=deploy_handler)

def vertx_stop():
    EventBus.unregister_handler(handler_id)
    tu.unregister_all()
    tu.app_stopped()

tu.register_all(DeployTest())
tu.app_ready()
Пример #2
0

def vertx_stop():
    tu.unregister_all()
    if peer1 is not None:

        def close_handler():
            if peer2 is not None:

                def close_handler():
                    tu.app_stopped()

                peer2.close(close_handler)
            else:
                tu.app_stopped()

        peer1.close(close_handler)

    elif peer2 is not None:

        def close_handler():
            tu.app_stopped()

        peer2.close(close_handler)
    else:
        tu.app_stopped()


tu.register_all(DatagramTest())
tu.app_ready()