diff options
author | Robert Gemmell <robbie@apache.org> | 2010-02-25 17:19:12 +0000 |
---|---|---|
committer | Robert Gemmell <robbie@apache.org> | 2010-02-25 17:19:12 +0000 |
commit | a2241eb32656ab82ff88c5677edefa7532b04abf (patch) | |
tree | 86721312e96c2f72ced01c03048a0536186f53b6 | |
parent | c8310f80c59024051530cbac19323c423f6c7785 (diff) | |
download | qpid-python-a2241eb32656ab82ff88c5677edefa7532b04abf.tar.gz |
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
-rw-r--r-- | java/systests/src/main/java/org/apache/qpid/test/unit/topic/DurableSubscriptionTest.java | 31 |
1 files changed, 27 insertions, 4 deletions
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 |