activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbert...@apache.org
Subject [1/2] activemq-artemis git commit: ARTEMIS-882 Supporting lists on URIs
Date Fri, 09 Dec 2016 21:22:05 GMT
Repository: activemq-artemis
Updated Branches:
  refs/heads/master 6682072da -> 12f4e5eec


ARTEMIS-882 Supporting lists on URIs


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

Branch: refs/heads/master
Commit: dc472192f41875bd390f3f2f00af0f98b7c08c6c
Parents: 6682072
Author: Clebert Suconic <clebertsuconic@apache.org>
Authored: Fri Dec 9 12:47:40 2016 -0500
Committer: Clebert Suconic <clebertsuconic@apache.org>
Committed: Fri Dec 9 16:20:01 2016 -0500

----------------------------------------------------------------------
 .../artemis/api/core/client/ActiveMQClient.java |  2 +-
 .../core/client/impl/ServerLocatorImpl.java     |  4 +-
 .../serverLocator/TCPServerLocatorSchema.java   |  7 +--
 .../jms/client/ActiveMQConnectionFactory.java   |  2 +-
 .../artemis/tests/integration/jms/URITest.java  | 46 ++++++++++++++++++++
 5 files changed, 55 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc472192/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/client/ActiveMQClient.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/client/ActiveMQClient.java
b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/client/ActiveMQClient.java
index 0ad80fc..a07ef6d 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/client/ActiveMQClient.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/client/ActiveMQClient.java
@@ -289,7 +289,7 @@ public final class ActiveMQClient {
     */
    public static ServerLocator createServerLocator(final String url) throws Exception {
       ServerLocatorParser parser = new ServerLocatorParser();
-      return parser.newObject(new URI(url), null);
+      return parser.newObject(parser.expandURI(url), null);
    }
 
    /**

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc472192/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ServerLocatorImpl.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ServerLocatorImpl.java
b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ServerLocatorImpl.java
index beb1b13..949ef90 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ServerLocatorImpl.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ServerLocatorImpl.java
@@ -397,7 +397,9 @@ public final class ServerLocatorImpl implements ServerLocatorInternal,
Discovery
 
    public static ServerLocator newLocator(String uri) {
       try {
-         return newLocator(new URI(uri));
+         ServerLocatorParser parser = new ServerLocatorParser();
+         URI newURI = parser.expandURI(uri);
+         return parser.newObject(newURI, null);
       } catch (Exception e) {
          throw new RuntimeException(e);
       }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc472192/artemis-core-client/src/main/java/org/apache/activemq/artemis/uri/schema/serverLocator/TCPServerLocatorSchema.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/uri/schema/serverLocator/TCPServerLocatorSchema.java
b/artemis-core-client/src/main/java/org/apache/activemq/artemis/uri/schema/serverLocator/TCPServerLocatorSchema.java
index 9468a50..5a2724e 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/uri/schema/serverLocator/TCPServerLocatorSchema.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/uri/schema/serverLocator/TCPServerLocatorSchema.java
@@ -30,7 +30,8 @@ import org.apache.activemq.artemis.utils.IPV6Util;
 import org.apache.activemq.artemis.utils.uri.BeanSupport;
 import org.apache.activemq.artemis.utils.uri.SchemaConstants;
 
-public class TCPServerLocatorSchema extends AbstractServerLocatorSchema {
+public class
+TCPServerLocatorSchema extends AbstractServerLocatorSchema {
 
    @Override
    public String getSchemaName() {
@@ -45,9 +46,9 @@ public class TCPServerLocatorSchema extends AbstractServerLocatorSchema
{
       TransportConfiguration[] tcs = new TransportConfiguration[configurations.size()];
       configurations.toArray(tcs);
       if (options.isHa()) {
-         return ActiveMQClient.createServerLocatorWithHA(tcs);
+         return BeanSupport.setData(uri, ActiveMQClient.createServerLocatorWithHA(tcs), query);
       } else {
-         return ActiveMQClient.createServerLocatorWithoutHA(tcs);
+         return BeanSupport.setData(uri, ActiveMQClient.createServerLocatorWithoutHA(tcs),
query);
       }
    }
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc472192/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQConnectionFactory.java
----------------------------------------------------------------------
diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQConnectionFactory.java
b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQConnectionFactory.java
index 91dee3c..4d314ce 100644
--- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQConnectionFactory.java
+++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQConnectionFactory.java
@@ -204,7 +204,7 @@ public class ActiveMQConnectionFactory implements ConnectionFactoryOptions,
Exte
    public ActiveMQConnectionFactory(String url) {
       ConnectionFactoryParser cfParser = new ConnectionFactoryParser();
       try {
-         URI uri = new URI(url);
+         URI uri = cfParser.expandURI(url);
          serverLocator = ServerLocatorImpl.newLocator(uri);
          cfParser.populateObject(uri, this);
       } catch (Exception e) {

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc472192/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/URITest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/URITest.java
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/URITest.java
new file mode 100644
index 0000000..b66b10b
--- /dev/null
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/URITest.java
@@ -0,0 +1,46 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.activemq.artemis.tests.integration.jms;
+
+import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
+import org.apache.activemq.artemis.api.core.client.ServerLocator;
+import org.apache.activemq.artemis.api.jms.ActiveMQJMSClient;
+import org.apache.activemq.artemis.core.client.impl.ServerLocatorImpl;
+import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class URITest {
+
+   @Test
+   public void testParseURIs() throws Throwable {
+      ActiveMQConnectionFactory factory = ActiveMQJMSClient.createConnectionFactory("(tcp://localhost:61616,tcp://localhost:61617)?blockOnDurableSend=false",
"some name");
+      Assert.assertEquals(2, ((ServerLocatorImpl) factory.getServerLocator()).getInitialConnectors().length);
+
+      ActiveMQConnectionFactory factory2 = new ActiveMQConnectionFactory("(tcp://localhost:61614,tcp://localhost:61616)?blockOnDurableSend=false");
+      Assert.assertEquals(2, ((ServerLocatorImpl) factory2.getServerLocator()).getInitialConnectors().length);
+
+      ServerLocator locator = ServerLocatorImpl.newLocator("(tcp://localhost:61616,tcp://localhost:61617)?blockOnDurableSend=false");
+      Assert.assertEquals(2, ((ServerLocatorImpl) locator).getInitialConnectors().length);
+
+      ServerLocator locator2 = ActiveMQClient.createServerLocator("(tcp://localhost:61616,tcp://localhost:61617)?blockOnDurableSend=false");
+      Assert.assertEquals(2, ((ServerLocatorImpl) locator2).getInitialConnectors().length);
+
+   }
+
+}


Mime
View raw message