From a2241eb32656ab82ff88c5677edefa7532b04abf Mon Sep 17 00:00:00 2001 From: Robert Gemmell Date: Thu, 25 Feb 2010 17:19:12 +0000 Subject: QPID-2417: add a test that restarts the broker at the end to validate the store if it is persistent git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@916359 13f79535-47bb-0310-9956-ffa450edef68 --- .../test/unit/topic/DurableSubscriptionTest.java | 31 +++++++++++++++++++--- 1 file changed, 27 insertions(+), 4 deletions(-) (limited to 'java') diff --git a/java/systests/src/main/java/org/apache/qpid/test/unit/topic/DurableSubscriptionTest.java b/java/systests/src/main/java/org/apache/qpid/test/unit/topic/DurableSubscriptionTest.java index 59c37f6b71..91bb5d2529 100644 --- a/java/systests/src/main/java/org/apache/qpid/test/unit/topic/DurableSubscriptionTest.java +++ b/java/systests/src/main/java/org/apache/qpid/test/unit/topic/DurableSubscriptionTest.java @@ -118,12 +118,23 @@ public class DurableSubscriptionTest extends QpidTestCase 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 @@ public class DurableSubscriptionTest extends QpidTestCase 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 @@ public class DurableSubscriptionTest extends QpidTestCase session3.unsubscribe("MySubscription"); con.close(); + + if(restartBroker) + { + try + { + restartBroker(); + } + catch (Exception e) + { + fail("Error restarting the broker"); + } + } } private void durabilityImplSessionPerConnection(int ackMode) throws Exception -- cgit v1.2.1