activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gtu...@apache.org
Subject svn commit: r960869 - /activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/failover/AMQ1925Test.java
Date Tue, 06 Jul 2010 10:58:06 GMT
Author: gtully
Date: Tue Jul  6 10:58:06 2010
New Revision: 960869

URL: http://svn.apache.org/viewvc?rev=960869&view=rev
Log:
reinstate this test case

Modified:
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/failover/AMQ1925Test.java

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/failover/AMQ1925Test.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/failover/AMQ1925Test.java?rev=960869&r1=960868&r2=960869&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/failover/AMQ1925Test.java
(original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/failover/AMQ1925Test.java
Tue Jul  6 10:58:06 2010
@@ -32,6 +32,7 @@ import javax.jms.MessageConsumer;
 import javax.jms.MessageProducer;
 import javax.jms.Session;
 import javax.jms.TextMessage;
+import javax.jms.TransactionRolledBackException;
 
 import junit.framework.TestCase;
 
@@ -263,11 +264,12 @@ public class AMQ1925Test extends TestCas
 		MessageConsumer consumer = session.createConsumer(session
 				.createQueue(QUEUE_NAME));
 
+		boolean restartDone = false;
 		for (int i = 0; i < MESSAGE_COUNT; i++) {
 			Message message = consumer.receive(500);
 			assertNotNull(message);
 
-			if (i == 222) {
+			if (i == 222 && !restartDone) {
 				// Simulate broker failure & restart
 				bs.stop();
 				bs = new BrokerService();
@@ -275,10 +277,16 @@ public class AMQ1925Test extends TestCas
 				bs.setUseJmx(true);
 				bs.addConnector(tcpUri);
 				bs.start();
+				restartDone = true;
 			}
 
 			assertEquals(i, message.getIntProperty(PROPERTY_MSG_NUMBER));
-			session.commit();
+			try {
+			    session.commit();
+			} catch (TransactionRolledBackException expectedOnOccasion) {
+			    log.info("got rollback: "  + expectedOnOccasion);
+			    i--;
+			}
 		}
 		assertNull(consumer.receive(500));
 



Mime
View raw message