1 7 8 package org.jzonic.jlo; 9 10 import junit.framework.Test; 11 import junit.framework.TestCase; 12 import junit.framework.TestSuite; 13 import org.jzonic.jlo.formatter.Formatter; 14 import org.jzonic.jlo.formatter.SimpleFormatter; 15 import org.jzonic.jlo.handler.Handler; 16 import org.jzonic.jlo.handler.MockHandler; 17 18 22 public class LogConfigurationTest extends TestCase { 23 24 private LogConfiguration lc; 25 26 public LogConfigurationTest(java.lang.String testName) { 27 super(testName); 28 } 29 30 public static void main(java.lang.String [] args) { 31 junit.textui.TestRunner.run(suite()); 32 } 33 34 public static Test suite() { 35 TestSuite suite = new TestSuite(LogConfigurationTest.class); 36 return suite; 37 } 38 39 public void setUp() throws Exception { 40 lc = new LogConfiguration("Test"); 41 } 42 43 public void testAddLogger() { 44 Handler fileHandler = new MockHandler("Test"); 45 Formatter simpleFormatter = new SimpleFormatter("Test"); 46 LogGenerator lg = new LogGenerator("TestGenerator", fileHandler, simpleFormatter); 47 Logger logger = new Logger("org.jzonic.jlo", Target.parse("ALL"),"Default"); 48 logger.addLogGenerator(lg); 49 lc.addLogger(logger); 50 assertEquals(1,lc.getLoggerCount()); 51 assertNotNull(lc.getLogger("org.jzonic.jlo")); 52 } 53 54 public void testAddLogGenerator() { 55 Handler fileHandler = new MockHandler("Test"); 56 Formatter simpleFormatter = new SimpleFormatter("Test"); 57 LogGenerator lg = new LogGenerator("TestGenerator", fileHandler, simpleFormatter); 58 lc.addLogGenerator(lg); 59 assertEquals(1,lc.getLogGeneratorCount()); 60 } 61 62 63 64 65 } 66 | Popular Tags |