activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject [1/2] activemq-artemis git commit: NO-JIRA de-duplicate class
Date Fri, 20 Jan 2017 18:51:53 GMT
Repository: activemq-artemis
Updated Branches:
  refs/heads/master 5edf940ed -> 98f6fa760


NO-JIRA de-duplicate class


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

Branch: refs/heads/master
Commit: a138a27adbd239121d97503cdfa3c62864668744
Parents: 5edf940
Author: Justin Bertram <jbertram@apache.org>
Authored: Fri Jan 20 12:07:14 2017 -0600
Committer: Justin Bertram <jbertram@apache.org>
Committed: Fri Jan 20 12:07:14 2017 -0600

----------------------------------------------------------------------
 .../tests/integration/amqp/ProtonTest.java      | 12 ++---
 .../tests/integration/client/ReceiveTest.java   |  4 +-
 .../management/ActiveMQServerControlTest.java   |  4 +-
 .../integration/mqtt/imported/MQTTTest.java     | 22 ++++-----
 .../integration/mqtt/imported/util/Wait.java    | 52 --------------------
 5 files changed, 21 insertions(+), 73 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/a138a27a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/ProtonTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/ProtonTest.java
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/ProtonTest.java
index 355328c..b790f0e 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/ProtonTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/ProtonTest.java
@@ -82,7 +82,7 @@ import org.apache.activemq.artemis.protocol.amqp.broker.ProtonProtocolManagerFac
 import org.apache.activemq.artemis.protocol.amqp.proton.AmqpSupport;
 import org.apache.activemq.artemis.protocol.amqp.proton.ProtonServerReceiverContext;
 import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection;
-import org.apache.activemq.artemis.tests.integration.mqtt.imported.util.Wait;
+import org.apache.activemq.artemis.tests.util.Wait;
 import org.apache.activemq.artemis.utils.ByteUtil;
 import org.apache.activemq.artemis.utils.TimeUtils;
 import org.apache.activemq.artemis.utils.VersionLoader;
@@ -829,7 +829,7 @@ public class ProtonTest extends ProtonTestBase {
 
          Wait.waitFor(new Wait.Condition() {
             @Override
-            public boolean isSatisified() throws Exception {
+            public boolean isSatisfied() throws Exception {
                return amqpConnection.isClosed();
             }
          });
@@ -853,7 +853,7 @@ public class ProtonTest extends ProtonTestBase {
 
          Wait.waitFor(new Wait.Condition() {
             @Override
-            public boolean isSatisified() throws Exception {
+            public boolean isSatisfied() throws Exception {
                return amqpConnection.isClosed();
             }
          });
@@ -1003,7 +1003,7 @@ public class ProtonTest extends ProtonTestBase {
       try {
          Wait.waitFor(new Wait.Condition() {
             @Override
-            public boolean isSatisified() throws Exception {
+            public boolean isSatisfied() throws Exception {
                return remote.isActive();
             }
          });
@@ -1024,7 +1024,7 @@ public class ProtonTest extends ProtonTestBase {
       try {
          Wait.waitFor(new Wait.Condition() {
             @Override
-            public boolean isSatisified() throws Exception {
+            public boolean isSatisfied() throws Exception {
                return remote.getConnectionCount() > 0;
             }
          });
@@ -1033,7 +1033,7 @@ public class ProtonTest extends ProtonTestBase {
          lifeCycleListener.stop();
          Wait.waitFor(new Wait.Condition() {
             @Override
-            public boolean isSatisified() throws Exception {
+            public boolean isSatisfied() throws Exception {
                return remote.getConnectionCount() == 0;
             }
          });

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/a138a27a/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 5be552b..b46bac9 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
@@ -30,8 +30,8 @@ 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.core.server.RoutingType;
-import org.apache.activemq.artemis.tests.integration.mqtt.imported.util.Wait;
 import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
+import org.apache.activemq.artemis.tests.util.Wait;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
@@ -151,7 +151,7 @@ public class ReceiveTest extends ActiveMQTestBase {
 
       Wait.waitFor(new Wait.Condition() {
          @Override
-         public boolean isSatisified() throws Exception {
+         public boolean isSatisfied() throws Exception {
             return queue.getMessageCount() == 3;
          }
       });

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/a138a27a/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 4db2c22..2b09cad 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
@@ -61,8 +61,8 @@ import org.apache.activemq.artemis.jlibaio.LibaioContext;
 import org.apache.activemq.artemis.spi.core.security.ActiveMQJAASSecurityManager;
 import org.apache.activemq.artemis.spi.core.security.jaas.InVMLoginModule;
 import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
-import org.apache.activemq.artemis.tests.integration.mqtt.imported.util.Wait;
 import org.apache.activemq.artemis.tests.unit.core.config.impl.fakes.FakeConnectorServiceFactory;
+import org.apache.activemq.artemis.tests.util.Wait;
 import org.apache.activemq.artemis.utils.RandomUtil;
 import org.apache.activemq.artemis.utils.UUIDGenerator;
 import org.junit.Assert;
@@ -312,7 +312,7 @@ public class ActiveMQServerControlTest extends ManagementTestBase {
       serverControl.destroyQueue(name.toString(), true);
       Wait.waitFor(new Wait.Condition() {
          @Override
-         public boolean isSatisified() throws Exception {
+         public boolean isSatisfied() throws Exception {
             return consumer.isClosed();
          }
       }, 1000, 100);

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/a138a27a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/MQTTTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/MQTTTest.java
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/MQTTTest.java
index fb2a367..39c950a 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/MQTTTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/MQTTTest.java
@@ -42,7 +42,7 @@ import org.apache.activemq.artemis.core.protocol.mqtt.MQTTConnectionManager;
 import org.apache.activemq.artemis.core.protocol.mqtt.MQTTSession;
 import org.apache.activemq.artemis.core.server.RoutingType;
 import org.apache.activemq.artemis.core.server.impl.AddressInfo;
-import org.apache.activemq.artemis.tests.integration.mqtt.imported.util.Wait;
+import org.apache.activemq.artemis.tests.util.Wait;
 import org.fusesource.mqtt.client.BlockingConnection;
 import org.fusesource.mqtt.client.MQTT;
 import org.fusesource.mqtt.client.Message;
@@ -789,7 +789,7 @@ public class MQTTTest extends MQTTTestSupport {
 
       Wait.waitFor(new Wait.Condition() {
          @Override
-         public boolean isSatisified() throws Exception {
+         public boolean isSatisfied() throws Exception {
             return publishList.size() == 2;
          }
       }, 5000);
@@ -802,7 +802,7 @@ public class MQTTTest extends MQTTTestSupport {
 
       Wait.waitFor(new Wait.Condition() {
          @Override
-         public boolean isSatisified() throws Exception {
+         public boolean isSatisfied() throws Exception {
             return publishList.size() == 4;
          }
       }, 5000);
@@ -964,7 +964,7 @@ public class MQTTTest extends MQTTTestSupport {
       connection.connect();
       Wait.waitFor(new Wait.Condition() {
          @Override
-         public boolean isSatisified() throws Exception {
+         public boolean isSatisfied() throws Exception {
             return connection.isConnected();
          }
       });
@@ -983,7 +983,7 @@ public class MQTTTest extends MQTTTestSupport {
       newConnection.connect();
       Wait.waitFor(new Wait.Condition() {
          @Override
-         public boolean isSatisified() throws Exception {
+         public boolean isSatisfied() throws Exception {
             return newConnection.isConnected();
          }
       });
@@ -1125,7 +1125,7 @@ public class MQTTTest extends MQTTTestSupport {
       assertTrue("KeepAlive didn't work properly", Wait.waitFor(new Wait.Condition() {
 
          @Override
-         public boolean isSatisified() throws Exception {
+         public boolean isSatisfied() throws Exception {
             return connection.isConnected();
          }
       }));
@@ -1148,7 +1148,7 @@ public class MQTTTest extends MQTTTestSupport {
       assertTrue("KeepAlive didn't work properly", Wait.waitFor(new Wait.Condition() {
 
          @Override
-         public boolean isSatisified() throws Exception {
+         public boolean isSatisfied() throws Exception {
             return connection.isConnected();
          }
       }));
@@ -1216,14 +1216,14 @@ public class MQTTTest extends MQTTTestSupport {
 
       assertTrue("Duplicate client disconnected", Wait.waitFor(new Wait.Condition() {
          @Override
-         public boolean isSatisified() throws Exception {
+         public boolean isSatisfied() throws Exception {
             return connection1.isConnected();
          }
       }));
 
       assertTrue("Old client still connected", Wait.waitFor(new Wait.Condition() {
          @Override
-         public boolean isSatisified() throws Exception {
+         public boolean isSatisfied() throws Exception {
             return !connection.isConnected();
          }
       }));
@@ -1413,7 +1413,7 @@ public class MQTTTest extends MQTTTestSupport {
       assertTrue("KeepAlive didn't work properly", Wait.waitFor(new Wait.Condition() {
 
          @Override
-         public boolean isSatisified() throws Exception {
+         public boolean isSatisfied() throws Exception {
             return connection.isConnected();
          }
       }));
@@ -1611,7 +1611,7 @@ public class MQTTTest extends MQTTTestSupport {
       assertTrue("KeepAlive didn't work properly", Wait.waitFor(new Wait.Condition() {
 
          @Override
-         public boolean isSatisified() throws Exception {
+         public boolean isSatisfied() throws Exception {
             return connection.isConnected();
          }
       }));

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/a138a27a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/util/Wait.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/util/Wait.java
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/util/Wait.java
deleted file mode 100644
index fec6bc4..0000000
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/util/Wait.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/**
- * 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.tests.integration.mqtt.imported.util;
-
-import java.util.concurrent.TimeUnit;
-
-public class Wait {
-
-   public static final long MAX_WAIT_MILLIS = 30 * 1000;
-   public static final int SLEEP_MILLIS = 1000;
-
-   public interface Condition {
-
-      boolean isSatisified() throws Exception;
-   }
-
-   public static boolean waitFor(Condition condition) throws Exception {
-      return waitFor(condition, MAX_WAIT_MILLIS);
-   }
-
-   public static boolean waitFor(final Condition condition, final long duration) throws Exception
{
-      return waitFor(condition, duration, SLEEP_MILLIS);
-   }
-
-   public static boolean waitFor(final Condition condition,
-                                 final long duration,
-                                 final int sleepMillis) throws Exception {
-
-      final long expiry = System.currentTimeMillis() + duration;
-      boolean conditionSatisified = condition.isSatisified();
-      while (!conditionSatisified && System.currentTimeMillis() < expiry) {
-         TimeUnit.MILLISECONDS.sleep(sleepMillis);
-         conditionSatisified = condition.isSatisified();
-      }
-      return conditionSatisified;
-   }
-}


Mime
View raw message