[hornetq-commits] JBoss hornetq SVN: r8027 - in trunk/tests/src/org/hornetq/tests: integration/jms/divert and 1 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Thu Oct 1 18:12:50 EDT 2009


Author: clebert.suconic at jboss.com
Date: 2009-10-01 18:12:50 -0400 (Thu, 01 Oct 2009)
New Revision: 8027

Added:
   trunk/tests/src/org/hornetq/tests/integration/jms/divert/
   trunk/tests/src/org/hornetq/tests/integration/jms/divert/DivertAndACKClientTest.java
Modified:
   trunk/tests/src/org/hornetq/tests/util/JMSTestBase.java
   trunk/tests/src/org/hornetq/tests/util/ServiceTestBase.java
Log:
https://jira.jboss.org/jira/browse/HORNETQ-165 - Adding test to replicate it

Added: trunk/tests/src/org/hornetq/tests/integration/jms/divert/DivertAndACKClientTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/jms/divert/DivertAndACKClientTest.java	                        (rev 0)
+++ trunk/tests/src/org/hornetq/tests/integration/jms/divert/DivertAndACKClientTest.java	2009-10-01 22:12:50 UTC (rev 8027)
@@ -0,0 +1,105 @@
+/*
+ * Copyright 2009 Red Hat, Inc.
+ * Red Hat 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.hornetq.tests.integration.jms.divert;
+
+import java.util.ArrayList;
+
+import javax.jms.*;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+
+import org.hornetq.core.config.Configuration;
+import org.hornetq.core.config.cluster.DivertConfiguration;
+import org.hornetq.jms.HornetQQueue;
+import org.hornetq.tests.util.JMSTestBase;
+
+/**
+ * A DivertAndACKClientTest
+ *
+ * @author <mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
+ *
+ *
+ */
+public class DivertAndACKClientTest extends JMSTestBase
+{
+
+   // Constants -----------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   // Public --------------------------------------------------------
+
+   public void testAutoACK() throws Exception
+   {
+      HornetQQueue queueSource = (HornetQQueue)createQueue("Source");
+      HornetQQueue queueTarget = (HornetQQueue)createQueue("Dest");
+
+      Connection connection = cf.createConnection();
+      Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+      final MessageProducer producer = session.createProducer(queueSource);
+
+      final TextMessage message = session.createTextMessage("message text");
+      producer.send(message);
+
+      connection.start();
+
+      final MessageConsumer consumer = session.createConsumer(queueTarget);
+      TextMessage receivedMessage = (TextMessage)consumer.receive(1000);
+
+      assertNotNull(receivedMessage);
+
+      connection.close();
+   }
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+   
+   protected boolean usePersistence()
+   {
+      return true;
+   }
+   
+
+   protected Configuration createDefaultConfig(final boolean netty)
+   {
+      Configuration config = super.createDefaultConfig(netty);
+
+      DivertConfiguration divert = new DivertConfiguration("local-divert",
+                                                           "some-name",
+                                                           "jms.queue.Source",
+                                                           "jms.queue.Dest",
+                                                           true,
+                                                           null,
+                                                           null);
+
+      ArrayList<DivertConfiguration> divertList = new ArrayList<DivertConfiguration>();
+      divertList.add(divert);
+
+      config.setDivertConfigurations(divertList);
+
+      return config;
+   }
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+
+}

Modified: trunk/tests/src/org/hornetq/tests/util/JMSTestBase.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/util/JMSTestBase.java	2009-10-01 21:02:07 UTC (rev 8026)
+++ trunk/tests/src/org/hornetq/tests/util/JMSTestBase.java	2009-10-01 22:12:50 UTC (rev 8027)
@@ -122,7 +122,7 @@
 
       conf.getAcceptorConfigurations().add(new TransportConfiguration(NettyAcceptorFactory.class.getName()));
 
-      server = HornetQ.newHornetQServer(conf, false);
+      server = HornetQ.newHornetQServer(conf, usePersistence());
 
       jmsServer = new JMSServerManagerImpl(server);
       context = new InVMContext();

Modified: trunk/tests/src/org/hornetq/tests/util/ServiceTestBase.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/util/ServiceTestBase.java	2009-10-01 21:02:07 UTC (rev 8026)
+++ trunk/tests/src/org/hornetq/tests/util/ServiceTestBase.java	2009-10-01 22:12:50 UTC (rev 8027)
@@ -250,6 +250,8 @@
       configuration.setLargeMessagesDirectory(getLargeMessagesDir());
       configuration.setJournalCompactMinFiles(0);
       configuration.setJournalCompactPercentage(0);
+      
+      configuration.setFileDeploymentEnabled(false);
 
       configuration.setJournalType(JournalType.ASYNCIO);
 



More information about the hornetq-commits mailing list