0c860bbd8ace4f2e9e48b8588235d4194345c2a4
[lttng-ust-java-tests.git] /
1 /*
2 * Copyright (C) 2015, EfficiOS Inc., Alexandre Montplaisir <alexmonthy@efficios.com>
3 *
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.
8 *
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.
13 *
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.
17 */
18
19 package org.lttng.ust.agent.integration.events;
20
21 import java.io.IOException;
22 import java.util.logging.Handler;
23 import java.util.logging.Level;
24 import java.util.logging.Logger;
25
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;
33
34 /**
35 * JUL tests for multiple concurrent tracing sessions
36 */
37 public class JulMultiSessionIT extends MultiSessionITBase {
38
39 private static final Domain DOMAIN = Domain.JUL;
40
41 private Logger loggerA;
42 private Logger loggerB;
43 private Logger loggerC;
44 private Logger loggerD;
45
46 /**
47 * Class setup
48 */
49 @BeforeClass
50 public static void julClassSetup() {
51 JulTestUtils.testClassSetup();
52 }
53
54 /**
55 * Class cleanup
56 */
57 @AfterClass
58 public static void julClassCleanup() {
59 JulTestUtils.testClassCleanup();
60 }
61
62 /**
63 * Test setup
64 *
65 * @throws SecurityException
66 * @throws IOException
67 */
68 @Before
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);
74
75 loggerA.setLevel(Level.ALL);
76 loggerB.setLevel(Level.ALL);
77 loggerC.setLevel(Level.ALL);
78 loggerD.setLevel(Level.ALL);
79
80 handlerA = new LttngLogHandler();
81 handlerB = new LttngLogHandler();
82 handlerC = new LttngLogHandler();
83 handlerD = new LttngLogHandler();
84
85 loggerA.addHandler((Handler) handlerA);
86 loggerB.addHandler((Handler) handlerB);
87 loggerC.addHandler((Handler) handlerC);
88 loggerD.addHandler((Handler) handlerD);
89 }
90
91 /**
92 * Test teardown
93 */
94 @After
95 public void julTeardown() {
96 loggerA.removeHandler((Handler) handlerA);
97 loggerB.removeHandler((Handler) handlerB);
98 loggerC.removeHandler((Handler) handlerC);
99 loggerD.removeHandler((Handler) handlerD);
100
101 loggerA = null;
102 loggerB = null;
103 loggerC = null;
104 loggerD = null;
105 }
106
107 @Override
108 protected Domain getDomain() {
109 return DOMAIN;
110 }
111
112 @Override
113 protected void sendEventsToLoggers() {
114 JulTestUtils.send10EventsTo(loggerA);
115 JulTestUtils.send10EventsTo(loggerB);
116 JulTestUtils.send10EventsTo(loggerC);
117 JulTestUtils.send10EventsTo(loggerD);
118 }
119 }
This page took 0.030475 seconds and 3 git commands to generate.