[rhmessaging-commits] rhmessaging commits: r2009 - in mgmt/cumin: python/cumin and 1 other directory.
rhmessaging-commits at lists.jboss.org
rhmessaging-commits at lists.jboss.org
Thu May 8 15:26:23 EDT 2008
Author: justi9
Date: 2008-05-08 15:26:23 -0400 (Thu, 08 May 2008)
New Revision: 2009
Modified:
mgmt/cumin/bin/cumin-test
mgmt/cumin/python/cumin/quirk.py
mgmt/cumin/python/cumin/test.py
Log:
Interim checkin of updates to test code for 0-10 python client.
There's still an issue with session close.
Modified: mgmt/cumin/bin/cumin-test
===================================================================
--- mgmt/cumin/bin/cumin-test 2008-05-08 18:09:50 UTC (rev 2008)
+++ mgmt/cumin/bin/cumin-test 2008-05-08 19:26:23 UTC (rev 2009)
@@ -25,7 +25,7 @@
host, port = parse_broker_addr(config.broker)
- env = TestEnvironment(app, host, port)
+ env = TestEnvironment(app, host, port, config.spec)
env.init();
session = env.run_test(MainTest(env))
Modified: mgmt/cumin/python/cumin/quirk.py
===================================================================
--- mgmt/cumin/python/cumin/quirk.py 2008-05-08 18:09:50 UTC (rev 2008)
+++ mgmt/cumin/python/cumin/quirk.py 2008-05-08 19:26:23 UTC (rev 2009)
@@ -44,7 +44,7 @@
session.psession.message_flow(self.name, 0, 0xFFFFFFFF)
session.psession.message_flow(self.name, 1, 0xFFFFFFFF)
- self.client_queue = session.client.pclient.queue(self.name)
+ self.client_queue = session.client.pconn.queue(self.name)
def get(self, session):
if self.client_queue is None:
@@ -83,22 +83,33 @@
def __str__(self):
return self.content.body
-class Client(object):
- def __init__(self, host, port):
+class Connection(object):
+ def __init__(self, host, port, spec_path):
self.host = host
self.port = port
- self.pclient = qpid.client.Client(host, port)
+ self.spec = qpid.spec.load(spec_path)
- def login(self, user, password):
- self.pclient.start({"LOGIN": user, "PASSWORD": password})
+ self.pconn = None
+ def open(self):
+ assert self.pconn is None
+
+ sock = qpid.util.connect(self.host, self.port)
+ self.pconn = qpid.connection.Connection(sock, self.spec)
+
+ def close(self):
+ assert self.pconn
+
+ self.pconn.close()
+
class Session(object):
- def __init__(self, client):
- self.client = client
- self.psession = client.pclient.session()
+ def __init__(self, conn, name):
+ self.conn = conn
+ self.name = name
+ self.psession = conn.pconn.session(name)
def open(self):
- self.psession.open()
+ pass
def close(self):
self.psession.close()
Modified: mgmt/cumin/python/cumin/test.py
===================================================================
--- mgmt/cumin/python/cumin/test.py 2008-05-08 18:09:50 UTC (rev 2008)
+++ mgmt/cumin/python/cumin/test.py 2008-05-08 19:26:23 UTC (rev 2009)
@@ -9,10 +9,11 @@
import time
class TestEnvironment(object):
- def __init__(self, app, broker_host, broker_port):
+ def __init__(self, app, broker_host, broker_port, spec_path):
self.app = app
- self.broker_client = quirk.Client(broker_host, broker_port)
+ self.broker_conn = quirk.Connection(broker_host, broker_port,
+ spec_path)
self.broker_queue = quirk.Queue("cumin.queue")
self.broker_exchange = quirk.Exchange("cumin.exchange")
@@ -23,9 +24,9 @@
self.exchange = None
def init(self):
- self.broker_client.login("guest", "guest")
+ self.broker_conn.open()
- session = quirk.Session(self.broker_client)
+ session = quirk.Session(self.broker_conn, "test")
session.open()
try:
@@ -201,7 +202,7 @@
form.names.get(s).append(session.id)
addr = "%s:%s" % \
- (self.env.broker_client.host, self.env.broker_client.port)
+ (self.env.broker_conn.host, self.env.broker_conn.port)
form.addrs.get(s).append(addr)
form.groups.get(s).append(None)
form.submit(s)
@@ -375,8 +376,8 @@
raise Exception("Not implemented")
vhost = self.env.vhost
- address = self.env.broker_client.host + ":" + \
- str(self.env.broker_client.port)
+ address = self.env.broker_conn.host + ":" + \
+ str(self.env.broker_conn.port)
self.env.client = Client.selectBy(vhost=vhost, address=address)[0]
More information about the rhmessaging-commits
mailing list