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 <clebertsuco...@apache.org>
Authored: Fri Apr 27 10:12:28 2018 -0400
Committer: Clebert Suconic <clebertsuco...@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();
       }

Reply via email to