You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ro...@apache.org on 2022/08/15 15:16:04 UTC

[activemq-artemis] 01/04: reinstate another test manipulating levels

This is an automated email from the ASF dual-hosted git repository.

robbie pushed a commit to branch new-logging
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git

commit 7cd51416c148de13f2daccfd8f500ed3f03b7b1e
Author: Robbie Gemmell <ro...@apache.org>
AuthorDate: Mon Aug 15 15:24:06 2022 +0100

    reinstate another test manipulating levels
---
 .../integration/server/NetworkHealthCheckTest.java     | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/NetworkHealthCheckTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/NetworkHealthCheckTest.java
index 82d65cb23b..f5017bc31b 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/NetworkHealthCheckTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/NetworkHealthCheckTest.java
@@ -21,29 +21,31 @@ import org.apache.activemq.artemis.core.config.Configuration;
 import org.apache.activemq.artemis.core.server.ActiveMQServer;
 import org.apache.activemq.artemis.core.server.NetworkHealthCheck;
 import org.apache.activemq.artemis.logs.AssertionLoggerHandler;
+import org.apache.activemq.artemis.logs.AssertionLoggerHandler.LogLevel;
 import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
 import org.junit.AfterClass;
 import org.junit.Assert;
 import org.junit.BeforeClass;
-import org.junit.Ignore;
 import org.junit.Test;
 
-@Ignore("Needs updated to account for logging impl changes") //TODO: reinstate
 public class NetworkHealthCheckTest extends ActiveMQTestBase {
 
-   //TODO: private static final Logger logManager = org.jboss.logmanager.Logger.getLogger(NetworkHealthCheck.class.getPackage().getName());
-   //TODO: private static java.util.logging.Level previousLevel = logManager.getLevel();
+   private static final String HEALTH_CHECK_LOGGER_NAME = NetworkHealthCheck.class.getName();
+   private static LogLevel previousLevel = null;
 
    @BeforeClass
    public static void prepareLogger() {
-      //TODO: logManager.setLevel(Level.ALL);
+      previousLevel = AssertionLoggerHandler.setLevel(HEALTH_CHECK_LOGGER_NAME, LogLevel.DEBUG);
       AssertionLoggerHandler.startCapture();
    }
 
    @AfterClass
    public static void clearLogger() {
-      AssertionLoggerHandler.stopCapture();
-      //TODO: logManager.setLevel(previousLevel);
+      try {
+         AssertionLoggerHandler.stopCapture();
+      } finally {
+         AssertionLoggerHandler.setLevel(HEALTH_CHECK_LOGGER_NAME, previousLevel);
+      }
    }
 
 
@@ -63,7 +65,7 @@ public class NetworkHealthCheckTest extends ActiveMQTestBase {
 
       server.start();
       try {
-         Assert.assertTrue(AssertionLoggerHandler.findText(String.format(customIpv4Command, checkingTimeout, checkingHost)));
+         Assert.assertTrue(AssertionLoggerHandler.findText("executing ping:: " + String.format(customIpv4Command, checkingTimeout, checkingHost)));
          Assert.assertFalse(AssertionLoggerHandler.findText(String.format(NetworkHealthCheck.IPV4_DEFAULT_COMMAND, checkingTimeout, checkingHost)));
       } finally {
          server.stop();