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";
+ protected static final String LOGGER_NAME_3 = "org.lttng.myothercomponent-àéç";
private ILttngSession session;
/**
* Common test setup
*/
- @Before
+ @BeforeEach
public void testSetup() {
session = ILttngSession.createSession(null, getDomain());
}
/**
* Common test teardown
*/
- @After
+ @AfterEach
public void testTeardown() {
session.close();
}
@Test
public void testManyLoggersNoneAttached() {
/* Don't attach anything */
- Set<String> actualEvents = session.listEvents();
+ List<String> actualEvents = session.listEvents();
assertTrue(actualEvents.isEmpty());
}
public void testManyLoggersSomeAttached() {
attachHandlerToLogger(1, 1);
- Set<String> expectedEvents = new HashSet<>(Arrays.asList(LOGGER_NAME_1));
- Set<String> actualEvents = session.listEvents();
+ List<String> expectedEvents = Arrays.asList(LOGGER_NAME_1);
+ List<String> actualEvents = session.listEvents();
+
+ Collections.sort(expectedEvents);
+ Collections.sort(actualEvents);
assertEquals(expectedEvents, actualEvents);
}
attachHandlerToLogger(2, 2);
attachHandlerToLogger(2, 3);
- Set<String> expectedEvents = new HashSet<>(Arrays.asList(LOGGER_NAME_1, LOGGER_NAME_2, LOGGER_NAME_3));
- Set<String> actualEvents = session.listEvents();
+ List<String> expectedEvents = Arrays.asList(LOGGER_NAME_1, LOGGER_NAME_2, LOGGER_NAME_3);
+ List<String> actualEvents = session.listEvents();
+
+ Collections.sort(expectedEvents);
+ Collections.sort(actualEvents);
assertEquals(expectedEvents, actualEvents);
}
detachHandlerFromLogger(2, 3);
/* Only loggers 1 and 2 will be attached */
- Set<String> expectedEvents = new HashSet<>(Arrays.asList(LOGGER_NAME_1, LOGGER_NAME_2));
- Set<String> actualEvents = session.listEvents();
+ List<String> expectedEvents = Arrays.asList(LOGGER_NAME_1, LOGGER_NAME_2);
+ List<String> actualEvents = session.listEvents();
+
+ Collections.sort(expectedEvents);
+ Collections.sort(actualEvents);
assertEquals(expectedEvents, actualEvents);
}
detachHandlerFromLogger(2, 2);
detachHandlerFromLogger(2, 3);
- Set<String> actualEvents = session.listEvents();
+ List<String> actualEvents = session.listEvents();
assertTrue(actualEvents.isEmpty());
}
}