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.Logger;
private static final String EVENT_NAME_B = "EventB";
private ILttngSession session;
+ private LTTngAgent agent;
private Logger loggerA;
private Logger loggerB;
@Before
public void setup() {
loggerA = Logger.getLogger(EVENT_NAME_A);
- LTTngAgent.getLTTngAgent();
+ agent = LTTngAgent.getLTTngAgent();
loggerB = Logger.getLogger(EVENT_NAME_B);
loggerA.setLevel(Level.ALL);
public void tearDown() {
session.close();
- LTTngAgent.dispose();
+ agent.dispose();
loggerA = null;
loggerB = null;
assertEquals(10, handler.getEventCount());
}
+ /**
+ * Test that the "lttng list" commands lists the expected events.
+ */
+ @Test
+ public void testListEvents() {
+ List<String> enabledEvents = session.listEvents();
+ List<String> 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.