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/04/27 01:18:56 UTC

activemq-artemis git commit: NO-JIRA Fixing Test only

Repository: activemq-artemis
Updated Branches:
  refs/heads/master 07f00e8dd -> e937c9903


NO-JIRA Fixing Test only

no feature or semantic changes on this commit, hence no JIRA


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

Branch: refs/heads/master
Commit: e937c9903f9fa429c23fe50a3fd49e99ad2de0b9
Parents: 07f00e8
Author: Clebert Suconic <cl...@apache.org>
Authored: Thu Apr 26 21:16:38 2018 -0400
Committer: Clebert Suconic <cl...@apache.org>
Committed: Thu Apr 26 21:18:40 2018 -0400

----------------------------------------------------------------------
 .../integration/openwire/BasicOpenWireTest.java |  6 ++--
 .../openwire/amq/RedeliveryPolicyTest.java      | 30 ++++++++++++++++----
 2 files changed, 27 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/e937c990/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/BasicOpenWireTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/BasicOpenWireTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/BasicOpenWireTest.java
index bc4829e..0a079f2 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/BasicOpenWireTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/BasicOpenWireTest.java
@@ -66,11 +66,11 @@ public class BasicOpenWireTest extends OpenWireTestBase {
       System.setProperty("org.apache.activemq.transport.AbstractInactivityMonitor.keepAliveTime", "5");
       createFactories();
       SimpleString coreQueue = new SimpleString(queueName);
-      this.server.createQueue(coreQueue, RoutingType.ANYCAST, coreQueue, null, false, false, -1, false, true);
+      this.server.createQueue(coreQueue, RoutingType.ANYCAST, coreQueue, null, true, false, -1, false, true);
       testQueues.put(queueName, coreQueue);
 
       SimpleString coreQueue2 = new SimpleString(queueName2);
-      this.server.createQueue(coreQueue2, RoutingType.ANYCAST, coreQueue2, null, false, false, -1, false, true);
+      this.server.createQueue(coreQueue2, RoutingType.ANYCAST, coreQueue2, null, true, false, -1, false, true);
       testQueues.put(queueName2, coreQueue2);
 
       SimpleString durableQueue = new SimpleString(durableQueueName);
@@ -151,7 +151,7 @@ public class BasicOpenWireTest extends OpenWireTestBase {
       SimpleString coreQ = testQueues.get(qname);
       if (coreQ == null) {
          coreQ = new SimpleString(qname);
-         this.server.createQueue(coreQ, RoutingType.ANYCAST, coreQ, null, false, false, -1, false, true);
+         this.server.createQueue(coreQ, RoutingType.ANYCAST, coreQ, null, true, false, -1, false, true);
          testQueues.put(qname, coreQ);
       }
    }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/e937c990/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/RedeliveryPolicyTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/RedeliveryPolicyTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/RedeliveryPolicyTest.java
index 030d522..7ee0eb9 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/RedeliveryPolicyTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/RedeliveryPolicyTest.java
@@ -16,6 +16,9 @@
  */
 package org.apache.activemq.artemis.tests.integration.openwire.amq;
 
+import javax.jms.DeliveryMode;
+import javax.jms.Destination;
+import javax.jms.Message;
 import javax.jms.MessageConsumer;
 import javax.jms.MessageProducer;
 import javax.jms.Session;
@@ -34,6 +37,13 @@ import org.junit.Test;
  */
 public class RedeliveryPolicyTest extends BasicOpenWireTest {
 
+   @Override
+   public void setUp() throws Exception {
+      // making data persistent makes it easier to debug it with print-data
+      this.realStore = true;
+      super.setUp();
+   }
+
    @Test
    public void testGetNext() throws Exception {
 
@@ -506,6 +516,12 @@ public class RedeliveryPolicyTest extends BasicOpenWireTest {
       session.commit();
    }
 
+   private void send(Session session, MessageProducer producer, Destination destination, String text) throws Exception {
+      Message message = session.createTextMessage(text);
+      message.setStringProperty("texto", text);
+      producer.send(destination, message);
+   }
+
    @Test
    public void testRedeliveryPolicyPerDestination() throws Exception {
       RedeliveryPolicy queuePolicy = new RedeliveryPolicy();
@@ -525,22 +541,24 @@ public class RedeliveryPolicyTest extends BasicOpenWireTest {
       map.put(new ActiveMQTopic(">"), topicPolicy);
       map.put(new ActiveMQQueue(">"), queuePolicy);
 
+      connection.setClientID("id1");
       connection.start();
       Session session = connection.createSession(true, Session.AUTO_ACKNOWLEDGE);
       ActiveMQQueue queue = new ActiveMQQueue("TEST");
-      ActiveMQTopic topic = new ActiveMQTopic("TEST");
+      ActiveMQTopic topic = new ActiveMQTopic("TESTTOPIC");
       this.makeSureCoreQueueExist("TEST");
 
       MessageProducer producer = session.createProducer(null);
+      producer.setDeliveryMode(DeliveryMode.PERSISTENT);
 
       MessageConsumer queueConsumer = session.createConsumer(queue);
-      MessageConsumer topicConsumer = session.createConsumer(topic);
+      MessageConsumer topicConsumer = session.createDurableSubscriber(topic, "tp1");
 
       // Send the messages
-      producer.send(queue, session.createTextMessage("1st"));
-      producer.send(queue, session.createTextMessage("2nd"));
-      producer.send(topic, session.createTextMessage("1st"));
-      producer.send(topic, session.createTextMessage("2nd"));
+      send(session, producer, queue,"1st");
+      send(session, producer, queue,"2nd");
+      send(session, producer, topic,"1st");
+      send(session, producer, topic,"2nd");
 
       session.commit();