[Batchserver-cvs] batchserver/test/org/jmonks/batch/framework/controller/basic BasicJobControllerT
Brought to you by:
suresh_pragada
From: Suresh <sur...@us...> - 2006-09-15 20:25:02
|
Update of /cvsroot/batchserver/batchserver/test/org/jmonks/batch/framework/controller/basic In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv28013 Added Files: BasicJobControllerTest.java TestBasicJobProcessor.java Log Message: no message --- NEW FILE: BasicJobControllerTest.java --- /* * BasicJobControllerTest.java * JUnit based test * * Created on May 4, 2006, 12:51 PM */ package org.jmonks.batch.framework.controller.basic; import junit.framework.*; import org.jmonks.batch.framework.LoggingManager; import org.jmonks.batch.framework.ErrorCode; import org.jmonks.batch.framework.config.BasicJobControllerConfig; import org.jmonks.batch.framework.config.FrameworkConfig; import org.jmonks.batch.framework.config.JobConfig; import org.jmonks.batch.framework.config.JobConfigFactory; import org.jmonks.batch.framework.config.JobLoggingConfig; import org.jmonks.batch.framework.controller.JobController; /** * * @author w951h8m */ public class BasicJobControllerTest extends TestCase { public BasicJobControllerTest(String testName) { super(testName); } protected void setUp() throws Exception { } protected void tearDown() throws Exception { } public static Test suite() { //TestSuite suite = new TestSuite(BasicJobControllerTest.class); TestSuite suite=new TestSuite(); suite.addTest(new BasicJobControllerTest("testProcess")); return suite; } /** * Test of process method, of class org.jmonks.batchserver.framework.controller.basic.BasicJobController. */ public void testProcess() { FrameworkConfig frameworkConfig=FrameworkConfig.getInstance(); assertNotNull(frameworkConfig); FrameworkConfig.FrameworkLoggingConfig frameworkLoggingConfig=frameworkConfig.getFrameworkLoggingConfig(); assertNotNull(frameworkLoggingConfig); LoggingManager.initializeFrameworkLogging(frameworkLoggingConfig); FrameworkConfig.JobConfigFactoryConfig factoryConfig=frameworkConfig.getJobConfigFactoryConfig(); assertNotNull(factoryConfig); JobConfigFactory factory=JobConfigFactory.getJobConfigFactory(factoryConfig); assertNotNull(factory); JobConfig jobConfig=factory.getJobConfig("process_file_xyz"); assertNotNull(jobConfig); JobLoggingConfig jobLoggingConfig=jobConfig.getJobLoggingConfig(); assertNotNull(jobLoggingConfig); LoggingManager.initializeJobLogging("process_file_xyz", frameworkLoggingConfig,jobLoggingConfig); BasicJobControllerConfig controllerConfig=(BasicJobControllerConfig)jobConfig.getJobControllerConfig(); assertNotNull(controllerConfig); JobController jobController=JobController.getJobController("process_file_xyz", controllerConfig); assertNotNull(jobController); ErrorCode returnCode=jobController.process(); assertNotNull(returnCode); } /** * Test of getExpectedRecordsCount method, of class org.jmonks.batchserver.framework.controller.basic.BasicJobController. */ public void testGetExpectedRecordsCount() { System.out.println("testGetExpectedRecordsCount"); // TODO add your test code below by replacing the default call to fail. fail("The test case is empty."); } /** * Test of getProcessedRecordsCount method, of class org.jmonks.batchserver.framework.controller.basic.BasicJobController. */ public void testGetProcessedRecordsCount() { System.out.println("testGetProcessedRecordsCount"); // TODO add your test code below by replacing the default call to fail. fail("The test case is empty."); } /** * Test of getThreadIDList method, of class org.jmonks.batchserver.framework.controller.basic.BasicJobController. */ public void testGetThreadIDList() { System.out.println("testGetThreadIDList"); // TODO add your test code below by replacing the default call to fail. fail("The test case is empty."); } /** * Test of getThreadState method, of class org.jmonks.batchserver.framework.controller.basic.BasicJobController. */ public void testGetThreadState() { System.out.println("testGetThreadState"); // TODO add your test code below by replacing the default call to fail. fail("The test case is empty."); } /** * Test of getJobStatus method, of class org.jmonks.batchserver.framework.controller.basic.BasicJobController. */ public void testGetJobStatus() { System.out.println("testGetJobStatus"); // TODO add your test code below by replacing the default call to fail. fail("The test case is empty."); } /** * Test of stop method, of class org.jmonks.batchserver.framework.controller.basic.BasicJobController. */ public void testStop() { System.out.println("testStop"); // TODO add your test code below by replacing the default call to fail. fail("The test case is empty."); } /** * Test of suspend method, of class org.jmonks.batchserver.framework.controller.basic.BasicJobController. */ public void testSuspend() { System.out.println("testSuspend"); // TODO add your test code below by replacing the default call to fail. fail("The test case is empty."); } /** * Test of resume method, of class org.jmonks.batchserver.framework.controller.basic.BasicJobController. */ public void testResume() { System.out.println("testResume"); // TODO add your test code below by replacing the default call to fail. fail("The test case is empty."); } } --- NEW FILE: TestBasicJobProcessor.java --- /* * TestBasicJobProcessor.java * * Created on May 4, 2006, 12:42 PM * * To change this template, choose Tools | Options and locate the template under * the Source Creation and Management node. Right-click the template and choose * Open. You can then make changes to the template in the Source Editor. */ package org.jmonks.batch.framework.controller.basic; import org.apache.log4j.Logger; import org.jmonks.batch.framework.ErrorCode; /** * Test class to be used in JUnits test the basic controller. * * @author Suresh Pragada */ public class TestBasicJobProcessor extends BasicJobProcessor { private static Logger logger=Logger.getLogger(TestBasicJobProcessor.class); public TestBasicJobProcessor() { logger.error("Error :: TestBasicJobProcessor has been initialized"); logger.info("Info :: TestBasicJobProcessor has been initialized"); logger.debug("Debug :: TestBasicJobProcessor has been initialized"); logger.fatal("Fatal :: TestBasicJobProcessor has been initialized"); logger.warn("Warn :: TestBasicJobProcessor has been initialized"); } public long getProcessedRecordsCount() { return 10; } public Object getProcessorState() { return "RUNNING"; } public long getTotalRecordsCount() { return 50; } public ErrorCode process(java.util.Map configProps) { return ErrorCode.createErrorCode(10001, "This is my error message."); } } |