a34f8a14332546a0488ddd361efbae14af4dee3d
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
.jupiter
.api
.AfterAll
;
27 import org
.junit
.jupiter
.api
.AfterEach
;
28 import org
.junit
.jupiter
.api
.BeforeAll
;
29 import org
.junit
.jupiter
.api
.BeforeEach
;
30 import org
.junit
.jupiter
.api
.Tag
;
31 import org
.lttng
.tools
.ILttngSession
.Domain
;
32 import org
.lttng
.ust
.agent
.jul
.LttngLogHandler
;
33 import org
.lttng
.ust
.agent
.utils
.JulTestUtils
;
36 * Enabled events test for the LTTng-UST JUL log handler.
40 public class JulEnabledEventsIT
extends EnabledEventsITBase
{
42 private static final Domain DOMAIN
= Domain
.JUL
;
44 private Logger loggerA
;
45 private Logger loggerB
;
46 private Logger loggerC
;
47 private Logger loggerD
;
53 public static void julClassSetup() {
54 JulTestUtils
.testClassSetup();
61 public static void julClassCleanup() {
62 JulTestUtils
.testClassCleanup();
68 * @throws SecurityException
72 public void julSetup() throws SecurityException
, IOException
{
73 loggerA
= Logger
.getLogger(EVENT_NAME_A
);
74 loggerB
= Logger
.getLogger(EVENT_NAME_B
);
75 loggerC
= Logger
.getLogger(EVENT_NAME_C
);
76 loggerD
= Logger
.getLogger(EVENT_NAME_D
);
78 loggerA
.setLevel(Level
.ALL
);
79 loggerB
.setLevel(Level
.ALL
);
80 loggerC
.setLevel(Level
.ALL
);
81 loggerD
.setLevel(Level
.ALL
);
83 handlerA
= new LttngLogHandler();
84 handlerB
= new LttngLogHandler();
85 handlerC
= new LttngLogHandler();
87 loggerA
.addHandler((Handler
) handlerA
);
88 loggerB
.addHandler((Handler
) handlerB
);
89 loggerC
.addHandler((Handler
) handlerC
);
96 public void julTeardown() {
97 loggerA
.removeHandler((Handler
) handlerA
);
98 loggerB
.removeHandler((Handler
) handlerB
);
99 loggerC
.removeHandler((Handler
) handlerC
);
108 protected Domain
getDomain() {
113 protected boolean closeHandlers()
119 protected void sendEventsToLoggers() {
120 JulTestUtils
.send10EventsTo(loggerA
);
121 JulTestUtils
.send10EventsTo(loggerB
);
122 JulTestUtils
.send10EventsTo(loggerC
);
123 JulTestUtils
.send10EventsTo(loggerD
);
127 protected void sendLocalizedEvent(String rawString
, Object
[] params
) {
128 loggerA
.log(Level
.SEVERE
, rawString
, params
);
This page took 0.032597 seconds and 4 git commands to generate.