From ad10e6cfc117b48e09ade71b312a04f06200330a Mon Sep 17 00:00:00 2001 From: Keith Wall Date: Thu, 9 Feb 2012 16:55:30 +0000 Subject: QPID-3825: TransactionTimeoutTest.testProducerOpenCommit and others fails sporadically on slower boxes The test needs to sync() after sending the last test message in order that the test and broker start measuring the idle transaction from the same point in time. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1242399 13f79535-47bb-0310-9956-ffa450edef68 --- .../qpid/test/unit/transacted/TransactionTimeoutTestCase.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'java') diff --git a/java/systests/src/main/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutTestCase.java b/java/systests/src/main/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutTestCase.java index 19f5073ec5..499e280ff3 100644 --- a/java/systests/src/main/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutTestCase.java +++ b/java/systests/src/main/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutTestCase.java @@ -26,6 +26,7 @@ import org.apache.qpid.AMQException; import org.apache.qpid.client.AMQConnection; import org.apache.qpid.client.AMQConnectionURL; import org.apache.qpid.client.AMQQueue; +import org.apache.qpid.client.AMQSession; import org.apache.qpid.framing.AMQShortString; import org.apache.qpid.jms.ConnectionURL; import org.apache.qpid.jms.Session; @@ -137,16 +138,21 @@ public abstract class TransactionTimeoutTestCase extends QpidBrokerTestCase impl /** * Send a number of messages to the queue, optionally pausing after each. + * + * Need to sync to ensure that the Broker has received the message(s) in order + * the test and broker start timing the idle transaction from the same point in time. */ protected void send(int count, float delay) throws Exception { for (int i = 0; i < count; i++) { - sleep(delay); + sleep(delay); Message msg = _psession.createTextMessage(TEXT); msg.setIntProperty("i", i); - _producer.send(msg); + _producer.send(msg); } + + ((AMQSession)_psession).sync(); } /** -- cgit v1.2.1