X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=lttng-ust-java-tests-jul%2Fsrc%2Ftest%2Fjava%2Forg%2Flttng%2Fust%2Fagent%2Fintegration%2Fevents%2FJulLegacyApiIT.java;h=97ba4b694049299795b686e4aecde7b66c7d83d0;hb=d21525e47ed5a103b35cf6cce652ce6e0e784464;hp=f7c130a325a9eae5917187c720f31571c6af61a1;hpb=eca27046b6f32c55dc7ceccb0821431c9be9f3af;p=lttng-ust-java-tests.git diff --git a/lttng-ust-java-tests-jul/src/test/java/org/lttng/ust/agent/integration/events/JulLegacyApiIT.java b/lttng-ust-java-tests-jul/src/test/java/org/lttng/ust/agent/integration/events/JulLegacyApiIT.java index f7c130a..97ba4b6 100644 --- a/lttng-ust-java-tests-jul/src/test/java/org/lttng/ust/agent/integration/events/JulLegacyApiIT.java +++ b/lttng-ust-java-tests-jul/src/test/java/org/lttng/ust/agent/integration/events/JulLegacyApiIT.java @@ -24,8 +24,11 @@ import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import java.lang.reflect.Field; +import java.util.Arrays; +import java.util.Collections; import java.util.List; import java.util.logging.Level; +import java.util.logging.LogManager; import java.util.logging.Logger; import org.junit.After; @@ -54,6 +57,7 @@ public class JulLegacyApiIT { private static final String EVENT_NAME_B = "EventB"; private ILttngSession session; + private LTTngAgent agent; private Logger loggerA; private Logger loggerB; @@ -79,8 +83,12 @@ public class JulLegacyApiIT { */ @Before public void setup() { + /* Clear the JUL logger configuration */ + LogManager.getLogManager().reset(); + System.gc(); + loggerA = Logger.getLogger(EVENT_NAME_A); - LTTngAgent.getLTTngAgent(); + agent = LTTngAgent.getLTTngAgent(); loggerB = Logger.getLogger(EVENT_NAME_B); loggerA.setLevel(Level.ALL); @@ -96,7 +104,7 @@ public class JulLegacyApiIT { public void tearDown() { session.close(); - LTTngAgent.dispose(); + agent.dispose(); loggerA = null; loggerB = null; @@ -164,6 +172,20 @@ public class JulLegacyApiIT { assertEquals(10, handler.getEventCount()); } + /** + * Test that the "lttng list" commands lists the expected events. + */ + @Test + public void testListEvents() { + List enabledEvents = session.listEvents(); + List expectedEvents = Arrays.asList(EVENT_NAME_A, EVENT_NAME_B); + + Collections.sort(enabledEvents); + Collections.sort(expectedEvents); + + assertEquals(expectedEvents, enabledEvents); + } + /** * Get the singleton JUL Handler currently managed by the LTTngAgent. It is * not public, so we need reflection to access it.