[jboss-cvs] JBoss Messaging SVN: r2701 - in trunk: src/main/org/jboss/jms/server/endpoint and 2 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu May 17 12:01:05 EDT 2007
Author: timfox
Date: 2007-05-17 12:01:05 -0400 (Thu, 17 May 2007)
New Revision: 2701
Added:
trunk/tests/src/org/jboss/test/messaging/jms/clustering/TemporaryDestinationTest.java
Removed:
trunk/tests/src/org/jboss/test/messaging/jms/clustering/TemporaryQueueTest.java
Modified:
trunk/src/main/org/jboss/jms/server/destination/ManagedDestination.java
trunk/src/main/org/jboss/jms/server/destination/ManagedQueue.java
trunk/src/main/org/jboss/jms/server/destination/ManagedTopic.java
trunk/src/main/org/jboss/jms/server/endpoint/ServerConnectionEndpoint.java
trunk/src/main/org/jboss/jms/server/endpoint/ServerConsumerEndpoint.java
trunk/src/main/org/jboss/jms/server/endpoint/ServerSessionEndpoint.java
trunk/tests/src/org/jboss/test/messaging/jms/server/DestinationManagerTest.java
Log:
http://jira.jboss.com/jira/browse/JBMESSAGING-956
Modified: trunk/src/main/org/jboss/jms/server/destination/ManagedDestination.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/destination/ManagedDestination.java 2007-05-17 08:58:32 UTC (rev 2700)
+++ trunk/src/main/org/jboss/jms/server/destination/ManagedDestination.java 2007-05-17 16:01:05 UTC (rev 2701)
@@ -96,12 +96,13 @@
/*
* Constructor for temporary destinations
*/
- public ManagedDestination(String name, int fullSize, int pageSize, int downCacheSize)
+ public ManagedDestination(String name, int fullSize, int pageSize, int downCacheSize, boolean clustered)
{
this.name = name;
this.fullSize = fullSize;
this.pageSize = pageSize;
this.downCacheSize = downCacheSize;
+ this.clustered = clustered;
}
public boolean isClustered()
Modified: trunk/src/main/org/jboss/jms/server/destination/ManagedQueue.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/destination/ManagedQueue.java 2007-05-17 08:58:32 UTC (rev 2700)
+++ trunk/src/main/org/jboss/jms/server/destination/ManagedQueue.java 2007-05-17 16:01:05 UTC (rev 2701)
@@ -64,9 +64,9 @@
{
}
- public ManagedQueue(String name, int fullSize, int pageSize, int downCacheSize)
+ public ManagedQueue(String name, int fullSize, int pageSize, int downCacheSize, boolean clustered)
{
- super(name, fullSize, pageSize, downCacheSize);
+ super(name, fullSize, pageSize, downCacheSize, clustered);
}
// ManagedDestination overrides -----------------------------------------------------------------
Modified: trunk/src/main/org/jboss/jms/server/destination/ManagedTopic.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/destination/ManagedTopic.java 2007-05-17 08:58:32 UTC (rev 2700)
+++ trunk/src/main/org/jboss/jms/server/destination/ManagedTopic.java 2007-05-17 16:01:05 UTC (rev 2701)
@@ -51,9 +51,9 @@
{
}
- public ManagedTopic(String name, int fullSize, int pageSize, int downCacheSize)
+ public ManagedTopic(String name, int fullSize, int pageSize, int downCacheSize, boolean clustered)
{
- super(name, fullSize, pageSize, downCacheSize);
+ super(name, fullSize, pageSize, downCacheSize, clustered);
}
public void removeAllMessages() throws Throwable
Modified: trunk/src/main/org/jboss/jms/server/endpoint/ServerConnectionEndpoint.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/endpoint/ServerConnectionEndpoint.java 2007-05-17 08:58:32 UTC (rev 2700)
+++ trunk/src/main/org/jboss/jms/server/endpoint/ServerConnectionEndpoint.java 2007-05-17 16:01:05 UTC (rev 2701)
@@ -21,6 +21,7 @@
*/
package org.jboss.jms.server.endpoint;
+import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
@@ -45,7 +46,6 @@
import org.jboss.jms.server.SecurityManager;
import org.jboss.jms.server.ServerPeer;
import org.jboss.jms.server.endpoint.advised.SessionAdvised;
-import org.jboss.jms.server.messagecounter.MessageCounter;
import org.jboss.jms.tx.ClientTransaction;
import org.jboss.jms.tx.MessagingXid;
import org.jboss.jms.tx.TransactionRequest;
@@ -55,6 +55,7 @@
import org.jboss.logging.Logger;
import org.jboss.messaging.core.message.Message;
import org.jboss.messaging.core.message.MessageReference;
+import org.jboss.messaging.core.plugin.contract.ClusteredPostOffice;
import org.jboss.messaging.core.plugin.contract.MessageStore;
import org.jboss.messaging.core.plugin.contract.PostOffice;
import org.jboss.messaging.core.tx.Transaction;
@@ -386,25 +387,32 @@
if (dest.isQueue())
{
- postOffice.unbindQueue(dest.getName());
-
- String counterName =
- ServerSessionEndpoint.TEMP_QUEUE_MESSAGECOUNTER_PREFIX + dest.getName();
-
- MessageCounter counter =
- serverPeer.getMessageCounterManager().unregisterMessageCounter(counterName);
-
- if (counter == null)
- {
- throw new IllegalStateException(
- "Cannot find counter to unregister " + counterName);
- }
+ if (postOffice.isLocal())
+ {
+ postOffice.unbindQueue(dest.getName());
+ }
+ else
+ {
+ ((ClusteredPostOffice)postOffice).unbindClusteredQueue(dest.getName());
+ }
}
else
{
- //No need to unbind - this will already have happened, and all removeAllReferences
+ //No need to unbind - this will already have happened, and removeAllReferences
//will have already been called when the subscriptions were closed
- //which always happens before the connection closed (depth first close)
+ //which always happens before the connection closed (depth first close)
+ //note there are no durable subs on a temporary topic
+
+ //Sanity check
+
+ Collection bindings =
+ postOffice.getBindingsForCondition(new JMSCondition(false, dest.getName()));
+
+ if (!bindings.isEmpty())
+ {
+ //This should never happen
+ throw new IllegalStateException("Cannot delete temporary destination if it has consumer(s)");
+ }
}
}
Modified: trunk/src/main/org/jboss/jms/server/endpoint/ServerConsumerEndpoint.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/endpoint/ServerConsumerEndpoint.java 2007-05-17 08:58:32 UTC (rev 2700)
+++ trunk/src/main/org/jboss/jms/server/endpoint/ServerConsumerEndpoint.java 2007-05-17 16:01:05 UTC (rev 2701)
@@ -28,6 +28,8 @@
import org.jboss.jms.delegate.ConsumerEndpoint;
import org.jboss.jms.destination.JBossDestination;
import org.jboss.jms.message.JBossMessage;
+import org.jboss.jms.server.ServerPeer;
+import org.jboss.jms.server.destination.ManagedDestination;
import org.jboss.jms.server.destination.TopicService;
import org.jboss.jms.server.messagecounter.MessageCounter;
import org.jboss.jms.server.selector.Selector;
@@ -482,14 +484,20 @@
Binding binding = postOffice.getBindingForQueueName(queueName);
- // Note binding can be null since there can many competing subscribers for the
- // subscription - in which case the first will have removed the subscription and
- // subsequently ones won't find it
-
- if (binding != null && !binding.getQueue().isRecoverable())
+ if (binding == null)
{
+ //Sanity check
+ throw new IllegalStateException("Cannot find binding for topic sub with queue name: " + queueName);
+ }
+
+ ServerPeer sp = sessionEndpoint.getConnectionEndpoint().getServerPeer();
+
+ ManagedDestination mDest = sp.getDestinationManager().getDestination(destination.getName(), false);
+
+ if (!binding.getQueue().isRecoverable())
+ {
Queue queue = binding.getQueue();
- if (!queue.isClustered())
+ if (!mDest.isClustered())
{
postOffice.unbindQueue(queue.getName());
}
@@ -498,15 +506,16 @@
((ClusteredPostOffice)postOffice).unbindClusteredQueue(queue.getName());
}
- String counterName = TopicService.SUBSCRIPTION_MESSAGECOUNTER_PREFIX + queueName;
-
- MessageCounter counter = sessionEndpoint.getConnectionEndpoint()
- .getServerPeer().getMessageCounterManager()
- .unregisterMessageCounter(counterName);
-
- if (counter == null)
+ if (!mDest.isTemporary())
{
- throw new IllegalStateException("Cannot find counter to remove " + counterName);
+ String counterName = TopicService.SUBSCRIPTION_MESSAGECOUNTER_PREFIX + queueName;
+
+ MessageCounter counter = sp.getMessageCounterManager().unregisterMessageCounter(counterName);
+
+ if (counter == null)
+ {
+ throw new IllegalStateException("Cannot find counter to remove " + counterName);
+ }
}
}
}
Modified: trunk/src/main/org/jboss/jms/server/endpoint/ServerSessionEndpoint.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/endpoint/ServerSessionEndpoint.java 2007-05-17 08:58:32 UTC (rev 2700)
+++ trunk/src/main/org/jboss/jms/server/endpoint/ServerSessionEndpoint.java 2007-05-17 16:01:05 UTC (rev 2701)
@@ -71,6 +71,7 @@
import org.jboss.messaging.core.message.MessageReference;
import org.jboss.messaging.core.plugin.IDManager;
import org.jboss.messaging.core.plugin.contract.ClusteredPostOffice;
+import org.jboss.messaging.core.plugin.contract.Condition;
import org.jboss.messaging.core.plugin.contract.MessageStore;
import org.jboss.messaging.core.plugin.contract.PersistenceManager;
import org.jboss.messaging.core.plugin.contract.PostOffice;
@@ -526,13 +527,16 @@
int pageSize = connectionEndpoint.getDefaultTempQueuePageSize();
int downCacheSize = connectionEndpoint.getDefaultTempQueueDownCacheSize();
+ //Temporary destinations are clustered if the post office is clustered
+ boolean clustered = !postOffice.isLocal();
+
if (dest.isTopic())
{
- mDest = new ManagedTopic(dest.getName(), fullSize, pageSize, downCacheSize);
+ mDest = new ManagedTopic(dest.getName(), fullSize, pageSize, downCacheSize, clustered);
}
else
{
- mDest = new ManagedQueue(dest.getName(), fullSize, pageSize, downCacheSize);
+ mDest = new ManagedQueue(dest.getName(), fullSize, pageSize, downCacheSize, clustered);
}
dm.registerDestination(mDest);
@@ -541,20 +545,31 @@
{
Queue coreQueue;
- coreQueue = new PagingFilteredQueue(dest.getName(),
- idm.getID(), ms, pm, true, false,
- -1, null, fullSize, pageSize, downCacheSize);
-
- String counterName = TEMP_QUEUE_MESSAGECOUNTER_PREFIX + dest.getName();
+ if (clustered)
+ {
+ coreQueue = new LocalClusteredQueue((ClusteredPostOffice)postOffice, nodeId, dest.getName(),
+ idm.getID(), ms, pm, true, false,
+ -1, null, tr,
+ fullSize, pageSize, downCacheSize);
+ }
+ else
+ {
+ coreQueue = new PagingFilteredQueue(dest.getName(),
+ idm.getID(), ms, pm, true, false,
+ -1, null, fullSize, pageSize, downCacheSize);
+ }
+
+ Condition cond = new JMSCondition(true, dest.getName());
- MessageCounter counter =
- new MessageCounter(counterName, null, coreQueue, false, false,
- sp.getDefaultMessageCounterHistoryDayLimit());
-
- sp.getMessageCounterManager().registerMessageCounter(counterName, counter);
-
- // make a binding for this queue
- postOffice.bindQueue(new JMSCondition(true, dest.getName()), coreQueue);
+ // make a binding for this queue
+ if (clustered)
+ {
+ ((ClusteredPostOffice)postOffice).bindClusteredQueue(cond, (LocalClusteredQueue)coreQueue);
+ }
+ else
+ {
+ postOffice.bindQueue(cond, coreQueue);
+ }
}
}
catch (Throwable t)
@@ -575,7 +590,7 @@
if (!dest.isTemporary())
{
throw new InvalidDestinationException("Destination:" + dest +
- " is not a temporary destination");
+ " is not a temporary destination");
}
ManagedDestination mDest = dm.getDestination(dest.getName(), dest.isQueue());
@@ -595,19 +610,14 @@
}
//Unbind
- postOffice.unbindQueue(dest.getName());
-
- String counterName = TEMP_QUEUE_MESSAGECOUNTER_PREFIX + dest.getName();
-
- connectionEndpoint.removeTemporaryDestination(dest);
-
- MessageCounter counter =
- sp.getMessageCounterManager().unregisterMessageCounter(counterName);
-
- if (counter == null)
- {
- throw new IllegalStateException("Cannot find counter to unregister " + counterName);
- }
+ if (mDest.isClustered())
+ {
+ ((ClusteredPostOffice)postOffice).unbindClusteredQueue(dest.getName());
+ }
+ else
+ {
+ postOffice.unbindQueue(dest.getName());
+ }
}
else
{
@@ -615,19 +625,18 @@
Collection bindings =
postOffice.getBindingsForCondition(new JMSCondition(false, dest.getName()));
- Iterator iter = bindings.iterator();
-
- while (iter.hasNext())
- {
- Binding binding = (Binding)iter.next();
-
- if (binding.getQueue().getNumberOfReceivers() != 0)
- {
- throw new IllegalStateException("Cannot delete temporary destination if it has consumer(s)");
- }
- }
+ if (!bindings.isEmpty())
+ {
+ throw new IllegalStateException("Cannot delete temporary destination if it has consumer(s)");
+ }
+
+ // There is no need to explicitly unbind the subscriptions for the temp topic, this is because we
+ // will not get here unless there are no bindings.
+ // Note that you cannot create surable subs on a temp topic
}
+ connectionEndpoint.removeTemporaryDestination(dest);
+
dm.unregisterDestination(mDest);
}
catch (Throwable t)
@@ -1228,11 +1237,15 @@
dayLimitToUse = sp.getDefaultMessageCounterHistoryDayLimit();
}
- MessageCounter counter =
- new MessageCounter(counterName, null, q, true, false,
- dayLimitToUse);
-
- sp.getMessageCounterManager().registerMessageCounter(counterName, counter);
+ //We don't create message counters on temp topics
+ if (!mDest.isTemporary())
+ {
+ MessageCounter counter =
+ new MessageCounter(counterName, null, q, true, false,
+ dayLimitToUse);
+
+ sp.getMessageCounterManager().registerMessageCounter(counterName, counter);
+ }
}
else
{
@@ -1292,13 +1305,18 @@
binding = cpo.bindQueue(topicCond, q);
}
}
- String counterName = TopicService.SUBSCRIPTION_MESSAGECOUNTER_PREFIX + q.getName();
-
- MessageCounter counter =
- new MessageCounter(counterName, subscriptionName, q, true, true,
- mDest.getMessageCounterHistoryDayLimit());
- sp.getMessageCounterManager().registerMessageCounter(counterName, counter);
+ //We don't create message counters on temp topics
+ if (!mDest.isTemporary())
+ {
+ String counterName = TopicService.SUBSCRIPTION_MESSAGECOUNTER_PREFIX + q.getName();
+
+ MessageCounter counter =
+ new MessageCounter(counterName, subscriptionName, q, true, true,
+ mDest.getMessageCounterHistoryDayLimit());
+
+ sp.getMessageCounterManager().registerMessageCounter(counterName, counter);
+ }
}
else
{
@@ -1389,11 +1407,14 @@
}
String counterName = TopicService.SUBSCRIPTION_MESSAGECOUNTER_PREFIX + q.getName();
- MessageCounter counter =
- new MessageCounter(counterName, subscriptionName, q, true, true,
- mDest.getMessageCounterHistoryDayLimit());
-
- sp.getMessageCounterManager().registerMessageCounter(counterName, counter);
+ if (!mDest.isTemporary())
+ {
+ MessageCounter counter =
+ new MessageCounter(counterName, subscriptionName, q, true, true,
+ mDest.getMessageCounterHistoryDayLimit());
+
+ sp.getMessageCounterManager().registerMessageCounter(counterName, counter);
+ }
}
}
}
Copied: trunk/tests/src/org/jboss/test/messaging/jms/clustering/TemporaryDestinationTest.java (from rev 2700, trunk/tests/src/org/jboss/test/messaging/jms/clustering/TemporaryQueueTest.java)
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/clustering/TemporaryDestinationTest.java (rev 0)
+++ trunk/tests/src/org/jboss/test/messaging/jms/clustering/TemporaryDestinationTest.java 2007-05-17 16:01:05 UTC (rev 2701)
@@ -0,0 +1,232 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.messaging.jms.clustering;
+
+import javax.jms.Connection;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.jms.Topic;
+
+import org.jboss.test.messaging.jms.clustering.base.ClusteringTestBase;
+
+/**
+ * A test for temporary destinations in a clustered enviroment.
+ * See http://jira.jboss.org/jira/browse/JBMESSAGING-841.
+ *
+ * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @version <tt>$Revision$</tt>
+ *
+ * $Id$
+ */
+public class TemporaryDestinationTest extends ClusteringTestBase
+{
+ // Constants ------------------------------------------------------------------------------------
+
+ // Static ---------------------------------------------------------------------------------------
+
+ // Attributes -----------------------------------------------------------------------------------
+
+ // Constructors ---------------------------------------------------------------------------------
+
+ public TemporaryDestinationTest(String name)
+ {
+ super(name);
+ }
+
+ // Public ---------------------------------------------------------------------------------------
+
+ public void testTemporaryQueueTrivial() throws Exception
+ {
+ Connection conn = null;
+
+ try
+ {
+ conn = cf.createConnection();
+
+ Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ Queue queue = session.createTemporaryQueue();
+
+ MessageProducer prod = session.createProducer(queue);
+ prod.send(session.createTextMessage("kwijibo"));
+
+ MessageConsumer cons = session.createConsumer(queue);
+ conn.start();
+
+ TextMessage rm = (TextMessage)cons.receive(2000);
+
+ assertNotNull(rm);
+ assertEquals("kwijibo", rm.getText());
+
+ }
+ finally
+ {
+ if (conn != null)
+ {
+ conn.close();
+ }
+ }
+ }
+
+ public void testTemporaryQueue() throws Exception
+ {
+ Connection conn0 = null;
+
+ Connection conn1 = null;
+
+ try
+ {
+ conn0 = cf.createConnection();
+
+ conn1 = cf.createConnection();
+
+ // Make sure the connections are on different servers
+
+ checkConnectionsDifferentServers(new Connection[] {conn0, conn1});
+
+ Session session0 = conn0.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ Queue queue = session0.createTemporaryQueue();
+
+ MessageConsumer cons0 = session0.createConsumer(queue);
+
+ conn0.start();
+
+ //The second connection sends a message back to the temporary queue from a different node
+ //This is what would happen in the classic "replyTo queue pattern"
+ //In the clustered version of this pattern the message can be sent to the replyTo queue from any node
+ //in the cluster
+
+ Session session1 = conn1.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ MessageProducer prod = session1.createProducer(queue);
+
+ TextMessage sm = session1.createTextMessage("hoo ja ma flip");
+
+ prod.send(sm);
+
+ TextMessage tm = (TextMessage)cons0.receive(3000);
+
+ assertNotNull(tm);
+
+ assertEquals(sm.getText(), tm.getText());
+
+ }
+ finally
+ {
+ if (conn0 != null)
+ {
+ conn0.close();
+ }
+
+ if (conn1 != null)
+ {
+ conn1.close();
+ }
+ }
+ }
+
+ public void testTemporaryTopic() throws Exception
+ {
+ Connection conn0 = null;
+
+ Connection conn1 = null;
+
+ try
+ {
+ conn0 = cf.createConnection();
+
+ conn1 = cf.createConnection();
+
+ // Make sure the connections are on different servers
+
+ checkConnectionsDifferentServers(new Connection[] {conn0, conn1});
+
+ Session session0 = conn0.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ Topic topic = session0.createTemporaryTopic();
+
+ MessageConsumer cons0 = session0.createConsumer(topic);
+
+ conn0.start();
+
+ //The second connection sends a message back to the temporary topic from a different node
+ //This is what would happen in the classic "replyTo topic pattern"
+ //In the clustered version of this pattern the message can be sent to the replyTo topic from any node
+ //in the cluster
+
+ Session session1 = conn1.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ MessageProducer prod = session1.createProducer(topic);
+
+ TextMessage sm = session1.createTextMessage("hoo ja ma flip2");
+
+ prod.send(sm);
+
+ TextMessage tm = (TextMessage)cons0.receive(3000);
+
+ assertNotNull(tm);
+
+ assertEquals(sm.getText(), tm.getText());
+
+ }
+ finally
+ {
+ if (conn0 != null)
+ {
+ conn0.close();
+ }
+
+ if (conn1 != null)
+ {
+ conn1.close();
+ }
+ }
+ }
+
+ // Package protected ----------------------------------------------------------------------------
+
+ // Protected ------------------------------------------------------------------------------------
+
+ protected void setUp() throws Exception
+ {
+ nodeCount = 2;
+
+ super.setUp();
+
+ log.debug("setup done");
+ }
+
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+ }
+
+ // Private --------------------------------------------------------------------------------------
+
+ // Inner classes --------------------------------------------------------------------------------
+
+}
Deleted: trunk/tests/src/org/jboss/test/messaging/jms/clustering/TemporaryQueueTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/clustering/TemporaryQueueTest.java 2007-05-17 08:58:32 UTC (rev 2700)
+++ trunk/tests/src/org/jboss/test/messaging/jms/clustering/TemporaryQueueTest.java 2007-05-17 16:01:05 UTC (rev 2701)
@@ -1,115 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.test.messaging.jms.clustering;
-
-import org.jboss.test.messaging.jms.clustering.base.ClusteringTestBase;
-
-import javax.jms.Connection;
-import javax.jms.Session;
-import javax.jms.Queue;
-import javax.jms.MessageProducer;
-import javax.jms.MessageConsumer;
-import javax.jms.TextMessage;
-
-/**
- * A test for temporary destinations in a clustered enviroment.
- * See http://jira.jboss.org/jira/browse/JBMESSAGING-841.
- *
- * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
- * @version <tt>$Revision$</tt>
- *
- * $Id$
- */
-public class TemporaryQueueTest extends ClusteringTestBase
-{
- // Constants ------------------------------------------------------------------------------------
-
- // Static ---------------------------------------------------------------------------------------
-
- // Attributes -----------------------------------------------------------------------------------
-
- // Constructors ---------------------------------------------------------------------------------
-
- public TemporaryQueueTest(String name)
- {
- super(name);
- }
-
- // Public ---------------------------------------------------------------------------------------
-
- public void testTemporaryQueue() throws Exception
- {
- Connection conn = null;
-
- try
- {
- conn = cf.createConnection();
-
- Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
- Queue queue = session.createTemporaryQueue();
-
- MessageProducer prod = session.createProducer(queue);
- prod.send(session.createTextMessage("kwijibo"));
-
- MessageConsumer cons = session.createConsumer(queue);
- conn.start();
-
- TextMessage rm = (TextMessage)cons.receive(2000);
-
- assertNotNull(rm);
- assertEquals("kwijibo", rm.getText());
-
- }
- finally
- {
- if (conn != null)
- {
- conn.close();
- }
- }
- }
-
- // Package protected ----------------------------------------------------------------------------
-
- // Protected ------------------------------------------------------------------------------------
-
- protected void setUp() throws Exception
- {
- // just start one node in clustered mode
- nodeCount = 1;
-
- super.setUp();
-
- log.debug("setup done");
- }
-
- protected void tearDown() throws Exception
- {
- super.tearDown();
- }
-
- // Private --------------------------------------------------------------------------------------
-
- // Inner classes --------------------------------------------------------------------------------
-
-}
Modified: trunk/tests/src/org/jboss/test/messaging/jms/server/DestinationManagerTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/server/DestinationManagerTest.java 2007-05-17 08:58:32 UTC (rev 2700)
+++ trunk/tests/src/org/jboss/test/messaging/jms/server/DestinationManagerTest.java 2007-05-17 16:01:05 UTC (rev 2701)
@@ -382,9 +382,9 @@
dm.start();
- ManagedQueue queue1 = new ManagedQueue("queue1", 1000, 10, 10);
+ ManagedQueue queue1 = new ManagedQueue("queue1", 1000, 10, 10, false);
- ManagedTopic topic1 = new ManagedTopic("topic1", 1000, 10, 10);
+ ManagedTopic topic1 = new ManagedTopic("topic1", 1000, 10, 10, false);
dm.registerDestination(queue1);
More information about the jboss-cvs-commits
mailing list