01: /*
02: * LogManagerTest.java
03: * JUnit based test
04: *
05: * Created on 4. Mai 2003, 20:59
06: */
07:
08: package org.jzonic.jlo;
09:
10: import junit.framework.Test;
11: import junit.framework.TestCase;
12: import junit.framework.TestSuite;
13:
14: /**
15: *
16: * @author Administrator
17: */
18: public class LogManagerTest extends TestCase {
19:
20: public LogManagerTest(java.lang.String testName) {
21: super (testName);
22: }
23:
24: public static void main(java.lang.String[] args) {
25: junit.textui.TestRunner.run(suite());
26: }
27:
28: public static Test suite() {
29: TestSuite suite = new TestSuite(LogManagerTest.class);
30:
31: return suite;
32: }
33:
34: public void testGetInstance() {
35: LogManager lm = LogManager.getInstance();
36: assertNotNull(lm);
37: }
38:
39: public void testGetLogger() {
40: Logger logger = LogManager.getLogger("org.jzonic.jlo");
41: assertNotNull(logger);
42: }
43:
44: public void testGetNonExistingLogger() {
45: Logger logger = LogManager.getLogger("org.jzonic.jlo.test");
46: String name = logger.getLoggerName();
47: assertEquals("org.jzonic.jlo", name);
48: }
49:
50: public void testGetNonExistingLogger2() {
51: Logger logger = LogManager.getLogger("org");
52: String name = logger.getLoggerName();
53: assertEquals("Default", name);
54: }
55:
56: public void testGetDifferentLogger() {
57: Logger logger = LogManager.getLogger("de.xcom", "test");
58: String name = logger.getLoggerName();
59: assertEquals("de.xcom", name);
60: }
61:
62: public void testGetNEDifferentLogger() {
63: Logger logger = LogManager.getLogger("de.xcom.test.hello",
64: "test");
65: String name = logger.getLoggerName();
66: assertEquals("de.xcom.test", name);
67: }
68:
69: public void testGetChannel() {
70: Channel channel = LogManager.getChannel("debug");
71: assertTrue(channel.isOn());
72: }
73:
74: public void testGetDifferentChannel() {
75: Channel channel = LogManager.getChannel("timing", "test");
76: String name = channel.getChannelName();
77: assertTrue(channel.isOn());
78: assertEquals("timing", name);
79: }
80:
81: public void testGetNEConfiguration() {
82: Logger logger = LogManager.getLogger("de.xcom", "NE");
83: String name = logger.getLoggerName();
84: assertEquals("Default", name);
85: }
86: }
|