Package org.jzonic.jlo

Source Code of org.jzonic.jlo.LogConfigurationTest

/*
* LogConfigurationTest.java
* JUnit based test
*
* Created on 25. November 2002, 22:42
*/

package org.jzonic.jlo;

import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.jzonic.jlo.formatter.Formatter;
import org.jzonic.jlo.formatter.SimpleFormatter;
import org.jzonic.jlo.handler.Handler;
import org.jzonic.jlo.handler.MockHandler;

/**
*
* @author Administrator
*/
public class LogConfigurationTest extends TestCase {
   
    private LogConfiguration lc;
   
    public LogConfigurationTest(java.lang.String testName) {
        super(testName);
    }
   
    public static void main(java.lang.String[] args) {
        junit.textui.TestRunner.run(suite());
    }
   
    public static Test suite() {
        TestSuite suite = new TestSuite(LogConfigurationTest.class);
        return suite;
    }
   
    public void setUp() throws Exception {
        lc = new LogConfiguration("Test");
    }
   
    public void testAddLogger() {
        Handler fileHandler = new MockHandler("Test");
        Formatter simpleFormatter = new SimpleFormatter("Test");       
        LogGenerator lg = new LogGenerator("TestGenerator", fileHandler, simpleFormatter);
        Logger logger = new Logger("org.jzonic.jlo", Target.parse("ALL"),"Default");
        logger.addLogGenerator(lg);
        lc.addLogger(logger);
        assertEquals(1,lc.getLoggerCount());
        assertNotNull(lc.getLogger("org.jzonic.jlo"));
    }
   
    public void testAddLogGenerator() {
        Handler fileHandler = new MockHandler("Test");
        Formatter simpleFormatter = new SimpleFormatter("Test");       
        LogGenerator lg = new LogGenerator("TestGenerator", fileHandler, simpleFormatter);       
        lc.addLogGenerator(lg);
        assertEquals(1,lc.getLogGeneratorCount());
    }
   
   
   
   
}
TOP

Related Classes of org.jzonic.jlo.LogConfigurationTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.