NO-JIRA Fixing tests that were changing logging configurations

This commit is contained in:
Clebert Suconic 2020-04-16 15:44:29 -04:00
parent 806b8d3217
commit c2c27bf601
2 changed files with 21 additions and 4 deletions

View File

@ -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

View File

@ -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);