activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject activemq-artemis git commit: NO-JIRA Improving ExpiryMessageTest
Date Sat, 23 Jun 2018 14:34:46 GMT
Repository: activemq-artemis
Updated Branches:
  refs/heads/master 2c8b6b4ae -> 901e5c4a9


NO-JIRA Improving ExpiryMessageTest


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

Branch: refs/heads/master
Commit: 901e5c4a98c9b1ecb5f82f129c889023a1077374
Parents: 2c8b6b4
Author: Clebert Suconic <clebertsuconic@apache.org>
Authored: Sat Jun 23 10:33:33 2018 -0400
Committer: Clebert Suconic <clebertsuconic@apache.org>
Committed: Sat Jun 23 10:33:33 2018 -0400

----------------------------------------------------------------------
 .../integration/jms/client/ExpiryMessageTest.java  | 17 ++++-------------
 1 file changed, 4 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/901e5c4a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/ExpiryMessageTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/ExpiryMessageTest.java
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/ExpiryMessageTest.java
index b5091dc..53a3637 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/ExpiryMessageTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/ExpiryMessageTest.java
@@ -25,6 +25,7 @@ import javax.jms.Topic;
 import org.apache.activemq.artemis.api.core.SimpleString;
 import org.apache.activemq.artemis.api.core.management.AddressControl;
 import org.apache.activemq.artemis.core.config.Configuration;
+import org.apache.activemq.artemis.junit.Wait;
 import org.apache.activemq.artemis.tests.integration.management.ManagementControlHelper;
 import org.apache.activemq.artemis.tests.util.JMSTestBase;
 import org.junit.Test;
@@ -42,7 +43,7 @@ public class ExpiryMessageTest extends JMSTestBase {
 
    @Override
    protected Configuration createDefaultConfig(boolean netty) throws Exception {
-      return super.createDefaultConfig(netty).setMessageExpiryScanPeriod(1000);
+      return super.createDefaultConfig(netty).setMessageExpiryScanPeriod(50);
    }
 
    @Test
@@ -64,7 +65,7 @@ public class ExpiryMessageTest extends JMSTestBase {
       conn = cf.createConnection();
       Session sess = conn.createSession(true, Session.SESSION_TRANSACTED);
       MessageProducer prod = sess.createProducer(topic);
-      prod.setTimeToLive(1000);
+      prod.setTimeToLive(100);
 
       for (int i = 0; i < 100; i++) {
          TextMessage txt = sess.createTextMessage("txt");
@@ -75,17 +76,7 @@ public class ExpiryMessageTest extends JMSTestBase {
 
       conn.close();
 
-      // minimal time needed
-      Thread.sleep(2000);
-
-      long timeout = System.currentTimeMillis() + 10000;
-
-      // We will wait some time, but we will wait as minimal as possible
-      while (control.getMessageCount() != 0 && System.currentTimeMillis() > timeout)
{
-         Thread.sleep(100);
-      }
-
-      assertEquals(0, control.getMessageCount());
+      Wait.assertEquals(0, control::getMessageCount);
 
    }
 


Mime
View raw message