activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajdav...@apache.org
Subject svn commit: r515627 - /activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/DurableConsumerCloseAndReconnectTest.java
Date Wed, 07 Mar 2007 16:12:36 GMT
Author: rajdavies
Date: Wed Mar  7 08:12:35 2007
New Revision: 515627

URL: http://svn.apache.org/viewvc?view=rev&rev=515627
Log:
remove data store at end of the junit run

Modified:
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/DurableConsumerCloseAndReconnectTest.java

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/DurableConsumerCloseAndReconnectTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/DurableConsumerCloseAndReconnectTest.java?view=diff&rev=515627&r1=515626&r2=515627
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/DurableConsumerCloseAndReconnectTest.java
(original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/DurableConsumerCloseAndReconnectTest.java
Wed Mar  7 08:12:35 2007
@@ -28,6 +28,7 @@
 import javax.jms.MessageConsumer;
 import javax.jms.MessageProducer;
 import javax.jms.Session;
+import javax.jms.TextMessage;
 import javax.jms.Topic;
 
 /**
@@ -41,14 +42,15 @@
     private MessageConsumer consumer;
     private MessageProducer producer;
     private Destination destination;
-
+    private int messageCount=0;
     protected ActiveMQConnectionFactory createConnectionFactory() throws Exception {
-        return new ActiveMQConnectionFactory("vm://localhost?broker.persistent=true");
+        return new ActiveMQConnectionFactory("vm://localhost?broker.deleteAllMessagesOnStartup=false");
     }
 
     public void testCreateDurableConsumerCloseThenReconnect() throws Exception {
         // force the server to stay up across both connection tests
         Connection dummyConnection = createConnection();
+        dummyConnection.start();
 
         consumeMessagesDeliveredWhileConsumerClosed();
 
@@ -56,6 +58,11 @@
 
         // now lets try again without one connection open
         consumeMessagesDeliveredWhileConsumerClosed();
+        //now delete the db
+        ActiveMQConnectionFactory fac = new ActiveMQConnectionFactory("vm://localhost?broker.deleteAllMessagesOnStartup=true");
+        dummyConnection = fac.createConnection();
+        dummyConnection.start();
+        dummyConnection.close();
     }
 
     protected void consumeMessagesDeliveredWhileConsumerClosed() throws Exception {
@@ -80,7 +87,7 @@
         message = consumer.receive(RECEIVE_TIMEOUT);
         assertTrue("Should have received a message!", message != null);
         message.acknowledge();
-
+       
         closeConsumer();
 
         log.info("Now lets create the consumer again and because we didn't ack, we should
get it again");
@@ -98,7 +105,7 @@
         message = consumer.receive(RECEIVE_TIMEOUT);
         assertTrue("Should have received a message!", message != null);
         message.acknowledge();
-
+       
         closeConsumer();
     }
 
@@ -111,9 +118,9 @@
 
         producer = session.createProducer(destination);
         producer.setDeliveryMode(DeliveryMode.PERSISTENT);
-
-        producer.send(session.createTextMessage("This is a test"));
-
+        TextMessage msg = session.createTextMessage("This is a test: " + messageCount++);
+        producer.send(msg);
+      
         producer.close();
         producer = null;
         closeSession();



Mime
View raw message