activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbert...@apache.org
Subject [2/4] activemq-artemis git commit: NO-JIRA: Test fixes and speed ups
Date Wed, 09 Nov 2016 20:01:26 GMT
NO-JIRA: Test fixes and speed ups


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

Branch: refs/heads/master
Commit: b8104f6b7eee97f009067f949c7da30eb7c5990a
Parents: a84a51f
Author: Clebert Suconic <clebertsuconic@apache.org>
Authored: Mon Nov 7 17:25:00 2016 -0500
Committer: Clebert Suconic <clebertsuconic@apache.org>
Committed: Wed Nov 9 14:35:47 2016 -0500

----------------------------------------------------------------------
 .../core/server/cluster/impl/BridgeImpl.java    | 72 +++++++++-----------
 .../tests/extras/jms/bridge/JMSBridgeTest.java  |  4 +-
 .../tests/integration/client/ReceiveTest.java   | 11 +++
 .../integration/cluster/bridge/BridgeTest.java  |  4 +-
 .../management/ActiveMQServerControlTest.java   |  1 +
 .../management/QueueControlTest.java            |  8 +--
 .../PagingWithFailoverAndCountersTest.java      |  2 +-
 7 files changed, 53 insertions(+), 49 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b8104f6b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/BridgeImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/BridgeImpl.java
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/BridgeImpl.java
index ac30c53..d928fff 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/BridgeImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/BridgeImpl.java
@@ -1053,59 +1053,51 @@ public class BridgeImpl implements Bridge, SessionFailureListener,
SendAcknowled
 
       @Override
       public void run() {
-         try {
-            logger.debug("stopping bridge " + BridgeImpl.this);
-            queue.removeConsumer(BridgeImpl.this);
-
-            if (!pendingAcks.await(10, TimeUnit.SECONDS)) {
-               ActiveMQServerLogger.LOGGER.timedOutWaitingCompletions(BridgeImpl.this.toString(),
pendingAcks.getCount());
-            }
+         logger.debug("stopping bridge " + BridgeImpl.this);
+         queue.removeConsumer(BridgeImpl.this);
 
-            synchronized (BridgeImpl.this) {
-               logger.debug("Closing Session for bridge " + BridgeImpl.this.name);
+         synchronized (BridgeImpl.this) {
+            logger.debug("Closing Session for bridge " + BridgeImpl.this.name);
 
-               started = false;
+            started = false;
 
-               active = false;
+            active = false;
 
-            }
+         }
 
-            if (session != null) {
-               logger.debug("Cleaning up session " + session);
-               session.removeFailureListener(BridgeImpl.this);
-               try {
-                  session.close();
-                  session = null;
-               } catch (ActiveMQException dontcare) {
-               }
+         if (session != null) {
+            logger.debug("Cleaning up session " + session);
+            session.removeFailureListener(BridgeImpl.this);
+            try {
+               session.close();
+               session = null;
+            } catch (ActiveMQException dontcare) {
             }
+         }
 
-            if (sessionConsumer != null) {
-               logger.debug("Cleaning up session " + session);
-               try {
-                  sessionConsumer.close();
-                  sessionConsumer = null;
-               } catch (ActiveMQException dontcare) {
-               }
+         if (sessionConsumer != null) {
+            logger.debug("Cleaning up session " + session);
+            try {
+               sessionConsumer.close();
+               sessionConsumer = null;
+            } catch (ActiveMQException dontcare) {
             }
+         }
 
-            internalCancelReferences();
+         internalCancelReferences();
 
-            if (csf != null) {
-               csf.cleanup();
-            }
+         if (csf != null) {
+            csf.cleanup();
+         }
 
-            synchronized (connectionGuard) {
-               keepConnecting = true;
-            }
+         synchronized (connectionGuard) {
+            keepConnecting = true;
+         }
 
-            if (logger.isTraceEnabled()) {
-               logger.trace("Removing consumer on stopRunnable " + this + " from queue "
+ queue);
-            }
-            ActiveMQServerLogger.LOGGER.bridgeStopped(name);
-         } catch (InterruptedException | RuntimeException e) {
-            ActiveMQServerLogger.LOGGER.error("Failed to stop bridge", e);
+         if (logger.isTraceEnabled()) {
+            logger.trace("Removing consumer on stopRunnable " + this + " from queue " + queue);
          }
+         ActiveMQServerLogger.LOGGER.bridgeStopped(name);
       }
    }
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b8104f6b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/jms/bridge/JMSBridgeTest.java
----------------------------------------------------------------------
diff --git a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/jms/bridge/JMSBridgeTest.java
b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/jms/bridge/JMSBridgeTest.java
index 3e8e13b..df45f68 100644
--- a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/jms/bridge/JMSBridgeTest.java
+++ b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/jms/bridge/JMSBridgeTest.java
@@ -1616,7 +1616,7 @@ public class JMSBridgeTest extends BridgeTestBase {
       }
 
       try {
-         final long MAX_BATCH_TIME = 3000;
+         final long MAX_BATCH_TIME = 300;
 
          final int MAX_BATCH_SIZE = 100000; // something big so it won't reach it
 
@@ -1655,7 +1655,7 @@ public class JMSBridgeTest extends BridgeTestBase {
       }
 
       try {
-         final long MAX_BATCH_TIME = 3000;
+         final long MAX_BATCH_TIME = 300;
 
          final int MAX_BATCH_SIZE = 100000; // something big so it won't reach it
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b8104f6b/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 dfe8f5a..10160f6 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
@@ -28,6 +28,8 @@ import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
 import org.apache.activemq.artemis.api.core.client.MessageHandler;
 import org.apache.activemq.artemis.api.core.client.ServerLocator;
 import org.apache.activemq.artemis.core.server.ActiveMQServer;
+import org.apache.activemq.artemis.core.server.Queue;
+import org.apache.activemq.artemis.tests.integration.mqtt.imported.util.Wait;
 import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
 import org.junit.Assert;
 import org.junit.Before;
@@ -144,6 +146,15 @@ public class ReceiveTest extends ActiveMQTestBase {
       cp.send(sendSession.createMessage(false));
       sendSession.commit();
 
+      final Queue queue = server.locateQueue(queueA);
+
+      Wait.waitFor(new Wait.Condition() {
+         @Override
+         public boolean isSatisified() throws Exception {
+            return queue.getMessageCount() == 3;
+         }
+      });
+
       Assert.assertNotNull(cc2.receive(5000));
       Assert.assertNotNull(cc.receive(5000));
       if (cc.receiveImmediate() == null) {

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b8104f6b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/BridgeTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/BridgeTest.java
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/BridgeTest.java
index e976664..59d35db 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/BridgeTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/BridgeTest.java
@@ -166,7 +166,7 @@ public class BridgeTest extends ActiveMQTestBase {
       connectors.put(server1tc.getName(), server1tc);
       server0.getConfiguration().setConnectorConfigurations(connectors);
 
-      final int messageSize = 1024 * 1024 * 5;
+      final int messageSize = 1024 * 200;
 
       final int numMessages = 10;
 
@@ -220,7 +220,7 @@ public class BridgeTest extends ActiveMQTestBase {
       }
 
       for (int i = 0; i < numMessages; i++) {
-         ClientMessage message = consumer1.receive(500000);
+         ClientMessage message = consumer1.receive(5000);
 
          Assert.assertNotNull(message);
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b8104f6b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlTest.java
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlTest.java
index 27a2838..2653b6d 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlTest.java
@@ -1175,6 +1175,7 @@ public class ActiveMQServerControlTest extends ManagementTestBase {
       ClientSession session = addClientSession(factory.createSession());
       server.createQueue(queueName, queueName, null, false, false);
       addClientConsumer(session.createConsumer(queueName));
+      Thread.sleep(100); // We check the timestamp for the creation time. We need to make
sure it's different
       addClientConsumer(session.createConsumer(queueName, SimpleString.toSimpleString(filter),
true));
 
       String jsonString = serverControl.listConsumersAsJSON(factory.getConnection().getID().toString());

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b8104f6b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/QueueControlTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/QueueControlTest.java
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/QueueControlTest.java
index fa84c16..d9377ec 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/QueueControlTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/QueueControlTest.java
@@ -1616,7 +1616,7 @@ public class QueueControlTest extends ManagementTestBase {
 
       ActiveMQServerControl serverControl = ManagementControlHelper.createActiveMQServerControl(mbeanServer);
       serverControl.enableMessageCounters();
-      serverControl.setMessageCounterSamplePeriod(MessageCounterManagerImpl.MIN_SAMPLE_PERIOD);
+      serverControl.setMessageCounterSamplePeriod(100);
 
       String jsonString = queueControl.listMessageCounter();
       MessageCounterInfo info = MessageCounterInfo.fromJSON(jsonString);
@@ -1627,7 +1627,7 @@ public class QueueControlTest extends ManagementTestBase {
       ClientProducer producer = session.createProducer(address);
       producer.send(session.createMessage(false));
 
-      Thread.sleep(MessageCounterManagerImpl.MIN_SAMPLE_PERIOD * 2);
+      Thread.sleep(200);
       jsonString = queueControl.listMessageCounter();
       info = MessageCounterInfo.fromJSON(jsonString);
       Assert.assertEquals(1, info.getDepth());
@@ -1637,7 +1637,7 @@ public class QueueControlTest extends ManagementTestBase {
 
       producer.send(session.createMessage(false));
 
-      Thread.sleep(MessageCounterManagerImpl.MIN_SAMPLE_PERIOD * 2);
+      Thread.sleep(200);
       jsonString = queueControl.listMessageCounter();
       info = MessageCounterInfo.fromJSON(jsonString);
       Assert.assertEquals(2, info.getDepth());
@@ -1647,7 +1647,7 @@ public class QueueControlTest extends ManagementTestBase {
 
       consumeMessages(2, session, queue);
 
-      Thread.sleep(MessageCounterManagerImpl.MIN_SAMPLE_PERIOD * 2);
+      Thread.sleep(200);
       jsonString = queueControl.listMessageCounter();
       info = MessageCounterInfo.fromJSON(jsonString);
       Assert.assertEquals(0, info.getDepth());

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b8104f6b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingWithFailoverAndCountersTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingWithFailoverAndCountersTest.java
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingWithFailoverAndCountersTest.java
index ed3befd..44b1558 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingWithFailoverAndCountersTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingWithFailoverAndCountersTest.java
@@ -279,7 +279,7 @@ public class PagingWithFailoverAndCountersTest extends ActiveMQTestBase
{
    public void testValidateDeliveryAndCounters() throws Exception {
       startLive();
 
-      ServerLocator locator = SpawnedServerSupport.createLocator(PORT1).setInitialConnectAttempts(100).setReconnectAttempts(-1).setRetryInterval(100);
+      ServerLocator locator = SpawnedServerSupport.createLocator(PORT1).setInitialConnectAttempts(-1).setReconnectAttempts(-1).setRetryInterval(100);
 
       ClientSessionFactory factory = locator.createSessionFactory();
 


Mime
View raw message