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.events;
21 import java.io.IOException;
22 import java.util.logging.Handler;
23 import java.util.logging.Level;
24 import java.util.logging.Logger;
26 import org.junit.After;
27 import org.junit.AfterClass;
28 import org.junit.Before;
29 import org.junit.BeforeClass;
30 import org.lttng.tools.ILttngSession.Domain;
31 import org.lttng.ust.agent.jul.LttngLogHandler;
32 import org.lttng.ust.agent.utils.JulTestUtils;
35 * JUL tests for multiple concurrent tracing sessions
37 public class JulMultiSessionIT extends MultiSessionITBase {
39 private static final Domain DOMAIN = Domain.JUL;
41 private Logger loggerA;
42 private Logger loggerB;
43 private Logger loggerC;
44 private Logger loggerD;
50 public static void julClassSetup() {
51 JulTestUtils.testClassSetup();
58 public static void julClassCleanup() {
59 JulTestUtils.testClassCleanup();
65 * @throws SecurityException
69 public void julSetup() throws SecurityException, IOException {
70 loggerA = Logger.getLogger(EVENT_NAME_A);
71 loggerB = Logger.getLogger(EVENT_NAME_B);
72 loggerC = Logger.getLogger(EVENT_NAME_C);
73 loggerD = Logger.getLogger(EVENT_NAME_D);
75 loggerA.setLevel(Level.ALL);
76 loggerB.setLevel(Level.ALL);
77 loggerC.setLevel(Level.ALL);
78 loggerD.setLevel(Level.ALL);
80 handlerA = new LttngLogHandler();
81 handlerB = new LttngLogHandler();
82 handlerC = new LttngLogHandler();
83 handlerD = new LttngLogHandler();
85 loggerA.addHandler((Handler) handlerA);
86 loggerB.addHandler((Handler) handlerB);
87 loggerC.addHandler((Handler) handlerC);
88 loggerD.addHandler((Handler) handlerD);
95 public void julTeardown() {
96 loggerA.removeHandler((Handler) handlerA);
97 loggerB.removeHandler((Handler) handlerB);
98 loggerC.removeHandler((Handler) handlerC);
99 loggerD.removeHandler((Handler) handlerD);
108 protected Domain getDomain() {
113 protected void sendEventsToLoggers() {
114 JulTestUtils.send10EventsTo(loggerA);
115 JulTestUtils.send10EventsTo(loggerB);
116 JulTestUtils.send10EventsTo(loggerC);
117 JulTestUtils.send10EventsTo(loggerD);