rhmessaging commits: r1128 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-10-22 09:45:12 -0400 (Mon, 22 Oct 2007)
New Revision: 1128
Modified:
mgmt/cumin/python/cumin/page.strings
mgmt/cumin/python/cumin/queue.strings
Log:
Organizes the stats into columns rather than quadrants.
Modified: mgmt/cumin/python/cumin/page.strings
===================================================================
--- mgmt/cumin/python/cumin/page.strings 2007-10-22 13:35:12 UTC (rev 1127)
+++ mgmt/cumin/python/cumin/page.strings 2007-10-22 13:45:12 UTC (rev 1128)
@@ -395,15 +395,16 @@
width: 80%;
}
-td.quadrant {
+td.twocol {
width: 50%;
}
-td.quadrant h2 {
+td.twocol h2 {
font-weight: bold;
+ margin: 0;
}
-td.quadrant table {
+td.twocol table {
border: 1px dotted #ddd;
margin: 1em;
}
Modified: mgmt/cumin/python/cumin/queue.strings
===================================================================
--- mgmt/cumin/python/cumin/queue.strings 2007-10-22 13:35:12 UTC (rev 1127)
+++ mgmt/cumin/python/cumin/queue.strings 2007-10-22 13:45:12 UTC (rev 1128)
@@ -171,24 +171,18 @@
[QueueStatistics.html]
<table class="QueueStatistics">
<tr>
- <td class="quadrant">
+ <td class="twocol">
<h2>General</h2>
{general_stats}
- </td>
- <td class="quadrant">
<h2>Disk</h2>
{disk_stats}
+ <h2>Persistent Messages</h2>
+ {persistent_stats}
</td>
- </tr>
- <tr>
- <td class="quadrant">
+ <td class="twocol">
<h2>Transactional Messages</h2>
{transactional_stats}
</td>
- <td class="quadrant">
- <h2>Persistent Messages</h2>
- {persistent_stats}
- </td>
</tr>
</table>
18 years, 6 months
rhmessaging commits: r1127 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-10-22 09:35:12 -0400 (Mon, 22 Oct 2007)
New Revision: 1127
Modified:
mgmt/cumin/python/cumin/demo.py
mgmt/cumin/python/cumin/model.py
mgmt/cumin/python/cumin/page.strings
mgmt/cumin/python/cumin/queue.py
mgmt/cumin/python/cumin/queue.strings
Log:
Adds all the queue instrumentation fields from the latest mgmt schema
and displays them in the queue statistics tab.
Modified: mgmt/cumin/python/cumin/demo.py
===================================================================
--- mgmt/cumin/python/cumin/demo.py 2007-10-19 21:17:36 UTC (rev 1126)
+++ mgmt/cumin/python/cumin/demo.py 2007-10-22 13:35:12 UTC (rev 1127)
@@ -164,14 +164,14 @@
for queue in vhost.queue_items():
queue.lock()
try:
- for stat in queue.stats:
- if stat.type == "int" and random() < 0.33:
+ for measure in queue.measurements:
+ if measure.type == "int" and random() < 0.33:
if random() < 0.5:
- value = stat.get_value()
- stat.add_value(value + randint(4, 12))
+ value = measure.get_value()
+ measure.add_value(value + randint(4, 12))
else:
- value = stat.get_value() - randint(3, 9)
- stat.add_value(value > 0 and value or 0)
+ value = measure.get_value() - randint(3, 9)
+ measure.add_value(value > 0 and value or 0)
queue.message_count += 1
Modified: mgmt/cumin/python/cumin/model.py
===================================================================
--- mgmt/cumin/python/cumin/model.py 2007-10-19 21:17:36 UTC (rev 1126)
+++ mgmt/cumin/python/cumin/model.py 2007-10-22 13:35:12 UTC (rev 1127)
@@ -268,7 +268,7 @@
writer.write("</realm>")
-class Statistic(object):
+class Measurement(object):
def __init__(self, name, type):
self.name = name
self.type = type
@@ -284,6 +284,9 @@
self.__value = value
self.values.append(value)
+ if len(self.values) > 1000:
+ del self.values[0]
+
def get_value(self):
return self.__value
@@ -302,53 +305,141 @@
self.error_count = 0
self.warning_count = 0
- self.stats = list()
+ self.measurements = list()
- stat = Statistic("msgTotalEnqueues", "int")
- stat.title = "Total messages enqueued"
- stat.categories = ("message", "general")
- self.stats.append(stat)
+ # General
- stat = Statistic("msgTotalDequeues", "int")
- stat.title = "Total messages dequeued"
- stat.categories = ("message", "general")
- self.stats.append(stat)
+ measure = Measurement("msgDepth", "int")
+ measure.title = "Message depth"
+ measure.categories = ("message", "general")
+ self.measurements.append(measure)
- stat = Statistic("msgTxEnqueues", "int")
- stat.title = "Transactional messages enqueued"
- stat.categories = ("message", "transactional")
- self.stats.append(stat)
+ measure = Measurement("msgTotalEnqueues", "int")
+ measure.title = "Messages enqueued"
+ measure.categories = ("message", "general")
+ self.measurements.append(measure)
- stat = Statistic("msgTxDequeues", "int")
- stat.title = "Transactional messages dequeued"
- stat.categories = ("message", "transactional")
- self.stats.append(stat)
+ measure = Measurement("msgTotalDequeues", "int")
+ measure.title = "Messages dequeued"
+ measure.categories = ("message", "general")
+ self.measurements.append(measure)
- stat = Statistic("msgPersistEnqueues", "int")
- stat.title = "Persistent messages enqueued"
- stat.categories = ("message", "persistent")
- self.stats.append(stat)
+ measure = Measurement("byteDepth", "int")
+ measure.title = "Byte depth"
+ measure.categories = ("byte", "general")
+ self.measurements.append(measure)
- stat = Statistic("msgPersistDequeues", "int")
- stat.title = "Persistent messages dequeued"
- stat.categories = ("message", "persistent")
- self.stats.append(stat)
+ measure = Measurement("byteTotalEnqueues", "int")
+ measure.title = "Bytes enqueued"
+ measure.categories = ("byte", "general")
+ self.measurements.append(measure)
- stat = Statistic("msgDepth", "int")
- stat.title = "Current number of messages in queue"
- stat.categories = ("message", "general")
- self.stats.append(stat)
+ measure = Measurement("byteTotalDequeues", "int")
+ measure.title = "Bytes dequeued"
+ measure.categories = ("byte", "general")
+ self.measurements.append(measure)
- stat = Statistic("msgDepthHigh", "int")
- stat.title = "Highest message depth in last x hours"
- stat.categories = ("message", "general")
- self.stats.append(stat)
+ # Disk
- stat = Statistic("msgDepthLow", "int")
- stat.title = "Lowest message depth in last x hours"
- stat.categories = ("message", "general")
- self.stats.append(stat)
+ measure = Measurement("diskPageSize", "int")
+ measure.title = "Disk page size"
+ measure.categories = ("disk")
+ self.measurements.append(measure)
+ measure = Measurement("diskPages", "int")
+ measure.title = "Disk pages"
+ measure.categories = ("disk")
+ self.measurements.append(measure)
+
+ measure = Measurement("diskAvailableSize", "int")
+ measure.title = "Disk available size"
+ measure.categories = ("disk")
+ self.measurements.append(measure)
+
+ # Transactional
+
+ measure = Measurement("msgTxEnqueues", "int")
+ measure.title = "Messages enqueued"
+ measure.categories = ("message", "transactional")
+ self.measurements.append(measure)
+
+ measure = Measurement("msgTxDequeues", "int")
+ measure.title = "Messages dequeued"
+ measure.categories = ("message", "transactional")
+ self.measurements.append(measure)
+
+ measure = Measurement("byteTxEnqueues", "int")
+ measure.title = "Bytes enqueued"
+ measure.categories = ("byte", "transactional")
+ self.measurements.append(measure)
+
+ measure = Measurement("byteTxDequeues", "int")
+ measure.title = "Bytes dequeued"
+ measure.categories = ("byte", "transactional")
+ self.measurements.append(measure)
+
+ measure = Measurement("enqueueTxStarts", "int")
+ measure.title = "Enqueue transactions started"
+ measure.categories = ("transactional")
+ self.measurements.append(measure)
+
+ measure = Measurement("enqueueTxCommits", "int")
+ measure.title = "Enqueue transactions committed"
+ measure.categories = ("transactional")
+ self.measurements.append(measure)
+
+ measure = Measurement("enqueueTxRejects", "int")
+ measure.title = "Enqueue transactions rejected"
+ measure.categories = ("transactional")
+ self.measurements.append(measure)
+
+ measure = Measurement("enqueueTxCount", "int")
+ measure.title = "Enqueue transactions pending"
+ measure.categories = ("transactional")
+ self.measurements.append(measure)
+
+ measure = Measurement("dequeueTxStarts", "int")
+ measure.title = "Dequeue transactions started"
+ measure.categories = ("transactional")
+ self.measurements.append(measure)
+
+ measure = Measurement("dequeueTxCommits", "int")
+ measure.title = "Dequeue transactions committed"
+ measure.categories = ("transactional")
+ self.measurements.append(measure)
+
+ measure = Measurement("dequeueTxRejects", "int")
+ measure.title = "Dequeue transactions rejected"
+ measure.categories = ("transactional")
+ self.measurements.append(measure)
+
+ measure = Measurement("dequeueTxCount", "int")
+ measure.title = "Dequeue transactions pending"
+ measure.categories = ("transactional")
+ self.measurements.append(measure)
+
+ # Persistent
+
+ measure = Measurement("msgPersistEnqueues", "int")
+ measure.title = "Messages enqueued"
+ measure.categories = ("message", "persistent")
+ self.measurements.append(measure)
+
+ measure = Measurement("msgPersistDequeues", "int")
+ measure.title = "Messages dequeued"
+ measure.categories = ("message", "persistent")
+ self.measurements.append(measure)
+
+ measure = Measurement("bytePersistEnqueues", "int")
+ measure.title = "Bytes enqueued"
+ measure.categories = ("byte", "persistent")
+ self.measurements.append(measure)
+
+ measure = Measurement("bytePersistDequeues", "int")
+ measure.title = "Bytes dequeued"
+ measure.categories = ("byte", "persistent")
+ self.measurements.append(measure)
+
def remove(self):
for binding in self.binding_items().copy():
binding.remove()
Modified: mgmt/cumin/python/cumin/page.strings
===================================================================
--- mgmt/cumin/python/cumin/page.strings 2007-10-19 21:17:36 UTC (rev 1126)
+++ mgmt/cumin/python/cumin/page.strings 2007-10-22 13:35:12 UTC (rev 1127)
@@ -395,6 +395,19 @@
width: 80%;
}
+td.quadrant {
+ width: 50%;
+}
+
+td.quadrant h2 {
+ font-weight: bold;
+}
+
+td.quadrant table {
+ border: 1px dotted #ddd;
+ margin: 1em;
+}
+
[CuminPage.html]
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
Modified: mgmt/cumin/python/cumin/queue.py
===================================================================
--- mgmt/cumin/python/cumin/queue.py 2007-10-19 21:17:36 UTC (rev 1126)
+++ mgmt/cumin/python/cumin/queue.py 2007-10-22 13:35:12 UTC (rev 1127)
@@ -340,24 +340,39 @@
def render_cancel_content(self, session, binding):
return "No, Cancel"
-class QueueStatistics(ItemSet):
+class MeasurementSet(ItemSet):
+ def __init__(self, app, name, category):
+ super(MeasurementSet, self).__init__(app, name)
+
+ self.category = category
+
+ def get_items(self, session, queue):
+ measures = sorted_by(queue.measurements, "title")
+
+ for measure in queue.measurements:
+ if self.category not in measure.categories:
+ measures.remove(measure)
+
+ return measures
+
+ def render_item_title(self, session, measure):
+ return measure.title
+
+ def render_item_value(self, session, measure):
+ return measure.get_value()
+
+ def render_item_average_value(self, session, measure):
+ return "%0.2f" % (sum(measure.values) / float(len(measure.values)))
+
+class QueueStatistics(Widget):
def __init__(self, app, name):
super(QueueStatistics, self).__init__(app, name)
- self.trans = BooleanParameter(app, "trans")
- self.add_parameter(self.trans)
+ self.add_child(MeasurementSet(app, "general_stats", "general"))
+ self.add_child(MeasurementSet(app, "disk_stats", "disk"))
+ self.add_child(MeasurementSet \
+ (app, "transactional_stats", "transactional"))
+ self.add_child(MeasurementSet(app, "persistent_stats", "persistent"))
def render_title(self, session, queue):
return "Statistics"
-
- def get_items(self, session, queue):
- return queue.stats
-
- def render_item_title(self, session, stat):
- return stat.title
-
- def render_item_value(self, session, stat):
- return stat.get_value()
-
- def render_item_average_value(self, session, stat):
- return "%0.2f" % (sum(stat.values) / float(len(stat.values)))
Modified: mgmt/cumin/python/cumin/queue.strings
===================================================================
--- mgmt/cumin/python/cumin/queue.strings 2007-10-19 21:17:36 UTC (rev 1126)
+++ mgmt/cumin/python/cumin/queue.strings 2007-10-22 13:35:12 UTC (rev 1127)
@@ -163,18 +163,47 @@
}())
</script>
+[QueueStatistics.css]
+table.QueueStatistics {
+ width: 100%;
+}
+
[QueueStatistics.html]
+<table class="QueueStatistics">
+ <tr>
+ <td class="quadrant">
+ <h2>General</h2>
+ {general_stats}
+ </td>
+ <td class="quadrant">
+ <h2>Disk</h2>
+ {disk_stats}
+ </td>
+ </tr>
+ <tr>
+ <td class="quadrant">
+ <h2>Transactional Messages</h2>
+ {transactional_stats}
+ </td>
+ <td class="quadrant">
+ <h2>Persistent Messages</h2>
+ {persistent_stats}
+ </td>
+ </tr>
+</table>
+
+[MeasurementSet.html]
<table class="mobjects">
<tr>
<th>Statistic</th>
- <th>Current Value</th>
- <th>Average Value</th>
+ <th>Current</th>
+ <th>Average</th>
</tr>
{items}
</table>
-[QueueStatistics.item_html]
+[MeasurementSet.item_html]
<tr>
<th>{item_title}</th>
<td>{item_value}</td>
18 years, 6 months
rhmessaging commits: r1126 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-10-19 17:17:36 -0400 (Fri, 19 Oct 2007)
New Revision: 1126
Modified:
mgmt/cumin/python/cumin/demo.py
mgmt/cumin/python/cumin/model.py
mgmt/cumin/python/cumin/queue.py
mgmt/cumin/python/cumin/queue.strings
Log:
Adds categories to statistics. Adds historical data to the model and
displays an average in the ui.
Modified: mgmt/cumin/python/cumin/demo.py
===================================================================
--- mgmt/cumin/python/cumin/demo.py 2007-10-19 20:13:06 UTC (rev 1125)
+++ mgmt/cumin/python/cumin/demo.py 2007-10-19 21:17:36 UTC (rev 1126)
@@ -167,10 +167,11 @@
for stat in queue.stats:
if stat.type == "int" and random() < 0.33:
if random() < 0.5:
- stat.value += randint(4, 12)
+ value = stat.get_value()
+ stat.add_value(value + randint(4, 12))
else:
- value = stat.value - randint(3, 9)
- stat.value = value > 0 and value or 0
+ value = stat.get_value() - randint(3, 9)
+ stat.add_value(value > 0 and value or 0)
queue.message_count += 1
Modified: mgmt/cumin/python/cumin/model.py
===================================================================
--- mgmt/cumin/python/cumin/model.py 2007-10-19 20:13:06 UTC (rev 1125)
+++ mgmt/cumin/python/cumin/model.py 2007-10-19 21:17:36 UTC (rev 1126)
@@ -268,17 +268,25 @@
writer.write("</realm>")
-class StatProperty(object):
+class Statistic(object):
def __init__(self, name, type):
self.name = name
self.type = type
+ self.categories = ()
self.title = None
+ self.__value = None
+ self.values = list()
if type == "int":
- self.value = 0
- else:
- self.value = None
+ self.add_value(0)
+ def add_value(self, value):
+ self.__value = value
+ self.values.append(value)
+
+ def get_value(self):
+ return self.__value
+
class Queue(ModelObject):
def __init__(self, model):
super(Queue, self).__init__(model, model.queue)
@@ -296,40 +304,49 @@
self.stats = list()
- stat = StatProperty("msgTotalEnqueues", "int")
+ stat = Statistic("msgTotalEnqueues", "int")
stat.title = "Total messages enqueued"
+ stat.categories = ("message", "general")
self.stats.append(stat)
- stat = StatProperty("msgTotalDequeues", "int")
+ stat = Statistic("msgTotalDequeues", "int")
stat.title = "Total messages dequeued"
+ stat.categories = ("message", "general")
self.stats.append(stat)
- stat = StatProperty("msgTxEnqueues", "int")
+ stat = Statistic("msgTxEnqueues", "int")
stat.title = "Transactional messages enqueued"
+ stat.categories = ("message", "transactional")
self.stats.append(stat)
- stat = StatProperty("msgTxDequeues", "int")
+ stat = Statistic("msgTxDequeues", "int")
stat.title = "Transactional messages dequeued"
+ stat.categories = ("message", "transactional")
self.stats.append(stat)
- stat = StatProperty("msgPersistEnqueues", "int")
- stat.title = "Persistent message enqueued"
+ stat = Statistic("msgPersistEnqueues", "int")
+ stat.title = "Persistent messages enqueued"
+ stat.categories = ("message", "persistent")
self.stats.append(stat)
- stat = StatProperty("msgPersistDequeues", "int")
+ stat = Statistic("msgPersistDequeues", "int")
stat.title = "Persistent messages dequeued"
+ stat.categories = ("message", "persistent")
self.stats.append(stat)
- stat = StatProperty("msgDepth", "int")
+ stat = Statistic("msgDepth", "int")
stat.title = "Current number of messages in queue"
+ stat.categories = ("message", "general")
self.stats.append(stat)
- stat = StatProperty("msgDepthHigh", "int")
+ stat = Statistic("msgDepthHigh", "int")
stat.title = "Highest message depth in last x hours"
+ stat.categories = ("message", "general")
self.stats.append(stat)
- stat = StatProperty("msgDepthLow", "int")
+ stat = Statistic("msgDepthLow", "int")
stat.title = "Lowest message depth in last x hours"
+ stat.categories = ("message", "general")
self.stats.append(stat)
def remove(self):
Modified: mgmt/cumin/python/cumin/queue.py
===================================================================
--- mgmt/cumin/python/cumin/queue.py 2007-10-19 20:13:06 UTC (rev 1125)
+++ mgmt/cumin/python/cumin/queue.py 2007-10-19 21:17:36 UTC (rev 1126)
@@ -341,6 +341,12 @@
return "No, Cancel"
class QueueStatistics(ItemSet):
+ def __init__(self, app, name):
+ super(QueueStatistics, self).__init__(app, name)
+
+ self.trans = BooleanParameter(app, "trans")
+ self.add_parameter(self.trans)
+
def render_title(self, session, queue):
return "Statistics"
@@ -351,4 +357,7 @@
return stat.title
def render_item_value(self, session, stat):
- return stat.value
+ return stat.get_value()
+
+ def render_item_average_value(self, session, stat):
+ return "%0.2f" % (sum(stat.values) / float(len(stat.values)))
Modified: mgmt/cumin/python/cumin/queue.strings
===================================================================
--- mgmt/cumin/python/cumin/queue.strings 2007-10-19 20:13:06 UTC (rev 1125)
+++ mgmt/cumin/python/cumin/queue.strings 2007-10-19 21:17:36 UTC (rev 1126)
@@ -166,7 +166,7 @@
[QueueStatistics.html]
<table class="mobjects">
<tr>
- <th style="background-color: white;"></th>
+ <th>Statistic</th>
<th>Current Value</th>
<th>Average Value</th>
</tr>
@@ -178,5 +178,5 @@
<tr>
<th>{item_title}</th>
<td>{item_value}</td>
- <td></td>
+ <td>{item_average_value}</td>
</tr>
\ No newline at end of file
18 years, 6 months
rhmessaging commits: r1125 - in mgmt/cumin/python: wooly and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-10-19 16:13:06 -0400 (Fri, 19 Oct 2007)
New Revision: 1125
Modified:
mgmt/cumin/python/cumin/demo.py
mgmt/cumin/python/cumin/model.py
mgmt/cumin/python/cumin/queue.py
mgmt/cumin/python/cumin/queue.strings
mgmt/cumin/python/wooly/__init__.py
Log:
Adds an initial statistics tab to the queue view. Improves the fake
demo stats a little. Fixes a bug in the way Template was rendering
zeros.
Modified: mgmt/cumin/python/cumin/demo.py
===================================================================
--- mgmt/cumin/python/cumin/demo.py 2007-10-19 19:33:00 UTC (rev 1124)
+++ mgmt/cumin/python/cumin/demo.py 2007-10-19 20:13:06 UTC (rev 1125)
@@ -166,7 +166,11 @@
try:
for stat in queue.stats:
if stat.type == "int" and random() < 0.33:
- stat.value += 1
+ if random() < 0.5:
+ stat.value += randint(4, 12)
+ else:
+ value = stat.value - randint(3, 9)
+ stat.value = value > 0 and value or 0
queue.message_count += 1
Modified: mgmt/cumin/python/cumin/model.py
===================================================================
--- mgmt/cumin/python/cumin/model.py 2007-10-19 19:33:00 UTC (rev 1124)
+++ mgmt/cumin/python/cumin/model.py 2007-10-19 20:13:06 UTC (rev 1125)
@@ -273,8 +273,12 @@
self.name = name
self.type = type
self.title = None
- self.value = None
+ if type == "int":
+ self.value = 0
+ else:
+ self.value = None
+
class Queue(ModelObject):
def __init__(self, model):
super(Queue, self).__init__(model, model.queue)
Modified: mgmt/cumin/python/cumin/queue.py
===================================================================
--- mgmt/cumin/python/cumin/queue.py 2007-10-19 19:33:00 UTC (rev 1124)
+++ mgmt/cumin/python/cumin/queue.py 2007-10-19 20:13:06 UTC (rev 1125)
@@ -104,12 +104,8 @@
self.add_child(self.tabs)
self.tabs.add_tab(QueueBindingSet(app, "bindings"))
- self.tabs.add_tab(self.QueueLog(app, "log"))
+ self.tabs.add_tab(QueueStatistics(app, "stats"))
- class QueueLog(Widget):
- def render_title(self, session, queue):
- return "Log Messages"
-
def render_title(self, session, queue):
return "Queue '%s'" % queue.name
@@ -343,3 +339,16 @@
def render_cancel_content(self, session, binding):
return "No, Cancel"
+
+class QueueStatistics(ItemSet):
+ def render_title(self, session, queue):
+ return "Statistics"
+
+ def get_items(self, session, queue):
+ return queue.stats
+
+ def render_item_title(self, session, stat):
+ return stat.title
+
+ def render_item_value(self, session, stat):
+ return stat.value
Modified: mgmt/cumin/python/cumin/queue.strings
===================================================================
--- mgmt/cumin/python/cumin/queue.strings 2007-10-19 19:33:00 UTC (rev 1124)
+++ mgmt/cumin/python/cumin/queue.strings 2007-10-19 20:13:06 UTC (rev 1125)
@@ -163,3 +163,20 @@
}())
</script>
+[QueueStatistics.html]
+<table class="mobjects">
+ <tr>
+ <th style="background-color: white;"></th>
+ <th>Current Value</th>
+ <th>Average Value</th>
+ </tr>
+
+ {items}
+</table>
+
+[QueueStatistics.item_html]
+<tr>
+ <th>{item_title}</th>
+ <td>{item_value}</td>
+ <td></td>
+</tr>
\ No newline at end of file
Modified: mgmt/cumin/python/wooly/__init__.py
===================================================================
--- mgmt/cumin/python/wooly/__init__.py 2007-10-19 19:33:00 UTC (rev 1124)
+++ mgmt/cumin/python/wooly/__init__.py 2007-10-19 20:13:06 UTC (rev 1125)
@@ -676,9 +676,11 @@
if type(elem) is str:
writer.write(elem)
elif callable(elem):
- writer.write(str(elem(self.widget, session, object) or ""))
+ result = elem(self.widget, session, object)
+ writer.write(result == None and "" or str(result))
else:
- writer.write(str(elem.render(session, object) or ""))
+ result = elem.render(session, object)
+ writer.write(result == None and "" or str(result))
class WidgetCall(object):
def __init__(self, stack, widget, session, object):
18 years, 6 months
rhmessaging commits: r1124 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-10-19 15:33:00 -0400 (Fri, 19 Oct 2007)
New Revision: 1124
Modified:
mgmt/cumin/python/cumin/demo.py
mgmt/cumin/python/cumin/model.py
Log:
Adds a stat object to the demo model and makes the demo update thread
change the value.
Modified: mgmt/cumin/python/cumin/demo.py
===================================================================
--- mgmt/cumin/python/cumin/demo.py 2007-10-19 19:32:15 UTC (rev 1123)
+++ mgmt/cumin/python/cumin/demo.py 2007-10-19 19:33:00 UTC (rev 1124)
@@ -164,6 +164,10 @@
for queue in vhost.queue_items():
queue.lock()
try:
+ for stat in queue.stats:
+ if stat.type == "int" and random() < 0.33:
+ stat.value += 1
+
queue.message_count += 1
if random() < 0.01:
Modified: mgmt/cumin/python/cumin/model.py
===================================================================
--- mgmt/cumin/python/cumin/model.py 2007-10-19 19:32:15 UTC (rev 1123)
+++ mgmt/cumin/python/cumin/model.py 2007-10-19 19:33:00 UTC (rev 1124)
@@ -268,6 +268,13 @@
writer.write("</realm>")
+class StatProperty(object):
+ def __init__(self, name, type):
+ self.name = name
+ self.type = type
+ self.title = None
+ self.value = None
+
class Queue(ModelObject):
def __init__(self, model):
super(Queue, self).__init__(model, model.queue)
@@ -283,6 +290,44 @@
self.error_count = 0
self.warning_count = 0
+ self.stats = list()
+
+ stat = StatProperty("msgTotalEnqueues", "int")
+ stat.title = "Total messages enqueued"
+ self.stats.append(stat)
+
+ stat = StatProperty("msgTotalDequeues", "int")
+ stat.title = "Total messages dequeued"
+ self.stats.append(stat)
+
+ stat = StatProperty("msgTxEnqueues", "int")
+ stat.title = "Transactional messages enqueued"
+ self.stats.append(stat)
+
+ stat = StatProperty("msgTxDequeues", "int")
+ stat.title = "Transactional messages dequeued"
+ self.stats.append(stat)
+
+ stat = StatProperty("msgPersistEnqueues", "int")
+ stat.title = "Persistent message enqueued"
+ self.stats.append(stat)
+
+ stat = StatProperty("msgPersistDequeues", "int")
+ stat.title = "Persistent messages dequeued"
+ self.stats.append(stat)
+
+ stat = StatProperty("msgDepth", "int")
+ stat.title = "Current number of messages in queue"
+ self.stats.append(stat)
+
+ stat = StatProperty("msgDepthHigh", "int")
+ stat.title = "Highest message depth in last x hours"
+ self.stats.append(stat)
+
+ stat = StatProperty("msgDepthLow", "int")
+ stat.title = "Lowest message depth in last x hours"
+ self.stats.append(stat)
+
def remove(self):
for binding in self.binding_items().copy():
binding.remove()
18 years, 6 months
rhmessaging commits: r1123 - store/trunk/cpp/tests.
by rhmessaging-commits@lists.jboss.org
Author: cctrieloff
Date: 2007-10-19 15:32:15 -0400 (Fri, 19 Oct 2007)
New Revision: 1123
Modified:
store/trunk/cpp/tests/OrderingTest.cpp
store/trunk/cpp/tests/SimpleTest.cpp
store/trunk/cpp/tests/TransactionalTest.cpp
store/trunk/cpp/tests/TwoPhaseCommitTest.cpp
Log:
Enable Async unit tests
Modified: store/trunk/cpp/tests/OrderingTest.cpp
===================================================================
--- store/trunk/cpp/tests/OrderingTest.cpp 2007-10-19 18:27:53 UTC (rev 1122)
+++ store/trunk/cpp/tests/OrderingTest.cpp 2007-10-19 19:32:15 UTC (rev 1123)
@@ -43,8 +43,10 @@
class OrderingTest : public CppUnit::TestCase
{
CPPUNIT_TEST_SUITE(OrderingTest);
- CPPUNIT_TEST(testBasic);
- CPPUNIT_TEST(testCycle);
+ CPPUNIT_TEST(testBasicSync);
+ CPPUNIT_TEST(testCycleSync);
+ CPPUNIT_TEST(testBasicAsync);
+ CPPUNIT_TEST(testCycleAsync);
CPPUNIT_TEST_SUITE_END();
const string name;
@@ -57,33 +59,53 @@
public:
OrderingTest() : name("OrderingQueue"), counter(1) {}
+ void testBasicAsync()
+ {
+ testBasic(true);
+ }
+
+ void testCycleAsync()
+ {
+ testCycle(true);
+ }
+
+ void testBasicSync()
+ {
+ testBasic(false);
+ }
+
+ void testCycleSync()
+ {
+ testCycle(false);
+ }
- void testBasic()
+ void testBasic(bool async = false)
{
- setup();
+ setup(async);
//push on 10 messages
for (int i = 0; i < 10; i++) push();
- restart();
+ restart(async);
check();
}
- void testCycle()
+ void testCycle(bool async = false)
{
- setup();
+ setup(async);
//push on 10 messages:
for (int i = 0; i < 10; i++) push();
//pop 5:
for (int i = 0; i < 5; i++) pop();
//push on another 5:
for (int i = 0; i < 5; i++) push();
- restart();
+ restart(async);
check();
}
- void setup()
+ void setup(bool async)
{
store = std::auto_ptr<BdbMessageStore>(new BdbMessageStore());
- store->truncate();
+ if (async) store->init("/var",async);
+ store->truncate();
queue = Queue::shared_ptr(new Queue(name, 0, store.get(), 0));
FieldTable settings;
@@ -118,12 +140,13 @@
}
}
- void restart()
+ void restart(bool async)
{
queue.reset();
store.reset();
store = std::auto_ptr<BdbMessageStore>(new BdbMessageStore());
+ if (async) store->init("/var",async);
ExchangeRegistry exchanges;
DtxManager mgr(store.get());
RecoveryManagerImpl recoveryMgr(queues, exchanges, mgr, 0);
Modified: store/trunk/cpp/tests/SimpleTest.cpp
===================================================================
--- store/trunk/cpp/tests/SimpleTest.cpp 2007-10-19 18:27:53 UTC (rev 1122)
+++ store/trunk/cpp/tests/SimpleTest.cpp 2007-10-19 19:32:15 UTC (rev 1123)
@@ -57,19 +57,33 @@
class SimpleTest : public CppUnit::TestCase
{
CPPUNIT_TEST_SUITE(SimpleTest);
- CPPUNIT_TEST(testCreateDelete);
- CPPUNIT_TEST(testEmptyRecover);
- CPPUNIT_TEST(testQueueCreate);
- CPPUNIT_TEST(testQueueCreateWithSettings);
- CPPUNIT_TEST(testQueueDestroy);
- CPPUNIT_TEST(testEnqueue);
- CPPUNIT_TEST(testDequeue);
- CPPUNIT_TEST(testStaging);
- CPPUNIT_TEST(testDestroyStagedMessage);
- CPPUNIT_TEST(testDestroyEnqueuedMessage);
- CPPUNIT_TEST(testExchangeCreateAndDestroy);
- CPPUNIT_TEST(testExchangeBindAndUnbind);
- CPPUNIT_TEST(testExchangeImplicitUnbind);
+ CPPUNIT_TEST(testCreateDeleteSync);
+ CPPUNIT_TEST(testEmptyRecoverSync);
+ CPPUNIT_TEST(testQueueCreateSync);
+ CPPUNIT_TEST(testQueueCreateWithSettingsSync);
+ CPPUNIT_TEST(testQueueDestroySync);
+ CPPUNIT_TEST(testEnqueueSync);
+ CPPUNIT_TEST(testDequeueSync);
+ CPPUNIT_TEST(testStagingSync);
+ CPPUNIT_TEST(testDestroyStagedMessageSync);
+ CPPUNIT_TEST(testDestroyEnqueuedMessageSync);
+ CPPUNIT_TEST(testExchangeCreateAndDestroySync);
+ CPPUNIT_TEST(testExchangeBindAndUnbindSync);
+ CPPUNIT_TEST(testExchangeImplicitUnbindSync);
+
+ CPPUNIT_TEST(testCreateDeleteAsync);
+ CPPUNIT_TEST(testEmptyRecoverAsync);
+ CPPUNIT_TEST(testQueueCreateAsync);
+ CPPUNIT_TEST(testQueueCreateWithSettingsAsync);
+ CPPUNIT_TEST(testQueueDestroyAsync);
+ CPPUNIT_TEST(testEnqueueAsync);
+ CPPUNIT_TEST(testDequeueAsync);
+ CPPUNIT_TEST(testStagingAsync);
+ CPPUNIT_TEST(testDestroyStagedMessageAsync);
+ CPPUNIT_TEST(testDestroyEnqueuedMessageAsync);
+ CPPUNIT_TEST(testExchangeCreateAndDestroyAsync);
+ CPPUNIT_TEST(testExchangeBindAndUnbindAsync);
+ CPPUNIT_TEST(testExchangeImplicitUnbindAsync);
CPPUNIT_TEST_SUITE_END();
void recover(BdbMessageStore& store, QueueRegistry& queues)
@@ -93,18 +107,26 @@
public:
- void testEmptyRecover()
+ void testEmptyRecoverSync() {testEmptyRecover(false);}
+ void testEmptyRecoverAsync() {testEmptyRecover(true);}
+
+ void testEmptyRecover(bool async)
{
BdbMessageStore store;
+ if (async) store.init("/var",async);
store.truncate();//make sure it is empty to begin with
QueueRegistry registry(&store);
recover(store, registry);
//nothing to assert, just testing it doesn't blow up
}
- void testCreateDelete()
+ void testCreateDeleteSync() {testCreateDelete(false);}
+ void testCreateDeleteAsync() {testCreateDelete(true);}
+
+ void testCreateDelete(bool async)
{
BdbMessageStore store;
+ if (async) store.init("/var",async);
store.truncate();//make sure it is empty to begin with
string name("CreateDeleteQueue");
Queue queue(name, 0, &store, 0);
@@ -116,13 +138,16 @@
}
+ void testQueueCreateSync() {testQueueCreate(false);}
+ void testQueueCreateAsync() {testQueueCreate(true);}
- void testQueueCreate()
+ void testQueueCreate(bool async)
{
uint64_t id(0);
string name("MyDurableQueue");
{
BdbMessageStore store;
+ if (async) store.init("/var",async);
store.truncate();//make sure it is empty to begin with
Queue queue(name, 0, &store, 0);
store.create(queue);
@@ -131,6 +156,7 @@
}//db will be closed
{
BdbMessageStore store;
+ if (async) store.init("/var",async);
QueueRegistry registry(&store);
recover(store, registry);
Queue::shared_ptr queue = registry.find(name);
@@ -139,12 +165,16 @@
}
}
- void testQueueCreateWithSettings()
+ void testQueueCreateWithSettingsSync() {testQueueCreateWithSettings(false);}
+ void testQueueCreateWithSettingsAsync() {testQueueCreateWithSettings(true);}
+
+ void testQueueCreateWithSettings(bool async)
{
QueuePolicy policy(101, 202);
string name("MyDurableQueue");
{
BdbMessageStore store;
+ if (async) store.init("/var",async);
store.truncate();//make sure it is empty to begin with
Queue queue(name, 0, &store, 0);
FieldTable settings;
@@ -154,6 +184,7 @@
}//db will be closed
{
BdbMessageStore store;
+ if (async) store.init("/var",async);
QueueRegistry registry(&store);
recover(store, registry);
Queue::shared_ptr queue = registry.find(name);
@@ -164,11 +195,14 @@
}
}
- void testQueueDestroy()
+ void testQueueDestroySync() {testQueueDestroy(false);}
+ void testQueueDestroyAsync() {testQueueDestroy(true);}
+ void testQueueDestroy(bool async)
{
string name("MyDurableQueue");
{
BdbMessageStore store;
+ if (async) store.init("/var",async);
store.truncate();//make sure it is empty to begin with
Queue queue(name, 0, &store, 0);
store.create(queue);
@@ -176,13 +210,16 @@
}//db will be closed
{
BdbMessageStore store;
+ if (async) store.init("/var",async);
QueueRegistry registry(&store);
recover(store, registry);
CPPUNIT_ASSERT(!registry.find(name));
}
}
- void testEnqueue()
+ void testEnqueueSync() {testEnqueue(false);}
+ void testEnqueueAsync() {testEnqueue(true);}
+ void testEnqueue(bool async)
{
//TODO: this is largely copy & paste'd from MessageTest in
//qpid tree. ideally need some helper routines for reducing
@@ -196,6 +233,7 @@
string data2("hijklmn");
{
BdbMessageStore store;
+ if (async) store.init("/var",async);
store.truncate();//make sure it is empty to begin with
Queue queue(name, 0, &store, 0);
FieldTable settings;
@@ -214,6 +252,7 @@
}//db will be closed
{
BdbMessageStore store;
+ if (async) store.init("/var",async);
QueueRegistry registry(&store);
recover(store, registry);
Queue::shared_ptr queue = registry.find(name);
@@ -238,7 +277,9 @@
}
}
- void testDequeue()
+ void testDequeueSync() {testDequeue(false);}
+ void testDequeueAsync() {testDequeue(true);}
+ void testDequeue(bool async)
{
//TODO: reduce the duplication in these tests
string name("MyDurableQueue");
@@ -248,6 +289,7 @@
string messageId = "MyMessage";
string data("abcdefg");
BdbMessageStore store;
+ if (async) store.init("/var",async);
store.truncate();//make sure it is empty to begin with
Queue queue(name, 0, &store, 0);
FieldTable settings;
@@ -262,6 +304,7 @@
}//db will be closed
{
BdbMessageStore store;
+ if (async) store.init("/var",async);
QueueRegistry registry(&store);
recover(store, registry);
Queue::shared_ptr queue = registry.find(name);
@@ -270,6 +313,8 @@
}
}
+ void testStagingSync() {testStaging();}
+ void testStagingAsync() {std::cout << std::endl << "Missing Async test!!" << std::endl << std:: flush;}
void testStaging()
{
const string name("MyDurableQueue");
@@ -363,6 +408,8 @@
}
}
+ void testDestroyStagedMessageSync() {testDestroyStagedMessage();}
+ void testDestroyStagedMessageAsync() {std::cout << std::endl << "Missing Async test!!" << std::endl << std:: flush;}
void testDestroyStagedMessage()
{
BdbMessageStore store;
@@ -383,6 +430,8 @@
}
}
+ void testDestroyEnqueuedMessageSync() {testDestroyEnqueuedMessage();}
+ void testDestroyEnqueuedMessageAsync() {std::cout << std::endl << "Missing Async test!!" << std::endl << std:: flush;}
void testDestroyEnqueuedMessage()
{
BdbMessageStore store;
@@ -407,7 +456,9 @@
}
- void testExchangeCreateAndDestroy()
+ void testExchangeCreateAndDestroySync() {testExchangeCreateAndDestroy(false);}
+ void testExchangeCreateAndDestroyAsync() {testExchangeCreateAndDestroy(true);}
+ void testExchangeCreateAndDestroy(bool async)
{
uint64_t id(0);
string name("MyDurableExchange");
@@ -416,6 +467,7 @@
args.setString("a", "A");
{
BdbMessageStore store;
+ if (async) store.init("/var",async);
store.truncate();//make sure it is empty to begin with
ExchangeRegistry registry;
Exchange::shared_ptr exchange = registry.declare(name, type, true, args).first;
@@ -425,6 +477,7 @@
}//db will be closed
{
BdbMessageStore store;
+ if (async) store.init("/var",async);
ExchangeRegistry registry;
recover(store, registry);
@@ -438,6 +491,7 @@
}
{
BdbMessageStore store;
+ if (async) store.init("/var",async);
ExchangeRegistry registry;
recover(store, registry);
@@ -451,7 +505,9 @@
}
}
- void testExchangeBindAndUnbind()
+ void testExchangeBindAndUnbindSync() {testExchangeBindAndUnbind(false);}
+ void testExchangeBindAndUnbindAsync() {testExchangeBindAndUnbind(true);}
+ void testExchangeBindAndUnbind(bool async)
{
string exchangeName("MyDurableExchange");
string queueName("MyDurableQueue");
@@ -459,6 +515,7 @@
FieldTable args;
{
BdbMessageStore store;
+ if (async) store.init("/var",async);
store.truncate();//make sure it is empty to begin with
Exchange::shared_ptr exchange(new DirectExchange(exchangeName, true, args));
Queue::shared_ptr queue(new Queue(queueName, 0, &store, 0));
@@ -469,6 +526,7 @@
}//db will be closed
{
BdbMessageStore store;
+ if (async) store.init("/var",async);
ExchangeRegistry exchanges;
QueueRegistry queues;
@@ -482,6 +540,7 @@
}
{
BdbMessageStore store;
+ if (async) store.init("/var",async);
ExchangeRegistry exchanges;
QueueRegistry queues;
@@ -494,7 +553,9 @@
}
}
- void testExchangeImplicitUnbind()
+ void testExchangeImplicitUnbindSync() {testExchangeImplicitUnbind(false);}
+ void testExchangeImplicitUnbindAsync() {testExchangeImplicitUnbind(true);}
+ void testExchangeImplicitUnbind(bool async)
{
string exchangeName("MyDurableExchange");
string queueName1("MyDurableQueue1");
@@ -503,6 +564,7 @@
FieldTable args;
{
BdbMessageStore store;
+ if (async) store.init("/var",async);
store.truncate();//make sure it is empty to begin with
Exchange::shared_ptr exchange(new DirectExchange(exchangeName, true, args));
Queue::shared_ptr queue1(new Queue(queueName1, 0, &store, 0));
@@ -517,6 +579,7 @@
}//db will be closed
{
BdbMessageStore store;
+ if (async) store.init("/var",async);
ExchangeRegistry exchanges;
QueueRegistry queues;
@@ -532,6 +595,7 @@
}
{
BdbMessageStore store;
+ if (async) store.init("/var",async);
ExchangeRegistry exchanges;
QueueRegistry queues;
Modified: store/trunk/cpp/tests/TransactionalTest.cpp
===================================================================
--- store/trunk/cpp/tests/TransactionalTest.cpp 2007-10-19 18:27:53 UTC (rev 1122)
+++ store/trunk/cpp/tests/TransactionalTest.cpp 2007-10-19 19:32:15 UTC (rev 1123)
@@ -41,8 +41,10 @@
class TransactionalTest : public CppUnit::TestCase
{
CPPUNIT_TEST_SUITE(TransactionalTest);
- CPPUNIT_TEST(testCommit);
- CPPUNIT_TEST(testAbort);
+ CPPUNIT_TEST(testCommitSync);
+ CPPUNIT_TEST(testAbortSync);
+ CPPUNIT_TEST(testCommitAsync);
+ CPPUNIT_TEST(testAbortAsync);
CPPUNIT_TEST_SUITE_END();
const string nameA;
@@ -56,41 +58,44 @@
public:
TransactionalTest() : nameA("queueA"), nameB("queueB"), messageId("TxnMessage") {}
-
- void testCommit()
+ void testCommitSync() {testCommit(false);}
+ void testCommitAsync() {testCommit(true);}
+ void testCommit(bool async)
{
- swap(true);
+ swap(true, async);
}
- void testAbort()
+ void testAbortSync() {testAbort(false);}
+ void testAbortAsync() {testAbort(true);}
+ void testAbort(bool async)
{
- swap(false);
+ swap(false, async);
}
- void swap(bool commit)
+ void swap(bool commit, bool async)
{
- setup();
+ setup(async);
Message::shared_ptr msg = queueA->dequeue().payload;
CPPUNIT_ASSERT(msg);
-
//move the message from one queue to the other as a transaction
std::auto_ptr<TransactionContext> txn = store->begin();
queueB->enqueue(txn.get(), msg);//note: need to enqueue it first to avoid message being deleted
queueA->dequeue(txn.get(), msg);
if (commit) {
- store->commit(*txn);
+ store->commit(*txn);
} else {
store->abort(*txn);
}
- restart();
+ restart(async);
check(commit);
- }
+ }
- void setup()
+ void setup(bool async)
{
store = std::auto_ptr<BdbMessageStore>(new BdbMessageStore());
+ if (async) store->init("/var",async);
store->truncate();
//create two queues:
@@ -107,18 +112,19 @@
queueA->deliver(msg);
}
- void restart()
+ void restart(bool async)
{
queueA.reset();
queueB.reset();
store.reset();
store = std::auto_ptr<BdbMessageStore>(new BdbMessageStore());
+ if (async) store->init("/var",async);
ExchangeRegistry exchanges;
DtxManager mgr(store.get());
RecoveryManagerImpl recovery(queues, exchanges, mgr, 0);
store->recover(recovery);
-
+
queueA = queues.find(nameA);
queueB = queues.find(nameB);
}
Modified: store/trunk/cpp/tests/TwoPhaseCommitTest.cpp
===================================================================
--- store/trunk/cpp/tests/TwoPhaseCommitTest.cpp 2007-10-19 18:27:53 UTC (rev 1122)
+++ store/trunk/cpp/tests/TwoPhaseCommitTest.cpp 2007-10-19 19:32:15 UTC (rev 1123)
@@ -41,21 +41,35 @@
class TwoPhaseCommitTest : public CppUnit::TestCase
{
CPPUNIT_TEST_SUITE(TwoPhaseCommitTest);
- CPPUNIT_TEST(testCommitSwap);
- CPPUNIT_TEST(testPrepareAndAbortSwap);
- CPPUNIT_TEST(testAbortNoPrepareSwap);
+ CPPUNIT_TEST(testCommitSwapSync);
+ CPPUNIT_TEST(testPrepareAndAbortSwapSync);
+ CPPUNIT_TEST(testAbortNoPrepareSwapSync);
- CPPUNIT_TEST(testCommitEnqueue);
- CPPUNIT_TEST(testPrepareAndAbortEnqueue);
- CPPUNIT_TEST(testAbortNoPrepareEnqueue);
+ CPPUNIT_TEST(testCommitEnqueueSync);
+ CPPUNIT_TEST(testPrepareAndAbortEnqueueSync);
+ CPPUNIT_TEST(testAbortNoPrepareEnqueueSync);
- CPPUNIT_TEST(testCommitDequeue);
- CPPUNIT_TEST(testPrepareAndAbortDequeue);
- CPPUNIT_TEST(testAbortNoPrepareDequeue);
+ CPPUNIT_TEST(testCommitDequeueSync);
+ CPPUNIT_TEST(testPrepareAndAbortDequeueSync);
+ CPPUNIT_TEST(testAbortNoPrepareDequeueSync);
- CPPUNIT_TEST(testRecoverPreparedThenCommitted);
- CPPUNIT_TEST(testRecoverPreparedThenAborted);
+ CPPUNIT_TEST(testRecoverPreparedThenCommittedSync);
+ CPPUNIT_TEST(testRecoverPreparedThenAbortedSync);
+ CPPUNIT_TEST(testCommitSwapAsync);
+ CPPUNIT_TEST(testPrepareAndAbortSwapAsync);
+ CPPUNIT_TEST(testAbortNoPrepareSwapAsync);
+
+ CPPUNIT_TEST(testCommitEnqueueAsync);
+ CPPUNIT_TEST(testPrepareAndAbortEnqueueAsync);
+ CPPUNIT_TEST(testAbortNoPrepareEnqueueAsync);
+
+ CPPUNIT_TEST(testCommitDequeueAsync);
+ CPPUNIT_TEST(testPrepareAndAbortDequeueAsync);
+ CPPUNIT_TEST(testAbortNoPrepareDequeueAsync);
+
+ CPPUNIT_TEST(testRecoverPreparedThenCommittedAsync);
+ CPPUNIT_TEST(testRecoverPreparedThenAbortedAsync);
CPPUNIT_TEST_SUITE_END();
class Strategy
@@ -141,23 +155,30 @@
Message::shared_ptr msg1;
Message::shared_ptr msg2;
Message::shared_ptr msg4;
+ bool async;
public:
TwoPhaseCommitTest() : nameA("queueA"), nameB("queueB") {}
//swap tests:
+ void testCommitSwapSync() {async=false ; testCommitSwap();}
+ void testCommitSwapAsync() {async=true ; testCommitSwap();}
void testCommitSwap()
{
Swap swap(this, "SwapMessageId");
commit(swap);
}
+ void testPrepareAndAbortSwapSync() {async=false ; testPrepareAndAbortSwap();}
+ void testPrepareAndAbortSwapAsync() {async=true ; testPrepareAndAbortSwap();}
void testPrepareAndAbortSwap()
{
Swap swap(this, "SwapMessageId");
abort(swap, true);
}
+ void testAbortNoPrepareSwapSync() {async=false ; testAbortNoPrepareSwap();}
+ void testAbortNoPrepareSwapAsync() {async=true ; testAbortNoPrepareSwap();}
void testAbortNoPrepareSwap()
{
Swap swap(this, "SwapMessageId");
@@ -165,18 +186,24 @@
}
//enqueue tests:
+ void testCommitEnqueueSync() {async=false ; testCommitEnqueue();}
+ void testCommitEnqueueAsync() {async=true ; testCommitEnqueue();}
void testCommitEnqueue()
{
Enqueue enqueue(this);
commit(enqueue);
}
+ void testPrepareAndAbortEnqueueSync() {async=false ; testPrepareAndAbortEnqueue();}
+ void testPrepareAndAbortEnqueueAsync() {async=true ; testPrepareAndAbortEnqueue();}
void testPrepareAndAbortEnqueue()
{
Enqueue enqueue(this);
abort(enqueue, true);
}
+ void testAbortNoPrepareEnqueueSync() {async=false ; testAbortNoPrepareEnqueue();}
+ void testAbortNoPrepareEnqueueAsync() {async=true ; testAbortNoPrepareEnqueue();}
void testAbortNoPrepareEnqueue()
{
Enqueue enqueue(this);
@@ -184,18 +211,24 @@
}
//dequeue tests:
+ void testCommitDequeueSync() {async=false ; testCommitDequeue();}
+ void testCommitDequeueAsync() {async=true ; testCommitDequeue();}
void testCommitDequeue()
{
Dequeue dequeue(this);
commit(dequeue);
}
+ void testPrepareAndAbortDequeueSync() {async=false ; testPrepareAndAbortDequeue();}
+ void testPrepareAndAbortDequeueAsync() {async=true ; testPrepareAndAbortDequeue();}
void testPrepareAndAbortDequeue()
{
Dequeue dequeue(this);
abort(dequeue, true);
}
+ void testAbortNoPrepareDequeueSync() {async=false ; testAbortNoPrepareDequeue();}
+ void testAbortNoPrepareDequeueAsync() {async=true ; testAbortNoPrepareDequeue();}
void testAbortNoPrepareDequeue()
{
Dequeue dequeue(this);
@@ -204,11 +237,15 @@
//test recovery of prepared txn:
+ void testRecoverPreparedThenCommittedSync() {async=false ; testRecoverPreparedThenCommitted();}
+ void testRecoverPreparedThenCommittedAsync() {async=true ; testRecoverPreparedThenCommitted();}
void testRecoverPreparedThenCommitted()
{
recoverPrepared(true);
}
+ void testRecoverPreparedThenAbortedSync() {async=false ; testRecoverPreparedThenAborted();}
+ void testRecoverPreparedThenAbortedAsync() {async=true ; testRecoverPreparedThenAborted();}
void testRecoverPreparedThenAborted()
{
recoverPrepared(false);
@@ -299,6 +336,7 @@
void setup()
{
store = std::auto_ptr<BdbMessageStore>(new BdbMessageStore());
+ if (async) store->init("/var",async);
store->truncate();
//create two queues:
@@ -323,6 +361,7 @@
store.reset();
store = std::auto_ptr<BdbMessageStore>(new BdbMessageStore());
+ if (async) store->init("/var",async);
ExchangeRegistry exchanges;
dtxmgr = std::auto_ptr<DtxManager>(new DtxManager(store.get()));
RecoveryManagerImpl recovery(queues, exchanges, *dtxmgr, 0);
18 years, 6 months
rhmessaging commits: r1122 - in mgmt: cumin/python/wooly and 1 other directories.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-10-19 14:27:53 -0400 (Fri, 19 Oct 2007)
New Revision: 1122
Modified:
mgmt/cumin/python/cumin/server.strings
mgmt/cumin/python/wooly/__init__.py
mgmt/cumin/python/wooly/parameters.py
mgmt/notes/Todo
Log:
Finishes making the server set form process correctly, though it still
doesn't do anything. Adds the marshal side of ListParameter, since
server set form uses it.
Modified: mgmt/cumin/python/cumin/server.strings
===================================================================
--- mgmt/cumin/python/cumin/server.strings 2007-10-19 18:00:54 UTC (rev 1121)
+++ mgmt/cumin/python/cumin/server.strings 2007-10-19 18:27:53 UTC (rev 1122)
@@ -49,6 +49,7 @@
{items}
</table>
+ {hidden_inputs}
</form>
[ServerSetForm.item_html]
Modified: mgmt/cumin/python/wooly/__init__.py
===================================================================
--- mgmt/cumin/python/wooly/__init__.py 2007-10-19 18:00:54 UTC (rev 1121)
+++ mgmt/cumin/python/wooly/__init__.py 2007-10-19 18:27:53 UTC (rev 1122)
@@ -230,6 +230,8 @@
def __init__(self, app, name):
super(Parameter, self).__init__(app, name)
+ self.is_collection = False
+
app.add_parameter(self)
def marshal(self, object):
@@ -509,14 +511,22 @@
for param in params:
key = param.path()
- value = self.get(key)
- default = param.get_default(self)
- if value not in (default, None):
- svalue = quote(param.marshal(value))
+ if param.is_collection:
+ collection = self.get(key)
- vars.append("%s=%s" % (key, svalue))
+ if collection:
+ for value in collection:
+ svalue = quote(param.marshal(value))
+ vars.append("%s=%s" % (key, svalue))
+ else:
+ value = self.get(key)
+ default = param.get_default(self)
+ if value not in (default, None):
+ svalue = quote(param.marshal(value))
+ vars.append("%s=%s" % (key, svalue))
+
return separator.join(vars)
def unmarshal(self, string):
Modified: mgmt/cumin/python/wooly/parameters.py
===================================================================
--- mgmt/cumin/python/wooly/parameters.py 2007-10-19 18:00:54 UTC (rev 1121)
+++ mgmt/cumin/python/wooly/parameters.py 2007-10-19 18:27:53 UTC (rev 1122)
@@ -9,6 +9,8 @@
self.param = param
self.default = list()
+ self.is_collection = True
+
def get_default(self, session):
return copy(self.default)
@@ -20,6 +22,9 @@
def do_unmarshal(self, string):
return self.param.do_unmarshal(string)
+ def do_marshal(self, object):
+ return self.param.do_marshal(object)
+
class IntegerParameter(Parameter):
def do_unmarshal(self, string):
return int(string)
Modified: mgmt/notes/Todo
===================================================================
--- mgmt/notes/Todo 2007-10-19 18:00:54 UTC (rev 1121)
+++ mgmt/notes/Todo 2007-10-19 18:27:53 UTC (rev 1122)
@@ -91,8 +91,6 @@
* Add group type to group add,edit
- * Add the marshal side of ListParameter
-
* Consider making add_child, add_param, add_mode, add_tab,
etc. return their argument
18 years, 6 months
rhmessaging commits: r1121 - in mgmt: notes and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-10-19 14:00:54 -0400 (Fri, 19 Oct 2007)
New Revision: 1121
Modified:
mgmt/cumin/python/wooly/forms.strings
mgmt/notes/Todo
Log:
Adds an id param to the form button html. Adds some todo items.
Modified: mgmt/cumin/python/wooly/forms.strings
===================================================================
--- mgmt/cumin/python/wooly/forms.strings 2007-10-19 17:58:47 UTC (rev 1120)
+++ mgmt/cumin/python/wooly/forms.strings 2007-10-19 18:00:54 UTC (rev 1121)
@@ -1,5 +1,5 @@
[FormButton.html]
-<button type="submit" name="{name}" value="{value}" tabindex="{tabindex}" {disabled_attr}>{content}</button>
+<button id="{id}" type="submit" name="{name}" value="{value}" tabindex="{tabindex}" {disabled_attr}>{content}</button>
[TextInput.html]
{errors}
Modified: mgmt/notes/Todo
===================================================================
--- mgmt/notes/Todo 2007-10-19 17:58:47 UTC (rev 1120)
+++ mgmt/notes/Todo 2007-10-19 18:00:54 UTC (rev 1121)
@@ -102,4 +102,11 @@
* Rename ServerGroupType to ServerGroupCategory
- * Add a frame() accessor to Widget
\ No newline at end of file
+ * Add a frame() accessor to Widget
+
+ * Perhaps make templates do this: <ul>{<li><a href="">somename</a></li>}</ul>
+
+ - or this: <ul>{?href <li><a href="$">Add User</A></li>}</ul>
+
+ * Add a sanity check traversal to the widget tree and to the
+ registered sets of widgets and parameters
18 years, 6 months
rhmessaging commits: r1120 - store/trunk/cpp/lib.
by rhmessaging-commits@lists.jboss.org
Author: cctrieloff
Date: 2007-10-19 13:58:47 -0400 (Fri, 19 Oct 2007)
New Revision: 1120
Modified:
store/trunk/cpp/lib/BdbMessageStore.cpp
Log:
fixed memory leaks
Modified: store/trunk/cpp/lib/BdbMessageStore.cpp
===================================================================
--- store/trunk/cpp/lib/BdbMessageStore.cpp 2007-10-19 17:56:15 UTC (rev 1119)
+++ store/trunk/cpp/lib/BdbMessageStore.cpp 2007-10-19 17:58:47 UTC (rev 1120)
@@ -466,13 +466,12 @@
dtokp.reset();
dtokp.set_wstate(DataTokenImpl::ENQ);
+ ::free(dbuff);
+ if (xidbuff)
+ ::free(xidbuff);
break;
}
case rhm::journal::RHM_IORES_AIO_WAIT:
-/* if (++aio_sleep_cnt > MAX_AIO_SLEEPS)
- {
- THROW_STORE_EXCEPTION("Store error, disk time out on recover for:" + queue->getName());
- }*/
::usleep(AIO_SLEEP_TIME);
break;
case rhm::journal::RHM_IORES_EMPTY:
@@ -568,9 +567,6 @@
std::set<string> prepared;
collectPreparedXids(prepared);
-//std::cout << "prep size:" << prepared.size() << std::endl;
-
-
//when using the async journal, it will abort unprepaired xids and populate the locked maps
if (!usingJrnl()){
txn_lock_map enqueues;
@@ -593,8 +589,6 @@
}
} else {
for (std::set<string>::iterator i = prepared.begin(); i != prepared.end(); i++) {
-
-//std::cout << "prep:" << *i << std::endl;
LockedMappings::shared_ptr enq_ptr;
enq_ptr.reset(new LockedMappings);
LockedMappings::shared_ptr deq_ptr;
18 years, 6 months
rhmessaging commits: r1119 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-10-19 13:56:15 -0400 (Fri, 19 Oct 2007)
New Revision: 1119
Modified:
mgmt/cumin/python/cumin/server.py
mgmt/cumin/python/cumin/server.strings
Log:
Adds a ServerSetForm (that has begun to function as a form should) in
place of the static mockup we had before.
Modified: mgmt/cumin/python/cumin/server.py
===================================================================
--- mgmt/cumin/python/cumin/server.py 2007-10-19 15:37:15 UTC (rev 1118)
+++ mgmt/cumin/python/cumin/server.py 2007-10-19 17:56:15 UTC (rev 1119)
@@ -62,6 +62,43 @@
def render_item_load(self, session, server):
return "%.2f" % random()
+class ServerSetForm(ServerSet, Form):
+ def __init__(self, app, name):
+ super(ServerSetForm, self).__init__(app, name)
+
+ self.server = ServerParameter(app, "param")
+ self.add_parameter(self.server)
+ self.add_form_parameter(self.server)
+
+ self.servers = ListParameter(app, "ids", self.server)
+ self.add_parameter(self.servers)
+ self.add_form_parameter(self.servers)
+
+ self.submit = self.Submit(app, "submit", self)
+ self.add_child(self.submit)
+
+ def do_process(self, session, model):
+ if self.submit.get(session):
+ self.submit.set(session, False)
+
+ for server in self.servers.get(session):
+ print "server", server
+
+ session.set_redirect(session.marshal())
+
+ def render_item_checkbox_name(self, session, server):
+ return self.servers.path()
+
+ def render_item_checkbox_value(self, session, server):
+ return self.server.marshal(server)
+
+ def render_item_checkbox_checked_attr(self, session, server):
+ return server in self.servers.get(session) and "checked=\"checked\""
+
+ class Submit(FormButton):
+ def render_content(self, session, model):
+ return "Submit"
+
class ServerFrame(CuminFrame):
def __init__(self, app, name):
super(ServerFrame, self).__init__(app, name)
@@ -283,7 +320,7 @@
self.servers = self.BrowserServers(app, "servers")
self.add_child(self.servers)
- class BrowserServers(ServerSet):
+ class BrowserServers(ServerSetForm):
def get_items(self, session, model):
servers = sorted_by(model.get_servers())
group = self.parent.group.get(session)
@@ -291,7 +328,6 @@
cluster = self.parent.cluster.get(session)
for server in model.get_servers():
- # XXX simplify with a loop
if group and group not in server.server_group_items():
servers.remove(server)
Modified: mgmt/cumin/python/cumin/server.strings
===================================================================
--- mgmt/cumin/python/cumin/server.strings 2007-10-19 15:37:15 UTC (rev 1118)
+++ mgmt/cumin/python/cumin/server.strings 2007-10-19 17:56:15 UTC (rev 1119)
@@ -18,6 +18,49 @@
<td>0 errors, 0 warnings</td>
</tr>
+[ServerSetForm.html]
+<form id="{id}" method="post" action="?">
+ <!-- <select onchange="document.getElementById('{id}.submit').submit()"> -->
+ <select>
+ <option>Act on Selection...</option>
+ <optgroup label="Actions">
+ <option>Shutdown</option>
+ <option>Load Balance</option>
+ </optgroup>
+ <optgroup label="Add to Group">
+ <option>East Coast</option>
+ <option>West Coast</option>
+ <option>Marketing</option>
+ <option>Sales</option>
+ </optgroup>
+ </select>
+ {submit}
+ <br/><br/>
+
+ <table class="mobjects">
+ <tr>
+ <th></th>
+ <th>Server</th>
+ <th>Profile</th>
+ <th>Cluster</th>
+ <th>Status</th>
+ <th>Load</th>
+ </tr>
+
+ {items}
+ </table>
+</form>
+
+[ServerSetForm.item_html]
+<tr>
+ <td><input type="checkbox" name="{item_checkbox_name}" value="{item_checkbox_value}" {item_checkbox_checked_attr}/></td>
+ <td>{item_link}</td>
+ <td>{item_profile_link}</td>
+ <td>{item_cluster_link}</td>
+ <td>{item_status}</td>
+ <td>{item_load}</td>
+</tr>
+
[ServerConfigTab.css]
.ServerConfigTab.diff {
background-color: #ff9;
@@ -148,45 +191,3 @@
[ServerBrowser.cluster_html]
<li>{cluster_link}</li>
-
-[BrowserServers.html]
-<form>
-
-<select>
- <option>Act on Selection...</option>
- <optgroup label="Actions">
- <option>Shutdown</option>
- <option>Load Balance</option>
- </optgroup>
- <optgroup label="Add to Group">
- <option>East Coast</option>
- <option>West Coast</option>
- <option>Marketing</option>
- <option>Sales</option>
- </optgroup>
-</select>
-<br/><br/>
-
-<table class="mobjects">
- <tr>
- <th><input type="checkbox"/></th>
- <th>Server</th>
- <th>Profile</th>
- <th>Cluster</th>
- <th>Status</th>
- <th>Load</th>
- </tr>
-
- {items}
-</table>
-</form>
-
-[BrowserServers.item_html]
-<tr>
- <td><input type="checkbox"/ name="server" value="{item_id}"></td>
- <td>{item_link}</td>
- <td>{item_profile_link}</td>
- <td>{item_cluster_link}</td>
- <td>{item_status}</td>
- <td>{item_load}</td>
-</tr>
18 years, 6 months