Refactor liblttng-ust-jul in liblttng-ust-agent
[lttng-ust.git] / tests / java-jul / JULTest.java
1 /*
2 * Copyright (C) 2013 - David Goulet <dgoulet@efficios.com>
3 *
4 * This library is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License, version 2.1 only,
6 * as published by the Free Software Foundation.
7 *
8 * This library is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
11 * for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this library; if not, write to the Free Software Foundation,
15 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16 */
17
18 import java.io.IOException;
19 import java.util.concurrent.Semaphore;
20 import java.util.logging.LogManager;
21
22 import org.lttng.ust.jul.*;
23
24 public class JULTest {
25 private final static int NUM_TESTS = 5;
26 private static int testCount = 1;
27
28 /* Singleton agent object. */
29 private static LTTngAgent agent;
30 private static LTTngLogHandler handler;
31 private static LTTngTCPSessiondClient client;
32
33 private static Semaphore sem;
34
35 private static void ok(String desc) {
36 System.out.println("ok " + testCount + " - " + desc);
37 testCount++;
38 }
39
40 public static void go() throws IOException {
41 client = new LTTngTCPSessiondClient("127.0.0.1", sem);
42 assert client != null;
43 ok("TCP client is valid");
44 client.destroy();
45 ok("TCP client destroyed");
46
47 agent = LTTngAgent.getLTTngAgent();
48 assert agent != null;
49 ok("LTTngAgent is valid");
50 agent.dispose();
51 ok("LTTngAgent disposed");
52 }
53
54 public static void main(String args[]) throws Exception {
55 System.out.println("1.." + NUM_TESTS);
56 go();
57 }
58 }
This page took 0.030806 seconds and 4 git commands to generate.