2 * Copyright (C) 2013 - David Goulet <dgoulet@efficios.com>
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.
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
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
18 import java
.io
.IOException
;
19 import java
.util
.concurrent
.Semaphore
;
20 import java
.util
.logging
.LogManager
;
22 import org
.lttng
.ust
.jul
.*;
24 public class JULTest
{
25 private final static int NUM_TESTS
= 5;
26 private static int testCount
= 1;
28 /* Singleton agent object. */
29 private static LTTngAgent agent
;
30 private static LTTngLogHandler handler
;
31 private static LTTngTCPSessiondClient client
;
33 private static Semaphore sem
;
35 private static void ok(String desc
) {
36 System
.out
.println("ok " + testCount
+ " - " + desc
);
40 public static void go() throws IOException
{
41 handler
= new LTTngLogHandler(LogManager
.getLogManager());
42 assert handler
.logManager
== LogManager
.getLogManager();
43 ok("Log handler logManager is valid");
45 client
= new LTTngTCPSessiondClient("127.0.0.1", sem
);
46 assert client
!= null;
47 ok("TCP client is valid");
49 ok("TCP client destroyed");
51 agent
= LTTngAgent
.getLTTngAgent();
53 ok("LTTngAgent is valid");
55 ok("LTTngAgent disposed");
58 public static void main(String args
[]) throws Exception
{
59 System
.out
.println("1.." + NUM_TESTS
);