activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject [1/2] activemq-artemis git commit: NO-JIRA: Fixing ReceiveTest::testReceiveImmediate
Date Tue, 11 Jul 2017 15:35:46 GMT
Repository: activemq-artemis
Updated Branches:
  refs/heads/master 83256c5d0 -> 82f071ff4


NO-JIRA: Fixing ReceiveTest::testReceiveImmediate


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

Branch: refs/heads/master
Commit: eab0cb587c128fbc45ee997bbcfda922b6717f2c
Parents: 83256c5
Author: Clebert Suconic <clebertsuconic@apache.org>
Authored: Tue Jul 11 08:36:16 2017 -0400
Committer: Clebert Suconic <clebertsuconic@apache.org>
Committed: Tue Jul 11 11:15:11 2017 -0400

----------------------------------------------------------------------
 .../tests/integration/client/ReceiveTest.java   | 22 +++++++++-----------
 1 file changed, 10 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/eab0cb58/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ReceiveTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ReceiveTest.java
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ReceiveTest.java
index 89b4b77..40b8333 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ReceiveTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ReceiveTest.java
@@ -31,6 +31,7 @@ import org.apache.activemq.artemis.core.server.ActiveMQServer;
 import org.apache.activemq.artemis.core.server.Queue;
 import org.apache.activemq.artemis.api.core.RoutingType;
 import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
+import org.apache.activemq.artemis.tests.util.RandomUtil;
 import org.apache.activemq.artemis.tests.util.Wait;
 import org.junit.Assert;
 import org.junit.Before;
@@ -38,9 +39,9 @@ import org.junit.Test;
 
 public class ReceiveTest extends ActiveMQTestBase {
 
-   SimpleString addressA = new SimpleString("addressA");
+   SimpleString addressA;
 
-   SimpleString queueA = new SimpleString("queueA");
+   SimpleString queueA;
 
    private ServerLocator locator;
 
@@ -51,6 +52,9 @@ public class ReceiveTest extends ActiveMQTestBase {
    public void setUp() throws Exception {
       super.setUp();
 
+      addressA = RandomUtil.randomSimpleString();
+      queueA = RandomUtil.randomSimpleString();
+
       locator = createInVMNonHALocator();
       server = createServer(false);
       server.start();
@@ -131,9 +135,8 @@ public class ReceiveTest extends ActiveMQTestBase {
 
    @Test
    public void testReceiveImmediate() throws Exception {
-
       // forces perfect round robin
-      locator.setConsumerMaxRate(1);
+      locator.setConsumerWindowSize(0);
       ClientSessionFactory cf = createSessionFactory(locator);
       ClientSession sendSession = cf.createSession(false, true, true);
       ClientProducer cp = sendSession.createProducer(addressA);
@@ -149,15 +152,10 @@ public class ReceiveTest extends ActiveMQTestBase {
 
       final Queue queue = server.locateQueue(queueA);
 
-      Wait.waitFor(new Wait.Condition() {
-         @Override
-         public boolean isSatisfied() throws Exception {
-            return queue.getMessageCount() == 3;
-         }
-      });
+      Wait.waitFor(() -> queue.getMessageCount() == 3, 500, 100);
 
-      Assert.assertNotNull(cc2.receive(5000));
-      Assert.assertNotNull(cc.receive(5000));
+      Assert.assertNotNull(cc2.receiveImmediate());
+      Assert.assertNotNull(cc.receiveImmediate());
       if (cc.receiveImmediate() == null) {
          Assert.assertNotNull(cc2.receiveImmediate());
       }


Mime
View raw message