fix intermittent failure with test, was forwarding to same destination which made it timing dependent

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@917628 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gary Tully 2010-03-01 18:17:51 +00:00
parent 37b5d7beed
commit 50dadbb877
1 changed files with 8 additions and 1 deletions

View File

@ -201,6 +201,8 @@ public class FailoverConsumerOutstandingCommitTest {
@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 @@ public class FailoverConsumerOutstandingCommitTest {
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 @@ public class FailoverConsumerOutstandingCommitTest {
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 @@ public class FailoverConsumerOutstandingCommitTest {
assertTrue("another message was received", messagesReceived.await(20, TimeUnit.SECONDS));
assertEquals("get message 1 eventually", MESSAGE_TEXT + "1", receivedMessages.get(2).getText());
connection.close();
}