This is an automated email from the ASF dual-hosted git repository.

clebertsuconic pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git


The following commit(s) were added to refs/heads/master by this push:
     new e857c1b  NO-JIRA Fixing test race on Wait (ProducerAutoCreateQueue)
e857c1b is described below

commit e857c1b9538f91b435ad180be974887e87569b5e
Author: Clebert Suconic <[email protected]>
AuthorDate: Wed Apr 15 14:34:25 2020 -0400

    NO-JIRA Fixing test race on Wait (ProducerAutoCreateQueue)
---
 .../openwire/amq/ProducerAutoCreateQueueTest.java      | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git 
a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/ProducerAutoCreateQueueTest.java
 
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/ProducerAutoCreateQueueTest.java
index e67fd65..5697ce5 100644
--- 
a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/ProducerAutoCreateQueueTest.java
+++ 
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/ProducerAutoCreateQueueTest.java
@@ -20,6 +20,7 @@ import org.apache.activemq.artemis.api.core.SimpleString;
 import org.apache.activemq.artemis.core.config.Configuration;
 import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
 import 
org.apache.activemq.artemis.tests.integration.openwire.BasicOpenWireTest;
+import org.apache.activemq.artemis.tests.util.Wait;
 import org.junit.Assert;
 import org.junit.Test;
 
@@ -72,8 +73,8 @@ public class ProducerAutoCreateQueueTest extends 
BasicOpenWireTest {
          }
       }
 
-      assertNotNull(server.getAddressInfo(new SimpleString("trash")));
-      assertEquals(0, server.getTotalMessageCount());
+      Wait.assertTrue(() -> server.getAddressInfo(new SimpleString("trash")) 
!= null);
+      Wait.assertEquals(0, server::getTotalMessageCount);
    }
 
    @Test
@@ -91,9 +92,9 @@ public class ProducerAutoCreateQueueTest extends 
BasicOpenWireTest {
          }
       }
 
-      assertNotNull(server.getAddressInfo(new SimpleString("trash")));
-      assertNotNull(server.locateQueue(new SimpleString("trash")));
-      assertEquals(1, server.getTotalMessageCount());
+      Wait.assertTrue(() -> server.getAddressInfo(new SimpleString("trash")) 
!= null);
+      Wait.assertTrue(() -> server.locateQueue(new SimpleString("trash")) != 
null);
+      Wait.assertEquals(1, server::getTotalMessageCount);
    }
 
    @Test
@@ -115,7 +116,8 @@ public class ProducerAutoCreateQueueTest extends 
BasicOpenWireTest {
          }
       }
 
-      assertNull(server.locateQueue(new SimpleString("trash")));
+      SimpleString queueName = SimpleString.toSimpleString("trash");
+      Wait.assertTrue(() -> server.locateQueue(queueName) == null);
    }
 
    @Test
@@ -138,7 +140,7 @@ public class ProducerAutoCreateQueueTest extends 
BasicOpenWireTest {
          }
       }
 
-      assertNotNull(server.locateQueue(new SimpleString("trash")));
-      assertNotNull(server.getAddressInfo(new SimpleString("trash")));
+      Wait.assertTrue(() -> server.locateQueue(new SimpleString("trash")) != 
null);
+      Wait.assertTrue(() -> server.getAddressInfo(new SimpleString("trash")) 
!= null);
    }
 }

Reply via email to