Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 3C21D2009FB for ; Fri, 6 May 2016 14:54:40 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 3AB52160A0C; Fri, 6 May 2016 12:54:40 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 82CDE1609F6 for ; Fri, 6 May 2016 14:54:39 +0200 (CEST) Received: (qmail 46112 invoked by uid 500); 6 May 2016 12:54:38 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 46101 invoked by uid 99); 6 May 2016 12:54:38 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 May 2016 12:54:38 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 4AAEFDFB79; Fri, 6 May 2016 12:54:38 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: gtully@apache.org To: commits@activemq.apache.org Message-Id: <87901a53e7db474894062176b97a0c80@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: activemq git commit: tackle ci intermittent failure - think with prefetch extension it is not guarenteed that second consumer will get a dispatch Date: Fri, 6 May 2016 12:54:38 +0000 (UTC) archived-at: Fri, 06 May 2016 12:54:40 -0000 Repository: activemq Updated Branches: refs/heads/master fc9ad9f02 -> 1de7e7e8a tackle ci intermittent failure - think with prefetch extension it is not guarenteed that second consumer will get a dispatch Project: http://git-wip-us.apache.org/repos/asf/activemq/repo Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/1de7e7e8 Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/1de7e7e8 Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/1de7e7e8 Branch: refs/heads/master Commit: 1de7e7e8a372e63d4fbae61ec8c111a179ff2413 Parents: fc9ad9f Author: gtully Authored: Fri May 6 13:54:12 2016 +0100 Committer: gtully Committed: Fri May 6 13:54:12 2016 +0100 ---------------------------------------------------------------------- .../transport/failover/FailoverTransactionTest.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/activemq/blob/1de7e7e8/activemq-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverTransactionTest.java ---------------------------------------------------------------------- diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverTransactionTest.java b/activemq-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverTransactionTest.java index 3d29ee0..bb02ffe 100644 --- a/activemq-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverTransactionTest.java +++ b/activemq-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverTransactionTest.java @@ -29,6 +29,8 @@ import org.apache.activemq.broker.ConnectionContext; import org.apache.activemq.broker.ConsumerBrokerExchange; import org.apache.activemq.broker.ProducerBrokerExchange; import org.apache.activemq.broker.region.RegionBroker; +import org.apache.activemq.broker.region.policy.PolicyEntry; +import org.apache.activemq.broker.region.policy.PolicyMap; import org.apache.activemq.broker.util.DestinationPathSeparatorBroker; import org.apache.activemq.command.ActiveMQDestination; import org.apache.activemq.command.ConsumerInfo; @@ -57,6 +59,7 @@ import java.net.URI; import java.util.ArrayDeque; import java.util.Deque; import java.util.NoSuchElementException; +import java.util.Random; import java.util.Stack; import java.util.Vector; import java.util.concurrent.CountDownLatch; @@ -75,6 +78,7 @@ public class FailoverTransactionTest extends TestSupport { private static final String TRANSPORT_URI = "tcp://localhost:0"; private String url; BrokerService broker; + final Random random = new Random(); public static Test suite() { return suite(FailoverTransactionTest.class); @@ -122,6 +126,12 @@ public class FailoverTransactionTest extends TestSupport { broker.addConnector(bindAddress); broker.setDeleteAllMessagesOnStartup(deleteAllMessagesOnStartup); + PolicyMap policyMap = new PolicyMap(); + PolicyEntry defaultEntry = new PolicyEntry(); + defaultEntry.setUsePrefetchExtension(false); + policyMap.setDefaultEntry(defaultEntry); + broker.setDestinationPolicy(policyMap); + url = broker.getTransportConnectors().get(0).getConnectUri().toString(); return broker; @@ -763,12 +773,12 @@ public class FailoverTransactionTest extends TestSupport { connection = cf.createConnection(); connection.start(); connections.add(connection); - final Session consumerSession1 = connection.createSession(true, Session.AUTO_ACKNOWLEDGE); + final Session consumerSession1 = connection.createSession(true, Session.SESSION_TRANSACTED); connection = cf.createConnection(); connection.start(); connections.add(connection); - final Session consumerSession2 = connection.createSession(true, Session.AUTO_ACKNOWLEDGE); + final Session consumerSession2 = connection.createSession(true, Session.SESSION_TRANSACTED); final MessageConsumer consumer1 = consumerSession1.createConsumer(destination); final MessageConsumer consumer2 = consumerSession2.createConsumer(destination); @@ -788,7 +798,7 @@ public class FailoverTransactionTest extends TestSupport { receivedMessages.add(msg); // give some variance to the runs - TimeUnit.SECONDS.sleep(pauseSeconds * 2); + TimeUnit.SECONDS.sleep(random.nextInt(5)); // should not get a second message as there are two messages and two consumers // and prefetch=1, but with failover and unordered connection restore it can get the second