[jboss-cvs] JBoss Messaging SVN: r1431 - in trunk: src/main/org/jboss/jms/server/destination src/main/org/jboss/jms/server/endpoint tests/src/org/jboss/test/messaging/core/plugin/postoffice/cluster tests/src/org/jboss/test/messaging/jms
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Oct 4 14:04:52 EDT 2006
Author: timfox
Date: 2006-10-04 14:04:44 -0400 (Wed, 04 Oct 2006)
New Revision: 1431
Modified:
trunk/src/main/org/jboss/jms/server/destination/QueueService.java
trunk/src/main/org/jboss/jms/server/endpoint/ServerSessionEndpoint.java
trunk/tests/src/org/jboss/test/messaging/core/plugin/postoffice/cluster/DefaultClusteredPostOfficeTest.java
trunk/tests/src/org/jboss/test/messaging/jms/WireFormatTest.java
Log:
http://jira.jboss.com/jira/browse/JBMESSAGING-589, also update version number in wire format test
Modified: trunk/src/main/org/jboss/jms/server/destination/QueueService.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/destination/QueueService.java 2006-10-04 16:07:34 UTC (rev 1430)
+++ trunk/src/main/org/jboss/jms/server/destination/QueueService.java 2006-10-04 18:04:44 UTC (rev 1431)
@@ -120,7 +120,16 @@
executor, null, tr,
destination.getFullSize(), destination.getPageSize(), destination.getDownCacheSize());
- ((ClusteredPostOffice)postOffice).bindClusteredQueue(destination.getName(), (LocalClusteredQueue)queue);
+ ClusteredPostOffice cpo = (ClusteredPostOffice)postOffice;
+
+ if (destination.isClustered())
+ {
+ cpo.bindClusteredQueue(destination.getName(), (LocalClusteredQueue)queue);
+ }
+ else
+ {
+ cpo.bindQueue(destination.getName(), (LocalClusteredQueue)queue);
+ }
}
}
Modified: trunk/src/main/org/jboss/jms/server/endpoint/ServerSessionEndpoint.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/endpoint/ServerSessionEndpoint.java 2006-10-04 16:07:34 UTC (rev 1430)
+++ trunk/src/main/org/jboss/jms/server/endpoint/ServerSessionEndpoint.java 2006-10-04 18:04:44 UTC (rev 1431)
@@ -216,7 +216,17 @@
mDest.getFullSize(),
mDest.getPageSize(),
mDest.getDownCacheSize());
- binding = ((ClusteredPostOffice)topicPostOffice).bindClusteredQueue(jmsDestination.getName(), (LocalClusteredQueue)q);
+
+ ClusteredPostOffice cpo = (ClusteredPostOffice)topicPostOffice;
+
+ if (mDest.isClustered())
+ {
+ binding = cpo.bindClusteredQueue(jmsDestination.getName(), (LocalClusteredQueue)q);
+ }
+ else
+ {
+ binding = cpo.bindQueue(jmsDestination.getName(), q);
+ }
}
}
else
@@ -265,7 +275,17 @@
mDest.getFullSize(),
mDest.getPageSize(),
mDest.getDownCacheSize());
- binding = ((ClusteredPostOffice)topicPostOffice).bindClusteredQueue(jmsDestination.getName(), (LocalClusteredQueue)q);
+
+ ClusteredPostOffice cpo = (ClusteredPostOffice)topicPostOffice;
+
+ if (mDest.isClustered())
+ {
+ binding = cpo.bindClusteredQueue(jmsDestination.getName(), (LocalClusteredQueue)q);
+ }
+ else
+ {
+ binding = cpo.bindQueue(jmsDestination.getName(), q);
+ }
}
}
else
@@ -323,7 +343,17 @@
mDest.getFullSize(),
mDest.getPageSize(),
mDest.getDownCacheSize());
- binding = ((ClusteredPostOffice)topicPostOffice).bindClusteredQueue(jmsDestination.getName(), (LocalClusteredQueue)q);
+
+ ClusteredPostOffice cpo = (ClusteredPostOffice)topicPostOffice;
+
+ if (mDest.isClustered())
+ {
+ binding = cpo.bindClusteredQueue(jmsDestination.getName(), (LocalClusteredQueue)q);
+ }
+ else
+ {
+ binding = cpo.bindQueue(jmsDestination.getName(), (LocalClusteredQueue)q);
+ }
}
}
}
Modified: trunk/tests/src/org/jboss/test/messaging/core/plugin/postoffice/cluster/DefaultClusteredPostOfficeTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/core/plugin/postoffice/cluster/DefaultClusteredPostOfficeTest.java 2006-10-04 16:07:34 UTC (rev 1430)
+++ trunk/tests/src/org/jboss/test/messaging/core/plugin/postoffice/cluster/DefaultClusteredPostOfficeTest.java 2006-10-04 18:04:44 UTC (rev 1431)
@@ -481,7 +481,17 @@
this.routeComplexTopic(false);
}
+ public void testRouteLocalQueuesPersistent() throws Throwable
+ {
+ this.routeLocalQueues(true);
+ }
+ public void testRouteLocalQueuesNonPersistent() throws Throwable
+ {
+ this.routeLocalQueues(false);
+ }
+
+
/*
* We should allow the clustered bind of queues with the same queue name on different nodes of the
* cluster
@@ -1031,7 +1041,92 @@
}
+ /*
+ * Clustered post offices should be able to have local queues bound to them too.
+ */
+ protected void routeLocalQueues(boolean persistentMessage) throws Throwable
+ {
+ ClusteredPostOffice office1 = null;
+
+ ClusteredPostOffice office2 = null;
+
+ ClusteredPostOffice office3 = null;
+
+ try
+ {
+ office1 = createClusteredPostOffice(1, "testgroup");
+ office2 = createClusteredPostOffice(2, "testgroup");
+ office3 = createClusteredPostOffice(3, "testgroup");
+
+ LocalClusteredQueue sub1 = new LocalClusteredQueue(office1, 1, "sub1", im.getId(), ms, pm, true, false, (QueuedExecutor)pool.get(), null, tr);
+ Binding binding1 = office1.bindQueue("topic", sub1);
+ SimpleReceiver receiver1 = new SimpleReceiver("blah", SimpleReceiver.ACCEPTING);
+ sub1.add(receiver1);
+
+ LocalClusteredQueue sub2 = new LocalClusteredQueue(office2, 2, "sub2", im.getId(), ms, pm, true, false, (QueuedExecutor)pool.get(), null, tr);
+ Binding binding2 = office2.bindQueue("topic", sub2);
+ SimpleReceiver receiver2 = new SimpleReceiver("blah", SimpleReceiver.ACCEPTING);
+ sub2.add(receiver2);
+
+ LocalClusteredQueue sub3 = new LocalClusteredQueue(office3, 3, "sub3", im.getId(), ms, pm, true, false, (QueuedExecutor)pool.get(), null, tr);
+ Binding binding3 = office3.bindQueue("topic", sub3);
+ SimpleReceiver receiver3 = new SimpleReceiver("blah", SimpleReceiver.ACCEPTING);
+ sub3.add(receiver3);
+
+ //Only the local sub should get it since we have bound locally
+
+ Message msg = CoreMessageFactory.createCoreMessage(1, persistentMessage, null);
+ MessageReference ref = ms.reference(msg);
+ boolean routed = office1.route(ref, "topic", null);
+ assertTrue(routed);
+ Thread.sleep(500);
+ checkContainsAndAcknowledge(msg, receiver1, sub1);
+ this.checkEmpty(receiver2);
+ this.checkEmpty(receiver3);
+
+ msg = CoreMessageFactory.createCoreMessage(2, persistentMessage, null);
+ ref = ms.reference(msg);
+ routed = office2.route(ref, "topic", null);
+ assertTrue(routed);
+ Thread.sleep(500);
+ this.checkEmpty(receiver1);
+ checkContainsAndAcknowledge(msg, receiver2, sub2);
+ this.checkEmpty(receiver3);
+
+ msg = CoreMessageFactory.createCoreMessage(3, persistentMessage, null);
+ ref = ms.reference(msg);
+ routed = office3.route(ref, "topic", null);
+ assertTrue(routed);
+ Thread.sleep(500);
+ this.checkEmpty(receiver1);
+ this.checkEmpty(receiver2);
+ checkContainsAndAcknowledge(msg, receiver3, sub2);
+
+ }
+ finally
+ {
+ if (office1 != null)
+ {
+ office1.stop();
+ }
+
+ if (office2 != null)
+ {
+ office2.stop();
+ }
+
+ if (office3 != null)
+ {
+ office3.stop();
+ }
+
+
+ checkNoMessageData();
+ }
+ }
+
+
/*
* We set up a complex scenario with multiple subscriptions, shared and unshared on different nodes
*
Modified: trunk/tests/src/org/jboss/test/messaging/jms/WireFormatTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/WireFormatTest.java 2006-10-04 16:07:34 UTC (rev 1430)
+++ trunk/tests/src/org/jboss/test/messaging/jms/WireFormatTest.java 2006-10-04 18:04:44 UTC (rev 1431)
@@ -75,7 +75,7 @@
private static final Logger log = Logger.getLogger(WireFormatTest.class);
// TODO - replace with a dynamic value
- private static final byte CURRENT_VERSION = 6;
+ private static final byte CURRENT_VERSION = 7;
// Static --------------------------------------------------------
More information about the jboss-cvs-commits
mailing list