You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by kw...@apache.org on 2012/09/14 10:49:37 UTC
svn commit: r1384685 -
/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/client/failover/FailoverTest.java
Author: kwall
Date: Fri Sep 14 08:49:36 2012
New Revision: 1384685
URL: http://svn.apache.org/viewvc?rev=1384685&view=rev
Log:
QPID-4303: FailoverTest sometimes fails on slower CI boxes.
In non-transacted case, test should sync after producing messages in order to ensure that messages
are on Broker before consumption begins.
Modified:
qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/client/failover/FailoverTest.java
Modified: qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/client/failover/FailoverTest.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/client/failover/FailoverTest.java?rev=1384685&r1=1384684&r2=1384685&view=diff
==============================================================================
--- qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/client/failover/FailoverTest.java (original)
+++ qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/client/failover/FailoverTest.java Fri Sep 14 08:49:36 2012
@@ -24,6 +24,7 @@ package org.apache.qpid.test.client.fail
import org.apache.log4j.Logger;
import org.apache.qpid.client.AMQConnection;
+import org.apache.qpid.client.AMQSession;
import org.apache.qpid.jms.ConnectionListener;
import org.apache.qpid.test.utils.FailoverBaseCase;
@@ -35,7 +36,6 @@ import javax.jms.MessageProducer;
import javax.jms.Queue;
import javax.jms.Session;
import javax.jms.TextMessage;
-import javax.naming.NamingException;
import java.util.Random;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
@@ -75,7 +75,7 @@ public class FailoverTest extends Failov
failoverComplete = new CountDownLatch(1);
}
- protected void init(boolean transacted, int mode) throws JMSException, NamingException
+ private void init(boolean transacted, int mode) throws Exception
{
consumerSession = connection.createSession(transacted, mode);
queue = consumerSession.createQueue(getName()+System.currentTimeMillis());
@@ -125,7 +125,7 @@ public class FailoverTest extends Failov
}
}
- private void sendMessages(int startIndex,int endIndex, boolean transacted) throws JMSException
+ private void sendMessages(int startIndex,int endIndex, boolean transacted) throws Exception
{
_logger.debug("**************** Send (Start: " + startIndex + ", End:" + endIndex + ")***********************");
@@ -144,6 +144,10 @@ public class FailoverTest extends Failov
{
producerSession.commit();
}
+ else
+ {
+ ((AMQSession<?, ?>)producerSession).sync();
+ }
}
public void testP2PFailover() throws Exception
@@ -163,13 +167,13 @@ public class FailoverTest extends Failov
{
if (CLUSTERED)
{
- testP2PFailover(numMessages, false,true, false);
+ testP2PFailover(numMessages, false, true, false);
}
}
public void testP2PFailoverTransacted() throws Exception
{
- testP2PFailover(numMessages, true,true, false);
+ testP2PFailover(numMessages, true,true, true);
}
public void testP2PFailoverTransactedWithMessagesLeftToConsumeAndProduce() throws Exception
@@ -177,17 +181,16 @@ public class FailoverTest extends Failov
// Currently the cluster does not support transactions that span a failover
if (CLUSTERED)
{
- testP2PFailover(numMessages, false,false, false);
+ testP2PFailover(numMessages, false, false, false);
}
}
-
- private void testP2PFailover(int totalMessages, boolean consumeAll, boolean produceAll , boolean transacted) throws JMSException, NamingException
+ private void testP2PFailover(int totalMessages, boolean consumeAll, boolean produceAll , boolean transacted) throws Exception
{
init(transacted, Session.AUTO_ACKNOWLEDGE);
runP2PFailover(totalMessages,consumeAll, produceAll , transacted);
}
-
- protected void runP2PFailover(int totalMessages, boolean consumeAll, boolean produceAll , boolean transacted) throws JMSException, NamingException
+
+ private void runP2PFailover(int totalMessages, boolean consumeAll, boolean produceAll , boolean transacted) throws Exception
{
int toProduce = totalMessages;
@@ -254,7 +257,7 @@ public class FailoverTest extends Failov
//evil ignore IE.
}
}
-
+
public void testClientAckFailover() throws Exception
{
init(false, Session.CLIENT_ACKNOWLEDGE);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org