You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2017/11/13 21:47:01 UTC

activemq-artemis git commit: ARTEMIS-1495 Test Improvements

Repository: activemq-artemis
Updated Branches:
  refs/heads/master ead60d54d -> 63b156e29


ARTEMIS-1495 Test Improvements

Server.stop is currently waiting completions on Sessions just because of test cases.

With the recent changes made into the Executors this is not needed any longer


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

Branch: refs/heads/master
Commit: 63b156e290818fe0da7fcdae62eddb9c7dd688ea
Parents: ead60d5
Author: Clebert Suconic <cl...@apache.org>
Authored: Thu Nov 9 16:06:05 2017 -0500
Committer: Clebert Suconic <cl...@apache.org>
Committed: Mon Nov 13 16:46:32 2017 -0500

----------------------------------------------------------------------
 .../java/org/apache/activemq/artemis/junit/Wait.java     |  8 ++++++++
 .../artemis/core/server/ActiveMQServerLogger.java        |  5 -----
 .../activemq/artemis/core/server/ServerSession.java      |  2 --
 .../artemis/core/server/impl/ActiveMQServerImpl.java     | 10 ----------
 .../artemis/core/server/impl/ServerSessionImpl.java      | 11 -----------
 .../integration/client/JMSPagingFileDeleteTest.java      |  7 ++-----
 6 files changed, 10 insertions(+), 33 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/63b156e2/artemis-junit/src/main/java/org/apache/activemq/artemis/junit/Wait.java
----------------------------------------------------------------------
diff --git a/artemis-junit/src/main/java/org/apache/activemq/artemis/junit/Wait.java b/artemis-junit/src/main/java/org/apache/activemq/artemis/junit/Wait.java
index 3032a2a..8deca21 100644
--- a/artemis-junit/src/main/java/org/apache/activemq/artemis/junit/Wait.java
+++ b/artemis-junit/src/main/java/org/apache/activemq/artemis/junit/Wait.java
@@ -67,6 +67,14 @@ public class Wait {
       assertTrue("Condition wasn't met", condition);
    }
 
+   public static void assertFalse(Condition condition) throws Exception {
+      assertTrue(() -> !condition.isSatisfied());
+   }
+
+   public static void assertFalse(String failureMessage, Condition condition) throws Exception {
+      assertTrue(failureMessage, () -> !condition.isSatisfied());
+   }
+
 
    public static void assertTrue(String failureMessage, Condition condition) throws Exception {
       boolean result = waitFor(condition);

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/63b156e2/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java
index 743ff78..26fb1ef 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java
@@ -846,11 +846,6 @@ public interface ActiveMQServerLogger extends BasicLogger {
    void ioErrorOnTX(Integer errorCode, String errorMessage);
 
    @LogMessage(level = Logger.Level.WARN)
-   @Message(id = 222105, value = "Could not finish context execution in 10 seconds",
-      format = Message.Format.MESSAGE_FORMAT)
-   void errorCompletingContext(@Cause Exception e);
-
-   @LogMessage(level = Logger.Level.WARN)
    @Message(id = 222106, value = "Replacing incomplete LargeMessage with ID={0}", format = Message.Format.MESSAGE_FORMAT)
    void replacingIncompleteLargeMessage(Long messageID);
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/63b156e2/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ServerSession.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ServerSession.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ServerSession.java
index d4bbe76..7162acd 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ServerSession.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ServerSession.java
@@ -203,8 +203,6 @@ public interface ServerSession extends SecurityAuth {
 
    void close(boolean failed) throws Exception;
 
-   void waitContextCompletion() throws Exception;
-
    void setTransferring(boolean transferring);
 
    Set<ServerConsumer> getServerConsumers();

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/63b156e2/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
index 8077ae9..90b0f83 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
@@ -1245,16 +1245,6 @@ public class ActiveMQServerImpl implements ActiveMQServer {
             ActiveMQServerLogger.LOGGER.errorClosingSessionsWhileStoppingServer(e);
          }
       }
-      if (!criticalIOError) {
-         for (ServerSession session : sessions.values()) {
-            try {
-               session.waitContextCompletion();
-            } catch (Exception e) {
-               ActiveMQServerLogger.LOGGER.errorClosingSessionsWhileStoppingServer(e);
-            }
-         }
-      }
-
    }
 
    static void stopComponent(ActiveMQComponent component) {

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/63b156e2/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java
index 48acdf1..c48cb2e 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java
@@ -1239,17 +1239,6 @@ public class ServerSessionImpl implements ServerSession, FailureListener {
    }
 
    @Override
-   public void waitContextCompletion() {
-      try {
-         if (!context.waitCompletion(10000)) {
-            ActiveMQServerLogger.LOGGER.errorCompletingContext(new Exception("warning"));
-         }
-      } catch (Exception e) {
-         ActiveMQServerLogger.LOGGER.errorCompletingContext(e);
-      }
-   }
-
-   @Override
    public void close(final boolean failed) {
       if (closed)
          return;

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/63b156e2/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/JMSPagingFileDeleteTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/JMSPagingFileDeleteTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/JMSPagingFileDeleteTest.java
index a51387d..bf2446b 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/JMSPagingFileDeleteTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/JMSPagingFileDeleteTest.java
@@ -29,6 +29,7 @@ import org.apache.activemq.artemis.core.paging.PagingStore;
 import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
 import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
 import org.apache.activemq.artemis.tests.util.JMSTestBase;
+import org.apache.activemq.artemis.tests.util.Wait;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -121,12 +122,8 @@ public class JMSPagingFileDeleteTest extends JMSTestBase {
             //subscriber1.close(); // << you can't call this on this test
             //session.close(); // << can't call this on this test
 
-            long timeout = System.currentTimeMillis() + 5000;
-            while (timeout > System.currentTimeMillis() && pagingStore.isPaging()) {
-               Thread.sleep(100);
-            }
+            Wait.assertFalse(pagingStore::isPaging);
             printPageStoreInfo(pagingStore);
-            assertFalse(pagingStore.isPaging());
          }
 
       } finally {