Author: kwall
Date: Thu Feb 9 16:55:30 2012
New Revision: 1242399
URL: http://svn.apache.org/viewvc?rev=1242399&view=rev
Log:
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.
Modified:
qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutTestCase.java
Modified:
qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutTestCase.java
URL:
http://svn.apache.org/viewvc/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutTestCase.java?rev=1242399&r1=1242398&r2=1242399&view=diff
==============================================================================
---
qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutTestCase.java
(original)
+++
qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutTestCase.java
Thu Feb 9 16:55:30 2012
@@ -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 TransactionTimeout
/**
* 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();
}
/**
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:[email protected]