Bump log4j2 test dependencies
[lttng-ust-java-tests.git] / lttng-ust-java-tests-log4j / src / test / java / org / lttng / ust / agent / integration / events / Log4jListEventsIT.java
index c7be8c84affb373f32a7cecade2b874cbdea72c4..90fa9634d6d6d15f55c358a8c73dd24f4f0caa92 100644 (file)
@@ -21,11 +21,13 @@ package org.lttng.ust.agent.integration.events;
 import java.io.IOException;
 
 import org.apache.log4j.Appender;
+import org.apache.log4j.LogManager;
 import org.apache.log4j.Logger;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Tag;
 import org.lttng.tools.ILttngSession;
 import org.lttng.ust.agent.log4j.LttngLogAppender;
 import org.lttng.ust.agent.utils.Log4jTestUtils;
@@ -33,6 +35,8 @@ import org.lttng.ust.agent.utils.Log4jTestUtils;
 /**
  * Test suite for the list events command for the log4j domain
  */
+@Tag("agent:log4j")
+@Tag("domain:log4j")
 public class Log4jListEventsIT extends ListEventsITBase {
 
     private Logger[] loggers;
@@ -41,7 +45,7 @@ public class Log4jListEventsIT extends ListEventsITBase {
     /**
      * Class setup
      */
-    @BeforeClass
+    @BeforeAll
     public static void log4jClassSetup() {
         Log4jTestUtils.testClassSetup();
     }
@@ -49,7 +53,7 @@ public class Log4jListEventsIT extends ListEventsITBase {
     /**
      * Class cleanup
      */
-    @AfterClass
+    @AfterAll
     public static void log4jClassCleanup() {
         Log4jTestUtils.testClassCleanup();
     }
@@ -60,8 +64,12 @@ public class Log4jListEventsIT extends ListEventsITBase {
      * @throws SecurityException
      * @throws IOException
      */
-    @Before
+    @BeforeEach
     public void log4jSetup() throws SecurityException, IOException {
+        /* Try clearing the log4j logger configuration */
+        LogManager.resetConfiguration();
+        System.gc();
+
         loggers = new Logger[] {
                 Logger.getLogger(LOGGER_NAME_1),
                 Logger.getLogger(LOGGER_NAME_2),
@@ -77,7 +85,7 @@ public class Log4jListEventsIT extends ListEventsITBase {
     /**
      * Test teardown. Detach and close all log handlers.
      */
-    @After
+    @AfterEach
     public void log4jTeardown() {
         for (Logger logger : loggers) {
             for (Appender appender : appenders) {
This page took 0.024935 seconds and 4 git commands to generate.