rhmessaging commits: r2267 - store/trunk/cpp/tests/jrnl/jtt.
by rhmessaging-commits@lists.jboss.org
Author: kpvdr
Date: 2008-08-08 06:58:59 -0400 (Fri, 08 Aug 2008)
New Revision: 2267
Modified:
store/trunk/cpp/tests/jrnl/jtt/jfile_chk.py
Log:
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/trunk/cpp/tests/jrnl/jtt/jfile_chk.py
===================================================================
--- store/trunk/cpp/tests/jrnl/jtt/jfile_chk.py 2008-08-07 19:49:37 UTC (rev 2266)
+++ store/trunk/cpp/tests/jrnl/jtt/jfile_chk.py 2008-08-08 10:58:59 UTC (rev 2267)
@@ -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
rhmessaging commits: r2266 - mgmt/trunk/cumin/resources.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-08-07 15:49:37 -0400 (Thu, 07 Aug 2008)
New Revision: 2266
Added:
mgmt/trunk/cumin/resources/help.html
Log:
Added first cut at a help file.
Added: mgmt/trunk/cumin/resources/help.html
===================================================================
--- mgmt/trunk/cumin/resources/help.html (rev 0)
+++ mgmt/trunk/cumin/resources/help.html 2008-08-07 19:49:37 UTC (rev 2266)
@@ -0,0 +1,133 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+ <title>Cumin - Help</title>
+ <link rel="stylesheet" href="http://www.redhat.com/docs/en-US/Red_Hat_Enterprise_MRG/1.0/html/Messagin..." type="text/css" />
+
+ </head>
+ <body>
+ <p id="title">
+ <a href="http://www.redhat.com/docs">
+ <strong>Cumin Help</strong>
+ </a>
+ </p>
+ <a name="top"/>
+ <p>
+ <span class="filename">Main - Broker - Queue</span>
+ </p>
+ <div class="section" lang="en-US" xml:lang="en-US">
+ <div class="titlepage">
+ <div>
+ <div>
+ <h3 class="title"><a name="main.broker.queue.queuebindingadd.help"/>Bind a Queue to an Exchange</h3>
+ </div>
+ </div>
+ </div>
+ <p>
+ Allows an existing queue to bind to an existing exchange. Select one or more exchanges from the list and
+ enter the exchange key and other required information. Each exchange type has different required information.
+ </p>
+
+ <div class="programlisting">
+ <ul>
+ <li>A "direct" exchange uses the queue name as the binding key so no input is required.</li>
+ <li>A "fanout" exchange does not require a binding key</li>
+ <li>A "topic" exchange requires a binding key</li>
+ <li>A "xml" exchange reqires a binding key and an XQuery. Selecting an "xml" exchange displays an XQuery input box.</li>
+ <li>A "headers" exchange requires:
+ <ul>
+ <li>a binding key</li>
+ <li>an x-match type of "all" or "any"</li>
+ <li>zero or more match keys. If a match key is entered, an optional type, value can be entered.</li>
+ </ul>
+ Selecting a "headers" exchange displays the additional inputs.</li>
+ </ul>
+ <p>
+ The exchanges listed default to all available exchanges. To view only "Active" exchanges, select the Active option above the list.
+ </p>
+ </div>
+
+
+<ul class="docnav">
+ <li class="up">
+ <a accesskey="u" href="#top">
+ <strong>Help Index</strong>
+ </a>
+ </li>
+</ul>
+
+ <div class="titlepage">
+ <div>
+ <div>
+ <h3 class="title"><a name="main.broker.queueadd.help"/>Adding a new Queue</h3>
+ </div>
+ </div>
+ </div>
+ <p>
+ Allows the creation of a new queue and optionally allows binding to an existing exchange. A new queue
+ requires a name and has several attributes:
+ </p>
+ <div class="programlisting">
+ <ul>
+ <li><strong>Durable</strong> Will the queue survive if the broker becomes unavailable.</li>
+ <li><strong>Exclusive</strong> </li>
+ <li><strong>Auto Delete</strong> </li>
+ </ul>
+ </div>
+
+ <p>
+ Optionally, a queue can be bound to one or more exchanges. Select an exchange from the list and
+ enter the exchange key and other required information. Each exchange type has different required information.
+ </p>
+ <div class="programlisting">
+ <ul>
+ <li>A "direct" exchange uses the queue name as the binding key so no input is required.</li>
+ <li>A "fanout" exchange does not require a binding key</li>
+ <li>A "topic" exchange requires a binding key</li>
+ <li>A "xml" exchange reqires a binding key and an XQuery. Selecting an "xml" exchange displays an XQuery input box.</li>
+ <li>A "headers" exchange requires:
+ <ul>
+ <li>a binding key</li>
+ <li>an x-match type of "all" or "any"</li>
+ <li>zero or more match keys. If a match key is entered, an optional type, value can be entered.</li>
+ </ul>
+ Selecting a "headers" exchange displays the additional inputs.</li>
+ </ul>
+ </div>
+ <p>
+ The exchanges listed default to all available exchanges. To view only "Active" exchanges, select the Active option above the list.
+ </p>
+
+<ul class="docnav">
+ <li class="up">
+ <a accesskey="u" href="#top">
+ <strong>Help Index</strong>
+ </a>
+ </li>
+</ul>
+
+ <div class="titlepage">
+ <div>
+ <div>
+ <h3 class="title"><a name="main.broker.exchangeadd.help"/>Adding a new Exchange</h3>
+ </div>
+ </div>
+ </div>
+ <p>
+ Allows the creation of a new exchange. An exchange name is required.
+ Choose one of the exchange types listed.
+ </p>
+
+<ul class="docnav">
+ <li class="up">
+ <a accesskey="u" href="#top">
+ <strong>Help Index</strong>
+ </a>
+ </li>
+</ul>
+ </div><!-- section -->
+
+ <div style="height:1000px;"><!-- --></div>
+ </body>
+</html>
17 years, 8 months
rhmessaging commits: r2265 - mgmt/trunk/cumin/python/wooly.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-08-07 15:48:23 -0400 (Thu, 07 Aug 2008)
New Revision: 2265
Modified:
mgmt/trunk/cumin/python/wooly/parameters.py
Log:
Removed ununsed argument to DictParameter
Modified: mgmt/trunk/cumin/python/wooly/parameters.py
===================================================================
--- mgmt/trunk/cumin/python/wooly/parameters.py 2008-08-07 19:47:57 UTC (rev 2264)
+++ mgmt/trunk/cumin/python/wooly/parameters.py 2008-08-07 19:48:23 UTC (rev 2265)
@@ -3,7 +3,7 @@
from wooly import *
class DictParameter(Parameter):
- def __init__(self, app, name, key):
+ def __init__(self, app, name):
super(DictParameter, self).__init__(app, name)
self.default = dict()
17 years, 8 months
rhmessaging commits: r2264 - mgmt/trunk/cumin/python/wooly.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-08-07 15:47:57 -0400 (Thu, 07 Aug 2008)
New Revision: 2264
Modified:
mgmt/trunk/cumin/python/wooly/__init__.py
mgmt/trunk/cumin/python/wooly/widgets.py
mgmt/trunk/cumin/python/wooly/widgets.strings
Log:
Tidied up some xhtml syntax.
Modified: mgmt/trunk/cumin/python/wooly/__init__.py
===================================================================
--- mgmt/trunk/cumin/python/wooly/__init__.py 2008-08-07 19:46:21 UTC (rev 2263)
+++ mgmt/trunk/cumin/python/wooly/__init__.py 2008-08-07 19:47:57 UTC (rev 2264)
@@ -234,7 +234,7 @@
return self.path
def render_class(self, session, *args):
- return None
+ return "noclass"
def render_href(self, session, *args):
return session.marshal()
Modified: mgmt/trunk/cumin/python/wooly/widgets.py
===================================================================
--- mgmt/trunk/cumin/python/wooly/widgets.py 2008-08-07 19:46:21 UTC (rev 2263)
+++ mgmt/trunk/cumin/python/wooly/widgets.py 2008-08-07 19:47:57 UTC (rev 2264)
@@ -72,7 +72,7 @@
def render_tab_class(self, session, tab):
stab = self.get_selected_mode(session)
- return stab is tab and "selected" or ""
+ return stab is tab and "class=\"selected\"" or ""
def render_tab_content(self, session, tab):
args = tab.get_args(session)
Modified: mgmt/trunk/cumin/python/wooly/widgets.strings
===================================================================
--- mgmt/trunk/cumin/python/wooly/widgets.strings 2008-08-07 19:46:21 UTC (rev 2263)
+++ mgmt/trunk/cumin/python/wooly/widgets.strings 2008-08-07 19:47:57 UTC (rev 2264)
@@ -47,7 +47,7 @@
<div class="TabbedModeSet mode">{mode}</div>
[TabbedModeSet.tab_html]
-<li><a href="{tab_href}" class="{tab_class}">{tab_content}</a></li>
+<li><a href="{tab_href}" {tab_class}>{tab_content}</a></li>
[LinkSet.html]
<ul class="{class}">{links}</ul>
17 years, 8 months
rhmessaging commits: r2263 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-08-07 15:46:21 -0400 (Thu, 07 Aug 2008)
New Revision: 2263
Modified:
mgmt/trunk/cumin/python/cumin/brokercluster.strings
mgmt/trunk/cumin/python/cumin/brokerprofile.strings
mgmt/trunk/cumin/python/cumin/exchange.py
mgmt/trunk/cumin/python/cumin/exchange.strings
mgmt/trunk/cumin/python/cumin/page.py
mgmt/trunk/cumin/python/cumin/page.strings
mgmt/trunk/cumin/python/cumin/queue.py
mgmt/trunk/cumin/python/cumin/stat.strings
mgmt/trunk/cumin/python/cumin/util.py
mgmt/trunk/cumin/python/cumin/widgets.py
mgmt/trunk/cumin/python/cumin/widgets.strings
Log:
Added help buttons to modal forms.
Tidied up some xhtml syntax.
Modified: mgmt/trunk/cumin/python/cumin/brokercluster.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/brokercluster.strings 2008-08-07 19:42:49 UTC (rev 2262)
+++ mgmt/trunk/cumin/python/cumin/brokercluster.strings 2008-08-07 19:46:21 UTC (rev 2263)
@@ -40,7 +40,7 @@
[BrokerClusterView.html]
{status}
-<h1><img src="resource?name=cluster-36.png"/>{title}</h1>
+<h1><img src="resource?name=cluster-36.png" alt="cluster" />{title}</h1>
<table class="props">
<tr><th>Name</th><td>{name}</td></tr>
@@ -91,7 +91,7 @@
{hidden_inputs}
</div>
<div class="foot">
- <a class="help action" href="{href}" target="help">Help</a>
+ {help}
{submit}
{cancel}
</div>
Modified: mgmt/trunk/cumin/python/cumin/brokerprofile.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/brokerprofile.strings 2008-08-07 19:42:49 UTC (rev 2262)
+++ mgmt/trunk/cumin/python/cumin/brokerprofile.strings 2008-08-07 19:46:21 UTC (rev 2263)
@@ -17,7 +17,7 @@
</tr>
[BrokerProfileView.html]
-<h1><img src="resource?name=profile-36.png"/> {title}</h1>
+<h1><img src="resource?name=profile-36.png" alt="profile" /> {title}</h1>
<table class="props">
<tr><th>Name</th><td>{name}</td></tr>
@@ -87,7 +87,7 @@
{hidden_inputs}
</div>
<div class="foot">
- <a class="help action" href="{href}" target="help">Help</a>
+ {help}
{submit}
{cancel}
</div>
Modified: mgmt/trunk/cumin/python/cumin/exchange.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/exchange.py 2008-08-07 19:42:49 UTC (rev 2262)
+++ mgmt/trunk/cumin/python/cumin/exchange.py 2008-08-07 19:46:21 UTC (rev 2263)
@@ -36,10 +36,8 @@
def __init__(self, app, name):
super(ExchangeSet, self).__init__(app, name)
- # exchange names we don't want to allow to remove
- skips = ["", "amq.direct", "amq.topic", "amq.fanout",
- "amq.match", "amq.xml", "qpid.management"]
- self.ids = FilteredCheckboxIdColumn(app, "id", self, "name", skips)
+ self.ids = FilteredCheckboxIdColumn(app, "id", self, "name",
+ ExchangeInfo.get_builtins())
self.add_column(self.ids)
col = self.NameColumn(app, "name")
@@ -548,9 +546,12 @@
return producer.name
class ExchangeInfo(object):
- def is_builtin(self, exchange):
- return exchange.name in ["amq.direct", "amq.topic", "amq.match", "amq.fanout"]
+ @classmethod
+ def is_builtin(cls, exchange):
+ return exchange.name in ExchangeInfo.get_builtins()
- is_builtin = classmethod(is_builtin)
+ @classmethod
+ def get_builtins(cls):
+ return ["", "amq.direct", "amq.topic", "amq.match", "amq.fanout", "qpid.management"]
\ No newline at end of file
Modified: mgmt/trunk/cumin/python/cumin/exchange.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/exchange.strings 2008-08-07 19:42:49 UTC (rev 2262)
+++ mgmt/trunk/cumin/python/cumin/exchange.strings 2008-08-07 19:46:21 UTC (rev 2263)
@@ -116,7 +116,7 @@
{hidden_inputs}
</div>
<div class="foot">
- <div style="display: block; float: left;"><button>Help</help></div>
+ {help}
{submit}
{cancel}
</div>
@@ -124,7 +124,7 @@
<script type="text/javascript" defer="defer">
(function() {
// elements[0] is a fieldset, at least in firefox
- var elem = wooly.doc().elembyid("{id}").node.elements[1];
+ var elem = wooly.doc().elembyid("{id}").node.elements[0];
elem.focus();
elem.select();
}())
Modified: mgmt/trunk/cumin/python/cumin/page.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/page.py 2008-08-07 19:42:49 UTC (rev 2262)
+++ mgmt/trunk/cumin/python/cumin/page.py 2008-08-07 19:46:21 UTC (rev 2263)
@@ -50,7 +50,7 @@
return self.__frames.get(session)
def render_class(self, session):
- return self.__modal.get(session) and "modal"
+ return self.__modal.get(session) and "modal" or "modeless"
def render_title(self, session):
return "MRG Management"
@@ -206,10 +206,7 @@
class Tab(Link):
def render_class(self, session):
- if self.parent.selection.get(session) == self.name:
- return "selected"
- else:
- return "none"
+ return (self.parent.selection.get(session) == self.name) and "selected" or "not-selected"
class MessagingTab(Tab):
def render_content(self, session):
Modified: mgmt/trunk/cumin/python/cumin/page.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/page.strings 2008-08-07 19:42:49 UTC (rev 2262)
+++ mgmt/trunk/cumin/python/cumin/page.strings 2008-08-07 19:46:21 UTC (rev 2263)
@@ -391,6 +391,13 @@
float: right;
}
+.rclear {
+ font-size:0.01em;
+ width: 0.01px;
+ clear:right;
+ line-height:0.01px;
+}
+
[CuminPage.javascript]
var cumin;
@@ -414,7 +421,12 @@
}
}
}())
-
+function addEvent(obj, event_type, funct) {
+ if (obj.addEventListener)
+ obj.addEventListener(event_type, funct, false);
+ else if (obj.attachEvent)
+ obj.attachEvent("on"+event_type, funct);
+}
[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">
@@ -424,8 +436,8 @@
<link rel="stylesheet" type="text/css" href="cumin.css"/>
<link rel="shortcut icon" href="resource?name=favicon.ico" type="image/x-icon"/>
<!-- XXX import this via cumin.js instead -->
- <script src="resource?name=wooly.js" type="text/javascript"> </script>
- <script src="cumin.js" type="text/javascript"> </script>
+ <script src="resource?name=wooly.js" type="text/javascript"> </script>
+ <script src="cumin.js" type="text/javascript"> </script>
</head>
<body class="{class}">
{mode}
@@ -597,7 +609,7 @@
<ul id="context">{frames}</ul>
</div>
- <!-- <a id="logo" href="{href}"><img src="resource?name=rhm-32x14.png"/></a> -->
+ <!-- <a id="logo" href="{href}"><img src="resource?name=rhm-32x14.png" alt="Red Hat Messaging" /></a> -->
</div>
<div id="trans"></div>
<div id="body">{mode}</div>
@@ -616,7 +628,7 @@
wooly.setIntervalUpdate("{data_url}", updateMain, 3000);
</script>
<div class="oblock">
- <img id="msg_logo" src="resource?name=rh_messaging_logo.png"/>
+ <img id="msg_logo" src="resource?name=rh_messaging_logo.png" alt="messaging logo"/>
<ul class="TabbedModeSet tabs">{tabs}</ul>
<div class="TabbedModeSet mode">{mode}</div>
Modified: mgmt/trunk/cumin/python/cumin/queue.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/queue.py 2008-08-07 19:42:49 UTC (rev 2262)
+++ mgmt/trunk/cumin/python/cumin/queue.py 2008-08-07 19:46:21 UTC (rev 2263)
@@ -214,6 +214,7 @@
return self.show_mode(session, self.purge)
def show_queue_binding_add(self, session):
+ self.page.set_current_frame(session, self.queue_binding_add)
return self.show_mode(session, self.queue_binding_add)
def render_href(self, session, queue):
@@ -489,10 +490,10 @@
class SummaryProperties(CuminProperties):
def do_get_items(self, session, queue):
- return [("Name:", queue.name),
- ("Durable:", queue.durable),
- ("Exclusive:", queue.exclusive),
- ("Auto-Delete:", queue.autoDelete)]
+ return [("Name", queue.name),
+ ("Durable", queue.durable),
+ ("Exclusive", queue.exclusive),
+ ("Auto-Delete", queue.autoDelete)]
def render_inputs(self, session, *args):
writer = Writer()
Modified: mgmt/trunk/cumin/python/cumin/stat.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/stat.strings 2008-08-07 19:42:49 UTC (rev 2262)
+++ mgmt/trunk/cumin/python/cumin/stat.strings 2008-08-07 19:46:21 UTC (rev 2263)
@@ -153,7 +153,7 @@
<div class="duration">{duration}</div>
- <img id="{id}" src="{href}" height="100" width="360"/>
+ <img id="{id}" src="{href}" height="100" width="360" alt="stats" />
</div>
<script type="text/javascript">
cumin.objectListeners["{id}"] = updateChart
Modified: mgmt/trunk/cumin/python/cumin/util.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/util.py 2008-08-07 19:42:49 UTC (rev 2262)
+++ mgmt/trunk/cumin/python/cumin/util.py 2008-08-07 19:46:21 UTC (rev 2263)
@@ -1,8 +1,8 @@
from ConfigParser import SafeConfigParser
from datetime import *
from logging import getLogger
+from mx.DateTime.DateTime import mktime
from random import randint
-from time import mktime
import sys
def short_id():
Modified: mgmt/trunk/cumin/python/cumin/widgets.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/widgets.py 2008-08-07 19:42:49 UTC (rev 2262)
+++ mgmt/trunk/cumin/python/cumin/widgets.py 2008-08-07 19:46:21 UTC (rev 2263)
@@ -118,6 +118,10 @@
self.frame.show_remove(branch)
return branch.marshal()
+class FormHelp(FormInput):
+ def __init__(self, app, name, form):
+ super(FormHelp, self).__init__(app, name, form)
+
class CuminForm(Form):
def __init__(self, app, name):
super(CuminForm, self).__init__(app, name)
@@ -130,6 +134,9 @@
self.__submit.set_tab_index(200)
self.add_child(self.__submit)
+ self.__help = self.Help(app, "help", self)
+ self.add_child(self.__help)
+
def submit(self, session):
self.__submit.set(session, True)
@@ -159,9 +166,6 @@
def process_display(self, session, *args):
pass
- def render_help_href(self, session, *args):
- return self.render_href(self, session, *args)
-
def render_cancel_content(self, session, *args):
return "Cancel"
@@ -184,6 +188,10 @@
cargs = self.parent.get_args(session)
return self.parent.render_submit_content(session, *cargs)
+ class Help(FormHelp):
+ def render_help_href(self, session, *args):
+ return "resource?name=help.html#%s" % self.path
+
class CuminFieldForm(CuminForm, FieldForm, Frame):
def render_form_error(self, session, *args):
pass
@@ -333,7 +341,8 @@
return self.__param.get(session)
def set(self, session, value):
- return self.__param.set(session, value)
+ foo = self.__param.set(session, value)
+ return foo
def get_items(self, session):
return self.__states
@@ -541,13 +550,14 @@
def clear(self, session):
self.ids.set(session, list())
- def do_render(self, session, data):
+ def do_render(self, session, data, disabled=False):
name = self.ids.path
id = data[self.name]
attr = id in self.ids.get(session) and "checked=\"checked\"" or ""
- t = "<td><input type=\"checkbox\" name=\"%s\" value=\"%i\" %s/></td>"
+ disa = disabled and "disabled=\"disabled\"" or ""
+ t = "<td><input type=\"checkbox\" name=\"%s\" value=\"%i\" %s %s/></td>"
- return t % (name, id, attr)
+ return t % (name, id, attr, disa)
class CheckboxIdColumnHeader(ItemTableColumnHeader):
def render_form_id(self, session, *args):
@@ -565,10 +575,8 @@
self.__col_name = col_name
def do_render(self, session, data):
- if data[self.__col_name] in self.__skip_list:
- return "<td></td>"
- else:
- return super(FilteredCheckboxIdColumn, self).do_render(session, data)
+ return super(FilteredCheckboxIdColumn, self).do_render(session, data,
+ disabled=data[self.__col_name] in self.__skip_list)
class NameField(StringField):
def __init__(self, app, name, form):
Modified: mgmt/trunk/cumin/python/cumin/widgets.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/widgets.strings 2008-08-07 19:42:49 UTC (rev 2262)
+++ mgmt/trunk/cumin/python/cumin/widgets.strings 2008-08-07 19:46:21 UTC (rev 2263)
@@ -1,5 +1,5 @@
[CuminView.html]
-<script>
+<script type="text/javascript">
{script}
</script>
@@ -15,6 +15,7 @@
<div class="body">{fields}</div>
{form_error}
<div class="foot">
+ {help}
{submit}
{cancel}
</div>
@@ -35,7 +36,7 @@
{hidden_inputs}
</div>
</form>
-<script>
+<script type="text/javascript">
wooly.doc().elembyid("{id}").node.elements[1].focus();
</script>
@@ -53,12 +54,12 @@
{hidden_inputs}
</div>
<div class="foot">
- <div style="display: block; float: left;"><button>Help</button></div>
+ {help}
{submit}
{cancel}
</div>
</form>
-<script>
+<script type="text/javascript">
wooly.doc().elembyid("{id}").node.elements[0].focus();
</script>
@@ -79,12 +80,12 @@
{hidden_inputs}
</div>
<div class="foot">
- <div style="display: block; float: left;"><button>Help</button></div>
+ {help}
{submit}
{cancel}
</div>
</form>
-<script>
+<script type="text/javascript">
wooly.doc().elembyid("{id}").node.elements[0].focus();
</script>
@@ -235,7 +236,7 @@
[CuminSummary.html]
<div class="CuminSummary">
<h1>
- <img src="{icon_href}"/>
+ <img src="{icon_href}" alt="summary" />
{title}
</h1>
@@ -322,3 +323,23 @@
[CheckboxIdColumnHeader.html]
<th><input id="{id}" type="checkbox"
onclick="checkAll('{id}', '{form_id}', '{elem_name}')"/></th>
+
+[FormHelp.javascript]
+function help_window(href) {
+ var left = screen.availWidth / 2;
+ var height = screen.availHeight - 40;
+ var args = "width="+left+",height="+height+",top=0,left="+left+",scrollbars=1,status=1,toolbar=1";
+ hwin = window.open(href, "help", args);
+ if (hwin.focus)
+ hwin.focus();
+ return false;
+}
+function attachHelp() {
+ if (document.getElementById("help_link"))
+ document.getElementById("help_link").onclick = function() { return help_window(this.href) }
+}
+addEvent(window, "load", attachHelp);
+
+[FormHelp.html]
+ <a class="help action" id="help_link" href="{help_href}">Help</a>
+
\ No newline at end of file
17 years, 8 months
rhmessaging commits: r2262 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-08-07 15:42:49 -0400 (Thu, 07 Aug 2008)
New Revision: 2262
Modified:
mgmt/trunk/cumin/python/cumin/binding.py
mgmt/trunk/cumin/python/cumin/binding.strings
mgmt/trunk/cumin/python/cumin/broker.py
mgmt/trunk/cumin/python/cumin/broker.strings
Log:
Added Active/All state to exchange bindings
Modified: mgmt/trunk/cumin/python/cumin/binding.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/binding.py 2008-08-07 17:54:00 UTC (rev 2261)
+++ mgmt/trunk/cumin/python/cumin/binding.py 2008-08-07 19:42:49 UTC (rev 2262)
@@ -1,5 +1,6 @@
from cumin.exchange import ExchangeInfo
from cumin.util import sorted_by, is_active
+from cumin.widgets import StateSwitch
from formats import fmt_shorten
from wooly import Template, Writer, Attribute
from wooly.forms import FormInput, FormField
@@ -199,13 +200,27 @@
def render_headers_extra(self, session, exchange):
return "headers_extra.%s" % str(exchange.id)
+class ExchangeState(StateSwitch):
+ def __init__(self, app, name):
+ super(ExchangeState, self).__init__(app, name)
+ self.add_state("c", "Active")
+ self.add_state("a", "All")
+
+ def render_href(self, session):
+ pass
+
+ def is_all(self, session):
+ return self.get(session) == "a"
+ def is_active(self, session):
+ return self.get(session) == "c"
+
class ExchangeKeysField(FormField):
def __init__(self, app, name, form, title="Initial bindings:"):
super(ExchangeKeysField, self).__init__(app, name, form)
- self.dict_param = DictParameter(app, "exchange", form)
+ self.dict_param = DictParameter(app, "exchange")
self.add_parameter(self.dict_param)
form.add_form_parameter(self.dict_param)
@@ -229,6 +244,9 @@
self.binding_errors = self.Errors(self, "binding_errors")
self.add_attribute(self.binding_errors)
+ self.__state = ExchangeState(app, "phase")
+ self.add_child(self.__state)
+
def get_args(self, session):
broker = self.get_parent_named("broker")
reg = broker.get_object(session)
@@ -247,7 +265,8 @@
# render each exchange we support
writer = Writer()
for exchange in sortedExchanges:
- if ExchangeInfo.is_builtin(exchange) or is_active(exchange):
+ if ExchangeInfo.is_builtin(exchange) or \
+ not (self.__state.is_active(session) and not is_active(exchange)):
# instance_key gives us a unique path for each exchange
# we will be rendering
instance_key = self.dict_param.get_instance_key(str(exchange.id))
Modified: mgmt/trunk/cumin/python/cumin/binding.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/binding.strings 2008-08-07 17:54:00 UTC (rev 2261)
+++ mgmt/trunk/cumin/python/cumin/binding.strings 2008-08-07 19:42:49 UTC (rev 2262)
@@ -135,7 +135,9 @@
[ExchangeKeysField.html]
<div class="field">
+ <div class="rfloat">{phase}</div>
<div class="title">{title}</div>
+ <div class="rclear"> </div>
<div class="inputs">
<table class="mobjects" id="exchange_types">
@@ -149,6 +151,7 @@
<tbody>
{exchanges}
</tbody>
+
</table>
</div>
</div>
Modified: mgmt/trunk/cumin/python/cumin/broker.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/broker.py 2008-08-07 17:54:00 UTC (rev 2261)
+++ mgmt/trunk/cumin/python/cumin/broker.py 2008-08-07 19:42:49 UTC (rev 2262)
@@ -191,6 +191,7 @@
return self.show_mode(session, self.__queues_remove)
def show_queue_add(self, session):
+ self.page.set_current_frame(session, self.__queue_add)
return self.show_mode(session, self.__queue_add)
def show_exchange(self, session, exchange):
@@ -573,6 +574,9 @@
class MoreEntries(FormButton):
def render_content(self, session):
return "More Entries"
+
+ def render_class(self, session):
+ return "more"
class BrokerSetAdd(BrokerSetForm):
def process_cancel(self, session):
Modified: mgmt/trunk/cumin/python/cumin/broker.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/broker.strings 2008-08-07 17:54:00 UTC (rev 2261)
+++ mgmt/trunk/cumin/python/cumin/broker.strings 2008-08-07 19:42:49 UTC (rev 2262)
@@ -191,7 +191,7 @@
{hidden_inputs}
</div>
<div class="foot">
- <a class="help action" href="{href}" target="help">Help</a>
+ {help}
{submit}
{cancel}
</div>
17 years, 8 months
rhmessaging commits: r2261 - store/trunk/cpp/rhel4-support.
by rhmessaging-commits@lists.jboss.org
Author: gordonsim
Date: 2008-08-07 13:54:00 -0400 (Thu, 07 Aug 2008)
New Revision: 2261
Modified:
store/trunk/cpp/rhel4-support/rhel4.patch
Log:
Updated patch for rhel4 support
Modified: store/trunk/cpp/rhel4-support/rhel4.patch
===================================================================
--- store/trunk/cpp/rhel4-support/rhel4.patch 2008-08-07 13:34:21 UTC (rev 2260)
+++ store/trunk/cpp/rhel4-support/rhel4.patch 2008-08-07 17:54:00 UTC (rev 2261)
@@ -1,8 +1,8 @@
Index: tests/.valgrind.supp
===================================================================
---- tests/.valgrind.supp (revision 2179)
+--- tests/.valgrind.supp (revision 2259)
+++ tests/.valgrind.supp (working copy)
-@@ -1,32 +1,205 @@
+@@ -1,32 +1,207 @@
{
- Benign error in libcpg.
- Memcheck:Param
@@ -79,6 +79,8 @@
+ fun:calloc
+ fun:_dl_allocate_tls
+ fun:pthread_create@@GLIBC_2.2.5
++ fun:_ZN4qpid3sys13ThreadPrivateC1EPNS0_8RunnableE
++ fun:_ZN4qpid3sys6ThreadC1EPNS0_8RunnableE
+ fun:_ZN4qpid6broker5Timer5startEv
+ fun:_ZN4qpid6broker5TimerC1Ev
+}
@@ -231,7 +233,7 @@
Index: configure.ac
===================================================================
---- configure.ac (revision 2179)
+--- configure.ac (revision 2259)
+++ configure.ac (working copy)
@@ -54,7 +54,6 @@
# -Wshadow - warns about boost headers.
@@ -251,7 +253,7 @@
AC_SUBST([WARNING_CFLAGS], [$COMPILER_FLAGS])
Index: lib/BdbMessageStore.cpp
===================================================================
---- lib/BdbMessageStore.cpp (revision 2179)
+--- lib/BdbMessageStore.cpp (revision 2259)
+++ lib/BdbMessageStore.cpp (working copy)
@@ -230,10 +230,6 @@
try {
@@ -266,7 +268,7 @@
Index: Makefile.am
===================================================================
---- Makefile.am (revision 2179)
+--- Makefile.am (revision 2259)
+++ Makefile.am (working copy)
@@ -1,4 +1,4 @@
-AUTOMAKE_OPTIONS = 1.9.6 foreign
17 years, 8 months
rhmessaging commits: r2260 - in store/branches/java/broker-queue-refactor/java/bdbstore: src and 10 other directories.
by rhmessaging-commits@lists.jboss.org
Author: ritchiem
Date: 2008-08-07 09:34:21 -0400 (Thu, 07 Aug 2008)
New Revision: 2260
Added:
store/branches/java/broker-queue-refactor/java/bdbstore/src/integrationTests/
store/branches/java/broker-queue-refactor/java/bdbstore/src/integrationTests/java/
store/branches/java/broker-queue-refactor/java/bdbstore/src/integrationTests/java/org/
store/branches/java/broker-queue-refactor/java/bdbstore/src/integrationTests/java/org/apache/
store/branches/java/broker-queue-refactor/java/bdbstore/src/integrationTests/java/org/apache/qpid/
store/branches/java/broker-queue-refactor/java/bdbstore/src/integrationTests/java/org/apache/qpid/server/
store/branches/java/broker-queue-refactor/java/bdbstore/src/integrationTests/java/org/apache/qpid/server/store/
store/branches/java/broker-queue-refactor/java/bdbstore/src/integrationTests/java/org/apache/qpid/server/store/berkeleydb/
store/branches/java/broker-queue-refactor/java/bdbstore/src/integrationTests/java/org/apache/qpid/server/store/berkeleydb/MessageStoreTest.java
Modified:
store/branches/java/broker-queue-refactor/java/bdbstore/build.xml
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/BindingKey.java
store/branches/java/broker-queue-refactor/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BindingTB.java
store/branches/java/broker-queue-refactor/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/FieldTableEncoding.java
store/branches/java/broker-queue-refactor/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/QueueTB.java
store/branches/java/broker-queue-refactor/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBStoreTest.java
Log:
RHM-4 : Store binding/queue arguments in the store. Additional test to validate, also test that utilises the Broker Test MessageStoreTest to perform integration tests
Modified: store/branches/java/broker-queue-refactor/java/bdbstore/build.xml
===================================================================
--- store/branches/java/broker-queue-refactor/java/bdbstore/build.xml 2008-08-06 13:39:16 UTC (rev 2259)
+++ store/branches/java/broker-queue-refactor/java/bdbstore/build.xml 2008-08-07 13:34:21 UTC (rev 2260)
@@ -36,7 +36,7 @@
classpathref="class.path"/>
</target>
- <target name="build-tests" depends="init,build">
+ <target name="build-tests" depends="build">
<javac srcdir="${src.test.dir}"
destdir="${build.test.classes}"
classpathref="test.class.path"/>
@@ -102,7 +102,7 @@
</target>
- <target name="release" depends="build, jar"/>
+ <target name="release" depends="jar"/>
</project>
Added: store/branches/java/broker-queue-refactor/java/bdbstore/src/integrationTests/java/org/apache/qpid/server/store/berkeleydb/MessageStoreTest.java
===================================================================
--- store/branches/java/broker-queue-refactor/java/bdbstore/src/integrationTests/java/org/apache/qpid/server/store/berkeleydb/MessageStoreTest.java (rev 0)
+++ store/branches/java/broker-queue-refactor/java/bdbstore/src/integrationTests/java/org/apache/qpid/server/store/berkeleydb/MessageStoreTest.java 2008-08-07 13:34:21 UTC (rev 2260)
@@ -0,0 +1,38 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.qpid.server.store.berkeleydb;
+
+import org.apache.commons.configuration.PropertiesConfiguration;
+
+public class MessageStoreTest extends org.apache.qpid.server.store.MessageStoreTest
+{
+
+ public void testBDBMessageStore()
+ {
+ PropertiesConfiguration config = new PropertiesConfiguration();
+
+ config.addProperty("store.environment-path", "BDB_MST");
+ config.addProperty("store.class", "org.apache.qpid.server.store.berkeleydb.BDBMessageStore");
+
+ runTestWithStore(config);
+ }
+
+}
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-06 13:39:16 UTC (rev 2259)
+++ store/branches/java/broker-queue-refactor/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStore.java 2008-08-07 13:34:21 UTC (rev 2260)
@@ -108,7 +108,6 @@
private static final String NEW_EXCHANGE_DB_NAME = "EXCHANGE";
-
private static final String QUEUEBINDINGSDB_NAME = "queueBindingsDb";
private Database _queueBindingsDb;
@@ -120,10 +119,6 @@
private static final AMQShortString EMPTY_SHORT_STRING = new AMQShortString("");
-
-
-
-
private final CommitThread _commitThread = new CommitThread("Commit-Thread");
private Map<AMQShortString, Long> _queueNameToIdMap = new ConcurrentHashMap<AMQShortString, Long>();
@@ -158,7 +153,6 @@
stateTransition(State.INITIAL, State.CONFIGURING);
_log.info("Configuring BDB message store");
- QueueRegistry queueRegistry = virtualHost.getQueueRegistry();
File environmentPath = new File(config.getString(base + "." + ENVIRONMENT_PATH_PROPERTY, "bdbEnv"));
if (!environmentPath.exists())
@@ -166,7 +160,7 @@
if (!environmentPath.mkdirs())
{
throw new IllegalArgumentException("Environment path " + environmentPath + " could not be read or created. "
- + "Ensure the path is correct and that the permissions are correct.");
+ + "Ensure the path is correct and that the permissions are correct.");
}
}
@@ -180,7 +174,6 @@
upgradeIfNecessary();
// this recovers durable queues and persistent messages
-
recover();
stateTransition(State.RECOVERING, State.STARTED);
@@ -196,7 +189,7 @@
if (_state != requiredState)
{
throw new AMQException("Cannot transition to the state: " + newState + "; need to be in state: " + requiredState
- + "; currently in state: " + _state);
+ + "; currently in state: " + _state);
}
_state = newState;
@@ -476,15 +469,15 @@
if (queue == null)
{
_log.error("Unkown queue: " + binding.getQueueName() + " cannot be bound to exchange: "
- + exchange.getName());
+ + exchange.getName());
}
else
{
_log.info("Restoring binding: (Exchange: " + binding.getExchangeName() + ", Queue: " + binding
- .getQueueName() + ", Routing Key: " + binding.getRoutingKey() + ", Arguments: " + binding.getArguments()
- + ")");
+ .getQueueName() + ", Routing Key: " + binding.getRoutingKey() + ", Arguments: " + binding.getArguments()
+ + ")");
- queue.bind(exchange, binding.getRoutingKey(), binding.getArguments() );
+ queue.bind(exchange, binding.getRoutingKey(), binding.getArguments());
}
}
}
@@ -503,19 +496,25 @@
BindingTB binding = new BindingTB(_virtualHost);
BindingKey queueBinding =
- new BindingKey(exchange.getName(), new AMQShortString(""), new AMQShortString(""), null);
+ new BindingKey(exchange.getName(), null, null, null);
EntryBinding keyBinding = new BindingTB(_virtualHost);
keyBinding.objectToEntry(queueBinding, key);
OperationStatus opStatus = cursor.getSearchKeyRange(key, value, LockMode.RMW);
- while ((opStatus == OperationStatus.SUCCESS)
- && ((queueBinding = (BindingKey) binding.entryToObject(key)).getExchangeName().equals(
- exchange.getName())))
+ while (opStatus == OperationStatus.SUCCESS)
{
- queueBindings.add(queueBinding);
- opStatus = cursor.getNext(key, value, LockMode.RMW);
+ queueBinding = (BindingKey) binding.entryToObject(key);
+ if (queueBinding.getExchangeName().equals(exchange.getName()))
+ {
+ queueBindings.add(queueBinding);
+ opStatus = cursor.getNext(key, value, LockMode.RMW);
+ }
+ else
+ {
+ break;
+ }
}
return queueBindings;
@@ -592,7 +591,7 @@
catch (DatabaseException e)
{
throw new AMQException("Error writing binding for AMQQueue with name " + queue.getName() + " to exchange "
- + exchange.getName() + " to database: " + e, e);
+ + exchange.getName() + " to database: " + e, e);
}
}
}
@@ -608,7 +607,7 @@
* @throws AMQException If the operation fails for any reason.
*/
public void unbindQueue(Exchange exchange, AMQShortString routingKey, AMQQueue queue, FieldTable args)
- throws AMQException
+ throws AMQException
{
DatabaseEntry key = new DatabaseEntry();
EntryBinding keyBinding = new BindingTB(_virtualHost);
@@ -620,37 +619,38 @@
if (status == OperationStatus.NOTFOUND)
{
throw new AMQException("Queue binding for queue with name " + queue.getName() + " to exchange "
- + exchange.getName() + " not found");
+ + exchange.getName() + " not found");
}
}
catch (DatabaseException e)
{
throw new AMQException("Error deleting queue binding for queue with name " + queue.getName() + " to exchange "
- + exchange.getName() + " from database: " + e, e);
+ + exchange.getName() + " from database: " + e, e);
}
}
/**
* Makes the specified queue persistent.
*
- * @param queue The queue to store.
+ * @param queue The queue to store.
+ * @param arguments
*
* @throws AMQException If the operation fails for any reason.
*/
- public void createQueue(AMQQueue queue) throws AMQException
+ public void createQueue(AMQQueue queue, FieldTable arguments) throws AMQException
{
- _log.debug("public void createQueue(AMQQueue queue = " + queue + "): called");
+ _log.debug("public void createQueue(AMQQueue queue(" + queue.getName() + ") = " + queue + "): called");
if (_state != State.RECOVERING)
{
long queueId = _queueId.getAndIncrement();
- _queueNameToIdMap.put(queue.getName(),queueId);
-
+ _queueNameToIdMap.put(queue.getName(), queueId);
+
DatabaseEntry key = new DatabaseEntry();
EntryBinding keyBinding = new AMQShortStringTB();
keyBinding.objectToEntry(queue.getName(), key);
DatabaseEntry value = new DatabaseEntry();
- TupleBinding queueBinding = new QueueTB(_virtualHost);
+ TupleBinding queueBinding = new QueueTB(_virtualHost, arguments);
queueBinding.objectToEntry(queue, value);
try
{
@@ -667,6 +667,7 @@
* Removes the specified queue from the persistent store.
*
* @param queue The queue to remove.
+ *
* @throws AMQException If the operation fails for any reason.
*/
public void removeQueue(final AMQQueue queue) throws AMQException
@@ -712,7 +713,7 @@
try
{
_queueDb.get(null, key, value, LockMode.RMW);
- QueueTB binding = new QueueTB(_virtualHost);
+ QueueTB binding = new QueueTB(_virtualHost, null);
return (AMQQueue) binding.entryToObject(value);
}
@@ -757,7 +758,7 @@
{
_log.error("Failed to enqueue: " + e, e);
throw new AMQException("Error writing enqueued message with id " + messageId + " for queue " + name
- + " to database", e);
+ + " to database", e);
}
}
@@ -789,7 +790,8 @@
* @param context The transactional context for the operation.
* @param queue The name queue to take the message from.
* @param messageId The message to dequeue.
- * @throws AMQException If the operation fails for any reason, or if the specified message does not exist.
+ *
+ * @throws AMQException If the operation fails for any reason, or if the specified message does not exist.
*/
public void dequeueMessage(StoreContext context, final AMQQueue queue, Long messageId) throws AMQException
{
@@ -874,7 +876,7 @@
if (context.getPayload() != null)
{
throw new AMQException("Fatal internal error: transactional context is not empty at beginTran: "
- + context.getPayload());
+ + context.getPayload());
}
else
{
@@ -1076,7 +1078,7 @@
* @throws AMQException If the operation fails for any reason, or if the specified message does not exist.
*/
public void storeContentBodyChunk(StoreContext context, Long messageId, int index, ContentChunk contentBody,
- boolean lastContentBody) throws AMQException
+ boolean lastContentBody) throws AMQException
{
Transaction tx = (Transaction) context.getPayload();
@@ -1092,7 +1094,7 @@
if (status != OperationStatus.SUCCESS)
{
throw new AMQException("Error adding content chunk " + index + " for message id " + messageId + ": "
- + status);
+ + status);
}
if (_log.isDebugEnabled())
@@ -1116,12 +1118,12 @@
* @throws AMQException If the operation fails for any reason, or if the specified message does not exist.
*/
public void storeMessageMetaData(StoreContext context, Long messageId, MessageMetaData messageMetaData)
- throws AMQException
+ throws AMQException
{
if (_log.isDebugEnabled())
{
_log.debug("public void storeMessageMetaData(StoreContext context = " + context + ", Long messageId = "
- + messageId + ", MessageMetaData messageMetaData = " + messageMetaData + "): called");
+ + messageId + ", MessageMetaData messageMetaData = " + messageMetaData + "): called");
}
//This call breaking tests - not sure where the txn it creates should be committed ??
//getOrCreateTransaction(context);
@@ -1161,7 +1163,7 @@
if (_log.isDebugEnabled())
{
_log.debug("public MessageMetaData getMessageMetaData(StoreContext context = " + context + ", Long messageId = "
- + messageId + "): called");
+ + messageId + "): called");
}
DatabaseEntry key = new DatabaseEntry();
@@ -1233,6 +1235,11 @@
}
}
+ public boolean isPersistent()
+ {
+ return true;
+ }
+
Map<AMQShortString, AMQQueue> loadQueues() throws DatabaseException, AMQException
{
Cursor cursor = null;
@@ -1242,14 +1249,14 @@
cursor = _queueDb.openCursor(null, null);
DatabaseEntry key = new DatabaseEntry();
DatabaseEntry value = new DatabaseEntry();
- QueueTB binding = new QueueTB(_virtualHost);
+ QueueTB binding = new QueueTB(_virtualHost, null);
while (cursor.getNext(key, value, LockMode.RMW) == OperationStatus.SUCCESS)
{
AMQQueue queue = (AMQQueue) binding.entryToObject(value);
_virtualHost.getQueueRegistry().registerQueue(queue);
queues.put(queue.getName(), queue);
_log.info("Recovering queue " + queue.getName() + " with owner:"
- + ((queue.getOwner() == null) ? " <<null>> " : (" \"" + queue.getOwner() + "\" ")));
+ + ((queue.getOwner() == null) ? " <<null>> " : (" \"" + queue.getOwner() + "\" ")));
}
return queues;
@@ -1284,9 +1291,9 @@
}
private void deliverMessages(final StoreContext context, Map<AMQShortString, AMQQueue> queues)
- throws DatabaseException, AMQException
+ throws DatabaseException, AMQException
{
- Map<Long, AMQMessage> msgMap = new HashMap<Long,AMQMessage>();
+ Map<Long, AMQMessage> msgMap = new HashMap<Long, AMQMessage>();
List<ProcessAction> actions = new ArrayList<ProcessAction>();
Map<AMQShortString, Integer> queueRecoveries = new TreeMap<AMQShortString, Integer>();
@@ -1316,7 +1323,7 @@
AMQQueue queue = queues.get(queueName);
if (queue == null)
{
- queue = AMQQueueFactory.createAMQQueueImpl(queueName, false, null, false, _virtualHost, null);
+ queue = AMQQueueFactory.createAMQQueueImpl(queueName, false, null, false, _virtualHost, null);
_virtualHost.getQueueRegistry().registerQueue(queue);
queues.put(queueName, queue);
}
@@ -1325,19 +1332,19 @@
maxId = Math.max(maxId, messageId);
AMQMessage message = msgMap.get(messageId);
- if(message != null)
+ if (message != null)
{
message.incrementReference();
}
else
{
message = new AMQMessage(messageId, this, messageHandleFactory, txnContext);
- msgMap.put(messageId,message);
+ msgMap.put(messageId, message);
}
if (_log.isDebugEnabled())
{
- _log.debug("On recovery, delivering " + message.getMessageId() + " to " + queue.getName());
+ _log.debug("On recovery, delivering Message ID:" + message.getMessageId() + " to " + queue.getName());
}
if (_log.isInfoEnabled())
@@ -1356,7 +1363,7 @@
}
- for(ProcessAction action : actions)
+ for (ProcessAction action : actions)
{
action.process();
}
@@ -1560,15 +1567,15 @@
{
// _environment.checkpoint(_config);
_environment.sync();
-
+
for (Commit commit : jobs)
{
commit.complete();
}
- if(_jobQueue.get().isEmpty())
+ if (_jobQueue.get().isEmpty())
{
_hasJobs.set(false);
- if(!_jobQueue.get().isEmpty())
+ if (!_jobQueue.get().isEmpty())
{
_hasJobs.set(true);
}
@@ -1593,9 +1600,9 @@
public void addJob(Commit commit)
{
_jobQueue.get().add(commit);
- if(_hasJobs.compareAndSet(false, true))
+ if (_hasJobs.compareAndSet(false, true))
{
- synchronized(_lock)
+ synchronized (_lock)
{
_lock.notifyAll();
}
@@ -1605,7 +1612,7 @@
public void close()
{
_stopped.set(true);
- synchronized(_lock)
+ synchronized (_lock)
{
_lock.notifyAll();
}
Modified: store/branches/java/broker-queue-refactor/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BindingKey.java
===================================================================
--- store/branches/java/broker-queue-refactor/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BindingKey.java 2008-08-06 13:39:16 UTC (rev 2259)
+++ store/branches/java/broker-queue-refactor/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BindingKey.java 2008-08-07 13:34:21 UTC (rev 2260)
@@ -1,3 +1,23 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
package org.apache.qpid.server.store.berkeleydb;
import org.apache.qpid.framing.AMQShortString;
@@ -3,11 +23,4 @@
import org.apache.qpid.framing.FieldTable;
-/**
- * Created by IntelliJ IDEA.
- * User: U146758
- * Date: 19-Feb-2007
- * Time: 14:11:01
- * To change this template use File | Settings | File Templates.
- */
public class BindingKey extends Object
{
Modified: store/branches/java/broker-queue-refactor/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BindingTB.java
===================================================================
--- store/branches/java/broker-queue-refactor/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BindingTB.java 2008-08-06 13:39:16 UTC (rev 2259)
+++ store/branches/java/broker-queue-refactor/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BindingTB.java 2008-08-07 13:34:21 UTC (rev 2260)
@@ -14,8 +14,6 @@
{
private static final Logger _log = Logger.getLogger(BindingTB.class);
-
-
private final VirtualHost _virtualHost;
public BindingTB(VirtualHost virtualHost)
@@ -32,9 +30,7 @@
AMQShortString routingKey = AMQShortStringEncoding.readShortString(tupleInput);
FieldTable arguments = FieldTableEncoding.readFieldTable(tupleInput);
-
-
- return new BindingKey(exchangeName,queueName,routingKey,arguments);
+ return new BindingKey(exchangeName, queueName, routingKey, arguments);
}
catch (DatabaseException e)
{
@@ -47,11 +43,17 @@
{
BindingKey binding = (BindingKey) object;
+ AMQShortStringEncoding.writeShortString(binding.getExchangeName(), tupleOutput);
+ AMQShortStringEncoding.writeShortString(binding.getQueueName(), tupleOutput);
+ AMQShortStringEncoding.writeShortString(binding.getRoutingKey(), tupleOutput);
+ FieldTableEncoding.writeFieldTable(binding.getArguments(), tupleOutput);
- AMQShortStringEncoding.writeShortString(binding.getExchangeName(),tupleOutput);
- AMQShortStringEncoding.writeShortString(binding.getQueueName(),tupleOutput);
- AMQShortStringEncoding.writeShortString(binding.getRoutingKey(),tupleOutput);
- FieldTableEncoding.writeFieldTable(binding.getArguments(),tupleOutput);
+ binding = (BindingKey) entryToObject(new TupleInput(tupleOutput.getBufferBytes()));
+ System.err.println(binding.getExchangeName());
+ System.err.println(binding.getQueueName());
+ System.err.println(binding.getRoutingKey());
+ System.err.println(binding.getArguments());
+
}
}
Modified: store/branches/java/broker-queue-refactor/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/FieldTableEncoding.java
===================================================================
--- store/branches/java/broker-queue-refactor/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/FieldTableEncoding.java 2008-08-06 13:39:16 UTC (rev 2259)
+++ store/branches/java/broker-queue-refactor/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/FieldTableEncoding.java 2008-08-07 13:34:21 UTC (rev 2260)
@@ -14,22 +14,21 @@
{
public static FieldTable readFieldTable(TupleInput tupleInput) throws DatabaseException
{
- int length = tupleInput.readInt();
- if (length == 0)
+ long length = tupleInput.readLong();
+ if (length <= 0)
{
return null;
}
else
{
- byte[] data = new byte[length];
+ byte[] data = new byte[(int)length];
tupleInput.readFast(data);
ByteBuffer buffer = ByteBuffer.wrap(data);
try
{
- FieldTable ft = new FieldTable(buffer,(long)length);
- return ft;
+ return new FieldTable(buffer,length);
}
catch (AMQFrameDecodingException e)
{
@@ -45,11 +44,11 @@
if (fieldTable == null)
{
- tupleOutput.writeInt(0);
+ tupleOutput.writeLong(0);
}
else
{
- tupleOutput.writeFast((int)fieldTable.getEncodedSize());
+ tupleOutput.writeLong(fieldTable.getEncodedSize());
tupleOutput.writeFast(fieldTable.getDataAsBytes());
}
}
Modified: store/branches/java/broker-queue-refactor/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/QueueTB.java
===================================================================
--- store/branches/java/broker-queue-refactor/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/QueueTB.java 2008-08-06 13:39:16 UTC (rev 2259)
+++ store/branches/java/broker-queue-refactor/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/QueueTB.java 2008-08-07 13:34:21 UTC (rev 2260)
@@ -20,39 +20,49 @@
import com.sleepycat.bind.tuple.TupleBinding;
import com.sleepycat.bind.tuple.TupleInput;
import com.sleepycat.bind.tuple.TupleOutput;
+import com.sleepycat.je.DatabaseException;
import org.apache.qpid.server.queue.AMQQueue;
import org.apache.qpid.server.queue.AMQQueueFactory;
import org.apache.qpid.server.virtualhost.VirtualHost;
import org.apache.qpid.AMQException;
import org.apache.qpid.framing.AMQShortString;
+import org.apache.qpid.framing.FieldTable;
import org.apache.log4j.Logger;
public class QueueTB extends TupleBinding
{
private static final Logger _log = Logger.getLogger(QueueTB.class);
-
-
private final VirtualHost _virtualHost;
+ private final FieldTable _arguments;
- public QueueTB(VirtualHost virtualHost)
+ public QueueTB(VirtualHost virtualHost, FieldTable arguments)
{
_virtualHost = virtualHost;
+ _arguments = arguments;
}
public Object entryToObject(TupleInput tupleInput)
{
- AMQShortString name = AMQShortStringEncoding.readShortString(tupleInput);
- AMQShortString owner = AMQShortStringEncoding.readShortString(tupleInput);
-
-
try
{
- return AMQQueueFactory.createAMQQueueImpl(name, true, owner, false, _virtualHost, null);
+ AMQShortString name = AMQShortStringEncoding.readShortString(tupleInput);
+ AMQShortString owner = AMQShortStringEncoding.readShortString(tupleInput);
+ FieldTable arguments = FieldTableEncoding.readFieldTable(tupleInput);
+
+ try
+ {
+ return AMQQueueFactory.createAMQQueueImpl(name, true, owner, false, _virtualHost, arguments);
+ }
+ catch (AMQException e)
+ {
+ _log.error("Unable to create queue: " + e, e);
+ return null;
+ }
}
- catch (AMQException e)
+ catch (DatabaseException e)
{
- _log.error("Unable to create queue: " + e, e);
+ _log.error("Unable to create binding: " + e, e);
return null;
}
}
@@ -61,9 +71,9 @@
{
AMQQueue queue = (AMQQueue) object;
+ AMQShortStringEncoding.writeShortString(queue.getName(), tupleOutput);
+ AMQShortStringEncoding.writeShortString(queue.getOwner(), tupleOutput);
+ FieldTableEncoding.writeFieldTable(_arguments, tupleOutput);
- AMQShortStringEncoding.writeShortString(queue.getName(),tupleOutput);
- AMQShortStringEncoding.writeShortString(queue.getOwner(),tupleOutput);
-
}
}
Modified: store/branches/java/broker-queue-refactor/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBStoreTest.java
===================================================================
--- store/branches/java/broker-queue-refactor/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBStoreTest.java 2008-08-06 13:39:16 UTC (rev 2259)
+++ store/branches/java/broker-queue-refactor/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBStoreTest.java 2008-08-07 13:34:21 UTC (rev 2260)
@@ -24,15 +24,20 @@
import org.apache.log4j.Logger;
import org.apache.mina.common.ByteBuffer;
import org.apache.qpid.AMQException;
+import org.apache.qpid.common.AMQPFilterTypes;
import org.apache.qpid.framing.*;
import org.apache.qpid.framing.abstraction.MessagePublishInfo;
import org.apache.qpid.framing.abstraction.ContentChunk;
import org.apache.qpid.server.RequiredDeliveryException;
+import org.apache.qpid.server.exchange.Exchange;
+import org.apache.qpid.server.exchange.DefaultExchangeFactory;
+import org.apache.qpid.server.exchange.DirectExchange;
import org.apache.qpid.server.virtualhost.VirtualHost;
import org.apache.qpid.server.store.StoreContext;
import org.apache.qpid.server.queue.AMQQueue;
import org.apache.qpid.server.queue.MessageMetaData;
import org.apache.qpid.server.queue.AMQQueueFactory;
+import org.apache.qpid.server.queue.AMQPriorityQueue;
import org.apache.qpid.server.registry.ApplicationRegistry;
import org.apache.qpid.server.txn.NonTransactionalContext;
import org.apache.qpid.server.txn.TransactionalContext;
@@ -59,25 +64,27 @@
private static final AMQShortString RK = new AMQShortString("rk");
private static final AMQShortString QUEUE2 = new AMQShortString("queue2");
private static final AMQShortString HIM = new AMQShortString("him");
+ private static final AMQShortString EXCHANGE1 = new AMQShortString("exchange1");
+ private static volatile int _loops;
+ private String TEST_LOCATION = "bdbTestEnv";
+ File BDB_DIR = new File(TEST_LOCATION);
+
+
public void setUp() throws Exception
{
+ if (BDB_DIR.exists())
+ {
+ deleteDirectory(BDB_DIR);
+ }
+
ApplicationRegistry.initialise(new NullApplicationRegistry());
- File bdbDir = new File("bdbTestEnv");
- if (bdbDir.exists())
- {
- File[] entries = bdbDir.listFiles();
- for (File f : entries)
- {
- f.delete();
- }
- bdbDir.delete();
- }
- bdbDir.mkdirs();
+ BDB_DIR.mkdirs();
+
_store = new BDBMessageStore();
- _store.createEnvironment(bdbDir);
+ _store.createEnvironment(BDB_DIR);
_store.openDatabases();
_virtualHost = new VirtualHost("test", _store);
_store.setVirtualHost(_virtualHost);
@@ -86,22 +93,102 @@
_txnContext = new NonTransactionalContext(_store, _storeContext, null, new LinkedList<RequiredDeliveryException>());
}
+ private void deleteDirectory(File path) throws InterruptedException
+ {
+ if (path.isDirectory())
+ {
+ for (File file : path.listFiles())
+ {
+ deleteDirectory(file);
+ }
+ }
+ else
+ {
+ path.delete();
+ }
+ }
+
+ private void reload() throws Exception
+ {
+ _virtualHost.close();
+
+ PropertiesConfiguration env = new PropertiesConfiguration();
+
+ env.addProperty("store.environment-path", "bdbTestEnv");
+ env.addProperty("store.class", "org.apache.qpid.server.store.berkeleydb.BDBMessageStore");
+
+ _virtualHost = new VirtualHost("test", env);
+ _store = (BDBMessageStore)_virtualHost.getMessageStore();
+ }
+
public void tearDown() throws Exception
{
- _store.close();
+ _virtualHost.close();
+
+ ApplicationRegistry.removeAll();
}
- public void testQueuePersistence() throws DatabaseException, AMQException
+ public void testExchangePersistence() throws Exception
{
- AMQQueue queue = AMQQueueFactory.createAMQQueueImpl(QUEUE1, true, ME, false, _virtualHost, null);
- _store.createQueue(queue);
- AMQQueue returnedQueue = _store.getQueue(QUEUE1);
+ FieldTable queueArguments = new FieldTable();
+ Integer priorityLevel = 5;
+ queueArguments.put(AMQQueueFactory.X_QPID_PRIORITIES, priorityLevel);
- Assert.assertEquals(returnedQueue.getName(), QUEUE1);
- Assert.assertEquals(returnedQueue.getOwner(), ME);
- Assert.assertEquals(returnedQueue.isDurable(), true);
+ Exchange exchange = new DefaultExchangeFactory(_virtualHost).createExchange(EXCHANGE1, DirectExchange.TYPE.getName(), true, false, 0);
+
+ assertNotNull("Exchange is null", exchange);
+ assertEquals("Exchange Name incorrect", EXCHANGE1, exchange.getName());
+ assertTrue("Exchange is not durable", exchange.isDurable());
+
+ _virtualHost.getExchangeRegistry().registerExchange(exchange);
+
+ //Ensure it is registered correctly
+ exchange = _virtualHost.getExchangeRegistry().getExchange(EXCHANGE1);
+ assertNotNull("Exchange is null", exchange);
+
+ reload();
+
+ exchange = _virtualHost.getExchangeRegistry().getExchange(EXCHANGE1);
+
+ assertNotNull("Exchange is null", exchange);
+ assertEquals("Exchange Name incorrect", EXCHANGE1, exchange.getName());
+ assertTrue("Exchange is not durable", exchange.isDurable());
+
}
+ public void testQueuePersistence() throws Exception
+ {
+
+ FieldTable queueArguments = new FieldTable();
+ Integer priorityLevel = 5;
+ queueArguments.put(AMQQueueFactory.X_QPID_PRIORITIES, priorityLevel);
+
+ AMQQueue queue = AMQQueueFactory.createAMQQueueImpl(QUEUE1, true, ME, false, _virtualHost, queueArguments);
+
+ _store.createQueue(queue, queueArguments);
+
+ AMQShortString routingKey = new AMQShortString("Test-Key");
+ FieldTable bindArguments = new FieldTable();
+ bindArguments.put(AMQPFilterTypes.JMS_SELECTOR.getValue(), "Test = 'MST'");
+
+ _store.bindQueue(_virtualHost.getExchangeRegistry().getDefaultExchange(), routingKey, queue, bindArguments);
+
+ reload();
+
+ AMQQueue returnedQueue = _virtualHost.getQueueRegistry().getQueue(QUEUE1);
+
+ assertEquals("Queue Name has changed", QUEUE1, returnedQueue.getName());
+ assertEquals("Queue Owner has changed", ME, returnedQueue.getOwner());
+ assertTrue("Returned Queue is not Durable", returnedQueue.isDurable());
+ assertEquals("Returned Queue is not A Priority Queue", AMQPriorityQueue.class, returnedQueue.getClass());
+ assertEquals("Returned Queue does not have the right number of priorities", priorityLevel.intValue(),
+ ((AMQPriorityQueue) returnedQueue).getPriorities());
+ assertNotNull("Queue has no exchange binding arguments.", returnedQueue.getExchangeBindings());
+ assertEquals("Incorrect binding count for queue.", 1, returnedQueue.getExchangeBindings().size());
+ assertTrue("Binding does not contain a Selector argument.",
+ returnedQueue.getExchangeBindings().get(0).getArguments().containsKey(AMQPFilterTypes.JMS_SELECTOR.getValue()));
+ }
+
private MessagePublishInfo createPublishBody()
{
@@ -191,25 +278,25 @@
MessageMetaData mmd = _store.getMessageMetaData(_storeContext, 14L);
MessagePublishInfo returnedPubBody = mmd.getMessagePublishInfo();
- Assert.assertEquals(pubBody.getExchange(), returnedPubBody.getExchange());
- Assert.assertEquals(pubBody.isImmediate(), returnedPubBody.isImmediate());
- Assert.assertEquals(pubBody.isMandatory(), returnedPubBody.isMandatory());
- Assert.assertEquals(pubBody.getRoutingKey(), returnedPubBody.getRoutingKey());
+ Assert.assertEquals("Message exchange has changed", pubBody.getExchange(), returnedPubBody.getExchange());
+ Assert.assertEquals("Immediate flag has changed", pubBody.isImmediate(), returnedPubBody.isImmediate());
+ Assert.assertEquals("Mandatory flag has changed", pubBody.isMandatory(), returnedPubBody.isMandatory());
+ Assert.assertEquals("Routing key has changed", pubBody.getRoutingKey(), returnedPubBody.getRoutingKey());
ContentHeaderBody returnedHeaderBody = mmd.getContentHeaderBody();
- Assert.assertEquals(chb.classId, returnedHeaderBody.classId);
- Assert.assertEquals(chb.weight, returnedHeaderBody.weight);
- Assert.assertEquals(chb.bodySize, returnedHeaderBody.bodySize);
+ Assert.assertEquals("ContentHeader ClassID has changed", chb.classId, returnedHeaderBody.classId);
+ Assert.assertEquals("ContentHeader weight has changed", chb.weight, returnedHeaderBody.weight);
+ Assert.assertEquals("ContentHeader bodySize has changed", chb.bodySize, returnedHeaderBody.bodySize);
BasicContentHeaderProperties returnedProperties = (BasicContentHeaderProperties) returnedHeaderBody.properties;
- Assert.assertEquals(props.getContentTypeAsString(), returnedProperties.getContentTypeAsString());
- Assert.assertEquals(props.getMessageIdAsString(), returnedProperties.getMessageIdAsString());
- Assert.assertEquals(mmd.getContentChunkCount(), 1);
+ Assert.assertEquals("Property ContentType has changed", props.getContentTypeAsString(), returnedProperties.getContentTypeAsString());
+ Assert.assertEquals("Property MessageID has changed", props.getMessageIdAsString(), returnedProperties.getMessageIdAsString());
+ Assert.assertEquals("MessageMD ChunkCount has changed", mmd.getContentChunkCount(), 1);
ContentChunk returnedContentBody = _store.getContentBodyChunk(_storeContext, 14L, 0);
ByteBuffer returnedPayloadAsBytes = returnedContentBody.getData();
byte[] returnedPayload = new byte[returnedPayloadAsBytes.remaining()];
returnedPayloadAsBytes.get(returnedPayload);
String returnedPayloadString = new String(returnedPayload);
- Assert.assertEquals(bodyText, returnedPayloadString);
+ Assert.assertEquals("Message Payload has changed", bodyText, returnedPayloadString);
}
public void testMessageCreateAndDelete() throws Exception
@@ -245,6 +332,7 @@
{
// pass since exception expected
}
+
}
public void testTranCommit() throws Exception
@@ -259,9 +347,8 @@
_store.storeMessageMetaData(_storeContext, 21L, new MessageMetaData(pubBody, chb, 0));
_store.storeMessageMetaData(_storeContext, 22L, new MessageMetaData(pubBody, chb, 0));
-
AMQQueue queue = AMQQueueFactory.createAMQQueueImpl(QUEUE1, true, ME, false, _virtualHost, null);
- _store.createQueue(queue);
+ _store.createQueue(queue, null);
_store.beginTran(_storeContext);
_store.enqueueMessage(_storeContext, queue, 20L);
@@ -269,15 +356,19 @@
_store.commitTran(_storeContext);
List<Long> enqueuedIds = _store.getEnqueuedMessages(QUEUE1);
- Assert.assertEquals(enqueuedIds.size(), 2);
+ Assert.assertEquals("Enqueued messages have changed", 2, enqueuedIds.size());
Long val = enqueuedIds.get(0);
- Assert.assertEquals(val.longValue(), 20L);
+ Assert.assertEquals("First Message is incorrect", 20L, val.longValue());
val = enqueuedIds.get(1);
- Assert.assertEquals(val.longValue(), 21L);
+ Assert.assertEquals("Second Message is incorrect", 21L, val.longValue());
+
}
public void testTranRollback1() throws Exception
{
+ List<Long> enqueuedIds = _store.getEnqueuedMessages(QUEUE1);
+ assertTrue("Last Test Messages are still present", enqueuedIds.isEmpty());
+
MessagePublishInfo pubBody = createPublishBody();
BasicContentHeaderProperties props = createContentHeaderProperties();
String bodyText = "dsjfhdsjkfhdsjflhsdjfdshfjdlhfjhdljfdhsljkfsh";
@@ -290,9 +381,8 @@
_store.storeMessageMetaData(_storeContext, 32L, new MessageMetaData(pubBody, chb, 0));
AMQQueue queue = AMQQueueFactory.createAMQQueueImpl(QUEUE1, true, ME, false, _virtualHost, null);
- _store.createQueue(queue);
+ _store.createQueue(queue, null);
-
_store.beginTran(_storeContext);
_store.enqueueMessage(_storeContext, queue, 30L);
_store.enqueueMessage(_storeContext, queue, 31L);
@@ -305,16 +395,22 @@
_store.beginTran(_storeContext);
_store.commitTran(_storeContext);
- List<Long> enqueuedIds = _store.getEnqueuedMessages(QUEUE1);
- Assert.assertEquals(enqueuedIds.size(), 2);
+ enqueuedIds = _store.getEnqueuedMessages(QUEUE1);
+ assertTrue("Last Test Message is still present", !enqueuedIds.contains(20L));
+ assertEquals("Incorrect Enqueued Message Count:", 2, enqueuedIds.size());
Long val = enqueuedIds.get(0);
- Assert.assertEquals(val.longValue(), 30L);
+ assertEquals("First Message is incorrect", 30L, val.longValue());
val = enqueuedIds.get(1);
- Assert.assertEquals(val.longValue(), 31L);
+ assertEquals("Second Message is incorrect", 31L, val.longValue());
+
}
+
public void testTranRollback2() throws Exception
{
+ List<Long> enqueuedIds = _store.getEnqueuedMessages(QUEUE1);
+ assertTrue("Last Test Messages are still present", enqueuedIds.isEmpty());
+
MessagePublishInfo pubBody = createPublishBody();
BasicContentHeaderProperties props = createContentHeaderProperties();
String bodyText = "dsjfhdsjkfhdsjflhsdjfdshfjdlhfjhdljfdhsljkfsh";
@@ -326,9 +422,8 @@
_store.storeMessageMetaData(_storeContext, 31L, new MessageMetaData(pubBody, chb, 0));
_store.storeMessageMetaData(_storeContext, 32L, new MessageMetaData(pubBody, chb, 0));
-
AMQQueue queue = AMQQueueFactory.createAMQQueueImpl(QUEUE1, true, ME, false, _virtualHost, null);
- _store.createQueue(queue);
+ _store.createQueue(queue, null);
_store.beginTran(_storeContext);
_store.enqueueMessage(_storeContext, queue, 30L);
@@ -339,16 +434,19 @@
_store.enqueueMessage(_storeContext, queue, 32L);
_store.commitTran(_storeContext);
- List<Long> enqueuedIds = _store.getEnqueuedMessages(QUEUE1);
- Assert.assertEquals(enqueuedIds.size(), 2);
+ enqueuedIds = _store.getEnqueuedMessages(QUEUE1);
+ Assert.assertEquals("Incorrect Enqueued Message Count", 2, enqueuedIds.size());
Long val = enqueuedIds.get(0);
- Assert.assertEquals(val.longValue(), 31L);
+ Assert.assertEquals("First Message is incorrect", 31L, val.longValue());
val = enqueuedIds.get(1);
- Assert.assertEquals(val.longValue(), 32L);
+ Assert.assertEquals("Second Message is incorrect", 32L, val.longValue());
}
public void testRecovery() throws Exception
{
+ List<Long> enqueuedIds = _store.getEnqueuedMessages(QUEUE1);
+ assertTrue("Last Test Messages are still present", enqueuedIds.isEmpty());
+
MessagePublishInfo pubBody = createPublishBody();
BasicContentHeaderProperties props = createContentHeaderProperties();
String bodyText = "dsjfhdsjkfhdsjflhsdjfdshfjdlhfjhdljfdhsljkfsh";
@@ -360,12 +458,11 @@
_store.storeMessageMetaData(_storeContext, 41L, new MessageMetaData(pubBody, chb, 0));
_store.storeMessageMetaData(_storeContext, 42L, new MessageMetaData(pubBody, chb, 0));
-
AMQQueue queue = AMQQueueFactory.createAMQQueueImpl(QUEUE1, true, ME, false, _virtualHost, null);
AMQQueue queue2 = AMQQueueFactory.createAMQQueueImpl(QUEUE2, true, HIM, false, _virtualHost, null);
- _store.createQueue(queue);
- _store.createQueue(queue2);
+ _store.createQueue(queue, null);
+ _store.createQueue(queue2, null);
_store.beginTran(_storeContext);
_store.enqueueMessage(_storeContext, queue, 40L);
@@ -375,29 +472,17 @@
_store.enqueueMessage(_storeContext, queue, 42L);
- _virtualHost.getQueueRegistry().unregisterQueue(queue.getName());
- _virtualHost.getQueueRegistry().unregisterQueue(queue2.getName());
+ reload();
- _store.close();
-
- _store = new BDBMessageStore();
-
- PropertiesConfiguration env = new PropertiesConfiguration();
-
- env.addProperty("store.environment-path", "bdbTestEnv");
- env.addProperty("store.class", "org.apache.qpid.server.store.berkeleydb.BDBMessageStore");
-
- _virtualHost = new VirtualHost("test", env);
-
try
{
AMQQueue q1 = _virtualHost.getQueueRegistry().getQueue(QUEUE1);
AMQQueue q2 = _virtualHost.getQueueRegistry().getQueue(QUEUE2);
- Assert.assertNotNull(q1);
- Assert.assertEquals(3, q1.getMessageCount());
- Assert.assertNotNull(q2);
- Assert.assertEquals(1, q2.getMessageCount());
+ Assert.assertNotNull("Queue1 is was not recovered", q1);
+ Assert.assertEquals("Queue1 has incorrect message count", 3, q1.getMessageCount());
+ Assert.assertNotNull("Queue2 is was not recovered", q2);
+ Assert.assertEquals("Queue2 has incorrect message count", 1, q2.getMessageCount());
}
catch (Exception e)
{
@@ -405,7 +490,6 @@
fail(e.getMessage());
}
-
}
public void testDequeue() throws AMQException
@@ -420,7 +504,7 @@
_store.storeMessageMetaData(_storeContext, 50L, new MessageMetaData(pubBody, chb, 0));
AMQQueue queue = AMQQueueFactory.createAMQQueueImpl(QUEUE1, true, ME, false, _virtualHost, null);
- _store.createQueue(queue);
+ _store.createQueue(queue, null);
_store.enqueueMessage(_storeContext, queue, 50L);
_store.dequeueMessage(_storeContext, queue, 50L);
@@ -429,7 +513,7 @@
public void testQueueRemove() throws AMQException
{
AMQQueue queue = AMQQueueFactory.createAMQQueueImpl(QUEUE1, true, ME, false, _virtualHost, null);
- _store.createQueue(queue);
+ _store.createQueue(queue, null);
_store.removeQueue(queue);
try
{
17 years, 8 months
rhmessaging commits: r2259 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-08-06 09:39:16 -0400 (Wed, 06 Aug 2008)
New Revision: 2259
Modified:
mgmt/trunk/cumin/python/cumin/binding.py
mgmt/trunk/cumin/python/cumin/exchange.py
Log:
Force built in exchanges to show up in exchange lists, even if they are currently inactive.
Modified: mgmt/trunk/cumin/python/cumin/binding.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/binding.py 2008-08-05 22:55:40 UTC (rev 2258)
+++ mgmt/trunk/cumin/python/cumin/binding.py 2008-08-06 13:39:16 UTC (rev 2259)
@@ -1,9 +1,10 @@
+from cumin.exchange import ExchangeInfo
from cumin.util import sorted_by, is_active
from formats import fmt_shorten
+from wooly import Template, Writer, Attribute
from wooly.forms import FormInput, FormField
+from wooly.parameters import DictParameter
from wooly.resources import StringCatalog
-from wooly import Template, Writer, Attribute
-from wooly.parameters import DictParameter
strings = StringCatalog(__file__)
@@ -246,7 +247,7 @@
# render each exchange we support
writer = Writer()
for exchange in sortedExchanges:
- if is_active(exchange):
+ if ExchangeInfo.is_builtin(exchange) or is_active(exchange):
# instance_key gives us a unique path for each exchange
# we will be rendering
instance_key = self.dict_param.get_instance_key(str(exchange.id))
Modified: mgmt/trunk/cumin/python/cumin/exchange.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/exchange.py 2008-08-05 22:55:40 UTC (rev 2258)
+++ mgmt/trunk/cumin/python/cumin/exchange.py 2008-08-06 13:39:16 UTC (rev 2259)
@@ -546,3 +546,11 @@
def render_item_name(self, session, producer):
return producer.name
+
+class ExchangeInfo(object):
+ def is_builtin(self, exchange):
+ return exchange.name in ["amq.direct", "amq.topic", "amq.match", "amq.fanout"]
+
+ is_builtin = classmethod(is_builtin)
+
+
\ No newline at end of file
17 years, 8 months
rhmessaging commits: r2258 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-08-05 18:55:40 -0400 (Tue, 05 Aug 2008)
New Revision: 2258
Modified:
mgmt/trunk/cumin/python/cumin/exchange.py
mgmt/trunk/cumin/python/cumin/exchange.strings
Log:
Allow add of headers exchange
Modified: mgmt/trunk/cumin/python/cumin/exchange.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/exchange.py 2008-08-05 22:55:19 UTC (rev 2257)
+++ mgmt/trunk/cumin/python/cumin/exchange.py 2008-08-05 22:55:40 UTC (rev 2258)
@@ -422,6 +422,11 @@
self.fanout.set_value("fanout")
self.add_child(self.fanout)
+ self.headers = RadioInput(app, "headers", self)
+ self.headers.set_parameter(self.type)
+ self.headers.set_value("headers")
+ self.add_child(self.headers)
+
self.xml = RadioInput(app, "xml", self)
self.xml.set_parameter(self.type)
self.xml.set_value("xml")
@@ -436,6 +441,9 @@
def render_fanout_id(self, session, *args):
return self.fanout.path
+ def render_headers_id(self, session, *args):
+ return self.headers.path
+
def render_xml_id(self, session, *args):
return self.xml.path
Modified: mgmt/trunk/cumin/python/cumin/exchange.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/exchange.strings 2008-08-05 22:55:19 UTC (rev 2257)
+++ mgmt/trunk/cumin/python/cumin/exchange.strings 2008-08-05 22:55:40 UTC (rev 2258)
@@ -103,6 +103,10 @@
<label for="{fanout_id}"><em>Fan Out:</em> Route message to all queues attached to this exchange</label>
</div>
<div class="field">
+ {headers}
+ <label for="{headers_id}"><em>Headers:</em> Route message to queues based on content of the message header</label>
+ </div>
+ <div class="field">
{xml}
<label for="{xml_id}"><em>XML:</em> Route message to queues based on XML content of the message</label>
</div>
17 years, 8 months