Add 'log4j2' domain tests to the Log4j 2.x agent
[lttng-ust-java-tests.git] / lttng-ust-java-tests-jul / src / test / java / org / lttng / ust / agent / integration / events / JulListEventsIT.java
index 0c97d37ae86f91d1bfc01f679727370f916805cb..b493b02769f8388a6bf2146b1c92687ff2527b2c 100644 (file)
@@ -20,12 +20,14 @@ package org.lttng.ust.agent.integration.events;
 
 import java.io.IOException;
 import java.util.logging.Handler;
+import java.util.logging.LogManager;
 import java.util.logging.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.jul.LttngLogHandler;
 import org.lttng.ust.agent.utils.JulTestUtils;
@@ -33,6 +35,8 @@ import org.lttng.ust.agent.utils.JulTestUtils;
 /**
  * Test suite for the list events command for the JUL domain
  */
+@Tag("agent:jul")
+@Tag("domain:jul")
 public class JulListEventsIT extends ListEventsITBase {
 
     private Logger[] loggers;
@@ -41,7 +45,7 @@ public class JulListEventsIT extends ListEventsITBase {
     /**
      * Class setup
      */
-    @BeforeClass
+    @BeforeAll
     public static void julClassSetup() {
         JulTestUtils.testClassSetup();
     }
@@ -49,7 +53,7 @@ public class JulListEventsIT extends ListEventsITBase {
     /**
      * Class cleanup
      */
-    @AfterClass
+    @AfterAll
     public static void julClassCleanup() {
         JulTestUtils.testClassCleanup();
     }
@@ -60,8 +64,12 @@ public class JulListEventsIT extends ListEventsITBase {
      * @throws SecurityException
      * @throws IOException
      */
-    @Before
+    @BeforeEach
     public void julSetup() throws SecurityException, IOException {
+        /* Clear the JUL logger configuration */
+        LogManager.getLogManager().reset();
+        System.gc();
+
         loggers = new Logger[] {
                 Logger.getLogger(LOGGER_NAME_1),
                 Logger.getLogger(LOGGER_NAME_2),
@@ -77,7 +85,7 @@ public class JulListEventsIT extends ListEventsITBase {
     /**
      * Test teardown. Detach and close all log handlers.
      */
-    @After
+    @AfterEach
     public void julTeardown() {
         for (Logger logger : loggers) {
             for (Handler handler : handlers) {
This page took 0.025344 seconds and 4 git commands to generate.