diff options
author | Keith Wall <kwall@apache.org> | 2012-02-09 16:55:30 +0000 |
---|---|---|
committer | Keith Wall <kwall@apache.org> | 2012-02-09 16:55:30 +0000 |
commit | 4f17ae00b4ec517bdf25fb1e70728c73390199f5 (patch) | |
tree | 2a86b83d29598bea6b74858578461718365eb803 | |
parent | 261f22ddb7a44201a9f9581e6016f0ad83ed625d (diff) | |
download | qpid-python-4f17ae00b4ec517bdf25fb1e70728c73390199f5.tar.gz |
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@1242399 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | qpid/java/systests/src/main/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutTestCase.java | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutTestCase.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutTestCase.java index 19f5073ec5..499e280ff3 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutTestCase.java +++ b/qpid/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(); } /** |