Replace test skipping with straight failures
[lttng-ust-java-tests.git] / lttng-ust-java-tests-log4j / src / test / java / org / lttng / ust / agent / integration / context / Log4jAppContextIT.java
CommitLineData
73fb6785
AM
1/*
2 * Copyright (C) 2016, 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
19package org.lttng.ust.agent.integration.context;
20
65a36bff 21import static org.junit.Assert.assertTrue;
73fb6785
AM
22
23import java.io.IOException;
24
25import org.apache.log4j.Appender;
26import org.apache.log4j.Level;
27import org.apache.log4j.Logger;
28import org.junit.After;
29import org.junit.AfterClass;
30import org.junit.Before;
31import org.junit.BeforeClass;
32import org.lttng.tools.ILttngSession.Domain;
33import org.lttng.tools.LttngToolsHelper;
34import org.lttng.ust.agent.log4j.LttngLogAppender;
35import org.lttng.ust.agent.utils.Log4jTestUtils;
36import org.lttng.ust.agent.utils.LttngUtils;
37
38/**
39 * Enabled app contexts test for the LTTng-UST JUL log handler.
40 */
41public class Log4jAppContextIT extends AppContextITBase {
42
43 private static final Domain DOMAIN = Domain.LOG4J;
44
45 private Logger logger;
46
47 /**
48 * Class setup
49 */
50 @BeforeClass
51 public static void julClassSetup() {
65a36bff
AM
52 /* Make sure we can find the JNI library and lttng-tools */
53 assertTrue(Log4jTestUtils.checkForLog4jLibrary());
54 assertTrue(LttngUtils.checkForLttngTools(Domain.LOG4J));
73fb6785
AM
55
56 LttngToolsHelper.destroyAllSessions();
57 }
58
59 /**
60 * Class cleanup
61 */
62 @AfterClass
63 public static void julClassCleanup() {
64 LttngToolsHelper.deleteAllTraces();
65 }
66
67 /**
68 * Test setup
69 *
70 * @throws SecurityException
71 * @throws IOException
72 */
73 @Before
74 public void julSetup() throws SecurityException, IOException {
75 logger = Logger.getLogger(EVENT_NAME);
76 logger.setLevel(Level.ALL);
77
78 logHandler = new LttngLogAppender();
79 logger.addAppender((Appender) logHandler);
80 }
81
82 /**
83 * Test teardown
84 */
85 @After
86 public void julTeardown() {
87 logger.removeAppender((Appender) logHandler);
88 logger = null;
89 }
90
91 @Override
92 protected Domain getDomain() {
93 return DOMAIN;
94 }
95
96 @Override
97 protected void sendEventsToLoggers() {
98 Log4jTestUtils.send10Events(logger);
99 }
100}
This page took 0.02636 seconds and 4 git commands to generate.