activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject [1/2] activemq-artemis git commit: ACTIVEMQ6-96 ensure connectionsAllowed work on invm acceptor URI
Date Tue, 05 May 2015 19:07:39 GMT
Repository: activemq-artemis
Updated Branches:
  refs/heads/master 7707a9c96 -> 59f35a400


ACTIVEMQ6-96 ensure connectionsAllowed work on invm acceptor URI


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

Branch: refs/heads/master
Commit: 03d1a9df8b4baddde857fc5c55853202a029098e
Parents: 7707a9c
Author: jbertram <jbertram@apache.org>
Authored: Tue May 5 10:39:36 2015 -0500
Committer: jbertram <jbertram@apache.org>
Committed: Tue May 5 10:51:33 2015 -0500

----------------------------------------------------------------------
 .../activemq/artemis/uri/InVMServerLocatorSchema.java  |  2 +-
 .../artemis/uri/InVMTransportConfigurationSchema.java  | 13 +++++++++++--
 .../org/apache/activemq/artemis/uri/InVMSchema.java    |  2 +-
 .../core/config/impl/FileConfigurationTest.java        |  3 +++
 .../test/resources/ConfigurationTest-full-config.xml   |  4 ++--
 5 files changed, 18 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/03d1a9df/artemis-core-client/src/main/java/org/apache/activemq/artemis/uri/InVMServerLocatorSchema.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/uri/InVMServerLocatorSchema.java
b/artemis-core-client/src/main/java/org/apache/activemq/artemis/uri/InVMServerLocatorSchema.java
index cb57306..d828c8d 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/uri/InVMServerLocatorSchema.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/uri/InVMServerLocatorSchema.java
@@ -37,7 +37,7 @@ public class InVMServerLocatorSchema extends AbstractServerLocatorSchema
    @Override
    protected ServerLocator internalNewObject(URI uri, Map<String, String> query, String
name) throws Exception
    {
-      TransportConfiguration tc = InVMTransportConfigurationSchema.createTransportConfiguration(uri,
name, "org.apache.activemq.artemis.core.remoting.impl.invm.InVMConnectorFactory");
+      TransportConfiguration tc = InVMTransportConfigurationSchema.createTransportConfiguration(uri,
query, name, "org.apache.activemq.artemis.core.remoting.impl.invm.InVMConnectorFactory");
       ServerLocator factory = ActiveMQClient.createServerLocatorWithoutHA(tc);
       return URISchema.setData(uri, factory, query);
    }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/03d1a9df/artemis-core-client/src/main/java/org/apache/activemq/artemis/uri/InVMTransportConfigurationSchema.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/uri/InVMTransportConfigurationSchema.java
b/artemis-core-client/src/main/java/org/apache/activemq/artemis/uri/InVMTransportConfigurationSchema.java
index a9ea8bc..722a89d 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/uri/InVMTransportConfigurationSchema.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/uri/InVMTransportConfigurationSchema.java
@@ -27,6 +27,11 @@ import java.util.Map;
 
 public class InVMTransportConfigurationSchema extends AbstractTransportConfigurationSchema
 {
+   /* This is the same as org.apache.activemq.artemis.core.remoting.impl.invm.TransportConstants.CONNECTIONS_ALLOWED,
+    * but this Maven module can't see that class.
+    */
+   public static final String CONNECTIONS_ALLOWED = "connectionsAllowed";
+
    @Override
    public String getSchemaName()
    {
@@ -37,7 +42,7 @@ public class InVMTransportConfigurationSchema extends AbstractTransportConfigura
    protected List<TransportConfiguration> internalNewObject(URI uri, Map<String,
String> query, String name) throws Exception
    {
       List<TransportConfiguration> configurations = new ArrayList<>();
-      configurations.add(createTransportConfiguration(uri, name, getFactoryName()));
+      configurations.add(createTransportConfiguration(uri, query, name, getFactoryName()));
       return configurations;
    }
 
@@ -52,10 +57,14 @@ public class InVMTransportConfigurationSchema extends AbstractTransportConfigura
       return "org.apache.activemq.artemis.core.remoting.impl.invm.InVMConnectorFactory";
    }
 
-   public static TransportConfiguration createTransportConfiguration(URI uri, String name,
String factoryName)
+   public static TransportConfiguration createTransportConfiguration(URI uri, Map<String,
String> query, String name, String factoryName)
    {
       Map<String, Object> inVmTransportConfig = new HashMap<>();
       inVmTransportConfig.put("serverId", uri.getHost());
+      if (query.containsKey(CONNECTIONS_ALLOWED))
+      {
+         inVmTransportConfig.put(CONNECTIONS_ALLOWED, query.get(CONNECTIONS_ALLOWED));
+      }
       return new TransportConfiguration(factoryName, inVmTransportConfig, name);
    }
 }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/03d1a9df/artemis-jms-client/src/main/java/org/apache/activemq/artemis/uri/InVMSchema.java
----------------------------------------------------------------------
diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/uri/InVMSchema.java
b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/uri/InVMSchema.java
index 366d7d0..f35366f 100644
--- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/uri/InVMSchema.java
+++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/uri/InVMSchema.java
@@ -37,7 +37,7 @@ public class InVMSchema extends AbstractCFSchema
       JMSConnectionOptions options = newConectionOptions(uri, query);
       ActiveMQConnectionFactory factory =
             ActiveMQJMSClient.createConnectionFactoryWithoutHA(options.getFactoryTypeEnum(),
-                                                               InVMTransportConfigurationSchema.createTransportConfiguration(uri,
name, "org.apache.activemq.artemis.core.remoting.impl.invm.InVMConnectorFactory"));
+                                                               InVMTransportConfigurationSchema.createTransportConfiguration(uri,
query, name, "org.apache.activemq.artemis.core.remoting.impl.invm.InVMConnectorFactory"));
       return setData(uri, factory, query);
    }
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/03d1a9df/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/FileConfigurationTest.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/FileConfigurationTest.java
b/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/FileConfigurationTest.java
index 6f93068..4a9ed43 100644
--- a/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/FileConfigurationTest.java
+++ b/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/FileConfigurationTest.java
@@ -36,6 +36,7 @@ import org.apache.activemq.artemis.core.config.DivertConfiguration;
 import org.apache.activemq.artemis.core.config.FileDeploymentManager;
 import org.apache.activemq.artemis.core.config.HAPolicyConfiguration;
 import org.apache.activemq.artemis.core.config.ha.LiveOnlyPolicyConfiguration;
+import org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants;
 import org.apache.activemq.artemis.core.security.Role;
 import org.apache.activemq.artemis.core.server.JournalType;
 import org.apache.activemq.artemis.core.settings.impl.SlowConsumerPolicy;
@@ -130,12 +131,14 @@ public class FileConfigurationTest extends ConfigurationImplTest
          {
             Assert.assertEquals("456", ac.getParams().get("tcpNoDelay"));
             Assert.assertEquals("44", ac.getParams().get("connectionTtl"));
+            Assert.assertEquals("92", ac.getParams().get(TransportConstants.CONNECTIONS_ALLOWED));
          }
          else
          {
             Assert.assertEquals("org.apache.activemq.artemis.core.remoting.impl.invm.InVMAcceptorFactory",
                                 ac.getFactoryClassName());
             Assert.assertEquals("0", ac.getParams().get("serverId"));
+            Assert.assertEquals("87", ac.getParams().get(org.apache.activemq.artemis.core.remoting.impl.invm.TransportConstants.CONNECTIONS_ALLOWED));
          }
       }
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/03d1a9df/artemis-server/src/test/resources/ConfigurationTest-full-config.xml
----------------------------------------------------------------------
diff --git a/artemis-server/src/test/resources/ConfigurationTest-full-config.xml b/artemis-server/src/test/resources/ConfigurationTest-full-config.xml
index 75f636c..0f81b75 100644
--- a/artemis-server/src/test/resources/ConfigurationTest-full-config.xml
+++ b/artemis-server/src/test/resources/ConfigurationTest-full-config.xml
@@ -64,8 +64,8 @@
          <connector name="connector2">vm://5</connector>
       </connectors>
       <acceptors>
-         <acceptor>tcp://0.0.0.0:61616?tcpNoDelay=456;connectionTtl=44</acceptor>
-   	   <acceptor>vm://0?e1=z1;e2=567</acceptor>
+         <acceptor>tcp://0.0.0.0:61616?tcpNoDelay=456;connectionTtl=44;connectionsAllowed=92</acceptor>
+   	     <acceptor>vm://0?e1=z1;e2=567;connectionsAllowed=87</acceptor>
       </acceptors>
       <broadcast-groups>
 	     <broadcast-group name="bg1">


Mime
View raw message