From 79a29f32ef84c26de35d3e75c3acff314b727f56 Mon Sep 17 00:00:00 2001 From: Ted Ross Date: Wed, 13 Jan 2010 11:57:19 +0000 Subject: Added raise_event support to the Ruby and Python wrapped agent APIs. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@898727 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/bindings/qmf/tests/python_console.py | 38 ++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'cpp/bindings/qmf/tests/python_console.py') diff --git a/cpp/bindings/qmf/tests/python_console.py b/cpp/bindings/qmf/tests/python_console.py index 6f366d1a3d..fe27c33c4b 100755 --- a/cpp/bindings/qmf/tests/python_console.py +++ b/cpp/bindings/qmf/tests/python_console.py @@ -23,6 +23,7 @@ from qpid.testlib import TestBase010 from qpid.datatypes import Message from qpid.queue import Empty from time import sleep +import qmf.console class QmfInteropTests(TestBase010): @@ -166,6 +167,43 @@ class QmfInteropTests(TestBase010): for binding in bindings: self.assertEqual(binding.exchangeRef, mgmt_exchange.getObjectId()) + def test_F_events(self): + class Handler(qmf.console.Console): + def __init__(self): + self.queue = [] + + def event(self, broker, event): + if event.getClassKey().getClassName() == "test_event": + self.queue.append(event) + + handler = Handler() + self.startQmf(handler) + + parents = self.qmf.getObjects(_class="parent") + self.assertEqual(len(parents), 1) + parent = parents[0] + + parent.set_numerics("big") + parent.set_numerics("small") + parent.set_numerics("negative") + parent.set_short_string("TEST") + parent.set_long_string("LONG_TEST") + parent.probe_userid() + + queue = handler.queue + self.assertEqual(len(queue), 5) + self.assertEqual(queue[0].arguments["uint32val"], 0xA5A55A5A) + self.assertEqual(queue[0].arguments["strval"], "Unused") + self.assertEqual(queue[1].arguments["uint32val"], 5) + self.assertEqual(queue[1].arguments["strval"], "Unused") + self.assertEqual(queue[2].arguments["uint32val"], 0) + self.assertEqual(queue[2].arguments["strval"], "Unused") + self.assertEqual(queue[3].arguments["uint32val"], 0) + self.assertEqual(queue[3].arguments["strval"], "TEST") + self.assertEqual(queue[4].arguments["uint32val"], 0) + self.assertEqual(queue[4].arguments["strval"], "LONG_TEST") + + def getProperty(self, msg, name): for h in msg.headers: if hasattr(h, name): return getattr(h, name) -- cgit v1.2.1