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

commit 576e01dba67d4e8e04861ed3a0844c1e6207e89e
Author: Clebert Suconic <[email protected]>
AuthorDate: Sat Apr 18 18:53:59 2020 -0400

    ARTEMIS-2725 Implementing retries policy on tests
---
 .../apache/activemq/artemis/utils/RetryMethod.java | 27 ++++++
 .../apache/activemq/artemis/utils/RetryRule.java   | 96 ++++++++++++++++++++++
 pom.xml                                            | 11 ++-
 .../integration/amqp/JMSNonDestructiveTest.java    |  2 +-
 .../integration/cluster/bridge/BridgeTestBase.java |  6 ++
 .../distribution/ClusteredGroupingTest.java        |  5 ++
 .../integration/cluster/failover/FailoverTest.java |  5 ++
 .../cluster/failover/QuorumFailOverTest.java       |  7 ++
 .../cluster/failover/QuorumResultWaitTest.java     |  7 ++
 ...atedMultipleServerFailoverExtraBackupsTest.java |  7 ++
 .../failover/ReplicatedPagedFailoverTest.java      | 20 +++++
 .../paging/PageCountSyncOnNonTXTest.java           |  5 ++
 .../tests/integration/paging/PagingTest.java       |  7 ++
 .../tests/integration/remoting/ReconnectTest.java  |  5 ++
 .../integration/server/ScaleDownRemoveSFTest.java  |  5 ++
 .../artemis/tests/integration/stomp/StompTest.java | 29 +++----
 .../tests/integration/stomp/StompTestBase.java     |  5 ++
 .../tests/integration/xa/SessionFailureXATest.java |  5 ++
 .../smoke/replicationflow/SoakPagingTest.java      |  5 ++
 19 files changed, 243 insertions(+), 16 deletions(-)

diff --git 
a/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/RetryMethod.java
 
b/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/RetryMethod.java
new file mode 100644
index 0000000..21fa103
--- /dev/null
+++ 
b/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/RetryMethod.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.activemq.artemis.utils;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Retention(RetentionPolicy.RUNTIME)
+public @interface RetryMethod {
+   int retries();
+
+}
diff --git 
a/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/RetryRule.java
 
b/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/RetryRule.java
new file mode 100644
index 0000000..6792b5a
--- /dev/null
+++ 
b/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/RetryRule.java
@@ -0,0 +1,96 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.activemq.artemis.utils;
+
+import org.jboss.logging.Logger;
+import org.junit.internal.AssumptionViolatedException;
+import org.junit.rules.MethodRule;
+import org.junit.runners.model.FrameworkMethod;
+import org.junit.runners.model.Statement;
+
+/**
+ * Please use this only if you have to.
+ * Try to fix the test first.
+ */
+public class RetryRule implements MethodRule {
+
+   public static final String PROPERTY_NAME = 
"org.apache.activemq.artemis.utils.RetryRule.retry";
+
+   private static Logger logger = Logger.getLogger(RetryRule.class);
+
+   int defaultNumberOfRetries;
+
+   public RetryRule() {
+      this(0);
+   }
+
+   public RetryRule(int defaultNumberOfRetries) {
+      this.defaultNumberOfRetries = defaultNumberOfRetries;
+   }
+
+   private int getNumberOfRetries(final FrameworkMethod method) {
+
+      if (!Boolean.parseBoolean(System.getProperty(PROPERTY_NAME))) {
+         return 0;
+      }
+      RetryMethod retry = method.getAnnotation(RetryMethod.class);
+      if (retry != null) {
+         return retry.retries();
+      } else {
+         return defaultNumberOfRetries;
+      }
+   }
+
+   @Override
+   public Statement apply(final Statement base, final FrameworkMethod method, 
Object target) {
+      return new Statement() {
+         @Override
+         public void evaluate() throws Throwable {
+            Throwable currentException = null;
+            try {
+               base.evaluate();
+            } catch (Throwable t) {
+
+               if (t instanceof AssumptionViolatedException) {
+                  throw t;
+               }
+
+               currentException = t;
+
+               int retries = getNumberOfRetries(method);
+
+               for (int retryNr = 0; retryNr < retries; retryNr++) {
+                  logger.warn("RETRY " + (retryNr + 1) + " of " + retries + " 
on " + target.getClass() + "::" + method.getName(), currentException);
+                  currentException = null;
+                  try {
+                     base.evaluate();
+                     logger.info("RETRY " + (retryNr + 1)  + " of " + retries 
+ " on " + target.getClass() + "::" + method.getName() + " succeeded");
+                     break;
+                  } catch (Throwable t2) {
+                     logger.info("RETRY " + (retryNr + 1)  + " of " + retries 
+ " on " + target.getClass() + "::" + method.getName() + " failed ", t2);
+                     currentException = t2;
+                  }
+               }
+               if (currentException != null) {
+                  throw currentException;
+               }
+            }
+         }
+      };
+   }
+}
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 68da35b..47387fd 100644
--- a/pom.xml
+++ b/pom.xml
@@ -74,6 +74,8 @@
        <!-- base url for site deployment.  See distribution management for 
full url.  Override this in settings.xml for staging -->
       
<staging.siteURL>scp://people.apache.org/x1/www/activemq.apache.org</staging.siteURL>
 
+      <retryTests>false</retryTests>
+
       <activemq-artemis-native-version>1.0.1</activemq-artemis-native-version>
       <karaf.version>4.0.6</karaf.version>
       <pax.exam.version>4.9.1</pax.exam.version>
@@ -172,7 +174,7 @@
 
       -->
 
-      <activemq-surefire-argline>-Dbrokerconfig.maxDiskUsage=100 
-Dorg.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants.DEFAULT_QUIET_PERIOD=0
 
-Dorg.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants.DEFAULT_SHUTDOWN_TIMEOUT=0
 -Djava.util.logging.manager=org.jboss.logmanager.LogManager
+      
<activemq-surefire-argline>-Dorg.apache.activemq.artemis.utils.RetryRule.retry=${retryTests}
 -Dbrokerconfig.maxDiskUsage=100 
-Dorg.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants.DEFAULT_QUIET_PERIOD=0
 
-Dorg.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants.DEFAULT_SHUTDOWN_TIMEOUT=0
 -Djava.util.logging.manager=org.jboss.logmanager.LogManager
          
-Dlogging.configuration="file:${activemq.basedir}/tests/config/logging.properties"
          
-Djava.library.path="${activemq.basedir}/target/bin/lib/linux-x86_64:${activemq.basedir}/target/bin/lib/linux-i686"
 -Djgroups.bind_addr=localhost 
-Dorg.apache.activemq.artemis.api.core.UDPBroadcastEndpointFactory.localBindAddress=localhost
          -Djava.net.preferIPv4Stack=true -Dbasedir=${basedir}
@@ -1015,6 +1017,13 @@
          </build>
       </profile>
       <profile>
+         <!-- this will activate the property required to play with tests 
retry -->
+         <id>tests-retry</id>
+         <properties>
+            <retryTests>true</retryTests>
+         </properties>
+      </profile>
+      <profile>
          <!-- tests is the profile we use to run the entire testsuite
                Running this entire build could take up to 2 hours -->
          <id>tests</id>
diff --git 
a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/JMSNonDestructiveTest.java
 
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/JMSNonDestructiveTest.java
index 2ec8b04..006fdfd 100644
--- 
a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/JMSNonDestructiveTest.java
+++ 
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/JMSNonDestructiveTest.java
@@ -283,7 +283,7 @@ public class JMSNonDestructiveTest extends 
JMSClientTestSupport {
    }
 
    public void testNonDestructiveLVQTombstone(ConnectionSupplier 
producerConnectionSupplier, ConnectionSupplier consumerConnectionSupplier) 
throws Exception {
-      int tombstoneTimeToLive = 50;
+      int tombstoneTimeToLive = 500;
 
       QueueBinding queueBinding = (QueueBinding) 
server.getPostOffice().getBinding(SimpleString.toSimpleString(NON_DESTRUCTIVE_TOMBSTONE_LVQ_QUEUE_NAME));
       LastValueQueue lastValueQueue = (LastValueQueue)queueBinding.getQueue();
diff --git 
a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/BridgeTestBase.java
 
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/BridgeTestBase.java
index d87c0e3..2e9bf13 100644
--- 
a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/BridgeTestBase.java
+++ 
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/BridgeTestBase.java
@@ -29,10 +29,16 @@ import 
org.apache.activemq.artemis.core.server.ActiveMQServers;
 import org.apache.activemq.artemis.core.server.NodeManager;
 import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
 import org.apache.activemq.artemis.tests.util.InVMNodeManagerServer;
+import org.apache.activemq.artemis.utils.RetryRule;
 import org.junit.After;
+import org.junit.Rule;
 
 public abstract class BridgeTestBase extends ActiveMQTestBase {
 
+
+   @Rule
+   public RetryRule retryRule = new RetryRule(2);
+
    @Override
    @After
    public void tearDown() throws Exception {
diff --git 
a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ClusteredGroupingTest.java
 
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ClusteredGroupingTest.java
index 7e3e5ac..47c7dc4 100644
--- 
a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ClusteredGroupingTest.java
+++ 
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ClusteredGroupingTest.java
@@ -50,10 +50,15 @@ import 
org.apache.activemq.artemis.core.settings.impl.AddressFullMessagePolicy;
 import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
 import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
 import org.apache.activemq.artemis.utils.ActiveMQThreadFactory;
+import org.apache.activemq.artemis.utils.RetryRule;
+import org.junit.Rule;
 import org.junit.Test;
 
 public class ClusteredGroupingTest extends ClusterTestBase {
 
+   @Rule
+   public RetryRule retryRule = new RetryRule(2);
+
    @Test
    public void testGroupingGroupTimeoutWithUnproposal() throws Exception {
       setupServer(0, isFileStorage(), isNetty());
diff --git 
a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/FailoverTest.java
 
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/FailoverTest.java
index dec6399..578743f 100644
--- 
a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/FailoverTest.java
+++ 
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/FailoverTest.java
@@ -64,13 +64,18 @@ import 
org.apache.activemq.artemis.tests.integration.cluster.util.TestableServer
 import org.apache.activemq.artemis.tests.util.CountDownSessionFailureListener;
 import org.apache.activemq.artemis.tests.util.TransportConfigurationUtils;
 import org.apache.activemq.artemis.utils.RandomUtil;
+import org.apache.activemq.artemis.utils.RetryRule;
 import org.apache.activemq.artemis.utils.Wait;
 import org.junit.Assert;
 import org.junit.Before;
+import org.junit.Rule;
 import org.junit.Test;
 
 public class FailoverTest extends FailoverTestBase {
 
+   @Rule
+   public RetryRule retryRule = new RetryRule(2);
+
    private static final IntegrationTestLogger log = 
IntegrationTestLogger.LOGGER;
 
    protected static final int NUM_MESSAGES = 100;
diff --git 
a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/QuorumFailOverTest.java
 
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/QuorumFailOverTest.java
index fdf282a..bd7e691 100644
--- 
a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/QuorumFailOverTest.java
+++ 
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/QuorumFailOverTest.java
@@ -29,10 +29,16 @@ import 
org.apache.activemq.artemis.core.config.ha.ReplicatedPolicyConfiguration;
 import org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl;
 import 
org.apache.activemq.artemis.core.server.impl.SharedNothingLiveActivation;
 import 
org.apache.activemq.artemis.tests.integration.cluster.util.BackupSyncDelay;
+import org.apache.activemq.artemis.utils.RetryMethod;
+import org.apache.activemq.artemis.utils.RetryRule;
+import org.junit.Rule;
 import org.junit.Test;
 
 public class QuorumFailOverTest extends StaticClusterWithBackupFailoverTest {
 
+   @Rule
+   public RetryRule retryRule = new RetryRule(0);
+
    @Override
    protected void setupServers() throws Exception {
       super.setupServers();
@@ -50,6 +56,7 @@ public class QuorumFailOverTest extends 
StaticClusterWithBackupFailoverTest {
 
    }
 
+   @RetryMethod(retries = 2)
    @Test
    public void testQuorumVoting() throws Exception {
       int[] liveServerIDs = new int[]{0, 1, 2};
diff --git 
a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/QuorumResultWaitTest.java
 
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/QuorumResultWaitTest.java
index db3aed3..852d751 100644
--- 
a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/QuorumResultWaitTest.java
+++ 
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/QuorumResultWaitTest.java
@@ -20,10 +20,16 @@ import 
org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration;
 import org.apache.activemq.artemis.core.config.ha.ReplicaPolicyConfiguration;
 import 
org.apache.activemq.artemis.core.config.ha.ReplicatedPolicyConfiguration;
 import org.apache.activemq.artemis.core.server.cluster.ha.ReplicatedPolicy;
+import org.apache.activemq.artemis.utils.RetryMethod;
+import org.apache.activemq.artemis.utils.RetryRule;
+import org.junit.Rule;
 import org.junit.Test;
 
 public class QuorumResultWaitTest extends StaticClusterWithBackupFailoverTest {
 
+   @Rule
+   public RetryRule retryRule = new RetryRule(0);
+
    public static final int QUORUM_VOTE_WAIT_CONFIGURED_TIME_SEC = 12;
    @Override
    protected void setupServers() throws Exception {
@@ -41,6 +47,7 @@ public class QuorumResultWaitTest extends 
StaticClusterWithBackupFailoverTest {
       
servers[3].getConfiguration().setHAPolicyConfiguration(replicatedPolicyConf);
    }
 
+   @RetryMethod(retries = 2)
    @Test
    public void testQuorumVotingResultWait() throws Exception {
       setupCluster();
diff --git 
a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/ReplicatedMultipleServerFailoverExtraBackupsTest.java
 
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/ReplicatedMultipleServerFailoverExtraBackupsTest.java
index 00ffa51..9e8d290 100644
--- 
a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/ReplicatedMultipleServerFailoverExtraBackupsTest.java
+++ 
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/ReplicatedMultipleServerFailoverExtraBackupsTest.java
@@ -32,15 +32,22 @@ import 
org.apache.activemq.artemis.core.config.ha.ReplicaPolicyConfiguration;
 import org.apache.activemq.artemis.core.server.ActiveMQServer;
 import org.apache.activemq.artemis.tests.util.Wait;
 import 
org.apache.activemq.artemis.tests.integration.cluster.util.TestableServer;
+import org.apache.activemq.artemis.utils.RetryMethod;
+import org.apache.activemq.artemis.utils.RetryRule;
 import org.junit.Assert;
+import org.junit.Rule;
 import org.junit.Test;
 
 public class ReplicatedMultipleServerFailoverExtraBackupsTest extends 
ReplicatedMultipleServerFailoverTest {
 
+   @Rule
+   public RetryRule retryRule = new RetryRule();
+
    private void waitForSync(ActiveMQServer server) throws Exception {
       Wait.waitFor(server::isReplicaSync);
    }
 
+   @RetryMethod(retries = 1)
    @Override
    @Test
    public void testStartLiveFirst() throws Exception {
diff --git 
a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/ReplicatedPagedFailoverTest.java
 
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/ReplicatedPagedFailoverTest.java
index 7f72217..4272139 100644
--- 
a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/ReplicatedPagedFailoverTest.java
+++ 
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/ReplicatedPagedFailoverTest.java
@@ -29,12 +29,18 @@ import 
org.apache.activemq.artemis.core.server.ActiveMQServer;
 import org.apache.activemq.artemis.core.server.NodeManager;
 import org.apache.activemq.artemis.core.server.Queue;
 import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
+import org.apache.activemq.artemis.utils.RetryMethod;
+import org.apache.activemq.artemis.utils.RetryRule;
 import org.apache.activemq.artemis.utils.Wait;
 import org.junit.Assert;
+import org.junit.Rule;
 import org.junit.Test;
 
 public class ReplicatedPagedFailoverTest extends ReplicatedFailoverTest {
 
+   @Rule
+   public RetryRule retryRule = new RetryRule(0);
+
    @Override
    protected ActiveMQServer createInVMFailoverServer(final boolean realFiles,
                                                      final Configuration 
configuration,
@@ -59,6 +65,20 @@ public class ReplicatedPagedFailoverTest extends 
ReplicatedFailoverTest {
       internalBrowser(2);
    }
 
+   @Override
+   @RetryMethod(retries = 2)
+   @Test(timeout = 120000)
+   public void testReplicatedFailback() throws Exception {
+      super.testReplicatedFailback();
+   }
+
+   @Override
+   @RetryMethod(retries = 2)
+   @Test(timeout = 120000)
+   public void testFailoverOnInitialConnection() throws Exception {
+      super.testFailoverOnInitialConnection();
+   }
+
    //
    // 0 - no tamper
    // 1 - close files
diff --git 
a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PageCountSyncOnNonTXTest.java
 
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PageCountSyncOnNonTXTest.java
index e3fa3c1..0231610 100644
--- 
a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PageCountSyncOnNonTXTest.java
+++ 
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PageCountSyncOnNonTXTest.java
@@ -32,14 +32,19 @@ import org.apache.activemq.artemis.core.server.Queue;
 import org.apache.activemq.artemis.logs.AssertionLoggerHandler;
 import org.apache.activemq.artemis.tests.util.SpawnedTestBase;
 import org.apache.activemq.artemis.utils.RandomUtil;
+import org.apache.activemq.artemis.utils.RetryRule;
 import org.apache.activemq.artemis.utils.Wait;
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
+import org.junit.Rule;
 import org.junit.Test;
 
 public class PageCountSyncOnNonTXTest extends SpawnedTestBase {
 
+   @Rule
+   public RetryRule retryRule = new RetryRule(1);
+
    public static final String WORD_START = "&*STARTED&*";
 
    // We will add a random factor on the wait time
diff --git 
a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingTest.java
 
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingTest.java
index 01a7833..fe03b7f 100644
--- 
a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingTest.java
+++ 
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingTest.java
@@ -105,12 +105,15 @@ import 
org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManagerImpl
 import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
 import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
 import org.apache.activemq.artemis.tests.util.Wait;
+import org.apache.activemq.artemis.utils.RetryMethod;
+import org.apache.activemq.artemis.utils.RetryRule;
 import org.apache.activemq.artemis.utils.actors.ArtemisExecutor;
 import org.jboss.logging.Logger;
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Assume;
 import org.junit.Before;
+import org.junit.Rule;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
@@ -118,6 +121,9 @@ import org.junit.runners.Parameterized;
 @RunWith(Parameterized.class)
 public class PagingTest extends ActiveMQTestBase {
 
+   @Rule
+   public RetryRule retryMethod = new RetryRule(0);
+
    private static final Logger logger = Logger.getLogger(PagingTest.class);
 
    protected ServerLocator locator;
@@ -1751,6 +1757,7 @@ public class PagingTest extends ActiveMQTestBase {
 
    }
 
+   @RetryMethod(retries = 1)
    @Test
    public void testInabilityToCreateDirectoryDuringPaging() throws Exception {
       // this test only applies to file-based stores
diff --git 
a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/remoting/ReconnectTest.java
 
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/remoting/ReconnectTest.java
index a3a3cbe..3e6417a 100644
--- 
a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/remoting/ReconnectTest.java
+++ 
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/remoting/ReconnectTest.java
@@ -48,12 +48,17 @@ import 
org.apache.activemq.artemis.core.server.ServerSession;
 import org.apache.activemq.artemis.core.server.impl.AddressInfo;
 import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection;
 import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
+import org.apache.activemq.artemis.utils.RetryRule;
 import org.apache.activemq.artemis.utils.Wait;
 import org.junit.Assert;
+import org.junit.Rule;
 import org.junit.Test;
 
 public class ReconnectTest extends ActiveMQTestBase {
 
+   @Rule
+   public RetryRule retryRule = new RetryRule(2);
+
    @Test
    public void testReconnectNetty() throws Exception {
       internalTestReconnect(true);
diff --git 
a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/ScaleDownRemoveSFTest.java
 
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/ScaleDownRemoveSFTest.java
index ae4e93c..e220a8f 100644
--- 
a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/ScaleDownRemoveSFTest.java
+++ 
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/ScaleDownRemoveSFTest.java
@@ -25,14 +25,19 @@ import 
org.apache.activemq.artemis.core.server.cluster.impl.ClusterConnectionImp
 import 
org.apache.activemq.artemis.core.server.cluster.impl.MessageLoadBalancingType;
 import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
 import 
org.apache.activemq.artemis.tests.integration.cluster.distribution.ClusterTestBase;
+import org.apache.activemq.artemis.utils.RetryRule;
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
+import org.junit.Rule;
 import org.junit.Test;
 
 
 public class ScaleDownRemoveSFTest extends ClusterTestBase {
 
+   @Rule
+   public RetryRule retryRule = new RetryRule(3);
+
    public ScaleDownRemoveSFTest() {
    }
 
diff --git 
a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompTest.java
 
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompTest.java
index fcd2623..b5c53b7 100644
--- 
a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompTest.java
+++ 
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompTest.java
@@ -57,7 +57,6 @@ import 
org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl;
 import org.apache.activemq.artemis.core.server.impl.AddressInfo;
 import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
 import org.apache.activemq.artemis.logs.AssertionLoggerHandler;
-import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
 import 
org.apache.activemq.artemis.tests.integration.mqtt.imported.FuseMQTTClientProvider;
 import 
org.apache.activemq.artemis.tests.integration.mqtt.imported.MQTTClientProvider;
 import 
org.apache.activemq.artemis.tests.integration.stomp.util.ClientStompFrame;
@@ -65,6 +64,7 @@ import 
org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConne
 import 
org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnectionFactory;
 import org.apache.activemq.artemis.tests.util.Wait;
 import org.apache.activemq.artemis.utils.RandomUtil;
+import org.jboss.logging.Logger;
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
@@ -75,7 +75,8 @@ import org.junit.runners.Parameterized;
 @RunWith(Parameterized.class)
 public class StompTest extends StompTestBase {
 
-   private static final transient IntegrationTestLogger log = 
IntegrationTestLogger.LOGGER;
+   private static final Logger log = Logger.getLogger(StompTest.class);
+
    protected StompClientConnection conn;
 
    @Override
@@ -968,7 +969,7 @@ public class StompTest extends StompTestBase {
       ClientStompFrame frame = conn.receiveFrame(10000);
       Assert.assertEquals(Stomp.Responses.MESSAGE, frame.getCommand());
 
-      log.info("Reconnecting!");
+      log.debug("Reconnecting!");
 
       if (sendDisconnect) {
          conn.disconnect();
@@ -1025,7 +1026,7 @@ public class StompTest extends StompTestBase {
       sendJmsMessage("second message");
 
       frame = conn.receiveFrame(1000);
-      log.info("Received frame: " + frame);
+      log.debug("Received frame: " + frame);
       Assert.assertNull("No message should have been received since 
subscription was removed", frame);
    }
 
@@ -1048,7 +1049,7 @@ public class StompTest extends StompTestBase {
       sendJmsMessage("second message");
 
       frame = conn.receiveFrame(1000);
-      log.info("Received frame: " + frame);
+      log.debug("Received frame: " + frame);
       Assert.assertNull("No message should have been received since 
subscription was removed", frame);
 
    }
@@ -1138,7 +1139,7 @@ public class StompTest extends StompTestBase {
             if (length - baselineQueueCount == 1) {
                return true;
             } else {
-               log.info("Queue count: " + (length - baselineQueueCount));
+               log.debug("Queue count: " + (length - baselineQueueCount));
                return false;
             }
          }
@@ -1156,7 +1157,7 @@ public class StompTest extends StompTestBase {
       sendJmsMessage(getName(), topic);
 
       frame = conn.receiveFrame(1000);
-      log.info("Received frame: " + frame);
+      log.debug("Received frame: " + frame);
       Assert.assertNull("No message should have been received since 
subscription was removed", frame);
 
       assertEquals("Subscription queue should be deleted", 0, 
server.getActiveMQServerControl().getQueueNames().length - baselineQueueCount);
@@ -1194,7 +1195,7 @@ public class StompTest extends StompTestBase {
       sendJmsMessage(getName(), queue);
 
       frame = conn.receiveFrame(1000);
-      log.info("Received frame: " + frame);
+      log.debug("Received frame: " + frame);
       Assert.assertNull("No message should have been received since 
subscription was removed", frame);
 
       assertEquals("Subscription queue should not be deleted", 
baselineQueueCount, server.getActiveMQServerControl().getQueueNames().length);
@@ -1237,7 +1238,7 @@ public class StompTest extends StompTestBase {
       sendJmsMessage(getName(), 
ActiveMQJMSClient.createQueue(nonExistentQueue));
 
       frame = conn.receiveFrame(1000);
-      log.info("Received frame: " + frame);
+      log.debug("Received frame: " + frame);
       Assert.assertNull("No message should have been received since 
subscription was removed", frame);
 
       conn.disconnect();
@@ -1408,7 +1409,7 @@ public class StompTest extends StompTestBase {
       send(conn, getTopicPrefix() + getTopicName(), null, "Hello World");
 
       ClientStompFrame frame = conn.receiveFrame(2000);
-      log.info("Received frame: " + frame);
+      log.debug("Received frame: " + frame);
       Assert.assertNull("No message should have been received since 
subscription was removed", frame);
 
       // send message on another JMS connection => it should be received
@@ -1443,7 +1444,7 @@ public class StompTest extends StompTestBase {
 
       // ...and nothing else
       ClientStompFrame frame = conn.receiveFrame(2000);
-      log.info("Received frame: " + frame);
+      log.debug("Received frame: " + frame);
       Assert.assertNull(frame);
 
       conn.disconnect();
@@ -1510,7 +1511,7 @@ public class StompTest extends StompTestBase {
       sendJmsMessage(getName(), topic);
 
       ClientStompFrame frame = conn.receiveFrame(TIME_OUT);
-      log.info("Received frame: " + frame);
+      log.debug("Received frame: " + frame);
       Assert.assertNull("No message should have been received since 
subscription was removed", frame);
 
       conn.disconnect();
@@ -1872,7 +1873,7 @@ public class StompTest extends StompTestBase {
 
       frame = conn.receiveFrame(10000);
 
-      IntegrationTestLogger.LOGGER.info("Received: " + frame);
+      log.debug("Received: " + frame);
 
       Assert.assertEquals(Boolean.TRUE.toString(), 
frame.getHeader(ManagementHelper.HDR_OPERATION_SUCCEEDED.toString()));
       // the address will be returned in the message body in a JSON array
@@ -1900,7 +1901,7 @@ public class StompTest extends StompTestBase {
 
       frame = conn.receiveFrame(10000);
 
-      IntegrationTestLogger.LOGGER.info("Received: " + frame);
+      log.debug("Received: " + frame);
 
       Assert.assertEquals(Boolean.TRUE.toString(), 
frame.getHeader(ManagementHelper.HDR_OPERATION_SUCCEEDED.toString()));
       // there is no such messages => 0 returned in a JSON array
diff --git 
a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompTestBase.java
 
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompTestBase.java
index 8b53f1b..741d885 100644
--- 
a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompTestBase.java
+++ 
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompTestBase.java
@@ -55,8 +55,10 @@ import 
org.apache.activemq.artemis.tests.integration.stomp.util.AbstractStompCli
 import 
org.apache.activemq.artemis.tests.integration.stomp.util.ClientStompFrame;
 import 
org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnection;
 import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
+import org.apache.activemq.artemis.utils.RetryRule;
 import org.junit.After;
 import org.junit.Before;
+import org.junit.Rule;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
 
@@ -66,6 +68,9 @@ public abstract class StompTestBase extends ActiveMQTestBase {
    @Parameterized.Parameter
    public String scheme;
 
+   @Rule
+   public RetryRule retryRule = new RetryRule(2);
+
    protected URI uri;
 
    @Parameterized.Parameters(name = "{0}")
diff --git 
a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/xa/SessionFailureXATest.java
 
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/xa/SessionFailureXATest.java
index d80edfc..a80546b 100644
--- 
a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/xa/SessionFailureXATest.java
+++ 
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/xa/SessionFailureXATest.java
@@ -40,9 +40,11 @@ import org.apache.activemq.artemis.core.server.ServerSession;
 import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
 import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
 import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
+import org.apache.activemq.artemis.utils.RetryRule;
 import org.apache.activemq.artemis.utils.Wait;
 import org.junit.Assert;
 import org.junit.Before;
+import org.junit.Rule;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
@@ -50,6 +52,9 @@ import org.junit.runners.Parameterized;
 @RunWith(Parameterized.class)
 public class SessionFailureXATest extends ActiveMQTestBase {
 
+   @Rule
+   public RetryRule retryRule = new RetryRule(1);
+
    private static IntegrationTestLogger log = IntegrationTestLogger.LOGGER;
 
    private final Map<String, AddressSettings> addressSettings = new 
HashMap<>();
diff --git 
a/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/replicationflow/SoakPagingTest.java
 
b/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/replicationflow/SoakPagingTest.java
index 7da070c..521cce6 100644
--- 
a/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/replicationflow/SoakPagingTest.java
+++ 
b/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/replicationflow/SoakPagingTest.java
@@ -30,10 +30,12 @@ import java.util.Collection;
 import java.util.concurrent.atomic.AtomicInteger;
 
 import org.apache.activemq.artemis.tests.smoke.common.SmokeTestBase;
+import org.apache.activemq.artemis.utils.RetryRule;
 import org.apache.activemq.artemis.utils.SpawnedVMSupport;
 import org.apache.qpid.jms.JmsConnectionFactory;
 import org.junit.Assert;
 import org.junit.Before;
+import org.junit.Rule;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
@@ -41,6 +43,9 @@ import org.junit.runners.Parameterized;
 @RunWith(Parameterized.class)
 public class SoakPagingTest extends SmokeTestBase {
 
+   @Rule
+   public RetryRule retryRule = new RetryRule(1);
+
    public static final int LAG_CONSUMER_TIME = 1000;
    public static final int TIME_RUNNING = 4000;
    public static final int CLIENT_KILLS = 2;

Reply via email to