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 14:16:57 UTC

[1/3] activemq-artemis git commit: NO-JIRA: Added a AMQP JMS LargeMessage test

Repository: activemq-artemis
Updated Branches:
  refs/heads/master d3c83898f -> be61adc00


NO-JIRA: Added a AMQP JMS LargeMessage test


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

Branch: refs/heads/master
Commit: 8a73fdd3a243ac8c3f0cd8063bd43ed96bfa82d0
Parents: d3c8389
Author: Howard Gao <ho...@gmail.com>
Authored: Fri Apr 27 20:22:28 2018 +0800
Committer: Clebert Suconic <cl...@apache.org>
Committed: Fri Apr 27 10:12:34 2018 -0400

----------------------------------------------------------------------
 .../amqp/JMSDurableConsumerTest.java            | 65 ++++++++++++++++++++
 1 file changed, 65 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/8a73fdd3/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/JMSDurableConsumerTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/JMSDurableConsumerTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/JMSDurableConsumerTest.java
index 31de59d..13453a0 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/JMSDurableConsumerTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/JMSDurableConsumerTest.java
@@ -16,6 +16,7 @@
  */
 package org.apache.activemq.artemis.tests.integration.amqp;
 
+import java.io.Serializable;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.concurrent.CountDownLatch;
@@ -29,10 +30,12 @@ import javax.jms.Message;
 import javax.jms.MessageConsumer;
 import javax.jms.MessageListener;
 import javax.jms.MessageProducer;
+import javax.jms.ObjectMessage;
 import javax.jms.Session;
 import javax.jms.TextMessage;
 import javax.jms.Topic;
 
+import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
 import org.apache.activemq.artemis.core.server.ActiveMQServer;
 import org.apache.activemq.artemis.tests.util.Wait;
 import org.junit.Test;
@@ -221,4 +224,66 @@ public class JMSDurableConsumerTest extends JMSClientTestSupport {
          connection.close();
       }
    }
+
+   @Test(timeout = 30000)
+   public void testDurableConsumerLarge() throws Exception {
+      String durableClientId = getTopicName() + "-ClientId";
+
+      Connection connection = createConnection(durableClientId);
+      try {
+         Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+         Topic topic = session.createTopic(getTopicName());
+         final MessageConsumer consumer1 = session.createDurableSubscriber(topic, "DurbaleSub1");
+         final MessageConsumer consumer2 = session.createDurableSubscriber(topic, "DurbaleSub2");
+         MessageProducer producer = session.createProducer(topic);
+         producer.setDeliveryMode(DeliveryMode.PERSISTENT);
+         connection.start();
+
+         ObjectMessage objMessage = session.createObjectMessage();
+         BigObject bigObject = new BigObject(ActiveMQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE);
+         objMessage.setObject(bigObject);
+         producer.send(objMessage);
+
+         final AtomicReference<Message> msg1 = new AtomicReference<>();
+         final AtomicReference<Message> msg2 = new AtomicReference<>();
+
+         assertTrue(Wait.waitFor(new Wait.Condition() {
+
+            @Override
+            public boolean isSatisfied() throws Exception {
+               msg1.set(consumer1.receiveNoWait());
+               return msg1.get() != null;
+            }
+         }, TimeUnit.SECONDS.toMillis(25), TimeUnit.MILLISECONDS.toMillis(200)));
+
+         assertTrue(Wait.waitFor(new Wait.Condition() {
+
+            @Override
+            public boolean isSatisfied() throws Exception {
+               msg2.set(consumer2.receiveNoWait());
+               return msg2.get() != null;
+            }
+         }, TimeUnit.SECONDS.toMillis(25), TimeUnit.MILLISECONDS.toMillis(200)));
+
+         assertNotNull("Should have received a message by now.", msg1.get());
+         assertTrue("Should be an instance of TextMessage", msg1.get() instanceof ObjectMessage);
+
+         assertNotNull("Should have received a message by now.", msg2.get());
+         assertTrue("Should be an instance of TextMessage", msg2.get() instanceof ObjectMessage);
+      } finally {
+         connection.close();
+      }
+   }
+
+   public static class BigObject implements Serializable {
+
+      private char[] contents;
+
+      public BigObject(int size) {
+         contents = new char[size];
+         for (int i = 0; i < size; i++) {
+            contents[i] = 'X';
+         }
+      }
+   }
 }


[2/3] activemq-artemis git commit: NO-JIRA: Simplifying AMQP JMS LargeMessage test

Posted by cl...@apache.org.
NO-JIRA: Simplifying AMQP JMS LargeMessage test


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

Branch: refs/heads/master
Commit: 6d2a464319034ce01190a72c7ed9105a8270de2b
Parents: 8a73fdd
Author: Clebert Suconic <cl...@apache.org>
Authored: Fri Apr 27 10:12:28 2018 -0400
Committer: Clebert Suconic <cl...@apache.org>
Committed: Fri Apr 27 10:16:37 2018 -0400

----------------------------------------------------------------------
 .../amqp/JMSDurableConsumerTest.java            | 32 +++++---------------
 1 file changed, 7 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6d2a4643/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/JMSDurableConsumerTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/JMSDurableConsumerTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/JMSDurableConsumerTest.java
index 13453a0..00ea410 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/JMSDurableConsumerTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/JMSDurableConsumerTest.java
@@ -38,6 +38,7 @@ import javax.jms.Topic;
 import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
 import org.apache.activemq.artemis.core.server.ActiveMQServer;
 import org.apache.activemq.artemis.tests.util.Wait;
+import org.junit.Assert;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
@@ -244,32 +245,13 @@ public class JMSDurableConsumerTest extends JMSClientTestSupport {
          objMessage.setObject(bigObject);
          producer.send(objMessage);
 
-         final AtomicReference<Message> msg1 = new AtomicReference<>();
-         final AtomicReference<Message> msg2 = new AtomicReference<>();
+         ObjectMessage msg1 = (ObjectMessage)consumer1.receive(5000);
+         Assert.assertNotNull(msg1);
+         assertTrue("Should be an instance of TextMessage", msg1 instanceof ObjectMessage);
 
-         assertTrue(Wait.waitFor(new Wait.Condition() {
-
-            @Override
-            public boolean isSatisfied() throws Exception {
-               msg1.set(consumer1.receiveNoWait());
-               return msg1.get() != null;
-            }
-         }, TimeUnit.SECONDS.toMillis(25), TimeUnit.MILLISECONDS.toMillis(200)));
-
-         assertTrue(Wait.waitFor(new Wait.Condition() {
-
-            @Override
-            public boolean isSatisfied() throws Exception {
-               msg2.set(consumer2.receiveNoWait());
-               return msg2.get() != null;
-            }
-         }, TimeUnit.SECONDS.toMillis(25), TimeUnit.MILLISECONDS.toMillis(200)));
-
-         assertNotNull("Should have received a message by now.", msg1.get());
-         assertTrue("Should be an instance of TextMessage", msg1.get() instanceof ObjectMessage);
-
-         assertNotNull("Should have received a message by now.", msg2.get());
-         assertTrue("Should be an instance of TextMessage", msg2.get() instanceof ObjectMessage);
+         ObjectMessage msg2 = (ObjectMessage)consumer2.receive(5000);
+         assertNotNull("Should have received a message by now.", msg2);
+         assertTrue("Should be an instance of TextMessage", msg2 instanceof ObjectMessage);
       } finally {
          connection.close();
       }


[3/3] activemq-artemis git commit: This closes #2049

Posted by cl...@apache.org.
This closes #2049


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

Branch: refs/heads/master
Commit: be61adc00254ca88820062e82b710e32c8204381
Parents: d3c8389 6d2a464
Author: Clebert Suconic <cl...@apache.org>
Authored: Fri Apr 27 10:16:51 2018 -0400
Committer: Clebert Suconic <cl...@apache.org>
Committed: Fri Apr 27 10:16:51 2018 -0400

----------------------------------------------------------------------
 .../amqp/JMSDurableConsumerTest.java            | 47 ++++++++++++++++++++
 1 file changed, 47 insertions(+)
----------------------------------------------------------------------