activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbert...@apache.org
Subject [27/48] activemq-artemis git commit: Fix ArtemisTest failures
Date Wed, 23 Nov 2016 17:43:28 GMT
Fix ArtemisTest failures


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

Branch: refs/heads/ARTEMIS-780
Commit: edc947d4f31c0d099c7cdd46a50e97ad3c544fbd
Parents: cf47a04
Author: jbertram <jbertram@apache.com>
Authored: Sat Nov 19 09:57:35 2016 -0600
Committer: jbertram <jbertram@apache.com>
Committed: Wed Nov 23 09:04:35 2016 -0600

----------------------------------------------------------------------
 .../activemq/artemis/cli/commands/Create.java   | 37 +++++++++++++++-----
 .../artemis/cli/commands/etc/broker.xml         |  2 +-
 .../apache/activemq/cli/test/ArtemisTest.java   | 18 +++++-----
 .../core/server/impl/ActiveMQServerImpl.java    |  3 +-
 4 files changed, 40 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/edc947d4/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java
----------------------------------------------------------------------
diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java
b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java
index 77a2e68..ae2734c 100644
--- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java
+++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java
@@ -187,11 +187,11 @@ public class Create extends InputAbstract {
    @Option(name = "--no-web", description = "This will remove the web server definition from
bootstrap.xml")
    boolean noWeb;
 
-   @Option(name = "--queues", description = "comma separated list of jms queues.")
+   @Option(name = "--queues", description = "comma separated list of queues.")
    String queues;
 
-   @Option(name = "--topics", description = "comma separated list of jms topics ")
-   String topics;
+   @Option(name = "--addresses", description = "comma separated list of addresses ")
+   String addresses;
 
    @Option(name = "--aio", description = "Force aio journal on the configuration regardless
of the library being available or not.")
    boolean forceLibaio;
@@ -616,7 +616,7 @@ public class Create extends InputAbstract {
          filters.put("${cluster-password}", "");
       }
 
-      applyJMSObjects(filters);
+      applyAddressesAndQueues(filters);
 
       if (home != null) {
          filters.put("${home}", path(home, false));
@@ -768,12 +768,33 @@ public class Create extends InputAbstract {
       for (String str : getQueueList()) {
          printWriter.println("      <queue name=\"" + str + "\"/>");
       }
-      for (String str : getTopicList()) {
+      for (String str : getAddressList()) {
          printWriter.println("      <topic name=\"" + str + "\"/>");
       }
       filters.put("${jms-list.settings}", writer.toString());
    }
 
+   /**
+    * It will create the address and queue configurations
+    */
+   private void applyAddressesAndQueues(HashMap<String, String> filters) {
+      StringWriter writer = new StringWriter();
+      PrintWriter printWriter = new PrintWriter(writer);
+      printWriter.println();
+
+      for (String str : getQueueList()) {
+         printWriter.println("         <address name=\"" + str + "\" type=\"anycast\">");
+         printWriter.println("            <queues>");
+         printWriter.println("               <queue name=\"" + str + "\" />");
+         printWriter.println("            </queues>");
+         printWriter.println("         </address>");
+      }
+      for (String str : getAddressList()) {
+         printWriter.println("         <address name=\"" + str + "\" type=\"multicast\"/>");
+      }
+      filters.put("${address-queue.settings}", writer.toString());
+   }
+
    private void performAutoTune(HashMap<String, String> filters, boolean aio, File
dataFolder) {
       if (noAutoTune) {
          filters.put("${journal-buffer.settings}", "");
@@ -846,11 +867,11 @@ public class Create extends InputAbstract {
       }
    }
 
-   private String[] getTopicList() {
-      if (topics == null) {
+   private String[] getAddressList() {
+      if (addresses == null) {
          return new String[0];
       } else {
-         return topics.split(",");
+         return addresses.split(",");
       }
    }
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/edc947d4/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/broker.xml
----------------------------------------------------------------------
diff --git a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/broker.xml
b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/broker.xml
index 62a82ec..3b67a09 100644
--- a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/broker.xml
+++ b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/broker.xml
@@ -106,7 +106,7 @@ ${cluster-security.settings}${cluster.settings}${replicated.settings}${shared-st
             <queues>
                <queue name="ExpiryQueue" />
             </queues>
-         </address>
+         </address>${address-queue.settings}
       </addresses>
 
    </core>

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/edc947d4/artemis-cli/src/test/java/org/apache/activemq/cli/test/ArtemisTest.java
----------------------------------------------------------------------
diff --git a/artemis-cli/src/test/java/org/apache/activemq/cli/test/ArtemisTest.java b/artemis-cli/src/test/java/org/apache/activemq/cli/test/ArtemisTest.java
index dd306e9..90f74ab 100644
--- a/artemis-cli/src/test/java/org/apache/activemq/cli/test/ArtemisTest.java
+++ b/artemis-cli/src/test/java/org/apache/activemq/cli/test/ArtemisTest.java
@@ -531,20 +531,20 @@ public class ArtemisTest {
       File instanceFolder = temporaryFolder.newFolder(folderName);
 
       setupAuth(instanceFolder);
-      String queues = "q1,t2";
-      String topics = "t1,t2";
+      String queues = "q1,q2";
+      String addresses = "a1,a2";
 
 
       // This is usually set when run from the command line via artemis.profile
-      Run.setEmbedded(false);
-      Artemis.main("create", instanceFolder.getAbsolutePath(), "--force", "--silent", "--no-web",
"--queues", queues, "--topics", topics, "--no-autotune", "--require-login");
+      Run.setEmbedded(true);
+      Artemis.main("create", instanceFolder.getAbsolutePath(), "--force", "--silent", "--no-web",
"--queues", queues, "--addresses", addresses, "--no-autotune", "--require-login");
       System.setProperty("artemis.instance", instanceFolder.getAbsolutePath());
 
       // Some exceptions may happen on the initialization, but they should be ok on start
the basic core protocol
       Artemis.internalExecute("run");
 
-      Artemis.main("queue", "create", "--name", "q1", "--address", "q1", "--user", "admin",
"--password", "admin");
-      Artemis.main("queue", "create", "--name", "t2", "--address", "t2", "--user", "admin",
"--password", "admin");
+//      Artemis.main("queue", "create", "--name", "q1", "--address", "q1", "--user", "admin",
"--password", "admin", "--autoCreateAddress");
+//      Artemis.main("queue", "create", "--name", "t2", "--address", "t2", "--user", "admin",
"--password", "admin", "--autoCreateAddress");
 
       try {
          try (ServerLocator locator = ServerLocatorImpl.newLocator("tcp://localhost:61616");
@@ -554,9 +554,9 @@ public class ArtemisTest {
                ClientSession.QueueQuery queryResult = coreSession.queueQuery(SimpleString.toSimpleString(str));
                assertTrue("Couldn't find queue " + str, queryResult.isExists());
             }
-            for (String str : topics.split(",")) {
-               ClientSession.QueueQuery queryResult = coreSession.queueQuery(SimpleString.toSimpleString(str));
-               assertTrue("Couldn't find topic " + str, queryResult.isExists());
+            for (String str : addresses.split(",")) {
+               ClientSession.AddressQuery queryResult = coreSession.addressQuery(SimpleString.toSimpleString(str));
+               assertTrue("Couldn't find address " + str, queryResult.isExists());
             }
          }
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/edc947d4/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
index 1c508df..b865361 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
@@ -614,7 +614,6 @@ public class ActiveMQServerImpl implements ActiveMQServer {
       return postOffice.isAddressBound(SimpleString.toSimpleString(address));
    }
 
-   // TODO: this should probably look at the addresses too, not just queue bindings
    @Override
    public BindingQueryResult bindingQuery(SimpleString address) throws Exception {
       if (address == null) {
@@ -642,7 +641,7 @@ public class ActiveMQServerImpl implements ActiveMQServer {
          }
       }
 
-      return new BindingQueryResult(!names.isEmpty(), names, autoCreateJmsQueues, autoCreateJmsTopics);
+      return new BindingQueryResult(getAddressInfo(address) != null, names, autoCreateJmsQueues,
autoCreateJmsTopics);
    }
 
    @Override


Mime
View raw message