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 14FE7200BB3 for ; Tue, 27 Sep 2016 18:46:16 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 13AE2160AE5; Tue, 27 Sep 2016 16:46:16 +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 BA5BE160AF0 for ; Tue, 27 Sep 2016 18:46:14 +0200 (CEST) Received: (qmail 24857 invoked by uid 500); 27 Sep 2016 16:46:13 -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 24552 invoked by uid 99); 27 Sep 2016 16:46:13 -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; Tue, 27 Sep 2016 16:46:13 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 5B963E08AE; Tue, 27 Sep 2016 16:46:13 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: tabish@apache.org To: commits@activemq.apache.org Date: Tue, 27 Sep 2016 16:46:25 -0000 Message-Id: <8109e9c741054dc4863a05236ffa71d0@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [13/14] activemq git commit: https://issues.apache.org/jira/browse/AMQ-6422 - move delivery tracking to pumpoutbound and additional test that shows how the presettle case breaks. Thanks to Robbie Gemmell for the feedback archived-at: Tue, 27 Sep 2016 16:46:16 -0000 https://issues.apache.org/jira/browse/AMQ-6422 - move delivery tracking to pumpoutbound and additional test that shows how the presettle case breaks. Thanks to Robbie Gemmell for the feedback Project: http://git-wip-us.apache.org/repos/asf/activemq/repo Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/8e6fe414 Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/8e6fe414 Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/8e6fe414 Branch: refs/heads/activemq-5.14.x Commit: 8e6fe414ad9078e765d3f8579dcd2898636b9ea1 Parents: ebbb7ab Author: gtully Authored: Wed Sep 21 13:59:45 2016 +0100 Committer: Timothy Bish Committed: Tue Sep 27 12:16:05 2016 -0400 ---------------------------------------------------------------------- .../transport/amqp/protocol/AmqpSender.java | 2 +- .../amqp/interop/AmqpReceiverTest.java | 41 ++++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/activemq/blob/8e6fe414/activemq-amqp/src/main/java/org/apache/activemq/transport/amqp/protocol/AmqpSender.java ---------------------------------------------------------------------- diff --git a/activemq-amqp/src/main/java/org/apache/activemq/transport/amqp/protocol/AmqpSender.java b/activemq-amqp/src/main/java/org/apache/activemq/transport/amqp/protocol/AmqpSender.java index 75f2371..455e0b0 100644 --- a/activemq-amqp/src/main/java/org/apache/activemq/transport/amqp/protocol/AmqpSender.java +++ b/activemq-amqp/src/main/java/org/apache/activemq/transport/amqp/protocol/AmqpSender.java @@ -292,7 +292,6 @@ public class AmqpSender extends AmqpAbstractLink { } pumpOutbound(); - logicalDeliveryCount++; } @Override @@ -410,6 +409,7 @@ public class AmqpSender extends AmqpAbstractLink { } currentBuffer = null; currentDelivery = null; + logicalDeliveryCount++; } } else { return; http://git-wip-us.apache.org/repos/asf/activemq/blob/8e6fe414/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/interop/AmqpReceiverTest.java ---------------------------------------------------------------------- diff --git a/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/interop/AmqpReceiverTest.java b/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/interop/AmqpReceiverTest.java index c68e850..b73f087 100644 --- a/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/interop/AmqpReceiverTest.java +++ b/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/interop/AmqpReceiverTest.java @@ -225,6 +225,47 @@ public class AmqpReceiverTest extends AmqpClientTestSupport { @Test(timeout = 60000) @Repeat(repetitions = 1) + public void testPresettledReceiverReadsAllMessagesInNonFlowBatch() throws Exception { + final int MSG_COUNT = 100; + sendMessages(getTestName(), MSG_COUNT, false); + + AmqpClient client = createAmqpClient(); + AmqpConnection connection = client.connect(); + AmqpSession session = connection.createSession(); + + AmqpReceiver receiver = session.createReceiver("queue://" + getTestName(), null, false, true); + + QueueViewMBean queueView = getProxyToQueue(getTestName()); + assertEquals(MSG_COUNT, queueView.getQueueSize()); + assertEquals(0, queueView.getDispatchCount()); + + receiver.flow(20); + // consume less that flow + for (int j=0;j<10;j++) { + assertNotNull(receiver.receive(5, TimeUnit.SECONDS)); + } + + // flow more and consume all + receiver.flow(10); + for (int j=0;j<20;j++) { + assertNotNull(receiver.receive(5, TimeUnit.SECONDS)); + } + + // remainder + receiver.flow(70); + for (int j=0;j<70;j++) { + assertNotNull(receiver.receive(5, TimeUnit.SECONDS)); + } + + receiver.close(); + + assertEquals(0, queueView.getQueueSize()); + + connection.close(); + } + + @Test(timeout = 60000) + @Repeat(repetitions = 1) public void testTwoQueueReceiversOnSameConnectionReadMessagesNoDispositions() throws Exception { int MSG_COUNT = 4; sendMessages(getTestName(), MSG_COUNT, false);