Пример #1
0
 def test_call():
     ee = QueueEventEngine()
     client = EventRPCClient(ee, 'test')
     server = EventRPCServer(ee, 'test')
     server.register("server_print_hello", server_print_hello)
     ee.start()
     client.call("server_print_hello", { 'msg': 'parral_client'}, client_print_hello)
     return ee
Пример #2
0
 def test_call():
     ee = QueueEventEngine()
     client = EventRPCClient(ee, 'test')
     server = EventRPCServer(ee, 'test')
     server.register("server_print_hello", server_print_hello)
     ee.start()
     client.call("server_print_hello", {'msg': 'parral_client'},
                 client_print_hello)
     return ee
Пример #3
0
 def test_sync_call(timeout):
     ee = QueueEventEngine()
     client = EventRPCClient(ee, 'test')
     server = EventRPCServer(ee, 'test')
     server.register("server_print_hello", server_print_hello)
     ee.start()
     print client.sync_call("server_print_hello", { 'msg': 'sync_client'}, timeout), "**" 
     ee.stop()
     return
Пример #4
0
def test_eventengine():
    """测试函数"""
    import sys
    from datetime import datetime
    import time

    def simpletest(event):
        print str(datetime.now()), event.route

    ee = QueueEventEngine()
    timer = Timer(ee)
    ee.register(Event.TIMER, simpletest)
    ee.start()
    timer.start()

    time.sleep(2)
    timer.stop()
    time.sleep(2)
    timer.resume()
    try:
        while True:
            time.sleep(1)
    except KeyboardInterrupt:
        ee.stop()
        timer.stop()
        sys.exit(0)
Пример #5
0
def test_eventengine():
    """测试函数"""
    import sys
    from datetime import datetime
    import time
    
    def simpletest(event):
        print str(datetime.now()), event.route
    
    ee = QueueEventEngine()
    timer = Timer(ee)
    ee.register(Event.TIMER, simpletest)
    ee.start()
    timer.start()

    time.sleep(2)
    timer.stop()
    time.sleep(2)
    timer.resume()
    try:
        while True:
            time.sleep(1)
    except KeyboardInterrupt:
        ee.stop()
        timer.stop()
        sys.exit(0)
Пример #6
0
 def test_sync_call(timeout):
     ee = QueueEventEngine()
     client = EventRPCClient(ee, 'test')
     server = EventRPCServer(ee, 'test')
     server.register("server_print_hello", server_print_hello)
     ee.start()
     print client.sync_call("server_print_hello", {'msg': 'sync_client'},
                            timeout), "**"
     ee.stop()
     return