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
.Assume
.assumeTrue
;
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
;
75 private static final boolean ROOT_SESSIOND
= true;
77 private static TcpClientDebugListener clientListener
;
78 private static LttngTcpSessiondClient client
;
79 private static Thread clientThread
;
81 private ILttngSession session
;
83 // ------------------------------------------------------------------------
85 // ------------------------------------------------------------------------
91 public static void setupClass() {
92 LttngToolsHelper
.destroyAllSessions();
94 clientListener
= new TcpClientDebugListener();
95 client
= new LttngTcpSessiondClient(clientListener
, DOMAIN_VALUE
, ROOT_SESSIOND
);
97 clientThread
= new Thread(client
);
100 assumeTrue("Timed out waiting for root sessiond", client
.waitForConnection(5));
107 public static void teardownClass() {
108 if (client
!= null) {
111 if (clientThread
!= null) {
114 } catch (InterruptedException e
) {
123 public void setup() {
124 session
= ILttngSession
.createSession(null, SESSION_DOMAIN
);
125 clientListener
.clearAllCommands();
132 public void teardown() {
137 private static ILogLevelStrings
getLogLevelStrings() {
138 return ILogLevelStrings
.JUL_LOGLEVEL_STRINGS
;
142 * Check that two lists contain the exact same element (including
143 * duplicates), but their order does not matter.
145 private static <T
extends Comparable
<T
>> boolean containSameElements(List
<T
> list1
, List
<T
> list2
) {
146 List
<T
> newlist1
= new ArrayList
<>(list1
);
147 List
<T
> newlist2
= new ArrayList
<>(list2
);
148 Collections
.sort(newlist1
);
149 Collections
.sort(newlist2
);
150 return (newlist1
.equals(newlist2
));
154 // ------------------------------------------------------------------------
155 // Event enabling/disabling test cases
156 // ------------------------------------------------------------------------
159 * Test enabling one event.
162 public void testEnableEvent() {
163 session
.enableEvent(EVENT_NAME_A
, null, false, null);
165 List
<EventRule
> expectedCommands
= Collections
.singletonList(
166 EventRuleFactory
.createRule(EVENT_NAME_A
));
168 List
<EventRule
> actualCommands
= clientListener
.getEnabledEventCommands();
169 assertEquals(expectedCommands
, actualCommands
);
173 * Test an "enable-event -a" command.
176 public void testEnableAllEvents() {
177 session
.enableAllEvents();
179 List
<EventRule
> expectedCommands
= Collections
.singletonList(
180 EventRuleFactory
.createRuleAllEvents());
181 List
<EventRule
> actualCommands
= clientListener
.getEnabledEventCommands();
183 assertEquals(expectedCommands
, actualCommands
);
187 * Test enabling then disabling one event.
190 public void testEnableThenDisableOneEvent() {
191 session
.enableEvent(EVENT_NAME_A
, null, false, null);
192 session
.disableEvents(EVENT_NAME_A
);
194 List
<EventRule
> expectedEnableCommands
= Collections
.singletonList(
195 EventRuleFactory
.createRule(EVENT_NAME_A
));
196 List
<String
> expectedDisableCommands
= Collections
.singletonList(EVENT_NAME_A
);
198 assertEquals(expectedEnableCommands
, clientListener
.getEnabledEventCommands());
199 assertTrue(containSameElements(expectedDisableCommands
, clientListener
.getDisabledEventCommands()));
203 * Test enabling some events manually, then disabling all events (-a).
206 public void testEnableSomeThenDisableAll() {
207 session
.enableEvent(EVENT_NAME_A
, null, false, null);
208 session
.enableEvent(EVENT_NAME_B
, null, false, null);
209 session
.enableEvent(EVENT_NAME_C
, null, false, null);
210 session
.disableAllEvents();
212 List
<EventRule
> expectedEnableCommands
= Arrays
.asList(
213 EventRuleFactory
.createRule(EVENT_NAME_A
),
214 EventRuleFactory
.createRule(EVENT_NAME_B
),
215 EventRuleFactory
.createRule(EVENT_NAME_C
));
217 * A "disable-event -a" will send one command for each enabled event.
218 * The order may be different though.
220 List
<String
> expectedDisableCommands
= Arrays
.asList(
221 EVENT_NAME_A
, EVENT_NAME_B
, EVENT_NAME_C
);
223 assertEquals(expectedEnableCommands
, clientListener
.getEnabledEventCommands());
224 assertTrue(containSameElements(expectedDisableCommands
, clientListener
.getDisabledEventCommands()));
228 * Test enabling then (enable-event -a) then disabling all (disable-event -a) events.
231 public void testEnableAllThenDisableAll() {
232 session
.enableAllEvents();
233 session
.disableAllEvents();
235 List
<EventRule
> expectedEnableCommands
= Arrays
.asList(EventRuleFactory
.createRuleAllEvents());
236 List
<String
> expectedDisableCommands
= Arrays
.asList(EventRuleFactory
.EVENT_NAME_ALL
);
238 assertEquals(expectedEnableCommands
, clientListener
.getEnabledEventCommands());
239 assertTrue(containSameElements(expectedDisableCommands
, clientListener
.getDisabledEventCommands()));
243 * Test enabling then destroying the session (should send corresponding
244 * disable event messages).
246 @SuppressWarnings("static-method")
248 public void testEnableEventThenDestroy() {
249 try (ILttngSession session2
= ILttngSession
.createSession(null, SESSION_DOMAIN
);) {
250 session2
.enableEvent(EVENT_NAME_A
, null, false, null);
251 session2
.enableEvent(EVENT_NAME_B
, null, false, null);
252 } // close(), aka destroy the session, sending "disable event" messages
254 List
<EventRule
> expectedEnabledCommands
= Arrays
.asList(EventRuleFactory
.createRule(EVENT_NAME_A
), EventRuleFactory
.createRule(EVENT_NAME_B
));
255 List
<String
> expectedDisabledCommands
= Arrays
.asList(EVENT_NAME_A
, EVENT_NAME_B
);
257 assertEquals(expectedEnabledCommands
, clientListener
.getEnabledEventCommands());
258 assertEquals(expectedDisabledCommands
, clientListener
.getDisabledEventCommands());
262 * Test specifying an event with a --loglevel option.
265 public void testEnableEventLogLevelRange() {
266 LogLevelSelector lls
= new LogLevelSelector(getLogLevelStrings().warningInt(), LogLevelType
.LTTNG_EVENT_LOGLEVEL_RANGE
);
268 session
.enableEvent(EVENT_NAME_A
, getLogLevelStrings().warningName(), false, null);
270 List
<EventRule
> expectedCommands
= Collections
.singletonList(
271 EventRuleFactory
.createRule(EVENT_NAME_A
, lls
));
272 List
<EventRule
> actualCommands
= clientListener
.getEnabledEventCommands();
274 assertEquals(expectedCommands
, actualCommands
);
278 * Test enabling an event with a --loglevel-only option.
281 public void testEnableEventLogLevelSingle() {
282 LogLevelSelector lls
= new LogLevelSelector(getLogLevelStrings().warningInt(), LogLevelType
.LTTNG_EVENT_LOGLEVEL_SINGLE
);
284 session
.enableEvent(EVENT_NAME_A
, getLogLevelStrings().warningName(), true, 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 twice, for the same loglevel, with --loglevel followed by --loglevel-only.
297 public void testEnableEventsLogLevelRangeAndSingle() {
298 LogLevelSelector lls1
= new LogLevelSelector(getLogLevelStrings().warningInt(), LogLevelType
.LTTNG_EVENT_LOGLEVEL_RANGE
);
299 LogLevelSelector lls2
= new LogLevelSelector(getLogLevelStrings().warningInt(), LogLevelType
.LTTNG_EVENT_LOGLEVEL_SINGLE
);
301 session
.enableEvent(EVENT_NAME_A
, getLogLevelStrings().warningName(), false, null);
302 session
.enableEvent(EVENT_NAME_A
, getLogLevelStrings().warningName(), true, null);
304 List
<EventRule
> expectedCommands
= Arrays
.asList(
305 EventRuleFactory
.createRule(EVENT_NAME_A
, lls1
),
306 EventRuleFactory
.createRule(EVENT_NAME_A
, lls2
)
308 List
<EventRule
> actualCommands
= clientListener
.getEnabledEventCommands();
310 assertEquals(expectedCommands
, actualCommands
);
314 * Test enabling an event twice, for the same loglevel, with --loglevel-only followed by --loglevel.
317 public void testEnableEventsLogLevelSingleAndRange() {
318 LogLevelSelector lls1
= new LogLevelSelector(getLogLevelStrings().warningInt(), LogLevelType
.LTTNG_EVENT_LOGLEVEL_SINGLE
);
319 LogLevelSelector lls2
= new LogLevelSelector(getLogLevelStrings().warningInt(), LogLevelType
.LTTNG_EVENT_LOGLEVEL_RANGE
);
321 session
.enableEvent(EVENT_NAME_A
, getLogLevelStrings().warningName(), true, null);
322 session
.enableEvent(EVENT_NAME_A
, getLogLevelStrings().warningName(), false, null);
324 List
<EventRule
> expectedCommands
= Arrays
.asList(
325 EventRuleFactory
.createRule(EVENT_NAME_A
, lls1
),
326 EventRuleFactory
.createRule(EVENT_NAME_A
, lls2
)
328 List
<EventRule
> actualCommands
= clientListener
.getEnabledEventCommands();
330 assertEquals(expectedCommands
, actualCommands
);
334 * Test enabling the same event, same loglevel, but different loglevel types
335 * (--loglevel vs --loglevel-only) in two separate sessions.
338 public void testEnableEventsLogLevelRangeAndSingleDiffSessions() {
339 try (ILttngSession session2
= ILttngSession
.createSession(null, SESSION_DOMAIN
);) {
341 LogLevelSelector lls1
= new LogLevelSelector(getLogLevelStrings().warningInt(), LogLevelType
.LTTNG_EVENT_LOGLEVEL_RANGE
);
342 LogLevelSelector lls2
= new LogLevelSelector(getLogLevelStrings().warningInt(), LogLevelType
.LTTNG_EVENT_LOGLEVEL_SINGLE
);
344 session
.enableEvent(EVENT_NAME_A
, getLogLevelStrings().warningName(), false, null);
345 session2
.enableEvent(EVENT_NAME_A
, getLogLevelStrings().warningName(), true, null);
347 List
<EventRule
> expectedCommands
= Arrays
.asList(
348 EventRuleFactory
.createRule(EVENT_NAME_A
, lls1
),
349 EventRuleFactory
.createRule(EVENT_NAME_A
, lls2
));
350 List
<EventRule
> actualCommands
= clientListener
.getEnabledEventCommands();
352 assertEquals(expectedCommands
, actualCommands
);
357 * Enable the same event multiple times with different filter strings.
360 public void testEnableEventsDiffFilters() {
361 final String filter1
= "filter1";
362 final String filter2
= "filter2";
364 session
.enableEvent(EVENT_NAME_A
, null, false, null);
365 session
.enableEvent(EVENT_NAME_A
, null, false, filter1
);
366 session
.enableEvent(EVENT_NAME_A
, null, false, filter2
);
368 List
<EventRule
> expectedCommands
= Arrays
.asList(
369 EventRuleFactory
.createRule(EVENT_NAME_A
),
370 EventRuleFactory
.createRule(EVENT_NAME_A
, EventRuleFactory
.LOG_LEVEL_UNSPECIFIED
, filter1
),
371 EventRuleFactory
.createRule(EVENT_NAME_A
, EventRuleFactory
.LOG_LEVEL_UNSPECIFIED
, filter2
));
372 List
<EventRule
> actualCommands
= clientListener
.getEnabledEventCommands();
374 assertEquals(expectedCommands
, actualCommands
);
378 * Enable the same event multiple times with different log levels and
382 public void testEnableEventsLogLevelAndFilters() {
383 final LogLevelSelector lls
= new LogLevelSelector(getLogLevelStrings().warningInt(), LogLevelType
.LTTNG_EVENT_LOGLEVEL_RANGE
);
384 final String filter
= "filter1";
386 session
.enableEvent(EVENT_NAME_A
, null, false, null);
387 session
.enableEvent(EVENT_NAME_A
, getLogLevelStrings().warningName(), false, null);
388 session
.enableEvent(EVENT_NAME_A
, null, false, filter
);
389 session
.enableEvent(EVENT_NAME_A
, getLogLevelStrings().warningName(), false, filter
);
391 List
<EventRule
> expectedCommands
= Arrays
.asList(
392 EventRuleFactory
.createRule(EVENT_NAME_A
),
393 EventRuleFactory
.createRule(EVENT_NAME_A
, lls
),
394 EventRuleFactory
.createRule(EVENT_NAME_A
, EventRuleFactory
.LOG_LEVEL_UNSPECIFIED
, filter
),
395 EventRuleFactory
.createRule(EVENT_NAME_A
, lls
, filter
));
396 List
<EventRule
> actualCommands
= clientListener
.getEnabledEventCommands();
398 assertEquals(expectedCommands
, actualCommands
);
401 // ------------------------------------------------------------------------
402 // Application context enabling/disabling test cases
403 // ------------------------------------------------------------------------
406 * Test enabling one application context.
409 public void testEnableAppContext() {
410 session
.enableAppContext(CONTEXT_RETRIEVER_NAME_A
, CONTEXT_NAME_A
);
412 List
<String
> expectedCommands
= Collections
.singletonList(
413 CONTEXT_RETRIEVER_NAME_A
+ ':' + CONTEXT_NAME_A
);
415 List
<String
> actualCommands
= clientListener
.getEnabledAppContextCommands();
416 assertEquals(expectedCommands
, actualCommands
);
420 * Test enabling two application contexts sharing the same retriever name.
423 public void testEnableAppContextsSameRetriever() {
424 session
.enableAppContext(CONTEXT_RETRIEVER_NAME_A
, CONTEXT_NAME_A
);
425 session
.enableAppContext(CONTEXT_RETRIEVER_NAME_A
, CONTEXT_NAME_B
);
427 List
<String
> expectedCommands
= Arrays
.asList(
428 CONTEXT_RETRIEVER_NAME_A
+ ':' + CONTEXT_NAME_A
,
429 CONTEXT_RETRIEVER_NAME_A
+ ':' + CONTEXT_NAME_B
);
431 List
<String
> actualCommands
= clientListener
.getEnabledAppContextCommands();
432 assertEquals(expectedCommands
, actualCommands
);
436 * Test enabling two application contexts sharing the same context name, but
437 * with different retrievers. Unusual, but they should still be recognized
441 public void testEnableAppContextsSameContext() {
442 session
.enableAppContext(CONTEXT_RETRIEVER_NAME_A
, CONTEXT_NAME_A
);
443 session
.enableAppContext(CONTEXT_RETRIEVER_NAME_B
, CONTEXT_NAME_A
);
445 List
<String
> expectedCommands
= Arrays
.asList(
446 CONTEXT_RETRIEVER_NAME_A
+ ':' + CONTEXT_NAME_A
,
447 CONTEXT_RETRIEVER_NAME_B
+ ':' + CONTEXT_NAME_A
);
449 List
<String
> actualCommands
= clientListener
.getEnabledAppContextCommands();
450 assertEquals(expectedCommands
, actualCommands
);
454 * Test enabling one application context, then destroying the session. We
455 * should receive the corresponding "context removed" message.
458 @SuppressWarnings("static-method")
459 public void testEnableAppContextThenDestroy() {
460 try (ILttngSession session2
= ILttngSession
.createSession(null, SESSION_DOMAIN
);) {
461 session2
.enableAppContext(CONTEXT_RETRIEVER_NAME_A
, CONTEXT_NAME_A
);
462 } // close(), aka destroy the session, sending "disable context" messages
464 List
<String
> expectedEnabledCommands
= Collections
.singletonList(CONTEXT_RETRIEVER_NAME_A
+ ':' + CONTEXT_NAME_A
);
465 List
<String
> expectedDisabledCommands
= Collections
.singletonList(CONTEXT_RETRIEVER_NAME_A
+ ':' + CONTEXT_NAME_A
);
466 List
<String
> actualEnabledCommands
= clientListener
.getEnabledAppContextCommands();
467 List
<String
> actualDisabledCommands
= clientListener
.getDisabledAppContextCommands();
469 assertEquals(expectedEnabledCommands
, actualEnabledCommands
);
470 assertEquals(expectedDisabledCommands
, actualDisabledCommands
);
474 * Test enabling the same application context in two different sessions.
475 * Upon destroying one, we should only receive one "destroyed" message.
478 public void testEnableSameAppContextTwoSessions() {
479 List
<String
> expectedEnabledCommands
= Arrays
.asList(
480 CONTEXT_RETRIEVER_NAME_A
+ ':' + CONTEXT_NAME_A
,
481 CONTEXT_RETRIEVER_NAME_A
+ ':' + CONTEXT_NAME_A
);
482 List
<String
> actualEnabledCommands
;
484 try (ILttngSession session2
= ILttngSession
.createSession(null, SESSION_DOMAIN
);) {
485 session
.enableAppContext(CONTEXT_RETRIEVER_NAME_A
, CONTEXT_NAME_A
);
486 session2
.enableAppContext(CONTEXT_RETRIEVER_NAME_A
, CONTEXT_NAME_A
);
488 actualEnabledCommands
= clientListener
.getEnabledAppContextCommands();
489 assertEquals(expectedEnabledCommands
, actualEnabledCommands
);
490 } // close/destroy session2
492 actualEnabledCommands
= clientListener
.getEnabledAppContextCommands();
493 assertEquals(expectedEnabledCommands
, actualEnabledCommands
);
495 List
<String
> expectedDisabledCommands
= Collections
.singletonList(CONTEXT_RETRIEVER_NAME_A
+ ':' + CONTEXT_NAME_A
);
496 List
<String
> actualDisabledCommands
= clientListener
.getDisabledAppContextCommands();
498 assertEquals(expectedDisabledCommands
, actualDisabledCommands
);
502 * Test enabling two different application context in two different
503 * sessions. Upon destroying one, we should receive the correct "destroyed"
507 public void testEnableDiffAppContextTwoSessions() {
508 List
<String
> expectedEnabledCommands
= Arrays
.asList(
509 CONTEXT_RETRIEVER_NAME_A
+ ':' + CONTEXT_NAME_A
,
510 CONTEXT_RETRIEVER_NAME_B
+ ':' + CONTEXT_NAME_B
);
511 List
<String
> actualEnabledCommands
;
513 try (ILttngSession session2
= ILttngSession
.createSession(null, SESSION_DOMAIN
);) {
514 session
.enableAppContext(CONTEXT_RETRIEVER_NAME_A
, CONTEXT_NAME_A
);
515 session2
.enableAppContext(CONTEXT_RETRIEVER_NAME_B
, CONTEXT_NAME_B
);
517 actualEnabledCommands
= clientListener
.getEnabledAppContextCommands();
518 assertEquals(expectedEnabledCommands
, actualEnabledCommands
);
519 } // close/destroy session2
521 actualEnabledCommands
= clientListener
.getEnabledAppContextCommands();
522 assertEquals(expectedEnabledCommands
, actualEnabledCommands
);
524 List
<String
> expectedDisabledCommands
= Collections
.singletonList(CONTEXT_RETRIEVER_NAME_B
+ ':' + CONTEXT_NAME_B
);
525 List
<String
> actualDisabledCommands
= clientListener
.getDisabledAppContextCommands();
527 assertEquals(expectedDisabledCommands
, actualDisabledCommands
);
530 // ------------------------------------------------------------------------
531 // Application context filtering
532 // ------------------------------------------------------------------------
535 * Test that enabling an event with a filter string referring to a context
536 * should send an agent message about this context now being "enabled".
538 * This is because we will pass the context information to UST for the
539 * filtering step, even if the actual context won't be present in the trace.
541 @SuppressWarnings("static-method")
543 public void testContextInFilterString() {
544 try (ILttngSession session2
= ILttngSession
.createSession(null, SESSION_DOMAIN
);) {
545 session2
.enableEvent(EVENT_NAME_A
, null, false, "$app." + CONTEXT_RETRIEVER_NAME_A
+ ':' + CONTEXT_NAME_A
+ "=\"bozo\"");
547 List
<String
> expectedEnabledCommands
= Collections
.singletonList(CONTEXT_RETRIEVER_NAME_A
+ ':' + CONTEXT_NAME_A
);
548 assertEquals(expectedEnabledCommands
, clientListener
.getEnabledAppContextCommands());
549 } // close(), aka destroy the session, sending "disable context" messages
551 List
<String
> expectedDisabledCommands
= Collections
.singletonList(CONTEXT_RETRIEVER_NAME_A
+ ':' + CONTEXT_NAME_A
);
552 assertEquals(expectedDisabledCommands
, clientListener
.getDisabledAppContextCommands());
556 * Test that if we the context is both referred to by a filter string *and*
557 * enabled directly, we receive *2* messages about this context being
558 * enabled (and disabled on session teardown).
560 @SuppressWarnings("static-method")
562 public void testContextEnabledAndInFilterString() {
563 try (ILttngSession session2
= ILttngSession
.createSession(null, SESSION_DOMAIN
);) {
564 session2
.enableEvent(EVENT_NAME_A
, null, false, "$app." + CONTEXT_RETRIEVER_NAME_A
+ ':' + CONTEXT_NAME_A
+ "=\"bozo\"");
565 session2
.enableAppContext(CONTEXT_RETRIEVER_NAME_A
, CONTEXT_NAME_A
);
567 List
<String
> expectedEnabledCommands
= Collections
.nCopies(2, CONTEXT_RETRIEVER_NAME_A
+ ':' + CONTEXT_NAME_A
);
568 assertEquals(expectedEnabledCommands
, clientListener
.getEnabledAppContextCommands());
569 } // close(), aka destroy the session, sending "disable context" messages
571 List
<String
> expectedDisabledCommands
= Collections
.nCopies(2, CONTEXT_RETRIEVER_NAME_A
+ ':' + CONTEXT_NAME_A
);
572 assertEquals(expectedDisabledCommands
, clientListener
.getDisabledAppContextCommands());