[rhmessaging-commits] rhmessaging commits: r1672 - mgmt/cumin/python/cumin.

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Sat Feb 9 14:32:25 EST 2008


Author: justi9
Date: 2008-02-09 14:32:24 -0500 (Sat, 09 Feb 2008)
New Revision: 1672

Modified:
   mgmt/cumin/python/cumin/test.py
Log:
Adds more tests to the suite.



Modified: mgmt/cumin/python/cumin/test.py
===================================================================
--- mgmt/cumin/python/cumin/test.py	2008-02-09 18:12:22 UTC (rev 1671)
+++ mgmt/cumin/python/cumin/test.py	2008-02-09 19:32:24 UTC (rev 1672)
@@ -17,7 +17,9 @@
         self.broker_queue = quirk.Queue("cumin.queue")
         self.broker_exchange = quirk.Exchange("cumin.exchange")
 
+        self.broker_registration = None
         self.broker = None
+        self.vhost = None
         self.queue = None
         self.exchange = None
 
@@ -101,13 +103,13 @@
     def __init__(self, env):
         super(MainTest, self).__init__(env, None)
 
-        BrokerTest(env, self)
+        BrokerRegistrationTest(env, self)
 
-class BrokerTest(Test):
+class BrokerRegistrationTest(Test):
     def __init__(self, env, parent):
-        super(BrokerTest, self).__init__(env, parent)
+        super(BrokerRegistrationTest, self).__init__(env, parent)
 
-        QueueTest(env, self)
+        BrokerTest(env, self)
 
     def do_run(self, session):
         app = self.env.app
@@ -145,15 +147,34 @@
         #file.write(html)
         #file.close()
 
-        reg = BrokerRegistration.selectBy(name=name)[0]
+        self.env.broker_registration = BrokerRegistration.selectBy \
+            (name=name)[0]
 
+        self.run_children(session)
+
+class BrokerTest(Test):
+    def __init__(self, env, parent):
+        super(BrokerTest, self).__init__(env, parent)
+
+        VhostTest(env, self)
+
+    def do_run(self, session):
+        reg = self.env.broker_registration
+
         wait(lambda: reg.broker)
 
         self.env.broker = reg.broker
-            
+
         self.run_children(session)
 
-class QueueTest(Test):
+class VhostTest(Test):
+    def __init__(self, env, parent):
+        super(VhostTest, self).__init__(env, parent)
+
+        QueueTest(env, self)
+        ExchangeTest(env, self)
+        ClientTest(env, self)
+
     def do_run(self, session):
         def predicate():
             for item in Vhost.selectBy(broker=self.env.broker, name="/"):
@@ -161,12 +182,50 @@
 
         wait(predicate)
 
-        vhost = Vhost.selectBy(broker=self.env.broker, name="/")[0]
+        self.env.vhost = Vhost.selectBy(broker=self.env.broker, name="/")[0]
+
+        self.run_children(session)
+
+class QueueTest(Test):
+    def do_run(self, session):
+        vhost = self.env.vhost
         name = self.env.broker_queue.name
-        self.queue = Queue.selectBy(vhost=vhost, name=name)[0]
 
-        print self.queue
+        def predicate():
+            for item in Queue.selectBy(vhost=vhost, name=name):
+                return True
 
+        wait(predicate)
+
+        self.env.queue = Queue.selectBy(vhost=vhost, name=name)[0]
+
+        print self.env.queue
+
+        self.run_children(session)
+
+class ExchangeTest(Test):
+    def do_run(self, session):
+        vhost = self.env.vhost
+        name = self.env.broker_exchange.name
+
+        self.env.exchange = Exchange.selectBy(vhost=vhost, name=name)[0]
+
+        print self.env.exchange
+
+        self.run_children(session)
+
+class ClientTest(Test):
+    def do_run(self, session):
+        vhost = self.env.vhost
+        address = self.env.broker_client.host + ":" + \
+            str(self.env.broker_client.port)
+
+        self.env.client = Client.selectBy(vhost=vhost, address=address)[0]
+
+        print self.env.client
+
+        self.run_children(session)
+
 def wait(predicate, timeout=30):
     start = time.time()
 




More information about the rhmessaging-commits mailing list