def secondary_node(): expected_at_secondary = [ ["style02c:test02", [1, 2, 3], { "a": 1, "b": 2 }], ["style03c:test01", [3, 2, 1], { "a": 1, "b": 2 }], ["style03s:test02", (), {}], ["style03s:test03", (), {}], ["style01c:test01", [], {}], ["style01s:test02", (), {}], ] test_results = [] @berrymq.following_function("*:*") def test_receiver(message): expected = expected_at_secondary[0] if expected[0] == message.id and \ expected[1] == message.args and \ expected[2] == message.kwargs: result = "ok" else: result = "ng" del expected_at_secondary[0] test_results.append([ str(expected), str([message.id, message.args, message.kwargs]), result ]) berrymq.init_connection(SECONDARY_NODE_URL) controller = berrymq.jsonrpc.client.ServerProxy(_url(CONTROL_SERVER_URL)) controller.style02.start() controller.style02.exit() controller.style03.start() berrymq.twitter("style03s:test02") controller.style03.check() berrymq.twitter("style03s:test03") controller.style03.exit() controller.style01.start() berrymq.twitter("style01s:test02") time.sleep(1) controller.style01.exit() controller.quit() berrymq.close_connection() for expected, actual, result in test_results: if result == "ok": print "ok: expected = %s" % expected else: print "ng: expected = %s, actual = %s" % (expected, actual) if len(test_results) == 0: print "ng: no message received"
def exit(self): expected = ['style01c:test01', u'style01s:test02'] check(expected, self.received_messages) berrymq.close_connection() return True
def exit(self): check("style03s:test03", berrymq.get_nowait().id) berrymq.close_connection() return True
def exit(self): berrymq.close_connection() return True