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


The following commit(s) were added to refs/heads/master by this push:
     new c2c27bf  NO-JIRA Fixing tests that were changing logging configurations
c2c27bf is described below

commit c2c27bf601c2761620ce0962d6b7289362b1cf04
Author: Clebert Suconic <[email protected]>
AuthorDate: Thu Apr 16 15:44:29 2020 -0400

    NO-JIRA Fixing tests that were changing logging configurations
---
 .../integration/management/AuditLoggerTest.java     | 21 +++++++++++++++++++++
 .../tests/integration/stomp/v12/StompV12Test.java   |  4 ----
 2 files changed, 21 insertions(+), 4 deletions(-)

diff --git 
a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/AuditLoggerTest.java
 
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/AuditLoggerTest.java
index 10a6f4a..41b6026 100644
--- 
a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/AuditLoggerTest.java
+++ 
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/AuditLoggerTest.java
@@ -42,11 +42,13 @@ import org.junit.Test;
 
 import java.io.BufferedReader;
 import java.io.File;
+import java.io.FileInputStream;
 import java.io.FileReader;
 import java.io.FileWriter;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.PrintWriter;
+import java.net.URI;
 import java.util.HashSet;
 import java.util.UUID;
 import java.util.logging.LogManager;
@@ -97,6 +99,23 @@ public class AuditLoggerTest extends ManagementTestBase {
    @Override
    public void tearDown() throws Exception {
       super.tearDown();
+
+      String originalLoggingConfig = 
System.getProperty("logging.configuration");
+
+      if (originalLoggingConfig != null) {
+         File file = new File(new URI(originalLoggingConfig));
+         InputStream inputStream = new FileInputStream(file);
+
+         LogManager logManager = LogManager.getLogManager();
+         try {
+            logManager.readConfiguration(inputStream);
+         } catch (IOException e) {
+            System.out.println("error loading logging conifg");
+            e.printStackTrace();
+         }
+
+         inputStream.close();
+      }
    }
 
    private void emptyLogFile() throws Exception {
@@ -155,10 +174,12 @@ public class AuditLoggerTest extends ManagementTestBase {
       LogManager logManager = LogManager.getLogManager();
       try {
          logManager.readConfiguration(inputStream);
+         inputStream.close();
       } catch (IOException e) {
          System.out.println("error loading logging conifg");
          e.printStackTrace();
       }
+
    }
 
    @Test
diff --git 
a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/v12/StompV12Test.java
 
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/v12/StompV12Test.java
index 2384de9..e50f405 100644
--- 
a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/v12/StompV12Test.java
+++ 
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/v12/StompV12Test.java
@@ -38,7 +38,6 @@ import java.util.regex.Pattern;
 import org.apache.activemq.artemis.api.core.RoutingType;
 import org.apache.activemq.artemis.api.core.SimpleString;
 import org.apache.activemq.artemis.core.protocol.stomp.Stomp;
-import org.apache.activemq.artemis.core.protocol.stomp.StompConnection;
 import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
 import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
 import org.apache.activemq.artemis.tests.integration.stomp.StompTestBase;
@@ -1466,7 +1465,6 @@ public class StompV12Test extends StompTestBase {
 
    @Test
    public void testMultipleDurableSubscribers() throws Exception {
-      
org.jboss.logmanager.Logger.getLogger(StompConnection.class.getName()).setLevel(org.jboss.logmanager.Level.TRACE);
       conn.connect(defUser, defPass, "myClientID");
       StompClientConnectionV12 conn2 = (StompClientConnectionV12) 
StompClientConnectionFactory.createClientConnection(uri);
       conn2.connect(defUser, defPass, "myClientID");
@@ -1482,8 +1480,6 @@ public class StompV12Test extends StompTestBase {
 
    @Test
    public void testMultipleConcurrentDurableSubscribers() throws Exception {
-      
org.jboss.logmanager.Logger.getLogger(StompConnection.class.getName()).setLevel(org.jboss.logmanager.Level.TRACE);
-
       int NUMBER_OF_THREADS = 25;
       SubscriberThread[] threads = new SubscriberThread[NUMBER_OF_THREADS];
       final CountDownLatch startFlag = new CountDownLatch(1);

Reply via email to