rhmessaging commits: r2277 - mgmt/trunk/mint/python/mint.
by rhmessaging-commits@lists.jboss.org
Author: nunofsantos
Date: 2008-08-11 17:59:12 -0400 (Mon, 11 Aug 2008)
New Revision: 2277
Modified:
mgmt/trunk/mint/python/mint/schemaparser.py
Log:
parser handles multiple xml schema files specified in SCHEMA_XML env var -- move deferred references to end of python output
Modified: mgmt/trunk/mint/python/mint/schemaparser.py
===================================================================
--- mgmt/trunk/mint/python/mint/schemaparser.py 2008-08-11 21:13:51 UTC (rev 2276)
+++ mgmt/trunk/mint/python/mint/schemaparser.py 2008-08-11 21:59:12 UTC (rev 2277)
@@ -163,14 +163,13 @@
def endClass(self):
if (self.additionalPythonOutput != ""):
- self.pythonOutput += self.additionalPythonOutput + "\n"
+ self.finalPythonOutput += self.additionalPythonOutput + "\n"
self.additionalPythonOutput = ""
if (self.pythonOutput.endswith("(SQLObject):\n")):
self.pythonOutput += " pass\n"
self.currentClass = ""
def generateCode(self):
-
self.pythonOutput += "import mint\n"
self.pythonOutput += "from sqlobject import *\n"
self.pythonOutput += "from datetime import datetime\n"
17 years, 8 months
rhmessaging commits: r2276 - in mgmt/trunk/mint: python/mint and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: nunofsantos
Date: 2008-08-11 17:13:51 -0400 (Mon, 11 Aug 2008)
New Revision: 2276
Modified:
mgmt/trunk/mint/Makefile
mgmt/trunk/mint/python/mint/schemaparser.py
Log:
parser handles multiple xml schema files specified in SCHEMA_XML env var
Modified: mgmt/trunk/mint/Makefile
===================================================================
--- mgmt/trunk/mint/Makefile 2008-08-11 18:15:24 UTC (rev 2275)
+++ mgmt/trunk/mint/Makefile 2008-08-11 21:13:51 UTC (rev 2276)
@@ -29,9 +29,8 @@
schema: schema-python schema-sql
schema-python:
- @if [ -z "$$MINT_SCHEMA_XML" ]; then echo "MINT_SCHEMA_XML is not set"; exit 1; fi
- python python/mint/schemaparser.py ${MINT_SCHEMA_XML} python/mint/schema.py ${dsn}
- @if [ -z "$$STORE_SCHEMA_XML" ]; then echo "Warning: STORE_SCHEMA_XML is not set, skipping store schema generation"; else echo "python python/mint/schemaparser.py ${STORE_SCHEMA_XML} python/mint/schema.py ${dsn} append"; python python/mint/schemaparser.py ${STORE_SCHEMA_XML} python/mint/schema.py ${dsn} append; fi
+ @if [ -z "$$SCHEMA_XML" ]; then echo "SCHEMA_XML is not set. SCHEMA_XML should contain a space-separated list of XML schema files to be parsed."; exit 1; fi
+ python python/mint/schemaparser.py python/mint/schema.py ${dsn} ${SCHEMA_XML}
schema-sql:
sqlobject-admin sql -m mint -m mint.schema -c ${dsn} | sed -e '1,2d' > sql/schema.sql
Modified: mgmt/trunk/mint/python/mint/schemaparser.py
===================================================================
--- mgmt/trunk/mint/python/mint/schemaparser.py 2008-08-11 18:15:24 UTC (rev 2275)
+++ mgmt/trunk/mint/python/mint/schemaparser.py 2008-08-11 21:13:51 UTC (rev 2276)
@@ -4,25 +4,15 @@
class SchemaParser:
"""parses broker XML schema"""
- def __init__(self, xmlSchemaPath, pythonFilePath, dsn, append=""):
- self.xmlSchemaPath = xmlSchemaPath
+ def __init__(self, pythonFilePath, dsn, xmlFilePaths):
self.pythonFilePath = pythonFilePath
self.dsn = dsn
+ self.xmlFilePaths = xmlFilePaths
self.style = MixedCaseUnderscoreStyle()
self.additionalPythonOutput = ""
self.currentClass = ""
self.pythonOutput = ""
self.finalPythonOutput = ""
- if (append == ""):
- self.pythonOutput += "import mint\n"
- self.pythonOutput += "from sqlobject import *\n"
- self.pythonOutput += "from datetime import datetime\n"
- self.finalPythonOutput += "\nclassToSchemaNameMap = dict()\n"
- self.finalPythonOutput += "schemaNameToClassMap = dict()\n"
- self.append = False
- else:
- self.pythonOutput += "\n\n"
- self.append = True
# mapping between xml schema types and database column types
# see xml/MintTypes.xml
self.dataTypesMap = dict()
@@ -180,31 +170,35 @@
self.currentClass = ""
def generateCode(self):
- if (self.append):
- fileFlag = "a"
- else:
- fileFlag = "w"
- outputFile = open(self.pythonFilePath, fileFlag)
- schema = mllib.xml_parse(self.xmlSchemaPath)
- classes = schema.query["schema/class"]
- for cls in classes:
- self.startClass(cls["@name"])
- self.generateClassAttribs(cls["@name"], cls.query["property"])
- for elem in cls.query["method"]:
- self.generateMethod(elem)
- self.endClass()
- self.startClass(cls["@name"], stats=True)
- self.generateClassAttribs(cls["@name"], cls.query["statistic"])
- self.endClass()
+
+ self.pythonOutput += "import mint\n"
+ self.pythonOutput += "from sqlobject import *\n"
+ self.pythonOutput += "from datetime import datetime\n"
+ self.finalPythonOutput += "\nclassToSchemaNameMap = dict()\n"
+ self.finalPythonOutput += "schemaNameToClassMap = dict()\n"
+ outputFile = open(self.pythonFilePath, "w")
+ for xmlFile in self.xmlFilePaths:
+ schema = mllib.xml_parse(xmlFile)
+ classes = schema.query["schema/class"]
+ for cls in classes:
+ self.startClass(cls["@name"])
+ self.generateClassAttribs(cls["@name"], cls.query["property"])
+ for elem in cls.query["method"]:
+ self.generateMethod(elem)
+ self.endClass()
+ self.startClass(cls["@name"], stats=True)
+ self.generateClassAttribs(cls["@name"], cls.query["statistic"])
+ self.endClass()
+ self.pythonOutput += "\n\n"
outputFile.write(self.pythonOutput + self.finalPythonOutput)
outputFile.close()
if __name__ == "__main__":
import sys
- if len(sys.argv) not in (4,5):
- print "Usage: schemaparser.py INPUT-XML-SCHEMA OUTPUT-PYTHON-FILE DSN [APPEND]"
+ if len(sys.argv) < 3:
+ print "Usage: schemaparser.py OUTPUT-PYTHON-FILE DSN INPUT-XML-SCHEMA [INPUT-XML-SCHEMA]*"
sys.exit(1)
else:
- parser = SchemaParser(*sys.argv[1:])
+ parser = SchemaParser(sys.argv[1], sys.argv[2], sys.argv[3:])
parser.generateCode()
17 years, 8 months
rhmessaging commits: r2275 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-08-11 14:15:24 -0400 (Mon, 11 Aug 2008)
New Revision: 2275
Modified:
mgmt/trunk/cumin/python/cumin/exchange.py
mgmt/trunk/cumin/python/cumin/model.py
mgmt/trunk/cumin/python/cumin/queue.py
Log:
Moved Queue/Exchange Add under model/Broker
Modified: mgmt/trunk/cumin/python/cumin/exchange.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/exchange.py 2008-08-11 14:31:40 UTC (rev 2274)
+++ mgmt/trunk/cumin/python/cumin/exchange.py 2008-08-11 18:15:24 UTC (rev 2275)
@@ -465,7 +465,7 @@
exchange.name = self.exchange_name.get(session)
exchange.type = self.type.get(session)
- action = self.app.model.exchange.add
+ action = self.app.model.broker.add_exchange
action.invoke(exchange, reg)
self.process_cancel(session)
Modified: mgmt/trunk/cumin/python/cumin/model.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/model.py 2008-08-11 14:31:40 UTC (rev 2274)
+++ mgmt/trunk/cumin/python/cumin/model.py 2008-08-11 18:15:24 UTC (rev 2275)
@@ -11,6 +11,8 @@
from formats import *
from parameters import *
+
+
log = getLogger("cumin.model")
class CuminModel(object):
@@ -142,6 +144,9 @@
else:
return self.name
+ def get_verb(self, session):
+ return None
+
def invoke(self, object, args={}):
invoc = CuminActionInvocation(self, object)
@@ -188,7 +193,9 @@
self.exception = None
def get_description(self, session):
- verb = self.action.get_title(session)
+ verb = self.action.get_verb(session)
+ if not verb:
+ verb = self.action.get_title(session)
if self.object:
cls = self.action.cumin_model.get_class_by_object(self.object)
object = cls.get_object_title(session, self.object)
@@ -548,6 +555,12 @@
prop = CuminProperty(self, "dataDir")
prop.title = "Data Directory"
+ action = self.AddExchange(self, "add_exchange")
+ action.summary = True
+
+ action = self.AddQueue(self, "add_queue")
+ action.summary = True
+
def get_icon_href(self, session):
return "resource?name=broker-36.png"
@@ -558,6 +571,49 @@
def get_object_name(self, broker):
return broker.id
+ class AddExchange(CuminAction):
+ def get_title(self, session):
+ return "Add Exchange"
+
+ def get_verb(self, session):
+ return "Add"
+
+ def show(self, session, exchange):
+ frame = self.cumin_class.show_object(session, exchange)
+ return frame.show_exchange_add(session)
+
+ def do_invoke(self, exchange, reg, completion):
+ session = self.getSessionFromRegistration(reg)
+ session.exchange_declare(exchange=exchange.name,
+ type=exchange.type)
+ # if the above call fails, an exception is
+ # raised and we won't get here
+ completion("OK")
+
+ class AddQueue(CuminAction):
+ def get_title(self, session):
+ return "Add Queue"
+
+ def get_verb(self, session):
+ return "Add"
+
+ def show(self, session, queue):
+ frame = self.cumin_class.show_object(session, queue)
+ return frame.show_queue_add(session)
+
+ def do_invoke(self, queue, args, completion):
+ reg = args["reg"]
+ session = self.getSessionFromRegistration(reg)
+ session.queue_declare(queue=queue.name,
+ exclusive=queue.exclusive,
+ durable=queue.durable,
+ auto_delete=queue.autoDelete)
+
+ # optionally bind to exchanges
+ binding_info = args['exchange_keys']
+ do_bind(session, queue, binding_info)
+ completion("OK")
+
def do_bind(session, queue, binding_info):
for exchange in binding_info:
if "key" in binding_info[exchange]:
@@ -741,9 +797,6 @@
action = self.Remove(self, "remove")
action.summary = True
- action = self.Add(self, "add")
- action.summary = True
-
action = self.Bind(self, "bind")
action.summary = True
@@ -802,27 +855,6 @@
completion("OK")
- class Add(CuminAction):
- def get_title(self, session):
- return "Add"
-
- def show(self, session, queue):
- frame = self.cumin_class.show_object(session, queue)
- return frame.show_queue_add(session)
-
- def do_invoke(self, queue, args, completion):
- reg = args["reg"]
- session = self.getSessionFromRegistration(reg)
- session.queue_declare(queue=queue.name,
- exclusive=queue.exclusive,
- durable=queue.durable,
- auto_delete=queue.autoDelete)
-
- # optionally bind to exchanges
- binding_info = args['exchange_keys']
- do_bind(session, queue, binding_info)
- completion("OK")
-
class CuminExchange(RemoteClass):
def __init__(self, model):
super(CuminExchange, self).__init__(model, "exchange",
@@ -875,8 +907,6 @@
stat.unit = "message"
stat.category = "io"
- self.Add(self, "add")
-
action = self.Remove(self, "remove")
action.summary = True
@@ -898,22 +928,6 @@
else:
return "Default Exchange"
- class Add(CuminAction):
- def get_title(self, session):
- return "Add"
-
- def show(self, session, exchange):
- frame = self.cumin_class.show_object(session, exchange)
- return frame.show_exchange_add(session)
-
- def do_invoke(self, exchange, reg, completion):
- session = self.getSessionFromRegistration(reg)
- session.exchange_declare(exchange=exchange.name,
- type=exchange.type)
- # if the above call fails, an exception is
- # raised and we won't get here
- completion("OK")
-
class Remove(CuminAction):
def get_title(self, session):
return "Remove"
Modified: mgmt/trunk/cumin/python/cumin/queue.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/queue.py 2008-08-11 14:31:40 UTC (rev 2274)
+++ mgmt/trunk/cumin/python/cumin/queue.py 2008-08-11 18:15:24 UTC (rev 2275)
@@ -384,7 +384,7 @@
"exchange_keys": form_binding_info,
"reg": reg}
- action = self.app.model.queue.add
+ action = self.app.model.broker.add_queue
action.invoke(queue, args)
# navigate back to main queue frame
17 years, 8 months
rhmessaging commits: r2274 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-08-11 10:31:40 -0400 (Mon, 11 Aug 2008)
New Revision: 2274
Modified:
mgmt/trunk/cumin/python/cumin/model.py
mgmt/trunk/cumin/python/cumin/queue.py
Log:
Removed ability set Queue as Exclusive
Modified: mgmt/trunk/cumin/python/cumin/model.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/model.py 2008-08-11 14:29:48 UTC (rev 2273)
+++ mgmt/trunk/cumin/python/cumin/model.py 2008-08-11 14:31:40 UTC (rev 2274)
@@ -170,10 +170,11 @@
def getSessionFromRegistration(self, reg):
conn = self.cumin_model.data.getConnectionByRegistration(reg)
- #for sess in conn.mconn.sessions:
- # if conn.mconn.sessions[sess].name == conn.getSessionId():
- # #this is active management session
- # return conn.mconn.sessions[sess]
+ for sess in conn.mconn.sessions:
+ if conn.mconn.sessions[sess].name == conn.getSessionId():
+ #this is active management session
+ return conn.mconn.sessions[sess]
+
return conn.mconn.session(str(uuid4()))
Modified: mgmt/trunk/cumin/python/cumin/queue.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/queue.py 2008-08-11 14:29:48 UTC (rev 2273)
+++ mgmt/trunk/cumin/python/cumin/queue.py 2008-08-11 14:31:40 UTC (rev 2274)
@@ -340,8 +340,8 @@
self.durable = DurabilityField(app, "durable", self)
self.add_field(self.durable)
- self.exclusive = ExclusivityField(app, "exclusive", self)
- self.add_field(self.exclusive)
+ #self.exclusive = ExclusivityField(app, "exclusive", self)
+ #self.add_field(self.exclusive)
self.autodelete = AutoDeleteField(app, "autodelete", self)
self.add_field(self.autodelete)
@@ -363,7 +363,7 @@
def process_submit(self, session):
queue_name = self.namef.get(session)
durable = self.durable.get(session)
- exclusive = self.exclusive.get(session)
+ #exclusive = self.exclusive.get(session)
autodelete = self.autodelete.get(session)
(errors, form_binding_info) = self.validate(session, queue_name)
@@ -376,7 +376,7 @@
queue = Queue()
queue.name = queue_name
queue.durable = (durable == "durable")
- queue.exclusive = (exclusive == "exclusive")
+ queue.exclusive = False
queue.autoDelete = (autodelete == "autodel")
reg = self.frame.get_object(session)
17 years, 8 months
rhmessaging commits: r2273 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
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")
17 years, 8 months
rhmessaging commits: r2272 - store/branches/java/broker-queue-refactor/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb.
by rhmessaging-commits@lists.jboss.org
Author: ritchiem
Date: 2008-08-11 07:03:48 -0400 (Mon, 11 Aug 2008)
New Revision: 2272
Modified:
store/branches/java/broker-queue-refactor/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStore.java
Log:
Updated Store to re-add createQueue(Queue) method
Modified: store/branches/java/broker-queue-refactor/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStore.java
===================================================================
--- store/branches/java/broker-queue-refactor/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStore.java 2008-08-08 20:44:01 UTC (rev 2271)
+++ store/branches/java/broker-queue-refactor/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStore.java 2008-08-11 11:03:48 UTC (rev 2272)
@@ -629,6 +629,11 @@
}
}
+ public void createQueue(AMQQueue queue) throws AMQException
+ {
+ createQueue(queue, null);
+ }
+
/**
* Makes the specified queue persistent.
*
17 years, 8 months
rhmessaging commits: r2271 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-08-08 16:44:01 -0400 (Fri, 08 Aug 2008)
New Revision: 2271
Modified:
mgmt/trunk/cumin/python/cumin/test.py
Log:
Added Queue: Add, Bind, and Remove tests
Modified: mgmt/trunk/cumin/python/cumin/test.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/test.py 2008-08-08 14:04:01 UTC (rev 2270)
+++ mgmt/trunk/cumin/python/cumin/test.py 2008-08-08 20:44:01 UTC (rev 2271)
@@ -69,7 +69,6 @@
def init(self):
self.broker_conn.open()
-
session = quirk.Session(self.broker_conn, "test")
session.open()
@@ -397,6 +396,21 @@
self.run_children(session)
class QueueTest(Test):
+ def __init__(self, env, parent):
+ super(QueueTest, self).__init__(env, parent)
+
+ self.Add(env, self)
+ self.Bind(env, self)
+ self.Remove(env, self)
+
+ self.queue = None
+
+ def set_queue(self, queue):
+ self.queue = queue
+
+ def get_queue(self):
+ return self.queue
+
def do_run(self, session):
vhost = self.env.vhost
name = self.env.broker_queue.name
@@ -414,6 +428,100 @@
self.run_children(session)
+ class Add(Test):
+ def do_run(self, session):
+ name = "cumin.queue.%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_queue_add(s)
+ form.namef.set(s, name)
+ form.durable.set(s, "durable")
+ form.autodelete.set(s, "preserve")
+
+ form.submit(s)
+
+ p.process(s)
+
+ self.env.check_redirect(p, s)
+
+ vhost = self.env.vhost
+
+ # wait for newly created queue to show up
+ def predicate():
+ for item in Queue.selectBy(vhost=vhost, name=name):
+ return True
+
+ wait(predicate)
+
+ # if it timed out, raise an exception
+ try:
+ queue = Queue.selectBy(vhost=vhost, name=name)[0]
+ self.parent.set_queue(queue)
+ except IndexError:
+ raise Exception("Queue %s not added" % name)
+ self.parent.set_queue(None)
+
+ class Bind(Test):
+ def do_run(self, session):
+ name = "cumin.queue.%s" % session.id
+ queue = self.parent.get_queue()
+ if not queue:
+ raise Exception("Bind skipped because Queue %s not added" % name)
+
+ # try to bind to it
+ p, s = self.env.page_and_session()
+
+ reg = self.env.broker_registration
+ form = p.show_main(s).show_broker(s, reg)
+ form = form.show_queue(s, queue)
+ form = form.show_queue_binding_add(s)
+ binding = dict()
+ binding["test"] = {}
+ direct = binding["test"]
+ direct["name"] = "amq.direct"
+ direct["type"] = "direct"
+ form.bindings.dict_param.set(s, binding)
+
+ form.submit(s)
+
+ p.process(s)
+
+ self.env.check_redirect(p, s)
+
+ class Remove(Test):
+ def do_run(self, session):
+ name = "cumin.queue.%s" % session.id
+ queue = self.parent.get_queue()
+ if not queue:
+ raise Exception("Remove skipped because Queue %s not added" % name)
+
+ # 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_queues_remove(s)
+
+ ids = [queue.id]
+ form.ids.set(s, ids)
+
+ form.submit(s)
+ p.process(s)
+
+ 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
+
+ wait(predicate)
+
+ # if it timed out, raise an exception
+ if not queue.deletionTime:
+ raise Exception("Queue %s not removed" % name)
+
class ExchangeTest(Test):
def do_run(self, session):
vhost = self.env.vhost
17 years, 8 months
rhmessaging commits: r2270 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-08-08 10:04:01 -0400 (Fri, 08 Aug 2008)
New Revision: 2270
Modified:
mgmt/trunk/cumin/python/cumin/binding.py
mgmt/trunk/cumin/python/cumin/queue.py
Log:
Refactor bindings so that each binding type does it's own input processing.
Modified: mgmt/trunk/cumin/python/cumin/binding.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/binding.py 2008-08-08 12:57:24 UTC (rev 2269)
+++ mgmt/trunk/cumin/python/cumin/binding.py 2008-08-08 14:04:01 UTC (rev 2270)
@@ -137,6 +137,10 @@
def render_xquery_value(self, session, exchange):
return self.get_exchange_info_for(session, exchange, "xquery")
+ def process_input(self, this_exchange, arguments):
+ if "xquery" in this_exchange:
+ arguments["xquery"] = this_exchange["xquery"]
+
class HeadersExchangeInput(BindingKeyExchangeInput):
def __init__(self, app, name, form):
super(HeadersExchangeInput, self).__init__(app, name, form)
@@ -199,6 +203,30 @@
def render_headers_extra(self, session, exchange):
return "headers_extra.%s" % str(exchange.id)
+
+ def process_input(self, this_exchange, arguments):
+ # x-match is a radio button, it must have a value
+ arguments["x-match"] = this_exchange["x-match"]
+ # Fill out the other arguments.
+ # The form has input boxes named mkey.* and mkey.*.nv
+ # We need to create an arguments dictionary entry
+ # of the form {mkey.*.value: mkey.*.nv.value}
+ for match_info in this_exchange:
+ if this_exchange[match_info]:
+ if match_info.startswith("mkey") \
+ and not match_info.endswith("nv"):
+ # find the value in the matching .nv field
+ match_value = self._find_match_value(this_exchange, match_info)
+ # it is valid for the value in the .nv field
+ # to be empty
+ arguments[this_exchange[match_info]] = \
+ match_value or None
+
+ def _find_match_value(self, this_exchange, match_info):
+ for m_info in this_exchange:
+ if m_info.startswith(match_info):
+ if m_info.endswith("nv"):
+ return this_exchange[m_info]
class ExchangeState(StateSwitch):
def __init__(self, app, name):
@@ -290,7 +318,7 @@
return writer.to_string()
- def get_binding_info(self, session, queue_name):
+ def get_binding_errors(self, session, queue_name):
form_binding_info = self.process_binding_info(session, queue_name)
binding_info = self.dict_param.get(session)
@@ -322,7 +350,7 @@
name = form_binding_info[exchange]["name"]
errs = berrs.setdefault(name, dict())
errs["key"] = ["A binding key is required"]
- if not "xquery" in form_binding_info[exchange]:
+ if not "xquery" in binding_info[exchange]:
name = binding_info[exchange]["name"]
if not name in berrs:
berrs.setdefault(name, dict())
@@ -341,51 +369,31 @@
return (len(berrs), form_binding_info)
def process_binding_info(self, session, queue_name):
+ """ Processes the raw binding_info from the DictParameter into
+ a "form_binding_info" dictionary that contains four keys:
+ name, key, arguments, and type
+ """
binding_info = self.dict_param.get(session)
form_binding_info = dict()
for this_exchange in binding_info:
# if the exchange checkbox is checked
if "name" in binding_info[this_exchange]:
- form_binding_info[this_exchange] = dict()
- arguments = dict()
type = binding_info[this_exchange]["type"]
- if type == "headers":
- arguments["x-match"] = binding_info[this_exchange]["x-match"]
+ if type == "direct":
+ binding_info[this_exchange]["key"] = queue_name
- # Fill out the other arguments.
- # The form has input boxes named mkey.* and mkey.*.nv
- # We need to create an arguments dictionary entry
- # of the form {mkey.*.value: mkey.*.nv.value}
- for match_info in binding_info[this_exchange]:
- if binding_info[this_exchange][match_info]:
- if match_info.startswith("mkey") \
- and not match_info.endswith("nv"):
- # find the value in the matching .nv field
- match_value = self._find_match_value(binding_info,
- this_exchange, match_info)
- # it is valid for the value in the .nv field
- # to be empty
- arguments[binding_info[this_exchange][match_info]] = \
- match_value or None
- elif type == "xml":
- if "xquery" in binding_info[this_exchange]:
- arguments["xquery"] = binding_info[this_exchange]["xquery"]
- elif type == "direct":
- binding_info[this_exchange]["key"] = queue_name
- #topic and fanout exchanges don't need any processing
-
+ form_binding_info[this_exchange] = dict()
form_binding_info[this_exchange]["name"] = binding_info[this_exchange]["name"]
if "key" in binding_info[this_exchange]:
form_binding_info[this_exchange]["key"] = binding_info[this_exchange]["key"]
+ form_binding_info[this_exchange]["type"] = type
+
+ arguments = dict()
+ if type == "headers":
+ self.headers_input.process_input(binding_info[this_exchange], arguments)
+ elif type == "xml":
+ self.xml_input.process_input(binding_info[this_exchange], arguments)
+ #direct, topic and fanout exchanges don't have aditional arguments
form_binding_info[this_exchange]["arguments"] = arguments
- # type is used in form validation only
- form_binding_info[this_exchange]["type"] = binding_info[this_exchange]["type"]
return form_binding_info
-
- def _find_match_value(self, binding_info, this_exchange, match_info):
- for m_info in binding_info[this_exchange]:
- if m_info.startswith(match_info):
- if m_info.endswith("nv"):
- return binding_info[this_exchange][m_info]
-
Modified: mgmt/trunk/cumin/python/cumin/queue.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/queue.py 2008-08-08 12:57:24 UTC (rev 2269)
+++ mgmt/trunk/cumin/python/cumin/queue.py 2008-08-08 14:04:01 UTC (rev 2270)
@@ -351,7 +351,7 @@
def validate(self, session, queue_name):
super_error = super(QueueForm, self).validate(session)
- (errors, form_binding_info) = self.bindings.get_binding_info(session, queue_name)
+ (errors, form_binding_info) = self.bindings.get_binding_errors(session, queue_name)
return (errors or super_error, form_binding_info)
class QueueAdd(QueueForm):
@@ -532,7 +532,7 @@
def process_submit(self, session):
queue = self.frame.get_object(session)
- (errors, form_binding_info) = self.bindings.get_binding_info(session, queue.name)
+ (errors, form_binding_info) = self.bindings.get_binding_errors(session, queue.name)
if not len(form_binding_info):
# no exhchanges were selected is not an
17 years, 8 months
rhmessaging commits: r2269 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-08-08 08:57:24 -0400 (Fri, 08 Aug 2008)
New Revision: 2269
Modified:
mgmt/trunk/cumin/python/cumin/util.py
Log:
Import the correct mktime.
Modified: mgmt/trunk/cumin/python/cumin/util.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/util.py 2008-08-08 11:00:14 UTC (rev 2268)
+++ mgmt/trunk/cumin/python/cumin/util.py 2008-08-08 12:57:24 UTC (rev 2269)
@@ -1,7 +1,7 @@
from ConfigParser import SafeConfigParser
from datetime import *
from logging import getLogger
-from mx.DateTime.DateTime import mktime
+from time import mktime
from random import randint
import sys
17 years, 8 months
rhmessaging commits: r2268 - store/branches/mrg-1.0/cpp/tests/jrnl/jtt.
by rhmessaging-commits@lists.jboss.org
Author: kpvdr
Date: 2008-08-08 07:00:14 -0400 (Fri, 08 Aug 2008)
New Revision: 2268
Modified:
store/branches/mrg-1.0/cpp/tests/jrnl/jtt/jfile_chk.py
Log:
Backport of r.2267 ok trunk: Minor bugfix to Python journal file analysis program jfile_chk.py; also added -a/--analysis flags which perform transactional analysis of journal content.
Modified: store/branches/mrg-1.0/cpp/tests/jrnl/jtt/jfile_chk.py
===================================================================
--- store/branches/mrg-1.0/cpp/tests/jrnl/jtt/jfile_chk.py 2008-08-08 10:58:59 UTC (rev 2267)
+++ store/branches/mrg-1.0/cpp/tests/jrnl/jtt/jfile_chk.py 2008-08-08 11:00:14 UTC (rev 2268)
@@ -210,7 +210,7 @@
f.read(rem_in_blk(f, dblk_size))
def check(self):
- if self.empty() or self.magic[:3] != 'RHM' or self.magic[-1] not in ['a', 'c', 'd', 'e', 'f', 'x']:
+ if self.empty() or self.magic[:3] != 'RHM' or self.magic[3] not in ['a', 'c', 'd', 'e', 'f', 'x']:
return True
if self.ver != hdr_ver and self.magic[-1] != 'x':
raise Exception('%s: Invalid header version: found %d, expected %d.' % (self, self.ver, hdr_ver))
@@ -420,6 +420,7 @@
self.bfn = None
self.csvfn = None
self.jdir = None
+ self.aflag = False
self.hflag = False
self.qflag = False
self.tnum = None
@@ -434,9 +435,11 @@
self.file_start = 0
self.file_num = 0
self.fro = 0x200
- self.enqueued = {}
+ self.emap = {}
+ self.tmap = {}
self.rec_cnt = 0
self.msg_cnt = 0
+ self.txn_msg_cnt = 0
self.fhdr = None
self.f = None
self.first_rec = False
@@ -471,75 +474,118 @@
stop = True;
else:
self.rec_cnt += 1
- if self.first_rec:
- if self.fhdr.fro != hdr.foffs:
- raise Exception('File header first record offset mismatch: fro=0x%08x; rec_offs=0x%08x' % (self.fhdr.fro, hdr.foffs))
- else:
- if not self.qflag: print ' * fro ok: 0x%08x' % self.fhdr.fro
- self.first_rec = False
- if isinstance(hdr, EnqRec) and not stop:
- while not hdr.complete():
- stop = self.advance_file()
- if stop:
- break
- hdr.load(self.f)
- if self.extern != None:
- if hdr.extern:
- if hdr.data != None:
- raise Exception('Message data found on external record')
+ if self.first_rec:
+ if self.fhdr.fro != hdr.foffs:
+ raise Exception('File header first record offset mismatch: fro=0x%08x; rec_offs=0x%08x' % (self.fhdr.fro, hdr.foffs))
else:
+ if not self.qflag: print ' * fro ok: 0x%08x' % self.fhdr.fro
+ self.first_rec = False
+ if isinstance(hdr, EnqRec) and not stop:
+ while not hdr.complete():
+ stop = self.advance_file()
+ if stop:
+ break
+ hdr.load(self.f)
+ if self.extern != None:
+ if hdr.extern:
+ if hdr.data != None:
+ raise Exception('Message data found on external record')
+ else:
+ if self.msg_len > 0 and len(hdr.data) != self.msg_len:
+ raise Exception('Message length (%d) incorrect; expected %d' % (len(hdr.data), self.msg_len))
+ else:
if self.msg_len > 0 and len(hdr.data) != self.msg_len:
raise Exception('Message length (%d) incorrect; expected %d' % (len(hdr.data), self.msg_len))
- else:
- if self.msg_len > 0 and len(hdr.data) != self.msg_len:
- raise Exception('Message length (%d) incorrect; expected %d' % (len(hdr.data), self.msg_len))
- if self.xid_len > 0 and len(hdr.xid) != self.xid_len:
- print ' ERROR: XID length (%d) incorrect; expected %d' % (len(hdr.xid), self.xid_len)
- sys.exit(1)
- #raise Exception('XID length (%d) incorrect; expected %d' % (len(hdr.xid), self.xid_len))
- if self.transient != None:
- if self.transient:
- if not hdr.transient:
- raise Exception('Expected transient record, found persistent')
+ if self.xid_len > 0 and len(hdr.xid) != self.xid_len:
+ print ' ERROR: XID length (%d) incorrect; expected %d' % (len(hdr.xid), self.xid_len)
+ sys.exit(1)
+ #raise Exception('XID length (%d) incorrect; expected %d' % (len(hdr.xid), self.xid_len))
+ if self.transient != None:
+ if self.transient:
+ if not hdr.transient:
+ raise Exception('Expected transient record, found persistent')
+ else:
+ if hdr.transient:
+ raise Exception('Expected persistent record, found transient')
+ stop = not self.check_owi(hdr)
+ if stop:
+ warn = ' (WARNING: OWI mismatch - could be overwrite boundary.)'
else:
- if hdr.transient:
- raise Exception('Expected persistent record, found transient')
- stop = not self.check_rid(hdr)
- if stop:
- warn = ' (WARNING: rid out of order, rid = %d; last rid = %d - could be overwrite boundary.)' % (hdr.rid, self.last_rid)
- else:
- self.msg_cnt += 1
- if self.auto_deq:
- self.enqueued[hdr.rid] = hdr
- elif isinstance(hdr, DeqHdr) and not stop:
- while not hdr.complete():
- stop = self.advance_file()
+ self.msg_cnt += 1
+ if self.aflag or self.auto_deq:
+ if hdr.xid == None:
+ self.emap[hdr.rid] = (self.fhdr.fid, hdr, False)
+ else:
+ self.txn_msg_cnt += 1
+ if hdr.xid in self.tmap:
+ self.tmap[hdr.xid].append((self.fhdr.fid, hdr)) #Append tuple to existing list
+ else:
+ self.tmap[hdr.xid] = [(self.fhdr.fid, hdr)] # Create new list
+ elif isinstance(hdr, DeqHdr) and not stop:
+ while not hdr.complete():
+ stop = self.advance_file()
+ if stop:
+ break
+ hdr.load(self.f)
+ stop = not self.check_owi(hdr)
if stop:
- break
- hdr.load(self.f)
- if self.auto_deq:
- if hdr.deq_rid in self.enqueued:
- del self.enqueued[hdr.deq_rid]
+ warn = ' (WARNING: OWI mismatch - could be overwrite boundary.)'
else:
- warn = ' (WARNING: dequeue rid %d not found in enqueued records)' % hdr.deq_rid
- stop = not self.check_rid(hdr)
- if stop:
- warn = ' (WARNING: rid out of order, rid = %d; last rid = %d - could be overwrite boundary.)' % (hdr.rid, self.last_rid)
- elif self.auto_deq != None:
- if not self.auto_deq:
- warn = ' WARNING: Dequeue record rid=%d found in non-dequeue test - ignoring.' % hdr.rid
- elif isinstance(hdr, TxnHdr) and not stop:
- while not hdr.complete():
- stop = self.advance_file()
+ if self.auto_deq != None:
+ if not self.auto_deq:
+ warn = ' WARNING: Dequeue record rid=%d found in non-dequeue test - ignoring.' % hdr.rid
+ if self.aflag or self.auto_deq:
+ if hdr.xid == None:
+ if hdr.deq_rid in self.emap:
+ if self.emap[hdr.deq_rid][2]:
+ warn = ' (WARNING: dequeue rid %d dequeues locked enqueue records %d)' % (hdr.rid, hdr.deq_rid)
+ del self.emap[hdr.deq_rid]
+ else:
+ warn = ' (WARNING: rid being dequeued %d not found in enqueued records)' % hdr.deq_rid
+ else:
+ if hdr.deq_rid in self.emap:
+ t = self.emap[hdr.deq_rid]
+ self.emap[hdr.deq_rid] = (t[0], t[1], True) # Lock enq record
+ if hdr.xid in self.tmap:
+ self.tmap[hdr.xid].append((self.fhdr.fid, hdr)) #Append to existing list
+ else:
+ self.tmap[hdr.xid] = [(self.fhdr.fid, hdr)] # Create new list
+ elif isinstance(hdr, TxnHdr) and not stop:
+ while not hdr.complete():
+ stop = self.advance_file()
+ if stop:
+ break
+ hdr.load(self.f)
+ stop = not self.check_owi(hdr)
if stop:
- break
- hdr.load(self.f)
- stop = not self.check_rid(hdr)
- if stop:
- warn = ' (WARNING: rid out of order, rid = %d; last rid = %d - could be overwrite boundary.)' % (hdr.rid, self.last_rid)
- if not self.qflag: print ' > %s%s' % (hdr, warn)
- if not stop:
- stop = (self.last_file and hdr.check()) or hdr.empty() or self.fhdr.empty()
+ warn = ' (WARNING: OWI mismatch - could be overwrite boundary.)'
+ else:
+ if hdr.xid in self.tmap:
+ mismatched_rids = []
+ if hdr.magic[-1] == 'c': # commit
+ for rec in self.tmap[hdr.xid]:
+ if isinstance(rec[1], EnqRec):
+ self.emap[rec[1].rid] = (rec[0], rec[1], False) # Transfer enq to emap
+ elif isinstance(rec[1], DeqHdr):
+ if rec[1].deq_rid in self.emap:
+ del self.emap[rec[1].deq_rid] # Delete from emap
+ else:
+ mismatched_rids.append('0x%x' % rec[1].deq_rid)
+ else:
+ raise Exception('Unknown header found in txn map: %s' % rec[1])
+ elif hdr.magic[-1] == 'a': # abort
+ for rec in self.tmap[hdr.xid]:
+ if isinstance(rec[1], DeqHdr):
+ if self.emap[rec[1].deq_rid] != None:
+ self.emap[rec[1].deq_rid][2] = False # Unlock enq record
+ del self.tmap[hdr.xid]
+ if len(mismatched_rids) > 0:
+ warn = ' (WARNING: transactional dequeues not found in enqueue map; rids=%s)' % mismatched_rids
+ else:
+ warn = ' (WARNING: xid %s not found in transaction map)' % hdr.xid
+ if not self.qflag: print ' > %s%s' % (hdr, warn)
+ if not stop:
+ stop = (self.last_file and hdr.check()) or hdr.empty() or self.fhdr.empty()
def analyze_files(self):
fname = ''
@@ -609,6 +655,9 @@
self.file_num = 0;
return self.file_num
+ def check_owi(self, hdr):
+ return self.fhdr.owi() == hdr.owi()
+
def check_rid(self, hdr):
if self.last_rid != -1 and hdr.rid <= self.last_rid:
return False
@@ -690,7 +739,7 @@
def proc_args(self, argv):
try:
- opts, args = getopt.getopt(sys.argv[1:], "b:c:d:hqt:", ["base-filename=", "csv-filename=", "dir=", "help", "quiet", "test-num="])
+ opts, args = getopt.getopt(sys.argv[1:], "ab:c:d:hqt:", ["analyse", "base-filename=", "csv-filename=", "dir=", "help", "quiet", "test-num="])
except getopt.GetoptError:
self.usage()
sys.exit(2)
@@ -698,6 +747,8 @@
if o in ("-h", "--help"):
self.usage()
sys.exit()
+ if o in ("-a", "--analyze"):
+ self.aflag = True
if o in ("-b", "--base-filename"):
self.bfn = a
if o in ("-c", "--csv-filename"):
@@ -723,6 +774,7 @@
def usage(self):
print 'Usage: %s opts' % sys.argv[0]
print ' where opts are in either short or long format (*=req\'d):'
+ print ' -a --analyze Analyze enqueue/dequeue records'
print ' -b --base-filename [string] * Base filename for journal files'
print ' -c --csv-filename [string] CSV filename containing test parameters'
print ' -d --dir [string] * Journal directory containing journal files'
@@ -732,13 +784,31 @@
def report(self):
if not self.qflag:
+ print
+ print ' === REPORT ===='
if self.num_msgs > 0 and self.msg_cnt != self.num_msgs:
print 'WARNING: Found %d messages; %d expected.' % (self.msg_cnt, self.num_msgs)
- if len(self.enqueued) > 0:
- print 'Remaining enqueued records: ', len(self.enqueued)
- for h in self.enqueued:
- print self.enqueued[h]
- print 'WARNING: Enqueue-Dequeue mismatch, %d enqueued records remain.' % len(self.enqueued)
+ if len(self.emap) > 0:
+ print
+ print 'Remaining enqueued records: '
+ for h in self.emap:
+ if self.emap[h][2] == True: # locked
+ locked = ' (locked)'
+ else:
+ locked = ''
+ print " fid=%d %s%s" % (self.emap[h][0], self.emap[h][1], locked)
+ print 'WARNING: Enqueue-Dequeue mismatch, %d enqueued records remain.' % len(self.emap)
+ if len(self.tmap) > 0:
+ txn_rec_cnt = 0
+ print
+ print 'Remaining transactions: '
+ for t in self.tmap:
+ print "xid=%s:" % t
+ for r in self.tmap[t]:
+ print " fid=%d %s" % (r[0], r[1])
+ print " Total: %d records for xid %s" % (len(self.tmap[t]), t)
+ txn_rec_cnt += len(self.tmap[t])
+ print 'WARNING: Incomplete transactions, %d xids remain containing %d records.' % (len(self.tmap), txn_rec_cnt)
print '%d enqueues, %d journal records processed.' % (self.msg_cnt, self.rec_cnt)
17 years, 8 months