activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject [41/50] [abbrv] activemq-artemis git commit: ARTEMIS-789 Fix TopicDestinationResource look up on Addr
Date Fri, 09 Dec 2016 19:49:25 GMT
ARTEMIS-789 Fix TopicDestinationResource look up on Addr


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

Branch: refs/heads/master
Commit: 61aec1ba747656d2c35c2e26958ae6d1c83cdd0f
Parents: 2dc6482
Author: Martyn Taylor <mtaylor@redhat.com>
Authored: Wed Nov 30 14:44:15 2016 +0000
Committer: Martyn Taylor <mtaylor@redhat.com>
Committed: Fri Dec 9 18:43:15 2016 +0000

----------------------------------------------------------------------
 .../artemis/rest/topic/TopicDestinationsResource.java    | 11 ++++++-----
 .../tests/integration/rest/RestDeserializationTest.java  |  6 ++++++
 2 files changed, 12 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/61aec1ba/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/topic/TopicDestinationsResource.java
----------------------------------------------------------------------
diff --git a/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/topic/TopicDestinationsResource.java
b/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/topic/TopicDestinationsResource.java
index af3e9c7..641bfb8 100644
--- a/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/topic/TopicDestinationsResource.java
+++ b/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/topic/TopicDestinationsResource.java
@@ -32,6 +32,7 @@ import java.util.concurrent.ConcurrentHashMap;
 import org.apache.activemq.artemis.api.core.ActiveMQException;
 import org.apache.activemq.artemis.api.core.SimpleString;
 import org.apache.activemq.artemis.api.core.client.ClientSession;
+import org.apache.activemq.artemis.core.server.RoutingType;
 import org.apache.activemq.artemis.jms.client.ActiveMQDestination;
 import org.apache.activemq.artemis.jms.client.ActiveMQTopic;
 import org.apache.activemq.artemis.jms.server.config.TopicConfiguration;
@@ -55,7 +56,7 @@ public class TopicDestinationsResource {
 
    @POST
    @Consumes("application/activemq.jms.topic+xml")
-   public Response createJmsQueue(@Context UriInfo uriInfo, Document document) {
+   public Response createJmsTopic(@Context UriInfo uriInfo, Document document) {
       ActiveMQRestLogger.LOGGER.debug("Handling POST request for \"" + uriInfo.getPath()
+ "\"");
 
       try {
@@ -65,9 +66,9 @@ public class TopicDestinationsResource {
          ClientSession session = manager.getSessionFactory().createSession(false, false,
false);
          try {
 
-            ClientSession.QueueQuery query = session.queueQuery(new SimpleString(topicName));
+            ClientSession.AddressQuery query = session.addressQuery(new SimpleString(topicName));
             if (!query.isExists()) {
-               session.createQueue(topicName, topicName, "__AMQX=-1", true);
+               session.createAddress(SimpleString.toSimpleString(topicName), RoutingType.MULTICAST,
true);
 
             } else {
                throw new WebApplicationException(Response.status(412).type("text/plain").entity("Queue
already exists.").build());
@@ -93,13 +94,13 @@ public class TopicDestinationsResource {
       if (topic == null) {
          ClientSession session = manager.getSessionFactory().createSession(false, false,
false);
          try {
-            ClientSession.QueueQuery query = session.queueQuery(new SimpleString(name));
+            ClientSession.AddressQuery query = session.addressQuery(new SimpleString(name));
             if (!query.isExists()) {
                System.err.println("Topic '" + name + "' does not exist");
                throw new WebApplicationException(Response.status(404).type("text/plain").entity("Topic
'" + name + "' does not exist").build());
             }
             DestinationSettings queueSettings = manager.getDefaultSettings();
-            boolean defaultDurable = queueSettings.isDurableSend() || query.isDurable();
+            boolean defaultDurable = queueSettings.isDurableSend();
 
             topic = createTopicResource(name, defaultDurable, queueSettings.getConsumerSessionTimeoutSeconds(),
queueSettings.isDuplicatesAllowed());
          } finally {

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/61aec1ba/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/rest/RestDeserializationTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/rest/RestDeserializationTest.java
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/rest/RestDeserializationTest.java
index 64086e2..b1472a4 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/rest/RestDeserializationTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/rest/RestDeserializationTest.java
@@ -30,6 +30,9 @@ import java.io.File;
 import java.io.Serializable;
 import java.io.StringReader;
 
+import org.apache.activemq.artemis.api.core.SimpleString;
+import org.apache.activemq.artemis.core.server.RoutingType;
+import org.apache.activemq.artemis.core.server.impl.AddressInfo;
 import org.apache.activemq.artemis.jms.client.ActiveMQDestination;
 import org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory;
 import org.apache.activemq.artemis.rest.HttpHeaderProperty;
@@ -82,6 +85,9 @@ public class RestDeserializationTest extends RestTestBase {
 
    @Test
    public void testWithoutBlackWhiteListTopic() throws Exception {
+
+      jmsServer.getActiveMQServer().createAddressInfo(new AddressInfo(SimpleString.toSimpleString("ordersTopic"),
RoutingType.MULTICAST));
+
       deployAndconfigureRESTService("rest-test.war");
 
       RestMessageContext topicContext = restConnection.createTopicContext("ordersTopic");


Mime
View raw message