X-Git-Url: https://git.liburcu.org/?a=blobdiff_plain;f=lttng-ust-java-tests-common%2Fsrc%2Fmain%2Fjava%2Forg%2Flttng%2Fust%2Fagent%2Fintegration%2Fevents%2FListEventsITBase.java;h=5551db8f21f9faee4b583c5b2af02983025a3518;hb=7a4f0255e3d52ad76b194fb2e83bcdc6f641549e;hp=dc3a10bb337615bfd97ab409b1c984c485f67153;hpb=6c2b24d50621f49424462666106dd022ced00bac;p=lttng-ust-java-tests.git diff --git a/lttng-ust-java-tests-common/src/main/java/org/lttng/ust/agent/integration/events/ListEventsITBase.java b/lttng-ust-java-tests-common/src/main/java/org/lttng/ust/agent/integration/events/ListEventsITBase.java index dc3a10b..5551db8 100644 --- a/lttng-ust-java-tests-common/src/main/java/org/lttng/ust/agent/integration/events/ListEventsITBase.java +++ b/lttng-ust-java-tests-common/src/main/java/org/lttng/ust/agent/integration/events/ListEventsITBase.java @@ -18,24 +18,27 @@ package org.lttng.ust.agent.integration.events; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; +import java.util.Collections; +import java.util.List; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.lttng.tools.ILttngSession; +import org.lttng.ust.agent.utils.TestPrintExtension; /** * Base class for the list events command tests */ +@ExtendWith(TestPrintExtension.class) public abstract class ListEventsITBase { - protected static final String LOGGER_NAME_1 = "org.lttng"; + protected static final String LOGGER_NAME_1 = "org.lttng.somecomponent"; protected static final String LOGGER_NAME_2 = "org.lttng.mycomponent"; protected static final String LOGGER_NAME_3 = "org.lttng.myothercomponent-àéç"; @@ -44,7 +47,7 @@ public abstract class ListEventsITBase { /** * Common test setup */ - @Before + @BeforeEach public void testSetup() { session = ILttngSession.createSession(null, getDomain()); } @@ -52,7 +55,7 @@ public abstract class ListEventsITBase { /** * Common test teardown */ - @After + @AfterEach public void testTeardown() { session.close(); } @@ -70,7 +73,7 @@ public abstract class ListEventsITBase { @Test public void testManyLoggersNoneAttached() { /* Don't attach anything */ - Set actualEvents = session.listEvents(); + List actualEvents = session.listEvents(); assertTrue(actualEvents.isEmpty()); } @@ -82,8 +85,11 @@ public abstract class ListEventsITBase { public void testManyLoggersSomeAttached() { attachHandlerToLogger(1, 1); - Set expectedEvents = new HashSet<>(Arrays.asList(LOGGER_NAME_1)); - Set actualEvents = session.listEvents(); + List expectedEvents = Arrays.asList(LOGGER_NAME_1); + List actualEvents = session.listEvents(); + + Collections.sort(expectedEvents); + Collections.sort(actualEvents); assertEquals(expectedEvents, actualEvents); } @@ -98,8 +104,11 @@ public abstract class ListEventsITBase { attachHandlerToLogger(2, 2); attachHandlerToLogger(2, 3); - Set expectedEvents = new HashSet<>(Arrays.asList(LOGGER_NAME_1, LOGGER_NAME_2, LOGGER_NAME_3)); - Set actualEvents = session.listEvents(); + List expectedEvents = Arrays.asList(LOGGER_NAME_1, LOGGER_NAME_2, LOGGER_NAME_3); + List actualEvents = session.listEvents(); + + Collections.sort(expectedEvents); + Collections.sort(actualEvents); assertEquals(expectedEvents, actualEvents); } @@ -116,8 +125,11 @@ public abstract class ListEventsITBase { detachHandlerFromLogger(2, 3); /* Only loggers 1 and 2 will be attached */ - Set expectedEvents = new HashSet<>(Arrays.asList(LOGGER_NAME_1, LOGGER_NAME_2)); - Set actualEvents = session.listEvents(); + List expectedEvents = Arrays.asList(LOGGER_NAME_1, LOGGER_NAME_2); + List actualEvents = session.listEvents(); + + Collections.sort(expectedEvents); + Collections.sort(actualEvents); assertEquals(expectedEvents, actualEvents); } @@ -134,7 +146,7 @@ public abstract class ListEventsITBase { detachHandlerFromLogger(2, 2); detachHandlerFromLogger(2, 3); - Set actualEvents = session.listEvents(); + List actualEvents = session.listEvents(); assertTrue(actualEvents.isEmpty()); } }