Author: gtully
Date: Mon Mar 1 18:17:51 2010
New Revision: 917628
URL: http://svn.apache.org/viewvc?rev=917628&view=rev
Log:
fix intermittent failure with test, was forwarding to same destination which
made it timing dependent
Modified:
activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/failover/FailoverConsumerOutstandingCommitTest.java
Modified:
activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/failover/FailoverConsumerOutstandingCommitTest.java
URL:
http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/failover/FailoverConsumerOutstandingCommitTest.java?rev=917628&r1=917627&r2=917628&view=diff
==============================================================================
---
activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/failover/FailoverConsumerOutstandingCommitTest.java
(original)
+++
activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/failover/FailoverConsumerOutstandingCommitTest.java
Mon Mar 1 18:17:51 2010
@@ -201,6 +201,8 @@
@Override
public void commitTransaction(ConnectionContext context,
TransactionId xid, boolean onePhase) throws Exception {
+ // from the consumer perspective whether the commit completed
on the broker or
+ // not is irrelevant, the transaction is still in doubt in the
absence of a reply
if (doActualBrokerCommit) {
LOG.info("doing actual broker commit...");
super.commitTransaction(context, xid, onePhase);
@@ -231,6 +233,10 @@
final Session producerSession = connection.createSession(false,
Session.AUTO_ACKNOWLEDGE);
final Queue destination = producerSession.createQueue(QUEUE_NAME
+ "?consumer.prefetchSize=" + prefetch);
+
+ final Queue signalDestination = producerSession.createQueue(QUEUE_NAME
+ ".signal"
+ + "?consumer.prefetchSize=" + prefetch);
+
final Session consumerSession = connection.createSession(true,
Session.SESSION_TRANSACTED);
@@ -246,7 +252,7 @@
assertNotNull("got message", message);
receivedMessages.add((TextMessage) message);
try {
- produceMessage(consumerSession, destination, 1);
+ produceMessage(consumerSession, signalDestination, 1);
consumerSession.commit();
} catch (JMSException e) {
LOG.info("commit exception", e);
@@ -286,6 +292,7 @@
assertTrue("another message was received", messagesReceived.await(20,
TimeUnit.SECONDS));
assertEquals("get message 1 eventually", MESSAGE_TEXT + "1",
receivedMessages.get(2).getText());
+
connection.close();
}