Add tests for "lttng list" when using the legacy agent
[lttng-ust-java-tests.git] / lttng-ust-java-tests-log4j / src / test / java / org / lttng / ust / agent / integration / events / Log4jLegacyApiIT.java
index 56a3d238ee2188e38c31c000afca45460cc8ac3f..50e824e9a7305a650c04dde6133c17dcec2ac1da 100644 (file)
@@ -24,6 +24,8 @@ 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 org.apache.log4j.Level;
@@ -166,6 +168,20 @@ public class Log4jLegacyApiIT {
         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 Log4j Handler currently managed by the LTTngAgent. It
      * is not public, so we need reflection to access it.
This page took 0.034002 seconds and 4 git commands to generate.