2 * Copyright (C) 2015, EfficiOS Inc., Alexandre Montplaisir <alexmonthy@efficios.com>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 package org
.lttng
.ust
.agent
.integration
.client
;
21 import static org
.junit
.Assert
.assertEquals
;
22 import static org
.junit
.Assert
.assertTrue
;
23 import static org
.junit
.Assert
.fail
;
25 import java
.util
.ArrayList
;
26 import java
.util
.Arrays
;
27 import java
.util
.Collections
;
28 import java
.util
.List
;
30 import org
.junit
.After
;
31 import org
.junit
.AfterClass
;
32 import org
.junit
.Before
;
33 import org
.junit
.BeforeClass
;
34 import org
.junit
.Test
;
35 import org
.junit
.runner
.RunWith
;
36 import org
.lttng
.tools
.ILttngSession
;
37 import org
.lttng
.tools
.LttngToolsHelper
;
38 import org
.lttng
.ust
.agent
.ILttngAgent
;
39 import org
.lttng
.ust
.agent
.client
.LttngTcpSessiondClient
;
40 import org
.lttng
.ust
.agent
.session
.EventRule
;
41 import org
.lttng
.ust
.agent
.session
.LogLevelSelector
;
42 import org
.lttng
.ust
.agent
.session
.LogLevelSelector
.LogLevelType
;
43 import org
.lttng
.ust
.agent
.utils
.EventRuleFactory
;
44 import org
.lttng
.ust
.agent
.utils
.ILogLevelStrings
;
45 import org
.lttng
.ust
.agent
.utils
.TestPrintRunner
;
48 * Tests for the TCP client only, without using an agent.
50 * This test suite requires that a *root* session daemon is running on the
51 * system. Since we have to explicitly tell the TCP client which sessiond to
52 * connect to, we have to hard-code it in here.
54 * @author Alexandre Montplaisir
56 @RunWith(TestPrintRunner
.class)
57 public class TcpClientIT
{
59 // ------------------------------------------------------------------------
61 // ------------------------------------------------------------------------
63 private static final String EVENT_NAME_A
= "eventA";
64 private static final String EVENT_NAME_B
= "eventB";
65 private static final String EVENT_NAME_C
= "eventC";
67 private static final String CONTEXT_RETRIEVER_NAME_A
= "retrieverA";
68 private static final String CONTEXT_RETRIEVER_NAME_B
= "retrieverB";
69 private static final String CONTEXT_NAME_A
= "contextA";
70 private static final String CONTEXT_NAME_B
= "contextB";
72 /* Test configuration */
73 private static final int DOMAIN_VALUE
= ILttngAgent
.Domain
.JUL
.value();
74 private static final ILttngSession
.Domain SESSION_DOMAIN
= ILttngSession
.Domain
.JUL
;
76 private static TcpClientDebugListener clientListener
;
77 private static LttngTcpSessiondClient client
;
78 private static Thread clientThread
;
80 private ILttngSession session
;
82 // ------------------------------------------------------------------------
84 // ------------------------------------------------------------------------
90 public static void setupClass() {
91 LttngToolsHelper
.destroyAllSessions();
93 clientListener
= new TcpClientDebugListener();
95 /* Try connecting to a root sessiond first */
96 client
= new LttngTcpSessiondClient(clientListener
, DOMAIN_VALUE
, true);
97 clientThread
= new Thread(client
);
100 if (client
.waitForConnection(5)) {
104 /* Connection was not established, try a user sessiond instead */
108 } catch (InterruptedException e
) {
109 fail(e
.getMessage());
112 client
= new LttngTcpSessiondClient(clientListener
, DOMAIN_VALUE
, false);
113 clientThread
= new Thread(client
);
114 clientThread
.start();
116 assertTrue("Timed out waiting for a sessiond", client
.waitForConnection(5));
123 public static void teardownClass() {
124 if (client
!= null) {
127 if (clientThread
!= null) {
130 } catch (InterruptedException e
) {
139 public void setup() {
140 session
= ILttngSession
.createSession(null, SESSION_DOMAIN
);
141 clientListener
.clearAllCommands();
148 public void teardown() {
153 private static ILogLevelStrings
getLogLevelStrings() {
154 return ILogLevelStrings
.JUL_LOGLEVEL_STRINGS
;
158 * Check that two lists contain the exact same element (including
159 * duplicates), but their order does not matter.
161 private static <T
extends Comparable
<T
>> boolean containSameElements(List
<T
> list1
, List
<T
> list2
) {
162 List
<T
> newlist1
= new ArrayList
<>(list1
);
163 List
<T
> newlist2
= new ArrayList
<>(list2
);
164 Collections
.sort(newlist1
);
165 Collections
.sort(newlist2
);
166 return (newlist1
.equals(newlist2
));
170 // ------------------------------------------------------------------------
171 // Event enabling/disabling test cases
172 // ------------------------------------------------------------------------
175 * Test enabling one event.
178 public void testEnableEvent() {
179 session
.enableEvent(EVENT_NAME_A
, null, false, null);
181 List
<EventRule
> expectedCommands
= Collections
.singletonList(
182 EventRuleFactory
.createRule(EVENT_NAME_A
));
184 List
<EventRule
> actualCommands
= clientListener
.getEnabledEventCommands();
185 assertEquals(expectedCommands
, actualCommands
);
189 * Test an "enable-event -a" command.
192 public void testEnableAllEvents() {
193 session
.enableAllEvents();
195 List
<EventRule
> expectedCommands
= Collections
.singletonList(
196 EventRuleFactory
.createRuleAllEvents());
197 List
<EventRule
> actualCommands
= clientListener
.getEnabledEventCommands();
199 assertEquals(expectedCommands
, actualCommands
);
203 * Test enabling then disabling one event.
206 public void testEnableThenDisableOneEvent() {
207 session
.enableEvent(EVENT_NAME_A
, null, false, null);
208 session
.disableEvents(EVENT_NAME_A
);
210 List
<EventRule
> expectedEnableCommands
= Collections
.singletonList(
211 EventRuleFactory
.createRule(EVENT_NAME_A
));
212 List
<String
> expectedDisableCommands
= Collections
.singletonList(EVENT_NAME_A
);
214 assertEquals(expectedEnableCommands
, clientListener
.getEnabledEventCommands());
215 assertTrue(containSameElements(expectedDisableCommands
, clientListener
.getDisabledEventCommands()));
219 * Test enabling some events manually, then disabling all events (-a).
222 public void testEnableSomeThenDisableAll() {
223 session
.enableEvent(EVENT_NAME_A
, null, false, null);
224 session
.enableEvent(EVENT_NAME_B
, null, false, null);
225 session
.enableEvent(EVENT_NAME_C
, null, false, null);
226 session
.disableAllEvents();
228 List
<EventRule
> expectedEnableCommands
= Arrays
.asList(
229 EventRuleFactory
.createRule(EVENT_NAME_A
),
230 EventRuleFactory
.createRule(EVENT_NAME_B
),
231 EventRuleFactory
.createRule(EVENT_NAME_C
));
233 * A "disable-event -a" will send one command for each enabled event.
234 * The order may be different though.
236 List
<String
> expectedDisableCommands
= Arrays
.asList(
237 EVENT_NAME_A
, EVENT_NAME_B
, EVENT_NAME_C
);
239 assertEquals(expectedEnableCommands
, clientListener
.getEnabledEventCommands());
240 assertTrue(containSameElements(expectedDisableCommands
, clientListener
.getDisabledEventCommands()));
244 * Test enabling then (enable-event -a) then disabling all (disable-event -a) events.
247 public void testEnableAllThenDisableAll() {
248 session
.enableAllEvents();
249 session
.disableAllEvents();
251 List
<EventRule
> expectedEnableCommands
= Arrays
.asList(EventRuleFactory
.createRuleAllEvents());
252 List
<String
> expectedDisableCommands
= Arrays
.asList(EventRuleFactory
.EVENT_NAME_ALL
);
254 assertEquals(expectedEnableCommands
, clientListener
.getEnabledEventCommands());
255 assertTrue(containSameElements(expectedDisableCommands
, clientListener
.getDisabledEventCommands()));
259 * Test enabling then destroying the session (should send corresponding
260 * disable event messages).
262 @SuppressWarnings("static-method")
264 public void testEnableEventThenDestroy() {
265 try (ILttngSession session2
= ILttngSession
.createSession(null, SESSION_DOMAIN
);) {
266 session2
.enableEvent(EVENT_NAME_A
, null, false, null);
267 session2
.enableEvent(EVENT_NAME_B
, null, false, null);
268 } // close(), aka destroy the session, sending "disable event" messages
270 List
<EventRule
> expectedEnabledCommands
= Arrays
.asList(EventRuleFactory
.createRule(EVENT_NAME_A
), EventRuleFactory
.createRule(EVENT_NAME_B
));
271 List
<String
> expectedDisabledCommands
= Arrays
.asList(EVENT_NAME_A
, EVENT_NAME_B
);
273 assertEquals(expectedEnabledCommands
, clientListener
.getEnabledEventCommands());
274 assertTrue(clientListener
.getDisabledEventCommands().containsAll(expectedDisabledCommands
));
278 * Test specifying an event with a --loglevel option.
281 public void testEnableEventLogLevelRange() {
282 LogLevelSelector lls
= new LogLevelSelector(getLogLevelStrings().warningInt(), LogLevelType
.LTTNG_EVENT_LOGLEVEL_RANGE
);
284 session
.enableEvent(EVENT_NAME_A
, getLogLevelStrings().warningName(), false, null);
286 List
<EventRule
> expectedCommands
= Collections
.singletonList(
287 EventRuleFactory
.createRule(EVENT_NAME_A
, lls
));
288 List
<EventRule
> actualCommands
= clientListener
.getEnabledEventCommands();
290 assertEquals(expectedCommands
, actualCommands
);
294 * Test enabling an event with a --loglevel-only option.
297 public void testEnableEventLogLevelSingle() {
298 LogLevelSelector lls
= new LogLevelSelector(getLogLevelStrings().warningInt(), LogLevelType
.LTTNG_EVENT_LOGLEVEL_SINGLE
);
300 session
.enableEvent(EVENT_NAME_A
, getLogLevelStrings().warningName(), true, null);
302 List
<EventRule
> expectedCommands
= Collections
.singletonList(
303 EventRuleFactory
.createRule(EVENT_NAME_A
, lls
));
304 List
<EventRule
> actualCommands
= clientListener
.getEnabledEventCommands();
306 assertEquals(expectedCommands
, actualCommands
);
310 * Test enabling an event twice, for the same loglevel, with --loglevel followed by --loglevel-only.
313 public void testEnableEventsLogLevelRangeAndSingle() {
314 LogLevelSelector lls1
= new LogLevelSelector(getLogLevelStrings().warningInt(), LogLevelType
.LTTNG_EVENT_LOGLEVEL_RANGE
);
315 LogLevelSelector lls2
= new LogLevelSelector(getLogLevelStrings().warningInt(), LogLevelType
.LTTNG_EVENT_LOGLEVEL_SINGLE
);
317 session
.enableEvent(EVENT_NAME_A
, getLogLevelStrings().warningName(), false, null);
318 session
.enableEvent(EVENT_NAME_A
, getLogLevelStrings().warningName(), true, null);
320 List
<EventRule
> expectedCommands
= Arrays
.asList(
321 EventRuleFactory
.createRule(EVENT_NAME_A
, lls1
),
322 EventRuleFactory
.createRule(EVENT_NAME_A
, lls2
)
324 List
<EventRule
> actualCommands
= clientListener
.getEnabledEventCommands();
326 assertEquals(expectedCommands
, actualCommands
);
330 * Test enabling an event twice, for the same loglevel, with --loglevel-only followed by --loglevel.
333 public void testEnableEventsLogLevelSingleAndRange() {
334 LogLevelSelector lls1
= new LogLevelSelector(getLogLevelStrings().warningInt(), LogLevelType
.LTTNG_EVENT_LOGLEVEL_SINGLE
);
335 LogLevelSelector lls2
= new LogLevelSelector(getLogLevelStrings().warningInt(), LogLevelType
.LTTNG_EVENT_LOGLEVEL_RANGE
);
337 session
.enableEvent(EVENT_NAME_A
, getLogLevelStrings().warningName(), true, null);
338 session
.enableEvent(EVENT_NAME_A
, getLogLevelStrings().warningName(), false, null);
340 List
<EventRule
> expectedCommands
= Arrays
.asList(
341 EventRuleFactory
.createRule(EVENT_NAME_A
, lls1
),
342 EventRuleFactory
.createRule(EVENT_NAME_A
, lls2
)
344 List
<EventRule
> actualCommands
= clientListener
.getEnabledEventCommands();
346 assertEquals(expectedCommands
, actualCommands
);
350 * Test enabling the same event, same loglevel, but different loglevel types
351 * (--loglevel vs --loglevel-only) in two separate sessions.
354 public void testEnableEventsLogLevelRangeAndSingleDiffSessions() {
355 try (ILttngSession session2
= ILttngSession
.createSession(null, SESSION_DOMAIN
);) {
357 LogLevelSelector lls1
= new LogLevelSelector(getLogLevelStrings().warningInt(), LogLevelType
.LTTNG_EVENT_LOGLEVEL_RANGE
);
358 LogLevelSelector lls2
= new LogLevelSelector(getLogLevelStrings().warningInt(), LogLevelType
.LTTNG_EVENT_LOGLEVEL_SINGLE
);
360 session
.enableEvent(EVENT_NAME_A
, getLogLevelStrings().warningName(), false, null);
361 session2
.enableEvent(EVENT_NAME_A
, getLogLevelStrings().warningName(), true, null);
363 List
<EventRule
> expectedCommands
= Arrays
.asList(
364 EventRuleFactory
.createRule(EVENT_NAME_A
, lls1
),
365 EventRuleFactory
.createRule(EVENT_NAME_A
, lls2
));
366 List
<EventRule
> actualCommands
= clientListener
.getEnabledEventCommands();
368 assertEquals(expectedCommands
, actualCommands
);
373 * Enable the same event multiple times with different filter strings.
376 public void testEnableEventsDiffFilters() {
377 final String filter1
= "filter1";
378 final String filter2
= "filter2";
380 session
.enableEvent(EVENT_NAME_A
, null, false, null);
381 session
.enableEvent(EVENT_NAME_A
, null, false, filter1
);
382 session
.enableEvent(EVENT_NAME_A
, null, false, filter2
);
384 List
<EventRule
> expectedCommands
= Arrays
.asList(
385 EventRuleFactory
.createRule(EVENT_NAME_A
),
386 EventRuleFactory
.createRule(EVENT_NAME_A
, EventRuleFactory
.LOG_LEVEL_UNSPECIFIED
, filter1
),
387 EventRuleFactory
.createRule(EVENT_NAME_A
, EventRuleFactory
.LOG_LEVEL_UNSPECIFIED
, filter2
));
388 List
<EventRule
> actualCommands
= clientListener
.getEnabledEventCommands();
390 assertEquals(expectedCommands
, actualCommands
);
394 * Enable the same event multiple times with different log levels and
398 public void testEnableEventsLogLevelAndFilters() {
399 final LogLevelSelector lls
= new LogLevelSelector(getLogLevelStrings().warningInt(), LogLevelType
.LTTNG_EVENT_LOGLEVEL_RANGE
);
400 final String filter
= "filter1";
402 session
.enableEvent(EVENT_NAME_A
, null, false, null);
403 session
.enableEvent(EVENT_NAME_A
, getLogLevelStrings().warningName(), false, null);
404 session
.enableEvent(EVENT_NAME_A
, null, false, filter
);
405 session
.enableEvent(EVENT_NAME_A
, getLogLevelStrings().warningName(), false, filter
);
407 List
<EventRule
> expectedCommands
= Arrays
.asList(
408 EventRuleFactory
.createRule(EVENT_NAME_A
),
409 EventRuleFactory
.createRule(EVENT_NAME_A
, lls
),
410 EventRuleFactory
.createRule(EVENT_NAME_A
, EventRuleFactory
.LOG_LEVEL_UNSPECIFIED
, filter
),
411 EventRuleFactory
.createRule(EVENT_NAME_A
, lls
, filter
));
412 List
<EventRule
> actualCommands
= clientListener
.getEnabledEventCommands();
414 assertEquals(expectedCommands
, actualCommands
);
417 // ------------------------------------------------------------------------
418 // Application context enabling/disabling test cases
419 // ------------------------------------------------------------------------
422 * Test enabling one application context.
425 public void testEnableAppContext() {
426 session
.enableAppContext(CONTEXT_RETRIEVER_NAME_A
, CONTEXT_NAME_A
);
428 List
<String
> expectedCommands
= Collections
.singletonList(
429 CONTEXT_RETRIEVER_NAME_A
+ ':' + CONTEXT_NAME_A
);
431 List
<String
> actualCommands
= clientListener
.getEnabledAppContextCommands();
432 assertEquals(expectedCommands
, actualCommands
);
436 * Test enabling two application contexts sharing the same retriever name.
439 public void testEnableAppContextsSameRetriever() {
440 session
.enableAppContext(CONTEXT_RETRIEVER_NAME_A
, CONTEXT_NAME_A
);
441 session
.enableAppContext(CONTEXT_RETRIEVER_NAME_A
, CONTEXT_NAME_B
);
443 List
<String
> expectedCommands
= Arrays
.asList(
444 CONTEXT_RETRIEVER_NAME_A
+ ':' + CONTEXT_NAME_A
,
445 CONTEXT_RETRIEVER_NAME_A
+ ':' + CONTEXT_NAME_B
);
447 List
<String
> actualCommands
= clientListener
.getEnabledAppContextCommands();
448 assertEquals(expectedCommands
, actualCommands
);
452 * Test enabling two application contexts sharing the same context name, but
453 * with different retrievers. Unusual, but they should still be recognized
457 public void testEnableAppContextsSameContext() {
458 session
.enableAppContext(CONTEXT_RETRIEVER_NAME_A
, CONTEXT_NAME_A
);
459 session
.enableAppContext(CONTEXT_RETRIEVER_NAME_B
, CONTEXT_NAME_A
);
461 List
<String
> expectedCommands
= Arrays
.asList(
462 CONTEXT_RETRIEVER_NAME_A
+ ':' + CONTEXT_NAME_A
,
463 CONTEXT_RETRIEVER_NAME_B
+ ':' + CONTEXT_NAME_A
);
465 List
<String
> actualCommands
= clientListener
.getEnabledAppContextCommands();
466 assertEquals(expectedCommands
, actualCommands
);
470 * Test enabling one application context, then destroying the session. We
471 * should receive the corresponding "context removed" message.
474 @SuppressWarnings("static-method")
475 public void testEnableAppContextThenDestroy() {
476 try (ILttngSession session2
= ILttngSession
.createSession(null, SESSION_DOMAIN
);) {
477 session2
.enableAppContext(CONTEXT_RETRIEVER_NAME_A
, CONTEXT_NAME_A
);
478 } // close(), aka destroy the session, sending "disable context" messages
480 List
<String
> expectedEnabledCommands
= Collections
.singletonList(CONTEXT_RETRIEVER_NAME_A
+ ':' + CONTEXT_NAME_A
);
481 List
<String
> expectedDisabledCommands
= Collections
.singletonList(CONTEXT_RETRIEVER_NAME_A
+ ':' + CONTEXT_NAME_A
);
482 List
<String
> actualEnabledCommands
= clientListener
.getEnabledAppContextCommands();
483 List
<String
> actualDisabledCommands
= clientListener
.getDisabledAppContextCommands();
485 assertEquals(expectedEnabledCommands
, actualEnabledCommands
);
486 assertEquals(expectedDisabledCommands
, actualDisabledCommands
);
490 * Test enabling the same application context in two different sessions.
491 * Upon destroying one, we should only receive one "destroyed" message.
494 public void testEnableSameAppContextTwoSessions() {
495 List
<String
> expectedEnabledCommands
= Arrays
.asList(
496 CONTEXT_RETRIEVER_NAME_A
+ ':' + CONTEXT_NAME_A
,
497 CONTEXT_RETRIEVER_NAME_A
+ ':' + CONTEXT_NAME_A
);
498 List
<String
> actualEnabledCommands
;
500 try (ILttngSession session2
= ILttngSession
.createSession(null, SESSION_DOMAIN
);) {
501 session
.enableAppContext(CONTEXT_RETRIEVER_NAME_A
, CONTEXT_NAME_A
);
502 session2
.enableAppContext(CONTEXT_RETRIEVER_NAME_A
, CONTEXT_NAME_A
);
504 actualEnabledCommands
= clientListener
.getEnabledAppContextCommands();
505 assertEquals(expectedEnabledCommands
, actualEnabledCommands
);
506 } // close/destroy session2
508 actualEnabledCommands
= clientListener
.getEnabledAppContextCommands();
509 assertEquals(expectedEnabledCommands
, actualEnabledCommands
);
511 List
<String
> expectedDisabledCommands
= Collections
.singletonList(CONTEXT_RETRIEVER_NAME_A
+ ':' + CONTEXT_NAME_A
);
512 List
<String
> actualDisabledCommands
= clientListener
.getDisabledAppContextCommands();
514 assertEquals(expectedDisabledCommands
, actualDisabledCommands
);
518 * Test enabling two different application context in two different
519 * sessions. Upon destroying one, we should receive the correct "destroyed"
523 public void testEnableDiffAppContextTwoSessions() {
524 List
<String
> expectedEnabledCommands
= Arrays
.asList(
525 CONTEXT_RETRIEVER_NAME_A
+ ':' + CONTEXT_NAME_A
,
526 CONTEXT_RETRIEVER_NAME_B
+ ':' + CONTEXT_NAME_B
);
527 List
<String
> actualEnabledCommands
;
529 try (ILttngSession session2
= ILttngSession
.createSession(null, SESSION_DOMAIN
);) {
530 session
.enableAppContext(CONTEXT_RETRIEVER_NAME_A
, CONTEXT_NAME_A
);
531 session2
.enableAppContext(CONTEXT_RETRIEVER_NAME_B
, CONTEXT_NAME_B
);
533 actualEnabledCommands
= clientListener
.getEnabledAppContextCommands();
534 assertEquals(expectedEnabledCommands
, actualEnabledCommands
);
535 } // close/destroy session2
537 actualEnabledCommands
= clientListener
.getEnabledAppContextCommands();
538 assertEquals(expectedEnabledCommands
, actualEnabledCommands
);
540 List
<String
> expectedDisabledCommands
= Collections
.singletonList(CONTEXT_RETRIEVER_NAME_B
+ ':' + CONTEXT_NAME_B
);
541 List
<String
> actualDisabledCommands
= clientListener
.getDisabledAppContextCommands();
543 assertEquals(expectedDisabledCommands
, actualDisabledCommands
);
546 // ------------------------------------------------------------------------
547 // Application context filtering
548 // ------------------------------------------------------------------------
551 * Test that enabling an event with a filter string referring to a context
552 * should send an agent message about this context now being "enabled".
554 * This is because we will pass the context information to UST for the
555 * filtering step, even if the actual context won't be present in the trace.
557 @SuppressWarnings("static-method")
559 public void testContextInFilterString() {
560 try (ILttngSession session2
= ILttngSession
.createSession(null, SESSION_DOMAIN
);) {
561 session2
.enableEvent(EVENT_NAME_A
, null, false, "$app." + CONTEXT_RETRIEVER_NAME_A
+ ':' + CONTEXT_NAME_A
+ "==\"bozo\"");
563 List
<String
> expectedEnabledCommands
= Collections
.singletonList(CONTEXT_RETRIEVER_NAME_A
+ ':' + CONTEXT_NAME_A
);
564 assertEquals(expectedEnabledCommands
, clientListener
.getEnabledAppContextCommands());
565 } // close(), aka destroy the session, sending "disable context" messages
567 List
<String
> expectedDisabledCommands
= Collections
.singletonList(CONTEXT_RETRIEVER_NAME_A
+ ':' + CONTEXT_NAME_A
);
568 assertEquals(expectedDisabledCommands
, clientListener
.getDisabledAppContextCommands());
572 * Test that if we the context is both referred to by a filter string *and*
573 * enabled directly, we receive *2* messages about this context being
574 * enabled (and disabled on session teardown).
576 @SuppressWarnings("static-method")
578 public void testContextEnabledAndInFilterString() {
579 try (ILttngSession session2
= ILttngSession
.createSession(null, SESSION_DOMAIN
);) {
580 session2
.enableEvent(EVENT_NAME_A
, null, false, "$app." + CONTEXT_RETRIEVER_NAME_A
+ ':' + CONTEXT_NAME_A
+ "==\"bozo\"");
581 session2
.enableAppContext(CONTEXT_RETRIEVER_NAME_A
, CONTEXT_NAME_A
);
583 List
<String
> expectedEnabledCommands
= Collections
.nCopies(2, CONTEXT_RETRIEVER_NAME_A
+ ':' + CONTEXT_NAME_A
);
584 assertEquals(expectedEnabledCommands
, clientListener
.getEnabledAppContextCommands());
585 } // close(), aka destroy the session, sending "disable context" messages
587 List
<String
> expectedDisabledCommands
= Collections
.nCopies(2, CONTEXT_RETRIEVER_NAME_A
+ ':' + CONTEXT_NAME_A
);
588 assertEquals(expectedDisabledCommands
, clientListener
.getDisabledAppContextCommands());