Add tests for "lttng list" when using the legacy agent
authorAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Thu, 2 Jun 2016 01:49:29 +0000 (21:49 -0400)
committerAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Thu, 2 Jun 2016 09:32:08 +0000 (05:32 -0400)
Highlights a bug in current master.

Signed-off-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
lttng-ust-java-tests-jul/src/test/java/org/lttng/ust/agent/integration/events/JulLegacyApiIT.java
lttng-ust-java-tests-log4j/src/test/java/org/lttng/ust/agent/integration/events/Log4jLegacyApiIT.java

index e8bcb9d39c7ef4f8fd8262c7c112a3c2f3bb04a3..674ca7985b9bff499d821b563a53c7f169fc4af7 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 java.util.logging.Level;
 import java.util.logging.Logger;
@@ -165,6 +167,20 @@ public class JulLegacyApiIT {
         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.
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.050464 seconds and 4 git commands to generate.