You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2018/08/09 23:35:35 UTC

[1/2] activemq-artemis git commit: This closes #2233

Repository: activemq-artemis
Updated Branches:
  refs/heads/master 6bdfcd04f -> 01800233c


This closes #2233


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

Branch: refs/heads/master
Commit: 01800233c3bca68a9fe2cf279c2c4d66b2dd7990
Parents: 6bdfcd0 1171f01
Author: Clebert Suconic <cl...@apache.org>
Authored: Thu Aug 9 19:35:27 2018 -0400
Committer: Clebert Suconic <cl...@apache.org>
Committed: Thu Aug 9 19:35:27 2018 -0400

----------------------------------------------------------------------
 .../artemis/ra/inflow/ActiveMQActivation.java   |  4 +-
 .../integration/ra/ResourceAdapterTest.java     | 65 ++++++++++++++++++++
 2 files changed, 67 insertions(+), 2 deletions(-)
----------------------------------------------------------------------



[2/2] activemq-artemis git commit: ARTEMIS-2020 Use prefixes when useJNDI=false in RA

Posted by cl...@apache.org.
ARTEMIS-2020 Use prefixes when useJNDI=false in RA


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

Branch: refs/heads/master
Commit: 1171f01b30468abfa4d6f2de6401802ad59d4c4f
Parents: 6bdfcd0
Author: Justin Bertram <jb...@apache.org>
Authored: Thu Aug 9 11:20:46 2018 -0500
Committer: Clebert Suconic <cl...@apache.org>
Committed: Thu Aug 9 19:35:27 2018 -0400

----------------------------------------------------------------------
 .../artemis/ra/inflow/ActiveMQActivation.java   |  4 +-
 .../integration/ra/ResourceAdapterTest.java     | 65 ++++++++++++++++++++
 2 files changed, 67 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/1171f01b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQActivation.java
----------------------------------------------------------------------
diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQActivation.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQActivation.java
index ede1b01..3a89369 100644
--- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQActivation.java
+++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQActivation.java
@@ -572,10 +572,10 @@ public class ActiveMQActivation {
          ActiveMQRALogger.LOGGER.instantiatingDestination(spec.getDestinationType(), spec.getDestination());
 
          if (Topic.class.getName().equals(spec.getDestinationType())) {
-            destination = (ActiveMQDestination) ActiveMQJMSClient.createTopic(spec.getDestination());
+            destination = (ActiveMQDestination) ActiveMQJMSClient.createTopic((spec.getTopicPrefix() == null ? "" : spec.getTopicPrefix()) + spec.getDestination());
             isTopic = true;
          } else {
-            destination = (ActiveMQDestination) ActiveMQJMSClient.createQueue(spec.getDestination());
+            destination = (ActiveMQDestination) ActiveMQJMSClient.createQueue((spec.getQueuePrefix() == null ? "" : spec.getQueuePrefix()) + spec.getDestination());
          }
       }
    }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/1171f01b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/ResourceAdapterTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/ResourceAdapterTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/ResourceAdapterTest.java
index 811cc29..6216bb3 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/ResourceAdapterTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/ResourceAdapterTest.java
@@ -26,12 +26,17 @@ import java.util.Set;
 import java.util.concurrent.CountDownLatch;
 
 import org.apache.activemq.artemis.api.core.DiscoveryGroupConfiguration;
+import org.apache.activemq.artemis.api.core.RoutingType;
+import org.apache.activemq.artemis.api.core.SimpleString;
 import org.apache.activemq.artemis.api.core.UDPBroadcastEndpointFactory;
 import org.apache.activemq.artemis.api.core.client.ClientSession;
 import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
 import org.apache.activemq.artemis.api.core.client.ServerLocator;
+import org.apache.activemq.artemis.api.core.management.AddressControl;
+import org.apache.activemq.artemis.api.core.management.ResourceNames;
 import org.apache.activemq.artemis.api.jms.ActiveMQJMSClient;
 import org.apache.activemq.artemis.core.client.impl.ServerLocatorImpl;
+import org.apache.activemq.artemis.core.server.impl.AddressInfo;
 import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
 import org.apache.activemq.artemis.jms.client.ActiveMQDestination;
 import org.apache.activemq.artemis.ra.ActiveMQResourceAdapter;
@@ -101,6 +106,66 @@ public class ResourceAdapterTest extends ActiveMQRATestBase {
    }
 
    @Test
+   public void testQueuePrefixWhenUseJndiIsFalse() throws Exception {
+      final String prefix = "jms.queue.";
+      final String destinationName = "test";
+      final SimpleString prefixedDestinationName = SimpleString.toSimpleString(prefix + destinationName);
+      server.createQueue(prefixedDestinationName, RoutingType.ANYCAST, prefixedDestinationName, null, false, false);
+      ActiveMQResourceAdapter ra = new ActiveMQResourceAdapter();
+      ra.setConnectorClassName(INVM_CONNECTOR_FACTORY);
+      ra.start(new BootstrapContext());
+      Connection conn = ra.getDefaultActiveMQConnectionFactory().createConnection();
+      conn.close();
+
+      ActiveMQActivationSpec spec = new ActiveMQActivationSpec();
+      spec.setResourceAdapter(ra);
+      spec.setUseJNDI(false);
+      spec.setDestinationType("javax.jms.Queue");
+      spec.setDestination(destinationName);
+      spec.setQueuePrefix(prefix);
+      spec.setMaxSession(1);
+      spec.setSetupAttempts(1);
+
+      ActiveMQActivation activation = new ActiveMQActivation(ra, new MessageEndpointFactory(), spec);
+
+      activation.start();
+
+      assertEquals(1, server.locateQueue(prefixedDestinationName).getConsumerCount());
+
+      activation.stop();
+   }
+
+   @Test
+   public void testTopicPrefixWhenUseJndiIsFalse() throws Exception {
+      final String prefix = "jms.topic.";
+      final String destinationName = "test";
+      final SimpleString prefixedDestinationName = SimpleString.toSimpleString(prefix + destinationName);
+      server.addAddressInfo(new AddressInfo(prefixedDestinationName).addRoutingType(RoutingType.MULTICAST));
+      ActiveMQResourceAdapter ra = new ActiveMQResourceAdapter();
+      ra.setConnectorClassName(INVM_CONNECTOR_FACTORY);
+      ra.start(new BootstrapContext());
+      Connection conn = ra.getDefaultActiveMQConnectionFactory().createConnection();
+      conn.close();
+
+      ActiveMQActivationSpec spec = new ActiveMQActivationSpec();
+      spec.setResourceAdapter(ra);
+      spec.setUseJNDI(false);
+      spec.setDestinationType("javax.jms.Topic");
+      spec.setDestination(destinationName);
+      spec.setTopicPrefix(prefix);
+      spec.setMaxSession(1);
+      spec.setSetupAttempts(1);
+
+      ActiveMQActivation activation = new ActiveMQActivation(ra, new MessageEndpointFactory(), spec);
+
+      activation.start();
+
+      assertEquals(1, ((AddressControl)server.getManagementService().getResource(ResourceNames.ADDRESS + prefixedDestinationName)).getQueueNames().length);
+
+      activation.stop();
+   }
+
+   @Test
    public void testStartStop() throws Exception {
       ActiveMQResourceAdapter qResourceAdapter = new ActiveMQResourceAdapter();
       qResourceAdapter.setConnectorClassName(INVM_CONNECTOR_FACTORY);