activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dej...@apache.org
Subject svn commit: r833034 - /activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/DurableSubscriptionTestSupport.java
Date Thu, 05 Nov 2009 12:14:47 GMT
Author: dejanb
Date: Thu Nov  5 12:14:21 2009
New Revision: 833034

URL: http://svn.apache.org/viewvc?rev=833034&view=rev
Log:
adding durable topic expiration test

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

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/DurableSubscriptionTestSupport.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/DurableSubscriptionTestSupport.java?rev=833034&r1=833033&r2=833034&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/DurableSubscriptionTestSupport.java
(original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/DurableSubscriptionTestSupport.java
Thu Nov  5 12:14:21 2009
@@ -110,6 +110,32 @@
     }
 
     protected abstract PersistenceAdapter createPersistenceAdapter() throws Exception;
+    
+    public void testMessageExpire() throws Exception {
+        session = connection.createSession(false, javax.jms.Session.AUTO_ACKNOWLEDGE);
+        Topic topic = session.createTopic("TestTopic");
+        consumer = session.createDurableSubscriber(topic, "sub1");
+        producer = session.createProducer(topic);
+        producer.setDeliveryMode(DeliveryMode.PERSISTENT);
+        producer.setTimeToLive(1000);
+        connection.start();
+
+        // Make sure it works when the durable sub is active.
+        producer.send(session.createTextMessage("Msg:1"));
+        assertTextMessageEquals("Msg:1", consumer.receive(1000));
+        
+        consumer.close();
+        
+        producer.send(session.createTextMessage("Msg:2"));
+        producer.send(session.createTextMessage("Msg:3"));
+        
+        consumer = session.createDurableSubscriber(topic, "sub1");
+
+        // Try to get the message.
+        assertTextMessageEquals("Msg:2", consumer.receive(1000));
+        Thread.sleep(1000);
+        assertNull(consumer.receive(1000));
+    }
 
     public void testUnsubscribeSubscription() throws Exception {
         session = connection.createSession(false, javax.jms.Session.AUTO_ACKNOWLEDGE);



Mime
View raw message