summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Gemmell <robbie@apache.org>2010-02-26 14:55:04 +0000
committerRobert Gemmell <robbie@apache.org>2010-02-26 14:55:04 +0000
commitcf512958b901f1aaae1a035c6ed47c3e2f14cf4e (patch)
treecc392e28597b96984e28a6b1eced101751724876
parent87f38fac91c05dfa497808125d9475868cd27a4b (diff)
downloadqpid-python-cf512958b901f1aaae1a035c6ed47c3e2f14cf4e.tar.gz
QPID-2417: add a test that restarts the broker at the end to validate the store if it is persistent
merged from trunk r916359 git-svn-id: https://svn.apache.org/repos/asf/qpid/branches/0.5.x-dev@916702 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/test/unit/topic/DurableSubscriptionTest.java31
1 files changed, 27 insertions, 4 deletions
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/topic/DurableSubscriptionTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/topic/DurableSubscriptionTest.java
index 59c37f6b71..91bb5d2529 100644
--- a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/topic/DurableSubscriptionTest.java
+++ b/qpid/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