Update of /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18893
Added Files:
LoggingManagerTest.java
Log Message:
no message
--- NEW FILE: LoggingManagerTest.java ---
/*
* LoggingManagerTest.java
* JUnit based test
*
* Created on March 12, 2006, 1:31 PM
*/
package org.jmonks.batchserver.framework;
import junit.framework.*;
import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.logging.FileHandler;
import java.util.logging.Handler;
import java.util.logging.Level;
import java.util.logging.LogManager;
import java.util.logging.Logger;
import org.jmonks.batchserver.framework.config.*;
/**
*
* @author Suresh Pragada
*/
public class LoggingManagerTest extends TestCase
{
public LoggingManagerTest(String testName)
{
super(testName);
}
protected void setUp() throws Exception
{
}
protected void tearDown() throws Exception
{
}
public static Test suite()
{
TestSuite suite = new TestSuite(LoggingManagerTest.class);
//TestSuite suite=new TestSuite();
//suite.addTest(new LoggingManagerTest("testChangeLoggingLevel"));
return suite;
}
/**
* Test of getInstance method, of class org.jmonks.batchserver.framework.LoggingManager.
*/
public void testGetInstance()
{
LoggingManager loggingManager=LoggingManager.getInstance();
assertNotNull(loggingManager);
}
/**
* Test of initializeJobLogging method, of class org.jmonks.batchserver.framework.LoggingManager.
*/
public void testInitializeJobLogging()
{
LoggingManager loggingManager=LoggingManager.getInstance();
assertNotNull(loggingManager);
loggingManager.initializeFrameworkLogging();
Logger logger1=Logger.getLogger("org.jmonks.batchserver.framework");
assertNotNull(logger1);
logger1.warning("This is the warning message");
logger1.config("This is the config message");
logger1.config("This is the severe message");
FrameworkConfig frameworkConfig=FrameworkConfig.getInstance();
assertNotNull(frameworkConfig);
FrameworkConfig.LoggingConfig loggingConfig=frameworkConfig.getLoggingConfig();
assertNotNull(loggingConfig);
loggingManager.initializeJobLogging("process_file_abc", loggingConfig);
Logger logger2=Logger.getLogger("org.jmonks.batchserver.framework");
assertNotNull(logger2);
logger2.warning("This is the warning message");
logger2.config("This is the config message");
logger2.config("This is the severe message");
}
/**
* Test to make sure logging level being modifieid.
*/
public void testChangeLoggingLevel()
{
LoggingManager loggingManager=LoggingManager.getInstance();
loggingManager.initializeFrameworkLogging();
Logger logger=Logger.getLogger(LoggingManagerTest.class.getName());
logger.severe("This is the severed messaged");
}
/**
* Test of initializeLogging method, of class org.jmonks.batchserver.framework.LoggingManager.
*/
public void testInitializeLogging()
{
LoggingManager loggingManager=LoggingManager.getInstance();
assertNotNull(loggingManager);
loggingManager.initializeFrameworkLogging();
Logger logger1=Logger.getLogger("org.jmonks");
assertNotNull(logger1);
Logger logger2=Logger.getLogger("org.jmonks.batchserver.framework.config");
assertNotNull(logger2);
}
}
|