You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ro...@apache.org on 2010/02/26 15:55:04 UTC

svn commit: r916702 - in /qpid/branches/0.5.x-dev/qpid/java: ./ systests/src/main/java/org/apache/qpid/test/unit/topic/DurableSubscriptionTest.java

Author: robbie
Date: Fri Feb 26 14:55:04 2010
New Revision: 916702

URL: http://svn.apache.org/viewvc?rev=916702&view=rev
Log:
QPID-2417: add a test that restarts the broker at the end to validate the store if it is persistent

merged from trunk r916359

Modified:
    qpid/branches/0.5.x-dev/qpid/java/   (props changed)
    qpid/branches/0.5.x-dev/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/topic/DurableSubscriptionTest.java

Propchange: qpid/branches/0.5.x-dev/qpid/java/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Feb 26 14:55:04 2010
@@ -1,2 +1,2 @@
 /qpid/branches/java-broker-0-10/qpid/java:829414,829575
-/qpid/trunk/qpid/java:835115,884634-884635,884838,885765,887948,887950-887952,887994,888246,888248,888250,888345,888348,889645,891323-891332,892228,896674,896692-896693,900919,900943,902231,907851,915866-915867,916356-916358
+/qpid/trunk/qpid/java:835115,884634-884635,884838,885765,887948,887950-887952,887994,888246,888248,888250,888345,888348,889645,891323-891332,892228,896674,896692-896693,900919,900943,902231,907851,915866-915867,916356-916359

Modified: qpid/branches/0.5.x-dev/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/topic/DurableSubscriptionTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.5.x-dev/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/topic/DurableSubscriptionTest.java?rev=916702&r1=916701&r2=916702&view=diff
==============================================================================
--- qpid/branches/0.5.x-dev/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/topic/DurableSubscriptionTest.java (original)
+++ qpid/branches/0.5.x-dev/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/topic/DurableSubscriptionTest.java Fri Feb 26 14:55:04 2010
@@ -118,12 +118,23 @@
     
     public void testDurabilityNOACK() throws Exception
     {
-        durabilityImpl(AMQSession.NO_ACKNOWLEDGE);
+        durabilityImpl(AMQSession.NO_ACKNOWLEDGE, false);
     }
 
     public void testDurabilityAUTOACK() throws Exception
     {
-        durabilityImpl(Session.AUTO_ACKNOWLEDGE);
+        durabilityImpl(Session.AUTO_ACKNOWLEDGE, false);
+    }
+    
+    public void testDurabilityAUTOACKwithRestartIfPersistent() throws Exception
+    {
+        if(!isBrokerStorePersistent())
+        {
+            System.out.println("The broker store is not persistent, skipping this test.");
+            return;
+        }
+        
+        durabilityImpl(Session.AUTO_ACKNOWLEDGE, true);
     }
 
     public void testDurabilityNOACKSessionPerConnection() throws Exception
@@ -136,8 +147,8 @@
         durabilityImplSessionPerConnection(Session.AUTO_ACKNOWLEDGE);
     }
 
-    private void durabilityImpl(int ackMode) throws Exception
-    {
+    private void durabilityImpl(int ackMode, boolean restartBroker) throws Exception
+    {        
         AMQConnection con = (AMQConnection) getConnection("guest", "guest");
         AMQTopic topic = new AMQTopic(con, "MyTopic");
         Session session1 = con.createSession(false, ackMode);
@@ -225,6 +236,18 @@
         session3.unsubscribe("MySubscription");
 
         con.close();
+        
+        if(restartBroker)
+        {
+            try
+            {
+                restartBroker();
+            }
+            catch (Exception e)
+            {
+                fail("Error restarting the broker");
+            }
+        }
     }
 
     private void durabilityImplSessionPerConnection(int ackMode) throws Exception



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org