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 5a74b8b  NO-JIRA fixing test failures
5a74b8b is described below

commit 5a74b8b34df0c800793831bccb40fbd0f1286c13
Author: Clebert Suconic <clebertsuco...@apache.org>
AuthorDate: Wed Mar 13 11:36:14 2019 -0400

    NO-JIRA fixing test failures
---
 .../management/AcceptorControlTest.java            | 22 ++++++++++++++++++----
 .../management/SecurityNotificationTest.java       | 18 +++++++++++++-----
 .../integration/mqtt/imported/MQTTFQQNTest.java    | 22 ----------------------
 .../imported/MQTTInterceptorPropertiesTest.java    | 13 -------------
 .../tests/integration/server/QueueQueryTest.java   |  1 +
 5 files changed, 32 insertions(+), 44 deletions(-)

diff --git 
a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/AcceptorControlTest.java
 
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/AcceptorControlTest.java
index c6ba3dc..2a37038 100644
--- 
a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/AcceptorControlTest.java
+++ 
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/AcceptorControlTest.java
@@ -135,19 +135,33 @@ public class AcceptorControlTest extends 
ManagementTestBase {
 
       acceptorControl.stop();
 
-      Assert.assertEquals(usingCore() ? 5 : 1, 
notifListener.getNotifications().size());
-      Notification notif = notifListener.getNotifications().get(usingCore() ? 
2 : 0);
+      Assert.assertEquals(usingCore() ? 7 : 1, 
notifListener.getNotifications().size());
+
+      int i = findNotification(notifListener, 
CoreNotificationType.ACCEPTOR_STOPPED);
+
+      Notification notif = notifListener.getNotifications().get(i);
       Assert.assertEquals(CoreNotificationType.ACCEPTOR_STOPPED, 
notif.getType());
       Assert.assertEquals(NettyAcceptorFactory.class.getName(), 
notif.getProperties().getSimpleStringProperty(new 
SimpleString("factory")).toString());
 
       acceptorControl.start();
 
-      Assert.assertEquals(usingCore() ? 10 : 2, 
notifListener.getNotifications().size());
-      notif = notifListener.getNotifications().get(usingCore() ? 7 : 1);
+      i = findNotification(notifListener, 
CoreNotificationType.ACCEPTOR_STARTED);
+      notif = notifListener.getNotifications().get(i);
       Assert.assertEquals(CoreNotificationType.ACCEPTOR_STARTED, 
notif.getType());
       Assert.assertEquals(NettyAcceptorFactory.class.getName(), 
notif.getProperties().getSimpleStringProperty(new 
SimpleString("factory")).toString());
    }
 
+   private int findNotification(SimpleNotificationService.Listener 
notifListener, CoreNotificationType type) {
+      int i = 0;
+      for (i = 0; i < notifListener.getNotifications().size(); i++) {
+         if (notifListener.getNotifications().get(i).getType().equals(type)) {
+            break;
+         }
+      }
+      Assert.assertTrue(i < notifListener.getNotifications().size());
+      return i;
+   }
+
    // Package protected ---------------------------------------------
 
    // Protected -----------------------------------------------------
diff --git 
a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/SecurityNotificationTest.java
 
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/SecurityNotificationTest.java
index b8d5231..08accec 100644
--- 
a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/SecurityNotificationTest.java
+++ 
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/SecurityNotificationTest.java
@@ -112,11 +112,19 @@ public class SecurityNotificationTest extends 
ActiveMQTestBase {
       } catch (Exception e) {
       }
 
-      ClientMessage[] notifications = 
SecurityNotificationTest.consumeMessages(1, notifConsumer);
-      Assert.assertEquals(SECURITY_PERMISSION_VIOLATION.toString(), 
notifications[0].getObjectProperty(ManagementHelper.HDR_NOTIFICATION_TYPE).toString());
-      Assert.assertEquals("guest", 
notifications[0].getObjectProperty(ManagementHelper.HDR_USER).toString());
-      Assert.assertEquals(address.toString(), 
notifications[0].getObjectProperty(ManagementHelper.HDR_ADDRESS).toString());
-      Assert.assertEquals(CheckType.CREATE_DURABLE_QUEUE.toString(), 
notifications[0].getObjectProperty(ManagementHelper.HDR_CHECK_TYPE).toString());
+      ClientMessage[] notifications = 
SecurityNotificationTest.consumeMessages(2, notifConsumer);
+
+      int i = 0;
+      for (i = 0; i < notifications.length; i++) {
+         if 
(SECURITY_PERMISSION_VIOLATION.toString().equals(notifications[i].getObjectProperty(ManagementHelper.HDR_NOTIFICATION_TYPE).toString()))
 {
+            break;
+         }
+      }
+      Assert.assertTrue(i < notifications.length);
+      Assert.assertEquals(SECURITY_PERMISSION_VIOLATION.toString(), 
notifications[i].getObjectProperty(ManagementHelper.HDR_NOTIFICATION_TYPE).toString());
+      Assert.assertEquals("guest", 
notifications[i].getObjectProperty(ManagementHelper.HDR_USER).toString());
+      Assert.assertEquals(address.toString(), 
notifications[i].getObjectProperty(ManagementHelper.HDR_ADDRESS).toString());
+      Assert.assertEquals(CheckType.CREATE_DURABLE_QUEUE.toString(), 
notifications[i].getObjectProperty(ManagementHelper.HDR_CHECK_TYPE).toString());
 
       guestSession.close();
    }
diff --git 
a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/MQTTFQQNTest.java
 
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/MQTTFQQNTest.java
index 565ce42..5324590 100644
--- 
a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/MQTTFQQNTest.java
+++ 
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/MQTTFQQNTest.java
@@ -16,18 +16,13 @@
  */
 package org.apache.activemq.artemis.tests.integration.mqtt.imported;
 
-import java.lang.reflect.Field;
 import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 
 import org.apache.activemq.artemis.api.core.SimpleString;
 import org.apache.activemq.artemis.core.postoffice.Binding;
-import org.apache.activemq.artemis.core.protocol.mqtt.MQTTSession;
 import org.apache.activemq.artemis.core.server.QueueQueryResult;
-import org.junit.After;
-import org.junit.Before;
 import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -36,23 +31,6 @@ public class MQTTFQQNTest extends MQTTTestSupport {
 
    private static final Logger LOG = 
LoggerFactory.getLogger(MQTTFQQNTest.class);
 
-   @Override
-   @Before
-   public void setUp() throws Exception {
-      Field sessions = MQTTSession.class.getDeclaredField("SESSIONS");
-      sessions.setAccessible(true);
-      sessions.set(null, new ConcurrentHashMap<>());
-      super.setUp();
-
-   }
-
-   @Override
-   @After
-   public void tearDown() throws Exception {
-      super.tearDown();
-
-   }
-
    @Test
    public void testMQTTSubNames() throws Exception {
       final MQTTClientProvider subscriptionProvider = getMQTTClientProvider();
diff --git 
a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/MQTTInterceptorPropertiesTest.java
 
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/MQTTInterceptorPropertiesTest.java
index c95a462..eae7dba 100644
--- 
a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/MQTTInterceptorPropertiesTest.java
+++ 
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/MQTTInterceptorPropertiesTest.java
@@ -16,9 +16,7 @@
  */
 package org.apache.activemq.artemis.tests.integration.mqtt.imported;
 
-import java.lang.reflect.Field;
 import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 
@@ -27,25 +25,14 @@ import io.netty.handler.codec.mqtt.MqttMessage;
 import io.netty.handler.codec.mqtt.MqttPublishMessage;
 import org.apache.activemq.artemis.api.core.ActiveMQException;
 import org.apache.activemq.artemis.core.protocol.mqtt.MQTTInterceptor;
-import org.apache.activemq.artemis.core.protocol.mqtt.MQTTSession;
 import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection;
 import org.apache.felix.resolver.util.ArrayMap;
-import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.ErrorCollector;
 
 public class MQTTInterceptorPropertiesTest extends MQTTTestSupport {
 
-   @Override
-   @Before
-   public void setUp() throws Exception {
-      Field sessions = MQTTSession.class.getDeclaredField("SESSIONS");
-      sessions.setAccessible(true);
-      sessions.set(null, new ConcurrentHashMap<>());
-      super.setUp();
-   }
-
    private static final String ADDRESS = "address";
    private static final String MESSAGE_TEXT = "messageText";
    private static final String RETAINED = "retained";
diff --git 
a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/QueueQueryTest.java
 
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/QueueQueryTest.java
index 3771119..b748733 100644
--- 
a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/QueueQueryTest.java
+++ 
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/QueueQueryTest.java
@@ -132,6 +132,7 @@ public class QueueQueryTest extends ActiveMQTestBase {
       server.getAddressSettingsRepository().addMatch(queueName.toString(), new 
AddressSettings());
       JMSContext c = new ActiveMQConnectionFactory("vm://0").createContext();
       c.createProducer().send(c.createQueue(queueName.toString()), 
c.createMessage());
+      Wait.assertEquals(1, server.locateQueue(queueName)::getMessageCount);
       QueueQueryResult queueQueryResult = server.queueQuery(queueName);
       assertTrue(queueQueryResult.isAutoCreateQueues());
       assertEquals(null, queueQueryResult.getFilterString());

Reply via email to