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/25 18:19:12 UTC
svn commit: r916359 -
/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/topic/DurableSubscriptionTest.java
Author: robbie
Date: Thu Feb 25 17:19:12 2010
New Revision: 916359
URL: http://svn.apache.org/viewvc?rev=916359&view=rev
Log:
QPID-2417: add a test that restarts the broker at the end to validate the store if it is persistent
Modified:
qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/topic/DurableSubscriptionTest.java
Modified: qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/topic/DurableSubscriptionTest.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/topic/DurableSubscriptionTest.java?rev=916359&r1=916358&r2=916359&view=diff
==============================================================================
--- qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/topic/DurableSubscriptionTest.java (original)
+++ qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/topic/DurableSubscriptionTest.java Thu Feb 25 17:19:12 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