Add test to to enable events then destroying the session
authorAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Thu, 4 Feb 2016 21:26:06 +0000 (16:26 -0500)
committerAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Thu, 4 Feb 2016 21:27:04 +0000 (16:27 -0500)
Upon session destroy, the sessiond should send the corresponding
agent messages to disable the events that were present in the session.

Signed-off-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
lttng-ust-java-tests-common/src/test/java/org/lttng/ust/agent/integration/client/TcpClientIT.java

index 2794dfa58411f96afcc98496756b1c9d6f82230e..16c7d0185f623e247155148f3f1acfe19364efa0 100644 (file)
@@ -234,6 +234,25 @@ public class TcpClientIT {
         assertTrue(containSameElements(expectedDisableCommands, clientListener.getDisabledEventCommands()));
     }
 
+    /**
+     * Test enabling then destroying the session (should send corresponding
+     * disable event messages).
+     */
+    @SuppressWarnings("static-method")
+    @Test
+    public void testEnableEventThenDestroy() {
+        try (ILttngSession session2 = ILttngSession.createSession(null, SESSION_DOMAIN);) {
+            session2.enableEvent(EVENT_NAME_A, null, false, null);
+            session2.enableEvent(EVENT_NAME_B, null, false, null);
+        } // close(), aka destroy the session, sending "disable event" messages
+
+        List<EventRule> expectedEnabledCommands = Arrays.asList(EventRuleFactory.createRule(EVENT_NAME_A), EventRuleFactory.createRule(EVENT_NAME_B));
+        List<String> expectedDisabledCommands = Arrays.asList(EVENT_NAME_A, EVENT_NAME_B);
+
+        assertEquals(expectedEnabledCommands, clientListener.getEnabledEventCommands());
+        assertEquals(expectedDisabledCommands, clientListener.getDisabledEventCommands());
+    }
+
     /**
      * Test specifying an event with a --loglevel option.
      */
This page took 0.023928 seconds and 4 git commands to generate.