activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject [2/3] activemq-artemis git commit: ARTEMIS-1848 auto-delete auto-created queue for OpenWire
Date Thu, 03 May 2018 20:44:44 GMT
ARTEMIS-1848 auto-delete auto-created queue for OpenWire


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/3016db69
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/3016db69
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/3016db69

Branch: refs/heads/master
Commit: 3016db699d7cf8c11e45c3828a714278c57807b2
Parents: 893f219
Author: Justin Bertram <jbertram@apache.org>
Authored: Thu May 3 12:18:51 2018 -0500
Committer: Justin Bertram <jbertram@apache.org>
Committed: Thu May 3 14:22:20 2018 -0500

----------------------------------------------------------------------
 .../core/protocol/openwire/amq/AMQSession.java       |  2 +-
 .../integration/openwire/SimpleOpenWireTest.java     | 15 ++++++++++++++-
 2 files changed, 15 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3016db69/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQSession.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQSession.java
b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQSession.java
index c607ca4..c3b1a20 100644
--- a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQSession.java
+++ b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQSession.java
@@ -249,7 +249,7 @@ public class AMQSession implements SessionCallback {
                         routingTypeToUse = as.getDefaultAddressRoutingType();
                      }
                   }
-                  coreSession.createQueue(addressToUse, queueNameToUse, routingTypeToUse,
null, isTemporary, true);
+                  coreSession.createQueue(addressToUse, queueNameToUse, routingTypeToUse,
null, isTemporary, true, true);
                   connection.addKnownDestination(queueName);
                } else {
                   hasQueue = false;

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3016db69/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/SimpleOpenWireTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/SimpleOpenWireTest.java
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/SimpleOpenWireTest.java
index 618249b..7a86e8c 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/SimpleOpenWireTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/SimpleOpenWireTest.java
@@ -919,10 +919,12 @@ public class SimpleOpenWireTest extends BasicOpenWireTest {
    }
 
    @Test
-   public void testAutoDestinationCreationOnConsumer() throws JMSException {
+   public void testAutoDestinationCreationAndDeletionOnConsumer() throws Exception {
       AddressSettings addressSetting = new AddressSettings();
       addressSetting.setAutoCreateQueues(true);
       addressSetting.setAutoCreateAddresses(true);
+      addressSetting.setAutoDeleteQueues(true);
+      addressSetting.setAutoDeleteAddresses(true);
 
       String address = "foo";
       server.getAddressSettingsRepository().addMatch(address, addressSetting);
@@ -935,11 +937,22 @@ public class SimpleOpenWireTest extends BasicOpenWireTest {
 
       MessageConsumer consumer = session.createConsumer(queue);
 
+      assertTrue(Wait.waitFor(() -> (server.locateQueue(SimpleString.toSimpleString("foo"))
!= null), 2000, 100));
+      assertTrue(Wait.waitFor(() -> (server.getAddressInfo(SimpleString.toSimpleString("foo"))
!= null), 2000, 100));
+
       MessageProducer producer = session.createProducer(null);
       producer.send(queue, message);
 
       TextMessage message1 = (TextMessage) consumer.receive(1000);
       assertTrue(message1.getText().equals(message.getText()));
+
+      assertNotNull(server.locateQueue(SimpleString.toSimpleString("foo")));
+
+      consumer.close();
+      connection.close();
+
+      assertTrue(Wait.waitFor(() -> (server.locateQueue(SimpleString.toSimpleString("foo"))
== null), 2000, 100));
+      assertTrue(Wait.waitFor(() -> (server.getAddressInfo(SimpleString.toSimpleString("foo"))
== null), 2000, 100));
    }
 
    @Test


Mime
View raw message