You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by or...@apache.org on 2019/07/24 10:34:32 UTC

[qpid-broker-j] branch master updated (5d295c0 -> 679d577)

This is an automated email from the ASF dual-hosted git repository.

orudyy pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/qpid-broker-j.git.


    from 5d295c0  QPID-8342: [Broker-J] Virtual host auto-creation policy should handle creation of duplicate nodes
     new 9484c5a  NO-JIRA: Remove unused import in test class
     new ca0d0d7  QPID-8345: [Broker-J][AMQP 1.0] Dequeue messages sent non-transactionally as pre-settled
     new 679d577  QPID-8344: [Broker-J] Fix link registry dump generation

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../store/berkeleydb/BDBAMQP10V0UpgradeTest.java   | 12 ------
 .../server/protocol/v1_0/ConsumerTarget_1_0.java   | 41 +++++++++++++++++-
 .../server/protocol/v1_0/LinkRegistryImpl.java     |  7 ++--
 .../server/protocol/v1_0/LinkRegistryTest.java     | 49 ++++++++++++++++++++++
 .../protocol/v1_0/messaging/TransferTest.java      |  8 +++-
 5 files changed, 100 insertions(+), 17 deletions(-)


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


[qpid-broker-j] 03/03: QPID-8344: [Broker-J] Fix link registry dump generation

Posted by or...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

orudyy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/qpid-broker-j.git

commit 679d577b5ed1a25ff75035922a07813227c844bd
Author: Alex Rudyy <or...@apache.org>
AuthorDate: Sat Jul 20 22:07:16 2019 +0100

    QPID-8344: [Broker-J] Fix link registry dump generation
---
 .../server/protocol/v1_0/LinkRegistryImpl.java     |  7 ++--
 .../server/protocol/v1_0/LinkRegistryTest.java     | 49 ++++++++++++++++++++++
 2 files changed, 53 insertions(+), 3 deletions(-)

diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/LinkRegistryImpl.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/LinkRegistryImpl.java
index ede4d5b..2710f22 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/LinkRegistryImpl.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/LinkRegistryImpl.java
@@ -288,12 +288,13 @@ public class LinkRegistryImpl<S extends BaseSource, T extends BaseTarget> implem
             private Map<String, LinkDump> _sendingLinks = new LinkedHashMap<>();
             private Map<String, LinkDump> _receivingLinks = new LinkedHashMap<>();
 
-            Map<String, LinkDump> getSendingLinks()
+
+            public Map<String, LinkDump> getSendingLinks()
             {
                 return Collections.unmodifiableMap(_sendingLinks);
             }
 
-            Map<String, LinkDump> getReceivingLinks()
+            public Map<String, LinkDump> getReceivingLinks()
             {
                 return Collections.unmodifiableMap(_receivingLinks);
             }
@@ -301,7 +302,7 @@ public class LinkRegistryImpl<S extends BaseSource, T extends BaseTarget> implem
 
         private Map<String, ContainerDump> _containers = new LinkedHashMap<>();
 
-        Map<String, ContainerDump> getContainers()
+        public Map<String, ContainerDump> getContainers()
         {
             return Collections.unmodifiableMap(_containers);
         }
diff --git a/broker-plugins/amqp-1-0-protocol/src/test/java/org/apache/qpid/server/protocol/v1_0/LinkRegistryTest.java b/broker-plugins/amqp-1-0-protocol/src/test/java/org/apache/qpid/server/protocol/v1_0/LinkRegistryTest.java
index ed91f28..c271fad 100644
--- a/broker-plugins/amqp-1-0-protocol/src/test/java/org/apache/qpid/server/protocol/v1_0/LinkRegistryTest.java
+++ b/broker-plugins/amqp-1-0-protocol/src/test/java/org/apache/qpid/server/protocol/v1_0/LinkRegistryTest.java
@@ -24,8 +24,10 @@ import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertSame;
 import static org.mockito.Mockito.mock;
 
+import java.util.Map;
 import java.util.regex.Pattern;
 
+import com.fasterxml.jackson.databind.ObjectMapper;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -158,4 +160,51 @@ public class LinkRegistryTest extends UnitTestBase
         assertEquals((long) dump.getContainers().get("testContainerId").getReceivingLinks().size(), (long) 0);
         assertEquals((long) dump.getContainers().get("testContainerId").getSendingLinks().size(), (long) 1);
     }
+
+    @Test
+    public void testDump() throws Exception
+    {
+        _linkRegistry.getSendingLink("testContainerId1", "testLinkName");
+        _linkRegistry.getReceivingLink("testContainerId2", "testLinkName");
+        final LinkRegistryImpl.LinkRegistryDump dump = _linkRegistry.dump();
+
+        assertNotNull(dump);
+        final Map<String, LinkRegistryImpl.LinkRegistryDump.ContainerDump> containers = dump.getContainers();
+
+        assertNotNull(containers);
+        assertEquals(2, containers.size());
+
+        final LinkRegistryImpl.LinkRegistryDump.ContainerDump container1 = containers.get("testContainerId1");
+        final LinkRegistryImpl.LinkRegistryDump.ContainerDump container2 = containers.get("testContainerId2");
+
+        assertNotNull(container1);
+        assertNotNull(container2);
+
+        assertEquals(0, container1.getReceivingLinks().size());
+        assertEquals(1, container1.getSendingLinks().size());
+        assertEquals(1, container2.getReceivingLinks().size());
+        assertEquals(0, container2.getSendingLinks().size());
+
+        final LinkRegistryImpl.LinkRegistryDump.ContainerDump.LinkDump link1 =
+                container1.getSendingLinks().get("testLinkName");
+
+        final LinkRegistryImpl.LinkRegistryDump.ContainerDump.LinkDump link2 =
+                container2.getReceivingLinks().get("testLinkName");
+
+        assertNotNull(link1);
+        assertNotNull(link2);
+    }
+
+    @Test
+    public void testDumpIsSerializable() throws Exception
+    {
+        _linkRegistry.getSendingLink("testContainerId1", "testLinkName");
+        _linkRegistry.getReceivingLink("testContainerId2", "testLinkName");
+        final LinkRegistryImpl.LinkRegistryDump dump = _linkRegistry.dump();
+        final ObjectMapper objectMapper = new ObjectMapper();
+        final String data = objectMapper.writeValueAsString(dump);
+
+        assertNotNull(data);
+    }
+
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


[qpid-broker-j] 01/03: NO-JIRA: Remove unused import in test class

Posted by or...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

orudyy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/qpid-broker-j.git

commit 9484c5a9839c5ecaf4907c3ca78893e0ab5d87d6
Author: Alex Rudyy <or...@apache.org>
AuthorDate: Wed Jul 24 09:37:56 2019 +0100

    NO-JIRA: Remove unused import in test class
---
 .../qpid/server/store/berkeleydb/BDBAMQP10V0UpgradeTest.java | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/bdbstore/systests/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBAMQP10V0UpgradeTest.java b/bdbstore/systests/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBAMQP10V0UpgradeTest.java
index c8c5e9a..924bf0a 100644
--- a/bdbstore/systests/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBAMQP10V0UpgradeTest.java
+++ b/bdbstore/systests/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBAMQP10V0UpgradeTest.java
@@ -23,18 +23,11 @@ import static org.apache.qpid.systests.JmsTestBase.DEFAULT_BROKER_CONFIG;
 import static org.hamcrest.CoreMatchers.equalTo;
 import static org.hamcrest.CoreMatchers.instanceOf;
 import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.not;
 import static org.hamcrest.CoreMatchers.notNullValue;
 import static org.junit.Assert.assertThat;
-import static org.junit.Assert.fail;
 import static org.junit.Assume.assumeThat;
 
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
 import java.security.MessageDigest;
-import java.util.Collections;
-import java.util.Map;
 
 import javax.jms.BytesMessage;
 import javax.jms.Connection;
@@ -43,17 +36,12 @@ import javax.jms.MessageConsumer;
 import javax.jms.Queue;
 import javax.jms.Session;
 
-import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
 import org.apache.qpid.server.model.Protocol;
-import org.apache.qpid.server.util.FileUtils;
 import org.apache.qpid.server.util.StringUtil;
-import org.apache.qpid.server.virtualhostnode.berkeleydb.BDBVirtualHostNode;
-import org.apache.qpid.systests.JmsTestBase;
 import org.apache.qpid.tests.utils.ConfigItem;
-import org.apache.qpid.tests.utils.RunBrokerAdmin;
 
 /**
  *


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


[qpid-broker-j] 02/03: QPID-8345: [Broker-J][AMQP 1.0] Dequeue messages sent non-transactionally as pre-settled

Posted by or...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

orudyy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/qpid-broker-j.git

commit ca0d0d7ec22c31364c1adc32f5dffee0392ff230
Author: Alex Rudyy <or...@apache.org>
AuthorDate: Wed Jul 24 11:31:42 2019 +0100

    QPID-8345: [Broker-J][AMQP 1.0] Dequeue messages sent non-transactionally as pre-settled
---
 .../server/protocol/v1_0/ConsumerTarget_1_0.java   | 41 +++++++++++++++++++++-
 .../protocol/v1_0/messaging/TransferTest.java      |  8 ++++-
 2 files changed, 47 insertions(+), 2 deletions(-)

diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/ConsumerTarget_1_0.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/ConsumerTarget_1_0.java
index bc87141..5f9283e 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/ConsumerTarget_1_0.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/ConsumerTarget_1_0.java
@@ -240,9 +240,14 @@ class ConsumerTarget_1_0 extends AbstractConsumerTarget<ConsumerTarget_1_0>
 
             if (_linkEndpoint.isAttached())
             {
-                if (SenderSettleMode.SETTLED.equals(getEndpoint().getSendingSettlementMode()))
+                boolean sendPreSettled = SenderSettleMode.SETTLED.equals(getEndpoint().getSendingSettlementMode());
+                if (sendPreSettled)
                 {
                     transfer.setSettled(true);
+                    if (_acquires && _transactionId == null)
+                    {
+                        transfer.setState(new Accepted());
+                    }
                 }
                 else
                 {
@@ -302,6 +307,11 @@ class ConsumerTarget_1_0 extends AbstractConsumerTarget<ConsumerTarget_1_0>
                 }
                 getSession().getAMQPConnection().registerMessageDelivered(message.getSize());
                 getEndpoint().transfer(transfer, false);
+
+                if (sendPreSettled && _acquires && _transactionId == null)
+                {
+                    handleAcquiredEntrySentPareSettledNonTransactional(entry, consumer);
+                }
             }
             else
             {
@@ -319,6 +329,35 @@ class ConsumerTarget_1_0 extends AbstractConsumerTarget<ConsumerTarget_1_0>
         }
     }
 
+    private void handleAcquiredEntrySentPareSettledNonTransactional(final MessageInstance entry,
+                                                                    final MessageInstanceConsumer consumer)
+    {
+        if (entry.makeAcquisitionUnstealable(consumer))
+        {
+            final ServerTransaction txn = _linkEndpoint.getAsyncAutoCommitTransaction();
+            txn.dequeue(entry.getEnqueueRecord(),
+                        new ServerTransaction.Action()
+                        {
+                            @Override
+                            public void postCommit()
+                            {
+                                entry.delete();
+                            }
+
+                            @Override
+                            public void onRollback()
+                            {
+                                entry.release(consumer);
+                            }
+                        });
+            txn.commit();
+        }
+        else
+        {
+            entry.release(consumer);
+        }
+    }
+
     @Override
     public void flushBatched()
     {
diff --git a/systests/protocol-tests-amqp-1-0/src/test/java/org/apache/qpid/tests/protocol/v1_0/messaging/TransferTest.java b/systests/protocol-tests-amqp-1-0/src/test/java/org/apache/qpid/tests/protocol/v1_0/messaging/TransferTest.java
index 53a8af6..94a1249 100644
--- a/systests/protocol-tests-amqp-1-0/src/test/java/org/apache/qpid/tests/protocol/v1_0/messaging/TransferTest.java
+++ b/systests/protocol-tests-amqp-1-0/src/test/java/org/apache/qpid/tests/protocol/v1_0/messaging/TransferTest.java
@@ -737,7 +737,6 @@ public class TransferTest extends BrokerAdminUsingTestBase
                                                      .begin().consumeResponse()
                                                      .attachRole(Role.RECEIVER)
                                                      .attachSourceAddress(BrokerAdmin.TEST_QUEUE_NAME)
-                                                     .attachRcvSettleMode(ReceiverSettleMode.FIRST)
                                                      .attachSndSettleMode(SenderSettleMode.SETTLED)
                                                      .attach().consumeResponse(Attach.class);
             Attach attach = interaction.getLatestResponse(Attach.class);
@@ -760,6 +759,13 @@ public class TransferTest extends BrokerAdminUsingTestBase
             // verify no unexpected performative received by closing the connection
             interaction.doCloseConnection();
         }
+
+        if (getBrokerAdmin().isQueueDepthSupported())
+        {
+            assertThat(getBrokerAdmin().getQueueDepthMessages(BrokerAdmin.TEST_QUEUE_NAME), is(equalTo(0)));
+        }
+        getBrokerAdmin().putMessageOnQueue(BrokerAdmin.TEST_QUEUE_NAME, "test");
+        assertThat(Utils.receiveMessage(_brokerAddress, BrokerAdmin.TEST_QUEUE_NAME), is(equalTo("test")));
     }
 
     @Test


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org