[rhmessaging-commits] rhmessaging commits: r2273 - mgmt/trunk/cumin/python/cumin.
rhmessaging-commits at lists.jboss.org
rhmessaging-commits at lists.jboss.org
Mon Aug 11 10:29:49 EDT 2008
Author: eallen
Date: 2008-08-11 10:29:48 -0400 (Mon, 11 Aug 2008)
New Revision: 2273
Modified:
mgmt/trunk/cumin/python/cumin/test.py
Log:
Adding tests for Exchange Add/Remove
Modified: mgmt/trunk/cumin/python/cumin/test.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/test.py 2008-08-11 11:03:48 UTC (rev 2272)
+++ mgmt/trunk/cumin/python/cumin/test.py 2008-08-11 14:29:48 UTC (rev 2273)
@@ -1,5 +1,6 @@
import sys, os, signal
from mint import *
+from mint.schema import *
from traceback import print_exc, extract_tb
from datetime import datetime
from threading import Thread
@@ -12,6 +13,7 @@
from util import *
import time
+
class TestBroker(Thread):
def __init__(self, path, port):
super(TestBroker, self).__init__()
@@ -440,7 +442,6 @@
form.autodelete.set(s, "preserve")
form.submit(s)
-
p.process(s)
self.env.check_redirect(p, s)
@@ -510,8 +511,6 @@
self.env.check_redirect(p, s)
- vhost = self.env.vhost
-
# wait for newly created queue to get marked as deleted
def predicate():
return queue.deletionTime
@@ -523,6 +522,14 @@
raise Exception("Queue %s not removed" % name)
class ExchangeTest(Test):
+ def __init__(self, env, parent):
+ super(ExchangeTest, self).__init__(env, parent)
+
+ self.Add(env, self)
+ self.Added(env, self)
+ self.Remove(env, self)
+ self.Removed(env, self)
+
def do_run(self, session):
vhost = self.env.vhost
name = self.env.broker_exchange.name
@@ -534,6 +541,69 @@
self.run_children(session)
+ class Add(Test):
+ def do_run(self, session):
+ name = "cumin.exchange.%s" % session.id
+ p, s = self.env.page_and_session()
+
+ reg = self.env.broker_registration
+ form = p.show_main(s).show_broker(s, reg).show_exchange_add(s)
+ form.exchange_name.set(s, name)
+ form.type.set(s, "topic")
+ form.submit(s)
+
+ p.process(s)
+
+ self.env.check_redirect(p, s)
+
+ class Added(Test):
+ def do_run(self, session):
+ vhost = self.env.vhost
+ name = "cumin.exchange.%s" % session.id
+
+ # wait for newly created exchange to show up
+ def predicate():
+ for item in Exchange.selectBy(vhost=vhost, name=name):
+ return True
+
+ wait(predicate)
+
+ # if it timed out, raise an exception
+ try:
+ self.env.added_exchange = Exchange.selectBy(vhost=vhost, name=name)[0]
+ except IndexError:
+ raise Exception("Exchange %s not added" % name)
+
+ class Remove(Test):
+ def do_run(self, session):
+ # try to delete it
+ p, s = self.env.page_and_session()
+
+ reg = self.env.broker_registration
+ form = p.show_main(s).show_broker(s, reg).show_exchanges_remove(s)
+
+ ids = [self.env.added_exchange.id]
+ form.ids.set(s, ids)
+
+ form.submit(s)
+ p.process(s)
+
+ self.env.check_redirect(p, s)
+
+ class Removed(Test):
+ def do_run(self, session):
+ name = "cumin.exchange.%s" % session.id
+
+ # wait for newly created exchange to get marked as deleted
+ def predicate():
+ return self.env.added_exchange.deletionTime
+
+ wait(predicate)
+ # if it timed out, raise an exception
+ if not self.env.added_exchange.deletionTime:
+ raise Exception("Exchange %s not removed" % name)
+
+
class ConnectionTest(Test):
def do_run(self, session):
raise Exception("Not implemented")
More information about the rhmessaging-commits
mailing list