batchserver-cvs Mailing List for Enterprise Batch Server (Page 4)
Brought to you by:
suresh_pragada
You can subscribe to this list here.
2006 |
Jan
|
Feb
(10) |
Mar
(159) |
Apr
(5) |
May
(52) |
Jun
(70) |
Jul
|
Aug
(28) |
Sep
(256) |
Oct
(38) |
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(3) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Suresh <sur...@us...> - 2006-09-19 12:10:00
|
Update of /cvsroot/batchserver/batchserver In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv26222 Modified Files: build_framework.xml Log Message: no message Index: build_framework.xml =================================================================== RCS file: /cvsroot/batchserver/batchserver/build_framework.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** build_framework.xml 19 Sep 2006 02:18:57 -0000 1.1 --- build_framework.xml 19 Sep 2006 12:09:57 -0000 1.2 *************** *** 40,43 **** --- 40,51 ---- <pathelement location="${lib.home}/stax/ri/stax_impl_1.2.zip"/> <pathelement location="${lib.home}/log4j/log4j_1.2.13.jar"/> + <pathelement location="${lib.home}/concurrent/concurrent_1.3.4.jar"/> + <pathelement location="${lib.home}/db/db4o/db4o_5.0.jar"/> + <pathelement location="${lib.home}/jdbc/mysql/mysql_jdbc_driver_3.1.13.jar"/> + <pathelement location="${lib.home}/jdbc/oracle/ojdbc14.jar"/> + <pathelement location="${lib.home}/jmx/ri/jmxri_1.2.1.jar"/> + <pathelement location="${lib.home}/jmx/ri/jmxremote_1.0.1_04.jar"/> + <pathelement location="${lib.home}/jmx/ri/jmxremote_optional1.0.1_04.jar"/> + <pathelement location="${lib.home}/jmx/ri/rmissl_1.0.1_04.jar"/> </path> <property name="compile.classpath" refid="compile.classpath"/> |
From: Suresh <sur...@us...> - 2006-09-19 02:19:00
|
Update of /cvsroot/batchserver/batchserver In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv17723 Added Files: build_framework.xml Log Message: no message --- NEW FILE: build_framework.xml --- <project name="framework" default="dist" basedir="."> <!-- ===================== Property Definitions =========================== --> <property name="app.version" value="1.0"/> <property name="app.name" value="batch_framework"/> <!-- ==================== File and Directory Names ======================== --> <property name="build.home" value="${basedir}/build"/> <property name="dist.home" value="${basedir}/dist"/> <property name="docs.home" value="${basedir}/docs"/> <property name="src.home" value="${basedir}/src"/> <property name="lib.home" value="${basedir}/lib"/> <property name="test.home" value="${basedir}/test"/> <property name="reports.home" value="${basedir}/reports"/> <!-- ==================== Compilation Control Options ==================== --> <property name="compile.debug" value="true"/> <property name="compile.deprecation" value="false"/> <property name="compile.optimize" value="true"/> <!-- ======= Pattern Sets, File Sets, Application Classpaths ======= --> <patternset id="app.resources"> <include name="**/*.properties"/> <include name="**/*.xml"/> </patternset> <path id="compile.classpath"> <!-- Include all JAR files that will be required to compile application --> <pathelement location="${lib.home}/xml/xml_apis.jar"/> <pathelement location="${lib.home}/xml/apache/resolver_2.7.1.jar"/> <pathelement location="${lib.home}/xml/apache/xerces_impl_2.7.1.jar"/> <pathelement location="${lib.home}/stax/stax_api_1.0.zip"/> <pathelement location="${lib.home}/stax/ri/stax_impl_1.2.zip"/> <pathelement location="${lib.home}/log4j/log4j_1.2.13.jar"/> </path> <property name="compile.classpath" refid="compile.classpath"/> <path id="runtime.classpath"> <path location="${build.home}/src"/> <path refid="compile.classpath"/> </path> <property name="runtime.classpath" refid="runtime.classpath"/> <path id="test.compile.classpath"> <path refid="runtime.classpath"/> <path location="${lib.home}/junit/junit_1.0.jar"/> </path> <property name="test.compile.classpath" refid="test.compile.classpath"/> <path id="test.runtime.classpath"> <path refid="test.compile.classpath"/> <pathelement location="${build.home}/test"/> </path> <property name="test.runtime.classpath" refid="test.runtime.classpath"/> <!-- ==================== Source-Clean-Compile Target ====================================== --> <target name="source-clean-compile" depends="source-clean,source-compile" description="Clean and compile the source"/> <!-- ==================== Source-Clean Target ==================================== --> <target name="source-clean" description="Delete old source build directories"> <delete dir="${build.home}/src"/> </target> <!-- ==================== Source-Compile Target ================================== --> <target name="source-compile" description="Compile Java sources"> <!-- Compile Java classes as necessary --> <mkdir dir="${build.home}/src"/> <echo message="Classpath for compilation : ${compile.classpath}"/> <javac srcdir="${src.home}" destdir="${build.home}/src" debug="${compile.debug}" deprecation="${compile.deprecation}" optimize="${compile.optimize}"> <classpath refid="compile.classpath"/> </javac> <!-- Copy application resources --> <copy todir="${build.home}/src"> <fileset dir="${src.home}"> <patternset refid="app.resources"/> </fileset> </copy> </target> <!-- ==================== Test-Clean-Compile Target ====================================== --> <target name="test-clean-compile" depends="test-clean,test-compile" description="Clean and compile the test classes"/> <!-- ==================== Test-Clean Target ==================================== --> <target name="test-clean" description="Delete old test build directories"> <delete dir="${build.home}/test"/> </target> <!-- ==================== Test-Compile Target ================================== --> <target name="test-compile" depends="source-compile" description="Compile Test Java sources"> <!-- Compile Test Java classes as necessary --> <mkdir dir="${build.home}/test"/> <echo message="Classpath for test compilation : ${test.compile.classpath}"/> <javac srcdir="${test.home}" destdir="${build.home}/test" debug="${compile.debug}" deprecation="${compile.deprecation}" optimize="${compile.optimize}"> <classpath refid="test.compile.classpath"/> </javac> <!-- Copy application resources --> <copy todir="${build.home}/test"> <fileset dir="${test.home}"> <patternset refid="app.resources"/> </fileset> </copy> </target> <!-- ==================== Run Framework Test Suite Target ===================================== --> <target name="run-framework-test-suite" depends="test-compile" description="Run Framework Test Suite"> <!-- Make sure you have junit jar and junit ant jar in ant lib directory --> <echo message="Running Framework Test Suite"/> <echo message="Classpath to run test suite : ${test.runtime.classpath}"/> <delete dir="${reports.home}"/> <mkdir dir="${reports.home}"/> <junit printsummary="true"> <classpath refid="test.runtime.classpath"/> <!-- To generate the test reports use the below xml formatter instead of plain formmater --> <formatter type="xml" usefile="true"/> <!-- <formatter type="plain" usefile="false"/> --> <test name="org.jmonks.batchserver.framework.FrameworkTestSuite" todir="${reports.home}"/> </junit> </target> <!-- ==================== Run All Tests Target ===================================== --> <target name="run-all-tests" depends="test-compile" description="Run all the tests available in project"> <!-- Make sure you have junit jar and junit ant jar in ant lib directory --> <echo message="Running All JUnit Tests"/> <echo message="Classpath for run all tests : ${test.runtime.classpath}"/> <delete dir="${reports.home}"/> <mkdir dir="${reports.home}"/> <junit printsummary="true"> <classpath refid="test.runtime.classpath"/> <!-- To run all the JUnit Test classes --> <formatter type="xml" usefile="true"/> <batchtest todir="${reports.home}"> <fileset dir="${build.home}/test" includes="**/*Test.class"/> </batchtest> </junit> </target> <!-- ==================== JUnit Reports Format Target ===================================== --> <target name="run-format-framework-test-suite" depends="run-framework-test-suite" description="Run the unittests and format the test results into html docs"> <!-- Make sure you have junit jar and junit ant jar in ant lib directory --> <junitreport todir="${reports.home}"> <fileset dir="${reports.home}"> <include name="*.xml"/> </fileset> <report format="frames" todir="${reports.home}/html"/> </junitreport> </target> <target name="run-format-all-tests-results" depends="run-all-tests" description="Run the unittests and format the test results into html docs"> <!-- Make sure you have junit jar and junit ant jar in ant lib directory --> <junitreport todir="${reports.home}"> <fileset dir="${reports.home}"> <include name="*.xml"/> </fileset> <report format="frames" todir="${reports.home}/html"/> </junitreport> </target> <!-- ==================== Dist Target ===================================== --> <target name="dist" depends="source-clean-compile,javadoc" description="Create binary distribution"> <!-- Copy documentation subdirectories --> <mkdir dir="${dist.home}/docs"/> <copy todir="${dist.home}/docs"> <fileset dir="${docs.home}"/> </copy> <!-- Create application JAR file --> <jar jarfile="${dist.home}/${app.name}-${app.version}.jar" basedir="${build.home}/src"/> </target> <!-- ==================== Javadoc Target ================================== --> <target name="javadoc" depends="source-clean-compile" description="Create Javadoc API documentation"> <delete dir="${docs.home}"/> <mkdir dir="${docs.home}"/> <javadoc sourcepath="${src.home}" destdir="${docs.home}" packagenames="*" author="true" version="true" use="true"> <classpath refid="compile.classpath"/> </javadoc> </target> </project> |
From: Suresh <sur...@us...> - 2006-09-19 00:09:46
|
Update of /cvsroot/batchserver/batchserver/test/org/jmonks/batch/framework In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv29106 Modified Files: FrameworkTestSuite.java Log Message: no message Index: FrameworkTestSuite.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/test/org/jmonks/batch/framework/FrameworkTestSuite.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** FrameworkTestSuite.java 15 Sep 2006 20:21:13 -0000 1.1 --- FrameworkTestSuite.java 19 Sep 2006 00:09:38 -0000 1.2 *************** *** 9,12 **** --- 9,16 ---- import junit.framework.*; + import org.jmonks.batch.framework.controller.basic.VerifyAllConfigPropsBasicJobControllerTest; + import org.jmonks.batch.framework.controller.basic.VerifyReturnCodeBasicJobControllerTest; + import org.jmonks.batch.framework.controller.pool.VerifyAllConfigPropsPoolJobControllerTest; + import org.jmonks.batch.framework.controller.pool.VerifyReturnCodePoolJobControllerTest; import org.jmonks.batch.framework.repository.jdbc.MySQLJdbcRepositoryTest; import org.jmonks.batch.framework.repository.jdbc.OracleJdbcRepositoryTest; *************** *** 64,73 **** mainSuite.addTest(BasicJobControllerConfigTest.suite()); mainSuite.addTest(PoolJobControllerConfigTest.suite()); - mainSuite.addTest(Db4oRepositoryTest.suite()); mainSuite.addTest(MySQLJdbcRepositoryTest.suite()); mainSuite.addTest(OracleJdbcRepositoryTest.suite()); mainSuite.addTest(MainTest.suite()); ! return mainSuite; } --- 68,79 ---- mainSuite.addTest(BasicJobControllerConfigTest.suite()); mainSuite.addTest(PoolJobControllerConfigTest.suite()); mainSuite.addTest(Db4oRepositoryTest.suite()); mainSuite.addTest(MySQLJdbcRepositoryTest.suite()); mainSuite.addTest(OracleJdbcRepositoryTest.suite()); mainSuite.addTest(MainTest.suite()); ! mainSuite.addTest(VerifyAllConfigPropsBasicJobControllerTest.suite()); ! mainSuite.addTest(VerifyReturnCodeBasicJobControllerTest.suite()); ! mainSuite.addTest(VerifyAllConfigPropsPoolJobControllerTest.suite()); ! mainSuite.addTest(VerifyReturnCodePoolJobControllerTest.suite()); return mainSuite; } |
From: Suresh <sur...@us...> - 2006-09-19 00:09:34
|
Update of /cvsroot/batchserver/batchserver/test/org/jmonks/batch/framework In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv29095 Modified Files: MainTest.java Log Message: no message Index: MainTest.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/test/org/jmonks/batch/framework/MainTest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** MainTest.java 15 Sep 2006 22:04:43 -0000 1.2 --- MainTest.java 19 Sep 2006 00:09:30 -0000 1.3 *************** *** 29,52 **** { TestSuite suite = new TestSuite(); ! suite.addTest(new MainTest("testProcess")); ! //suite.addTest(new MainTest("testProcessNoArgs")); ! //suite.addTest(new MainTest("testProcessNullArgs")); ! //suite.addTest(new MainTest("testProcessWrongJobName")); return suite; } /** - * Test of process method by passing the right configuration. - */ - public void testProcess() - { - Map args=new HashMap(); - args.put(Main.JOB_NAME_KEY_NAME, "process_file_xyz"); - ErrorCode returnCode=Main.process(args); - assertNotNull(returnCode); - assertEquals(ErrorCode.JOB_COMPLETED_SUCCESSFULLY.getCode(), returnCode.getCode()); - } - - /** * Test of process method by passing the empty configMap. */ --- 29,39 ---- { TestSuite suite = new TestSuite(); ! suite.addTest(new MainTest("testProcessNoArgs")); ! suite.addTest(new MainTest("testProcessNullArgs")); ! suite.addTest(new MainTest("testProcessWrongJobName")); return suite; } /** * Test of process method by passing the empty configMap. */ *************** *** 85,89 **** assertEquals(ErrorCode.JOB_IS_NOT_CONFIGURED.getCode(), exitCode); } - - } --- 72,74 ---- |
From: Suresh <sur...@us...> - 2006-09-19 00:09:16
|
Update of /cvsroot/batchserver/batchserver/test/org/jmonks/batch/framework/controller/basic In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv29037 Added Files: VerifyAllConfigPropsBasicJobControllerTest.java VerifyAllConfigPropsProcessor.java VerifyReturnCodeBasicJobControllerTest.java VerifyReturnCodeProcessor.java Removed Files: BasicJobControllerTest.java TestBasicJobProcessor.java Log Message: no message --- BasicJobControllerTest.java DELETED --- --- NEW FILE: VerifyAllConfigPropsBasicJobControllerTest.java --- /* * VerifyAllConfigPropsBasicJobControllerTest.java * JUnit based test * * Created on September 17, 2006, 9:36 AM */ package org.jmonks.batch.framework.controller.basic; import java.util.HashMap; import java.util.Map; import junit.framework.*; import org.jmonks.batch.framework.ErrorCode; import org.jmonks.batch.framework.JobContext; import org.jmonks.batch.framework.Main; import org.jmonks.batch.framework.config.BasicJobControllerConfig; /** * * @author Suresh Pragada */ public class VerifyAllConfigPropsBasicJobControllerTest extends TestCase { public VerifyAllConfigPropsBasicJobControllerTest(String testName) { super(testName); } protected void setUp() throws Exception { } protected void tearDown() throws Exception { } public static Test suite() { TestSuite suite = new TestSuite(); suite.addTest(new VerifyAllConfigPropsBasicJobControllerTest("testVerifyAllConfigProps")); return suite; } public void testVerifyAllConfigProps() { Map configMap=new HashMap(); configMap.put("job-name", "verify_config_props_basic_job_processor"); configMap.put("invoke-config-key1", "invoke-config-value1"); ErrorCode exitCode=Main.process(configMap); assertNotNull(exitCode); assertEquals(ErrorCode.JOB_COMPLETED_SUCCESSFULLY.getCode(), exitCode.getCode()); } } --- NEW FILE: VerifyAllConfigPropsProcessor.java --- /* * VerifyAllConfigPropsProcessor.java * * Created on September 17, 2006, 9:29 AM * * 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 java.util.Map; import junit.framework.Assert; import org.jmonks.batch.framework.ErrorCode; import org.jmonks.batch.framework.JobContext; import org.jmonks.batch.framework.config.BasicJobControllerConfig; /** * * @author Suresh Pragada */ public class VerifyAllConfigPropsProcessor extends BasicJobProcessor { /** * Creates a new instance of VerifyAllConfigPropsProcessor */ public VerifyAllConfigPropsProcessor() { } public long getProcessedRecordsCount() { return 0; } public Object getProcessorState() { return "No jobs are being processed."; } public long getTotalRecordsCount() { return 10; } public ErrorCode process(JobContext jobContext) { /** * Validate invoke configuration */ Map invokeConfigMap=jobContext.getJobInvokeConfig(); Assert.assertNotNull(invokeConfigMap); String invokeConfigValue1=(String)invokeConfigMap.get("invoke-config-key1"); Assert.assertNotNull(invokeConfigValue1); Assert.assertEquals("invoke-config-value1",invokeConfigValue1); /** * Validate processor configuration */ Map processorConfigMap=((BasicJobControllerConfig)jobContext.getJobConfig().getJobControllerConfig()).getBasicJobProcessorConfigProperties(); Assert.assertNotNull(processorConfigMap); String processorConfigValue1=(String)processorConfigMap.get("processor-config-key1"); Assert.assertNotNull(processorConfigValue1); Assert.assertEquals("processor-config-value1",processorConfigValue1); String processorConfigValue2=(String)processorConfigMap.get("processor-config-key2"); Assert.assertNotNull(processorConfigValue2); Assert.assertEquals("processor-config-value2",processorConfigValue2); /** * Validate controller configuration */ Map controllerConfigMap=jobContext.getJobConfig().getJobControllerConfig().getJobControllerConfigProperties(); Assert.assertNotNull(controllerConfigMap); String controllerConfigValue1=(String)controllerConfigMap.get("controller-config-key1"); Assert.assertNotNull(controllerConfigValue1); Assert.assertEquals("controller-config-value1",controllerConfigValue1); /** * Validate for the modification of config maps. */ try { invokeConfigMap.put("trying-to-change", "can-I"); Assert.fail("Would be able to the change the invoke config map."); } catch(UnsupportedOperationException exception){} try { processorConfigMap.put("trying-to-change", "can-I"); Assert.fail("Would be able to the change the processor config map."); } catch(UnsupportedOperationException exception){} try { controllerConfigMap.put("trying-to-change", "can-I"); Assert.fail("Would be able to the change the controller config map."); } catch(UnsupportedOperationException exception){} return ErrorCode.JOB_COMPLETED_SUCCESSFULLY; } } --- TestBasicJobProcessor.java DELETED --- --- NEW FILE: VerifyReturnCodeBasicJobControllerTest.java --- /* * VerifyAllConfigPropsProcessorTest.java * JUnit based test * * Created on September 17, 2006, 9:36 AM */ package org.jmonks.batch.framework.controller.basic; import java.util.HashMap; import java.util.Map; import junit.framework.*; import org.jmonks.batch.framework.ErrorCode; import org.jmonks.batch.framework.Main; /** * * @author Suresh Pragada */ public class VerifyReturnCodeBasicJobControllerTest extends TestCase { public VerifyReturnCodeBasicJobControllerTest(String testName) { super(testName); } protected void setUp() throws Exception { } protected void tearDown() throws Exception { } public static Test suite() { TestSuite suite = new TestSuite(); suite.addTest(new VerifyReturnCodeBasicJobControllerTest("testVerifyReturnCode")); return suite; } public void testVerifyReturnCode() { Map configMap=new HashMap(); configMap.put("job-name", "verify_return_code_basic_job_processor"); ErrorCode exitCode=Main.process(configMap); assertNotNull(exitCode); assertEquals(102, exitCode.getCode()); } } --- NEW FILE: VerifyReturnCodeProcessor.java --- /* * VerifyReturnCodeProcessor.java * * Created on September 17, 2006, 12:15 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.jmonks.batch.framework.ErrorCode; import org.jmonks.batch.framework.JobContext; /** * * @author Suresh Pragada */ public class VerifyReturnCodeProcessor extends BasicJobProcessor { /** Creates a new instance of VerifyReturnCodeProcessor */ public VerifyReturnCodeProcessor() { } public long getProcessedRecordsCount() { return 0; } public Object getProcessorState() { return "What am I doing?"; } public long getTotalRecordsCount() { return 10; } public ErrorCode process(JobContext jobContext) { String threadName=Thread.currentThread().getName(); if(threadName.endsWith("1")) return ErrorCode.JOB_COMPLETED_SUCCESSFULLY; else if(threadName.endsWith("2")) throw new RuntimeException("Just wanted to check."); else if(threadName.endsWith("3")) return ErrorCode.createErrorCode(101, "This is my error message"); else return ErrorCode.createErrorCode(102, "This is my error message"); } } |
Update of /cvsroot/batchserver/batchserver/test/org/jmonks/batch/framework/controller/pool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv28283 Added Files: VerifyAllConfigPropsJobLoader.java VerifyAllConfigPropsJobPool.java VerifyAllConfigPropsJobProcessor.java VerifyAllConfigPropsPoolJobControllerTest.java VerifyReturnCodeJobLoader.java VerifyReturnCodeJobProcessor.java VerifyReturnCodePoolJobControllerTest.java Removed Files: CollectionJobPoolTest.java Log Message: no message --- NEW FILE: VerifyReturnCodeJobProcessor.java --- /* * VerifyAllConfigPropsJobLoader.java * * Created on September 18, 2006, 5:39 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.pool; import junit.framework.Assert; import org.apache.log4j.Logger; import org.jmonks.batch.framework.ErrorCode; import org.jmonks.batch.framework.JobContext; /** * * @author Suresh Pragada */ public class VerifyReturnCodeJobProcessor extends AbstractPoolJobProcessor { private static Logger logger=Logger.getLogger(VerifyReturnCodeJobProcessor.class); public VerifyReturnCodeJobProcessor() { } public void cleanup() { } public void initialize(JobContext jobContext) { Assert.assertNotNull(jobContext); } public ErrorCode process(Object jobData) { Assert.assertNotNull(jobData); Integer value=(Integer)jobData; logger.error("Received the data to verify the return code process : " + jobData.toString()); String threadName=Thread.currentThread().getName(); if(threadName.endsWith("3")) return ErrorCode.createErrorCode(102, "This is my error code."); else return ErrorCode.JOB_COMPLETED_SUCCESSFULLY; } } --- NEW FILE: VerifyAllConfigPropsJobProcessor.java --- /* * VerifyAllConfigPropsJobLoader.java * * Created on September 18, 2006, 5:39 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.pool; import java.util.Map; import junit.framework.Assert; import org.apache.log4j.Logger; import org.jmonks.batch.framework.ErrorCode; import org.jmonks.batch.framework.JobContext; import org.jmonks.batch.framework.config.PoolJobControllerConfig; /** * * @author Suresh Pragada */ public class VerifyAllConfigPropsJobProcessor extends AbstractPoolJobProcessor { private static Logger logger=Logger.getLogger(VerifyAllConfigPropsJobProcessor.class); public VerifyAllConfigPropsJobProcessor() { } public void cleanup() { } public void initialize(JobContext jobContext) { Assert.assertNotNull(jobContext); /** * Validate invoke configuration */ Map invokeConfigMap=jobContext.getJobInvokeConfig(); Assert.assertNotNull(invokeConfigMap); String invokeConfigValue1=(String)invokeConfigMap.get("invoke-config-key1"); Assert.assertNotNull(invokeConfigValue1); Assert.assertEquals("invoke-config-value1",invokeConfigValue1); /** * Validate loader configuration */ Map processorConfigMap=((PoolJobControllerConfig)jobContext.getJobConfig().getJobControllerConfig()).getPoolJobProcessorConfigProperties(); Assert.assertNotNull(processorConfigMap); String processorConfigValue1=(String)processorConfigMap.get("processor-config-key1"); Assert.assertNotNull(processorConfigValue1); Assert.assertEquals("processor-config-value1",processorConfigValue1); String processorConfigValue2=(String)processorConfigMap.get("processor-config-key2"); Assert.assertNotNull(processorConfigValue2); Assert.assertEquals("processor-config-value2",processorConfigValue2); /** * Validate controller configuration */ Map controllerConfigMap=jobContext.getJobConfig().getJobControllerConfig().getJobControllerConfigProperties(); Assert.assertNotNull(controllerConfigMap); String controllerConfigValue1=(String)controllerConfigMap.get("controller-config-key1"); Assert.assertNotNull(controllerConfigValue1); Assert.assertEquals("controller-config-value1",controllerConfigValue1); /** * Validate for the modification of config maps. */ try { invokeConfigMap.put("trying-to-change", "can-I"); Assert.fail("Would be able to the change the invoke config map."); } catch(UnsupportedOperationException exception){} try { processorConfigMap.put("trying-to-change", "can-I"); Assert.fail("Would be able to the change the processor config map."); } catch(UnsupportedOperationException exception){} try { controllerConfigMap.put("trying-to-change", "can-I"); Assert.fail("Would be able to the change the controller config map."); } catch(UnsupportedOperationException exception){} } public ErrorCode process(Object jobData) { Assert.assertNotNull(jobData); Integer value=(Integer)jobData; logger.error("Received the data to process : " + jobData.toString()); return ErrorCode.JOB_COMPLETED_SUCCESSFULLY; } } --- CollectionJobPoolTest.java DELETED --- --- NEW FILE: VerifyReturnCodePoolJobControllerTest.java --- /* * VerifyAllConfigPropsPoolJobControllerTest.java * JUnit based test * * Created on September 17, 2006, 9:36 AM */ package org.jmonks.batch.framework.controller.pool; import java.util.HashMap; import java.util.Map; import junit.framework.*; import org.jmonks.batch.framework.ErrorCode; import org.jmonks.batch.framework.Main; /** * * @author Suresh Pragada */ public class VerifyReturnCodePoolJobControllerTest extends TestCase { public VerifyReturnCodePoolJobControllerTest(String testName) { super(testName); } protected void setUp() throws Exception { } protected void tearDown() throws Exception { } public static Test suite() { TestSuite suite = new TestSuite(); suite.addTest(new VerifyReturnCodePoolJobControllerTest("testVerifyReturnCode")); return suite; } public void testVerifyReturnCode() { Map configMap=new HashMap(); configMap.put("job-name", "verify_return_code_pool_job_controller"); ErrorCode exitCode=Main.process(configMap); assertNotNull(exitCode); assertEquals(102, exitCode.getCode()); } } --- NEW FILE: VerifyAllConfigPropsJobLoader.java --- /* * VerifyAllConfigPropsJobLoader.java * * Created on September 18, 2006, 5:39 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.pool; import java.util.Map; import junit.framework.Assert; import org.jmonks.batch.framework.ErrorCode; import org.jmonks.batch.framework.JobContext; import org.jmonks.batch.framework.config.PoolJobControllerConfig; /** * * @author Suresh Pragada */ public class VerifyAllConfigPropsJobLoader extends AbstractPoolJobLoader { /** Creates a new instance of VerifyAllConfigPropsJobLoader */ public VerifyAllConfigPropsJobLoader() { } public long getTotalJobDataCount() { return 100; } public ErrorCode loadPool(JobContext jobContext) { Assert.assertNotNull(jobContext); /** * Validate invoke configuration */ Map invokeConfigMap=jobContext.getJobInvokeConfig(); Assert.assertNotNull(invokeConfigMap); String invokeConfigValue1=(String)invokeConfigMap.get("invoke-config-key1"); Assert.assertNotNull(invokeConfigValue1); Assert.assertEquals("invoke-config-value1",invokeConfigValue1); /** * Validate loader configuration */ Map loaderConfigMap=((PoolJobControllerConfig)jobContext.getJobConfig().getJobControllerConfig()).getPoolJobLoaderConfigProperties(); Assert.assertNotNull(loaderConfigMap); String loaderConfigValue1=(String)loaderConfigMap.get("loader-config-key1"); Assert.assertNotNull(loaderConfigValue1); Assert.assertEquals("loader-config-value1",loaderConfigValue1); String loaderConfigValue2=(String)loaderConfigMap.get("loader-config-key2"); Assert.assertNotNull(loaderConfigValue2); Assert.assertEquals("loader-config-value2",loaderConfigValue2); /** * Validate controller configuration */ Map controllerConfigMap=jobContext.getJobConfig().getJobControllerConfig().getJobControllerConfigProperties(); Assert.assertNotNull(controllerConfigMap); String controllerConfigValue1=(String)controllerConfigMap.get("controller-config-key1"); Assert.assertNotNull(controllerConfigValue1); Assert.assertEquals("controller-config-value1",controllerConfigValue1); /** * Validate for the modification of config maps. */ try { invokeConfigMap.put("trying-to-change", "can-I"); Assert.fail("Would be able to the change the invoke config map."); } catch(UnsupportedOperationException exception){} try { loaderConfigMap.put("trying-to-change", "can-I"); Assert.fail("Would be able to the change the loader config map."); } catch(UnsupportedOperationException exception){} try { controllerConfigMap.put("trying-to-change", "can-I"); Assert.fail("Would be able to the change the controller config map."); } catch(UnsupportedOperationException exception){} for(int i=0;i<10;i++) loadJobData(new Integer(i)); loadJobData(null); return ErrorCode.JOB_COMPLETED_SUCCESSFULLY; } } --- NEW FILE: VerifyAllConfigPropsPoolJobControllerTest.java --- /* * VerifyAllConfigPropsPoolJobControllerTest.java * JUnit based test * * Created on September 17, 2006, 9:36 AM */ package org.jmonks.batch.framework.controller.pool; import java.util.HashMap; import java.util.Map; import junit.framework.*; import org.jmonks.batch.framework.ErrorCode; import org.jmonks.batch.framework.JobContext; import org.jmonks.batch.framework.Main; import org.jmonks.batch.framework.config.BasicJobControllerConfig; /** * * @author Suresh Pragada */ public class VerifyAllConfigPropsPoolJobControllerTest extends TestCase { public VerifyAllConfigPropsPoolJobControllerTest(String testName) { super(testName); } protected void setUp() throws Exception { } protected void tearDown() throws Exception { } public static Test suite() { TestSuite suite = new TestSuite(); suite.addTest(new VerifyAllConfigPropsPoolJobControllerTest("testVerifyAllConfigProps")); return suite; } public void testVerifyAllConfigProps() { Map configMap=new HashMap(); configMap.put("job-name", "verify_config_props_pool_job_controller"); configMap.put("invoke-config-key1", "invoke-config-value1"); ErrorCode exitCode=Main.process(configMap); assertNotNull(exitCode); assertEquals(ErrorCode.JOB_COMPLETED_SUCCESSFULLY.getCode(), exitCode.getCode()); } } --- NEW FILE: VerifyReturnCodeJobLoader.java --- /* * VerifyAllConfigPropsJobLoader.java * * Created on September 18, 2006, 5:39 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.pool; import junit.framework.Assert; import org.jmonks.batch.framework.ErrorCode; import org.jmonks.batch.framework.JobContext; /** * * @author Suresh Pragada */ public class VerifyReturnCodeJobLoader extends AbstractPoolJobLoader { public VerifyReturnCodeJobLoader() { } public long getTotalJobDataCount() { return 100; } public ErrorCode loadPool(JobContext jobContext) { Assert.assertNotNull(jobContext); for(int i=0;i<25;i++) loadJobData(new Integer(i)); loadJobData(null); return ErrorCode.JOB_COMPLETED_SUCCESSFULLY; } } --- NEW FILE: VerifyAllConfigPropsJobPool.java --- /* * VerifyAllConfigPropsJobLoader.java * * Created on September 18, 2006, 5:39 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.pool; import java.util.Map; import junit.framework.Assert; import org.jmonks.batch.framework.JobContext; import org.jmonks.batch.framework.config.PoolJobControllerConfig; /** * * @author Suresh Pragada */ public class VerifyAllConfigPropsJobPool extends CollectionJobPool { public VerifyAllConfigPropsJobPool() { } public void initialize(JobContext jobContext) { Assert.assertNotNull(jobContext); /** * Validate invoke configuration */ Map invokeConfigMap=jobContext.getJobInvokeConfig(); Assert.assertNotNull(invokeConfigMap); String invokeConfigValue1=(String)invokeConfigMap.get("invoke-config-key1"); Assert.assertNotNull(invokeConfigValue1); Assert.assertEquals("invoke-config-value1",invokeConfigValue1); /** * Validate loader configuration */ Map poolConfigMap=((PoolJobControllerConfig)jobContext.getJobConfig().getJobControllerConfig()).getPoolConfigProperties(); Assert.assertNotNull(poolConfigMap); String poolConfigValue1=(String)poolConfigMap.get("pool-config-key1"); Assert.assertNotNull(poolConfigValue1); Assert.assertEquals("pool-config-value1",poolConfigValue1); String poolConfigValue2=(String)poolConfigMap.get("pool-config-key2"); Assert.assertNotNull(poolConfigValue2); Assert.assertEquals("pool-config-value2",poolConfigValue2); /** * Validate controller configuration */ Map controllerConfigMap=jobContext.getJobConfig().getJobControllerConfig().getJobControllerConfigProperties(); Assert.assertNotNull(controllerConfigMap); String controllerConfigValue1=(String)controllerConfigMap.get("controller-config-key1"); Assert.assertNotNull(controllerConfigValue1); Assert.assertEquals("controller-config-value1",controllerConfigValue1); /** * Validate for the modification of config maps. */ try { invokeConfigMap.put("trying-to-change", "can-I"); Assert.fail("Would be able to the change the invoke config map."); } catch(UnsupportedOperationException exception){} try { poolConfigMap.put("trying-to-change", "can-I"); Assert.fail("Would be able to the change the pool config map."); } catch(UnsupportedOperationException exception){} try { controllerConfigMap.put("trying-to-change", "can-I"); Assert.fail("Would be able to the change the controller config map."); } catch(UnsupportedOperationException exception){} super.initialize(jobContext); } } |
From: Suresh <sur...@us...> - 2006-09-19 00:05:58
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batch/framework/controller/basic In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv27472/framework/controller/basic Modified Files: BasicJobController.java Log Message: no message Index: BasicJobController.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batch/framework/controller/basic/BasicJobController.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** BasicJobController.java 15 Sep 2006 20:06:39 -0000 1.1 --- BasicJobController.java 19 Sep 2006 00:05:52 -0000 1.2 *************** *** 3,6 **** --- 3,7 ---- import EDU.oswego.cs.dl.util.concurrent.CountDown; import EDU.oswego.cs.dl.util.concurrent.FutureResult; + import java.lang.reflect.InvocationTargetException; import java.util.Calendar; import java.util.Hashtable; *************** *** 114,117 **** --- 115,119 ---- this.jobStatistics=new JobStatistics(super.jobContext.getJobName()); this.jobStatistics.setStartTime(Calendar.getInstance().getTime()); + this.jobStatistics.setMaxMemeoryUsage(Runtime.getRuntime().totalMemory()-Runtime.getRuntime().freeMemory()); for(int i=0;i<threadCount;i++) { *************** *** 124,128 **** this.jobProcessorsMap.put(threadID,jobProcessor); this.jobProcessorsResultMap.put(threadID, result); ! logger.info(threadID + " basic job processor has been kicked off."); } ErrorCode returnCode=hybernate(countDownLock); --- 126,130 ---- this.jobProcessorsMap.put(threadID,jobProcessor); this.jobProcessorsResultMap.put(threadID, result); ! logger.info(threadID + " basic job processor has been started."); } ErrorCode returnCode=hybernate(countDownLock); *************** *** 344,350 **** boolean registered=jobProcessor.registerThread(); logger.debug("Status of registering thread with the processor = " + registered); - logger.trace("Going to call the process method"); returnCode=jobProcessor.process(jobContext); ! logger.debug("Done calling the process method"); } catch(Throwable exception) --- 346,351 ---- boolean registered=jobProcessor.registerThread(); logger.debug("Status of registering thread with the processor = " + registered); returnCode=jobProcessor.process(jobContext); ! logger.debug("Done calling the process method. Return code = " + returnCode); } catch(Throwable exception) *************** *** 352,359 **** exception.printStackTrace(); logger.error("Exception while processing = " + exception.getMessage(), exception); ! returnCode=ErrorCode.BASIC_JOB_PROCESSOR_EXCEPTION; } countDownLock.release(); ! logger.info(Thread.currentThread().getName() + " is exiting with the error code = " + returnCode); return returnCode; } --- 353,361 ---- exception.printStackTrace(); logger.error("Exception while processing = " + exception.getMessage(), exception); ! returnCode=ErrorCode.BASIC_JOB_PROCESSOR_EXCEPTION.appendMessage(" Message from processor = " + exception.getMessage()); } + logger.trace(Thread.currentThread().getName() + " is going to release the countdown lock."); countDownLock.release(); ! logger.info(Thread.currentThread().getName() + " is exiting with the error code = " + returnCode); return returnCode; } *************** *** 379,385 **** try { ! logger.debug("Going to wait until all the processors is gonna finish."); countDownLock.acquire(); logger.info("All processors have finished their task."); } catch(InterruptedException exception) --- 381,398 ---- try { ! logger.debug("Going to wait until all the processors are going to finish."); countDownLock.acquire(); logger.info("All processors have finished their task."); + + logger.debug("Calculating the final return code from all the processors results."); + for(Iterator iterator=this.jobProcessorsResultMap.values().iterator();iterator.hasNext();) + { + ErrorCode threadReturnCode=(ErrorCode)((FutureResult)iterator.next()).get(); + if(!ErrorCode.JOB_COMPLETED_SUCCESSFULLY.equals(threadReturnCode) && threadReturnCode.getCode()>returnCode.getCode()) + { + returnCode=threadReturnCode; + } + } + logger.debug("Calculated result from all the processeors is " + returnCode); } catch(InterruptedException exception) *************** *** 389,406 **** return ErrorCode.BASIC_JOB_PROCESSOR_EXCEPTION; } ! ! this.jobStatistics.setEndTime(Calendar.getInstance().getTime()); ! this.jobStatistics.setMaxMemeoryUsage(Runtime.getRuntime().totalMemory()-Runtime.getRuntime().freeMemory()); ! this.jobStatistics.setRecordsProcessed(this.getProcessedRecordsCount()); ! ! for(Iterator iterator=this.jobProcessorsResultMap.values().iterator();iterator.hasNext();) { ! ErrorCode threadReturnCode=(ErrorCode)((FutureResult)iterator.next()).peek(); ! if(!ErrorCode.JOB_COMPLETED_SUCCESSFULLY.equals(threadReturnCode)) ! { ! returnCode=threadReturnCode; ! break; ! } } this.jobStatistics.setExitCode(returnCode); logger.trace("Exiting hybernate = " + returnCode); --- 402,417 ---- return ErrorCode.BASIC_JOB_PROCESSOR_EXCEPTION; } ! catch(InvocationTargetException exception) { ! exception.printStackTrace(); ! logger.error("Exception while waiting for all the processors = " + exception.getMessage(), exception); ! return ErrorCode.BASIC_JOB_PROCESSOR_EXCEPTION; } + + this.jobStatistics.setEndTime(Calendar.getInstance().getTime()); + this.jobStatistics.setMaxMemeoryUsage( + (Runtime.getRuntime().totalMemory()-Runtime.getRuntime().freeMemory())-this.jobStatistics.getMaxMemoryUsage() + ); + this.jobStatistics.setRecordsProcessed(this.getProcessedRecordsCount()); this.jobStatistics.setExitCode(returnCode); logger.trace("Exiting hybernate = " + returnCode); |
From: Suresh <sur...@us...> - 2006-09-19 00:05:58
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batch/framework In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv27472/framework Modified Files: JobStatistics.java Main.java Log Message: no message Index: Main.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batch/framework/Main.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Main.java 15 Sep 2006 20:05:44 -0000 1.1 --- Main.java 19 Sep 2006 00:05:52 -0000 1.2 *************** *** 127,131 **** logger.debug("Registering the controller with the management agent"); jobManagementAgent.start(jobContext, jobController, frameworkCreator); ! logger.error("Kicking off the controller"); returnCode=jobController.process(); /** --- 127,131 ---- logger.debug("Registering the controller with the management agent"); jobManagementAgent.start(jobContext, jobController, frameworkCreator); ! logger.error("Starting the controller"); returnCode=jobController.process(); /** Index: JobStatistics.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batch/framework/JobStatistics.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** JobStatistics.java 15 Sep 2006 20:05:44 -0000 1.1 --- JobStatistics.java 19 Sep 2006 00:05:52 -0000 1.2 *************** *** 179,183 **** stringValue.append("[maxMemoryUsage = " + this.maxMemoryUsage + "]"); stringValue.append("[recordsProcessed = " + this.recordsProcessed + "]"); ! stringValue.append("[exitCode = " + this.exitCode.toString() + "]"); stringValue.append("}"); return stringValue.toString(); --- 179,183 ---- stringValue.append("[maxMemoryUsage = " + this.maxMemoryUsage + "]"); stringValue.append("[recordsProcessed = " + this.recordsProcessed + "]"); ! stringValue.append("[exitCode = " + ((this.exitCode!=null)?this.exitCode.toString():"") + "]"); stringValue.append("}"); return stringValue.toString(); |
From: Suresh <sur...@us...> - 2006-09-19 00:05:58
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batch/framework/management In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv27472/framework/management Modified Files: JobManagementAgent.java Log Message: no message Index: JobManagementAgent.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batch/framework/management/JobManagementAgent.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** JobManagementAgent.java 15 Sep 2006 20:07:01 -0000 1.1 --- JobManagementAgent.java 19 Sep 2006 00:05:52 -0000 1.2 *************** *** 68,72 **** * Tells whether the agent has been stopped or not. */ ! private boolean stopped=false; private static Logger logger=Logger.getLogger(JobManagementAgent.class); --- 68,72 ---- * Tells whether the agent has been stopped or not. */ ! private boolean stopped=true; private static Logger logger=Logger.getLogger(JobManagementAgent.class); *************** *** 129,134 **** if(this.started) throw new IllegalStateException("job management agent has been already started."); ! if(this.stopped) ! throw new IllegalStateException("job management agent has been already stopped."); if(jobContext==null) --- 129,134 ---- if(this.started) throw new IllegalStateException("job management agent has been already started."); ! if(!this.stopped) ! throw new IllegalStateException("job management agent has not been stopped."); if(jobContext==null) *************** *** 178,186 **** logger.debug("Successfully registered the connector server with the job name"); this.started=true; } else { logger.error("Unable to register the jmx connector server using job connector helper"); ! this.started=false; } } --- 178,188 ---- logger.debug("Successfully registered the connector server with the job name"); this.started=true; + this.stopped=false; } else { logger.error("Unable to register the jmx connector server using job connector helper"); ! this.started=false; ! this.stopped=false; } } *************** *** 239,244 **** if(!this.started) ! throw new IllegalStateException("Job management agent has not been started."); ! if(this.stopped) throw new IllegalStateException("Job management agent has been stopped already."); --- 241,245 ---- if(!this.started) ! throw new IllegalStateException("Job management agent has not been started."); if(this.stopped) throw new IllegalStateException("Job management agent has been stopped already."); *************** *** 256,259 **** --- 257,261 ---- this.jobConnectorHelper.unregisterConnectorServer(jobContext); this.stopped=true; + this.started=false; logger.debug("unregistered the jmx connector server from lookup location"); } |
From: Suresh <sur...@us...> - 2006-09-19 00:05:57
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batch/framework/controller/pool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv27472/framework/controller/pool Modified Files: AbstractPoolJobProcessor.java CollectionJobPool.java PoolJobController.java Log Message: no message Index: AbstractPoolJobProcessor.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batch/framework/controller/pool/AbstractPoolJobProcessor.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AbstractPoolJobProcessor.java 15 Sep 2006 20:06:49 -0000 1.1 --- AbstractPoolJobProcessor.java 19 Sep 2006 00:05:52 -0000 1.2 *************** *** 84,88 **** * and passes that information to the processor implementation for * processing and cleans up the processor implementation by calling the <i>cleanup</i> ! * method. * </p> * --- 84,91 ---- * and passes that information to the processor implementation for * processing and cleans up the processor implementation by calling the <i>cleanup</i> ! * method. It consolidates all the return codes from the processor implementation ! * process method and return the final error code. If it receives null as the ! * return code, continues the processing, but returns pool job processor exception ! * return code. * </p> * *************** *** 90,94 **** * @param pool Job pool reference where job data needs to be pulled. * ! * @return Returns the status code of this processor. */ public ErrorCode processPool(JobContext jobContext, JobPool pool) --- 93,97 ---- * @param pool Job pool reference where job data needs to be pulled. * ! * @return Returns the status code of this job processor. */ public ErrorCode processPool(JobContext jobContext, JobPool pool) *************** *** 121,125 **** this.processedJobDataCount++; ErrorCode errorCode=this.process(jobData); ! returnCode=errorCode; } catch(Throwable exception) --- 124,132 ---- this.processedJobDataCount++; ErrorCode errorCode=this.process(jobData); ! ! if(errorCode==null) ! returnCode=ErrorCode.POOL_JOB_PROCESSOR_EXCEPTION.appendMessage("Received the null returnCode from " + Thread.currentThread().getName() + " process."); ! else if (!errorCode.equals(ErrorCode.JOB_COMPLETED_SUCCESSFULLY)) ! returnCode=errorCode; } catch(Throwable exception) *************** *** 167,171 **** logger.trace("Exiting processPool"); ! return ErrorCode.JOB_COMPLETED_SUCCESSFULLY; } --- 174,178 ---- logger.trace("Exiting processPool"); ! return returnCode; } *************** *** 256,260 **** * @param jobData Data to be processed. * ! * @return Returns the status of the processingn of this jobData. */ public abstract ErrorCode process(Object jobData); --- 263,267 ---- * @param jobData Data to be processed. * ! * @return Returns the status of the processing of this jobData. */ public abstract ErrorCode process(Object jobData); Index: PoolJobController.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batch/framework/controller/pool/PoolJobController.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PoolJobController.java 15 Sep 2006 20:06:49 -0000 1.1 --- PoolJobController.java 19 Sep 2006 00:05:52 -0000 1.2 *************** *** 3,6 **** --- 3,7 ---- import EDU.oswego.cs.dl.util.concurrent.CountDown; import EDU.oswego.cs.dl.util.concurrent.FutureResult; + import java.lang.reflect.InvocationTargetException; import java.util.Calendar; import java.util.Hashtable; *************** *** 141,144 **** --- 142,146 ---- this.jobStatistics=new JobStatistics(super.jobContext.getJobName()); this.jobStatistics.setStartTime(Calendar.getInstance().getTime()); + this.jobStatistics.setMaxMemeoryUsage(Runtime.getRuntime().totalMemory()-Runtime.getRuntime().freeMemory()); /** * Create, initialize and spawn the processor(s). *************** *** 385,391 **** try { ! logger.debug("Going to wait until loader and all the processor(s) is gonna finish."); countDownLock.acquire(); logger.info("Loader and all processor(s) have finished their task."); /** As per the contract cleanup the pool. */ this.pool.cleanup(); --- 387,405 ---- try { ! logger.debug("Going to wait until loader and all the processor(s) going to finish."); countDownLock.acquire(); logger.info("Loader and all processor(s) have finished their task."); + + logger.debug("Calculating the final return code from all the processors/loader results."); + for(Iterator iterator=this.jobProcessorsResultMap.values().iterator();iterator.hasNext();) + { + ErrorCode threadReturnCode=(ErrorCode)((FutureResult)iterator.next()).get(); + if(!ErrorCode.JOB_COMPLETED_SUCCESSFULLY.equals(threadReturnCode) && threadReturnCode.getCode()>returnCode.getCode()) + { + returnCode=threadReturnCode; + } + } + logger.debug("Calculated result from all the processeors/loader is " + returnCode); + /** As per the contract cleanup the pool. */ this.pool.cleanup(); *************** *** 397,414 **** return ErrorCode.POOL_JOB_PROCESSOR_EXCEPTION; } this.jobStatistics.setEndTime(Calendar.getInstance().getTime()); ! this.jobStatistics.setMaxMemeoryUsage(Runtime.getRuntime().totalMemory()-Runtime.getRuntime().freeMemory()); this.jobStatistics.setRecordsProcessed(this.getProcessedRecordsCount()); - - for(Iterator iterator=this.jobProcessorsResultMap.values().iterator();iterator.hasNext();) - { - ErrorCode threadReturnCode=(ErrorCode)((FutureResult)iterator.next()).peek(); - if(!ErrorCode.JOB_COMPLETED_SUCCESSFULLY.equals(threadReturnCode)) - { - returnCode=threadReturnCode; - break; - } - } this.jobStatistics.setExitCode(returnCode); logger.trace("Exiting hybernate = " + returnCode); --- 411,426 ---- return ErrorCode.POOL_JOB_PROCESSOR_EXCEPTION; } + catch(InvocationTargetException exception) + { + exception.printStackTrace(); + logger.error("Exception while waiting for loader and all the processors = " + exception.getMessage(), exception); + return ErrorCode.POOL_JOB_PROCESSOR_EXCEPTION; + } this.jobStatistics.setEndTime(Calendar.getInstance().getTime()); ! this.jobStatistics.setMaxMemeoryUsage( ! (Runtime.getRuntime().totalMemory()-Runtime.getRuntime().freeMemory())-this.jobStatistics.getMaxMemoryUsage() ! ); this.jobStatistics.setRecordsProcessed(this.getProcessedRecordsCount()); this.jobStatistics.setExitCode(returnCode); logger.trace("Exiting hybernate = " + returnCode); *************** *** 438,442 **** logger.trace("Going to call the loadPool method"); returnCode=jobLoader.loadPool(jobContext,pool); ! logger.debug("Done calling the loadPool method"); } catch(Throwable exception) --- 450,454 ---- logger.trace("Going to call the loadPool method"); returnCode=jobLoader.loadPool(jobContext,pool); ! logger.debug("Done calling the loadPool method and return code = " + returnCode); } catch(Throwable exception) *************** *** 444,449 **** exception.printStackTrace(); logger.error("Exception while loading the job data into the pool = " + exception.getMessage(), exception); ! returnCode=ErrorCode.POOL_JOB_LOADER_EXCEPTION; } countDownLock.release(); logger.info(Thread.currentThread().getName() + " is exiting with the error code = " + returnCode); --- 456,462 ---- exception.printStackTrace(); logger.error("Exception while loading the job data into the pool = " + exception.getMessage(), exception); ! returnCode=ErrorCode.POOL_JOB_LOADER_EXCEPTION.appendMessage(" Message from loader = " + exception.getMessage()); } + logger.trace(Thread.currentThread().getName() + " is going to release the countdown lock."); countDownLock.release(); logger.info(Thread.currentThread().getName() + " is exiting with the error code = " + returnCode); *************** *** 477,481 **** logger.trace("Going to call the processPool method"); returnCode=jobProcessor.processPool(jobContext,pool); ! logger.debug("Done calling the processPool method"); } catch(Throwable exception) --- 490,494 ---- logger.trace("Going to call the processPool method"); returnCode=jobProcessor.processPool(jobContext,pool); ! logger.debug("Done calling the processPool method and return code = " + returnCode); } catch(Throwable exception) *************** *** 483,488 **** exception.printStackTrace(); logger.error("Exception while processing the job data from the pool = " + exception.getMessage(), exception); ! returnCode=ErrorCode.POOL_JOB_PROCESSOR_EXCEPTION; } countDownLock.release(); logger.info(Thread.currentThread().getName() + " is exiting with the error code = " + returnCode); --- 496,502 ---- exception.printStackTrace(); logger.error("Exception while processing the job data from the pool = " + exception.getMessage(), exception); ! returnCode=ErrorCode.POOL_JOB_PROCESSOR_EXCEPTION.appendMessage(" Message from processor = " + exception.getMessage()); } + logger.trace(Thread.currentThread().getName() + " is going to release the countdown lock."); countDownLock.release(); logger.info(Thread.currentThread().getName() + " is exiting with the error code = " + returnCode); *************** *** 552,556 **** Object jobProcessor=this.getInstance(controllerConfig.getPoolJobProcessorClassName()); ! if(jobProcessor instanceof PoolJobLoader) { logger.debug("Job Processor is configured properly = " + controllerConfig.getPoolJobProcessorClassName()); --- 566,570 ---- Object jobProcessor=this.getInstance(controllerConfig.getPoolJobProcessorClassName()); ! if(jobProcessor instanceof PoolJobProcessor) { logger.debug("Job Processor is configured properly = " + controllerConfig.getPoolJobProcessorClassName()); Index: CollectionJobPool.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batch/framework/controller/pool/CollectionJobPool.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** CollectionJobPool.java 15 Sep 2006 20:06:49 -0000 1.1 --- CollectionJobPool.java 19 Sep 2006 00:05:52 -0000 1.2 *************** *** 152,161 **** catch(Exception exception) { ! logger.info("Exception while obtaining the pool size from configuration... Using the default pool size"); } } else { ! logger.info("pool size has not been configured.. using the default pool size"); } this.pool=new BoundedBuffer(poolSize); --- 152,163 ---- catch(Exception exception) { ! logger.info("Exception while obtaining the pool size from configuration... Using the default pool size = " ! + CollectionJobPool.DEFAULT_COLLECTION_POOL_SIZE); } } else { ! logger.info("pool size has not been configured.. using the default pool size = " ! + CollectionJobPool.DEFAULT_COLLECTION_POOL_SIZE); } this.pool=new BoundedBuffer(poolSize); |
From: Suresh <sur...@us...> - 2006-09-19 00:05:34
|
Update of /cvsroot/batchserver/batchserver/conf In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv27455 Modified Files: batch-config.xml framework-config.xml test-batch-config.xml Log Message: no message Index: framework-config.xml =================================================================== RCS file: /cvsroot/batchserver/batchserver/conf/framework-config.xml,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** framework-config.xml 17 Sep 2006 14:11:41 -0000 1.4 --- framework-config.xml 19 Sep 2006 00:05:29 -0000 1.5 *************** *** 15,19 **** <repository-config repository-class-name="org.jmonks.batch.framework.repository.db4o.Db4oRepository"> ! <property key="db4o-filename">/batchserver/repository/batchserver_repository.db</property> </repository-config> <framework-logging-config framework-logging-level="DEBUG" job-logging-directory="/batchserver/logs" --- 15,19 ---- <repository-config repository-class-name="org.jmonks.batch.framework.repository.db4o.Db4oRepository"> ! <property key="db4o-directory">/batchserver/repository</property> </repository-config> <framework-logging-config framework-logging-level="DEBUG" job-logging-directory="/batchserver/logs" Index: batch-config.xml =================================================================== RCS file: /cvsroot/batchserver/batchserver/conf/batch-config.xml,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** batch-config.xml 15 Sep 2006 19:54:23 -0000 1.3 --- batch-config.xml 19 Sep 2006 00:05:29 -0000 1.4 *************** *** 9,13 **** <property key="pool-job-processor-key1">processor-value1</property> </pool-job-processor> ! <job-pool job-pool-class-name="org.jmonks.batch.framework.controller.pool.DefaultJobPool"> <property key="job-pool-size">50000</property> </job-pool> --- 9,13 ---- <property key="pool-job-processor-key1">processor-value1</property> </pool-job-processor> ! <job-pool job-pool-class-name="org.jmonks.batch.framework.controller.pool.CollectionJobPool"> <property key="job-pool-size">50000</property> </job-pool> Index: test-batch-config.xml =================================================================== RCS file: /cvsroot/batchserver/batchserver/conf/test-batch-config.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test-batch-config.xml 17 Sep 2006 14:11:42 -0000 1.1 --- test-batch-config.xml 19 Sep 2006 00:05:29 -0000 1.2 *************** *** 1,24 **** <?xml version="1.0" encoding="UTF-8"?> <batch-config> ! <job-config job-name="process_file_abc" job-status="active"> ! <job-controller job-controller-class-name="org.jmonks.batch.framework.controller.pool.PoolJobController"> ! <pool-job-loader pool-job-loader-class-name="com.mycompany.batch.processfileabc.AbcJobLoader"> ! <property key="pool-job-loader-key1">loader-value1</property> ! </pool-job-loader> ! <pool-job-processor pool-job-processor-class-name="com.mycompany.batch.processfileabc.AbcJobProcessor" thread-count="5"> ! <property key="pool-job-processor-key1">processor-value1</property> ! </pool-job-processor> ! <job-pool job-pool-class-name="org.jmonks.batch.framework.controller.pool.DefaultJobPool"> ! <property key="job-pool-size">50000</property> ! </job-pool> ! <property key="pool-job-controller-restart">true</property> </job-controller> <job-logging-config> ! <job-logger-config logger-name="com.mycompany.batch.abc" logger-level="DEBUG"/> ! </job-logging-config> </job-config> ! <job-config job-name="process_file_xyz" job-status="active"> <job-controller job-controller-class-name="org.jmonks.batch.framework.controller.basic.BasicJobController"> ! <basic-job-processor basic-job-processor-class-name="org.jmonks.batch.framework.controller.basic.TestBasicJobProcessor" thread-count="5"> <property key="processor-config-key1">processor-config-value1</property> </basic-job-processor> --- 1,20 ---- <?xml version="1.0" encoding="UTF-8"?> <batch-config> ! <job-config job-name="verify_config_props_basic_job_processor" job-status="active"> ! <job-controller job-controller-class-name="org.jmonks.batch.framework.controller.basic.BasicJobController"> ! <basic-job-processor basic-job-processor-class-name="org.jmonks.batch.framework.controller.basic.VerifyAllConfigPropsProcessor" thread-count="1"> ! <property key="processor-config-key1">processor-config-value1</property> ! <property key="processor-config-key2">processor-config-value2</property> ! </basic-job-processor> ! <property key="controller-config-key1">controller-config-value1</property> </job-controller> <job-logging-config> ! <job-logger-config logger-name="org.jmonks.batch.framework.controller.basic" logger-level="TRACE"/> ! <job-logger-config logger-name="org.jmonks.batch.framework" logger-level="ERROR"/> ! </job-logging-config> </job-config> ! <job-config job-name="verify_return_code_basic_job_processor" job-status="active"> <job-controller job-controller-class-name="org.jmonks.batch.framework.controller.basic.BasicJobController"> ! <basic-job-processor basic-job-processor-class-name="org.jmonks.batch.framework.controller.basic.VerifyReturnCodeProcessor" thread-count="5"> <property key="processor-config-key1">processor-config-value1</property> </basic-job-processor> *************** *** 27,32 **** <job-logging-config> <job-logger-config logger-name="org.jmonks.batch.framework.controller.basic" logger-level="TRACE"/> ! <job-logger-config logger-name="org.jmonks.batch.framework" logger-level="ERROR"/> </job-logging-config> ! </job-config> </batch-config> \ No newline at end of file --- 23,65 ---- <job-logging-config> <job-logger-config logger-name="org.jmonks.batch.framework.controller.basic" logger-level="TRACE"/> ! <job-logger-config logger-name="org.jmonks.batch.framework" logger-level="DEBUG"/> </job-logging-config> ! </job-config> ! <job-config job-name="verify_config_props_pool_job_controller" job-status="active"> ! <job-controller job-controller-class-name="org.jmonks.batch.framework.controller.pool.PoolJobController"> ! <pool-job-loader pool-job-loader-class-name="org.jmonks.batch.framework.controller.pool.VerifyAllConfigPropsJobLoader"> ! <property key="loader-config-key1">loader-config-value1</property> ! <property key="loader-config-key2">loader-config-value2</property> ! </pool-job-loader> ! <pool-job-processor pool-job-processor-class-name="org.jmonks.batch.framework.controller.pool.VerifyAllConfigPropsJobProcessor" thread-count="1"> ! <property key="processor-config-key1">processor-config-value1</property> ! <property key="processor-config-key2">processor-config-value2</property> ! </pool-job-processor> ! <job-pool job-pool-class-name="org.jmonks.batch.framework.controller.pool.CollectionJobPool"> ! <property key="pool-config-key1">pool-config-value1</property> ! <property key="pool-config-key2">pool-config-value2</property> ! </job-pool> ! <property key="controller-config-key1">controller-config-value1</property> ! </job-controller> ! <job-logging-config> ! <job-logger-config logger-name="org.jmonks.batch.framework.controller.pool" logger-level="TRACE"/> ! <job-logger-config logger-name="org.jmonks.batch.framework" logger-level="DEBUG"/> ! </job-logging-config> ! </job-config> ! <job-config job-name="verify_return_code_pool_job_controller" job-status="active"> ! <job-controller job-controller-class-name="org.jmonks.batch.framework.controller.pool.PoolJobController"> ! <pool-job-loader pool-job-loader-class-name="org.jmonks.batch.framework.controller.pool.VerifyReturnCodeJobLoader"> ! <property key="loader-config-key1">loader-config-value1</property> ! </pool-job-loader> ! <pool-job-processor pool-job-processor-class-name="org.jmonks.batch.framework.controller.pool.VerifyReturnCodeJobProcessor" thread-count="3"> ! <property key="processor-config-key1">processor-config-value1</property> ! </pool-job-processor> ! <job-pool job-pool-class-name="org.jmonks.batch.framework.controller.pool.CollectionJobPool"/> ! <property key="controller-config-key1">controller-config-value1</property> ! </job-controller> ! <job-logging-config> ! <job-logger-config logger-name="org.jmonks.batch.framework.controller.pool" logger-level="TRACE"/> ! <job-logger-config logger-name="org.jmonks.batch.framework" logger-level="DEBUG"/> ! </job-logging-config> ! </job-config> </batch-config> \ No newline at end of file |
From: Suresh <sur...@us...> - 2006-09-17 14:11:49
|
Update of /cvsroot/batchserver/batchserver/conf In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv28473 Modified Files: framework-config.xml Added Files: test-batch-config.xml Removed Files: framework-config.xsd Log Message: no message --- framework-config.xsd DELETED --- Index: framework-config.xml =================================================================== RCS file: /cvsroot/batchserver/batchserver/conf/framework-config.xml,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** framework-config.xml 15 Sep 2006 19:54:24 -0000 1.3 --- framework-config.xml 17 Sep 2006 14:11:41 -0000 1.4 *************** *** 2,6 **** <framework-config> <job-config-factory-config job-config-factory-class-name="org.jmonks.batch.framework.config.xml.XMLJobConfigFactory"> ! <property key="job-config-file-classpath-location">batch-config.xml</property> </job-config-factory-config> <!-- --- 2,6 ---- <framework-config> <job-config-factory-config job-config-factory-class-name="org.jmonks.batch.framework.config.xml.XMLJobConfigFactory"> ! <property key="job-config-file-classpath-location">test-batch-config.xml</property> </job-config-factory-config> <!-- --- NEW FILE: test-batch-config.xml --- <?xml version="1.0" encoding="UTF-8"?> <batch-config> <job-config job-name="process_file_abc" job-status="active"> <job-controller job-controller-class-name="org.jmonks.batch.framework.controller.pool.PoolJobController"> <pool-job-loader pool-job-loader-class-name="com.mycompany.batch.processfileabc.AbcJobLoader"> <property key="pool-job-loader-key1">loader-value1</property> </pool-job-loader> <pool-job-processor pool-job-processor-class-name="com.mycompany.batch.processfileabc.AbcJobProcessor" thread-count="5"> <property key="pool-job-processor-key1">processor-value1</property> </pool-job-processor> <job-pool job-pool-class-name="org.jmonks.batch.framework.controller.pool.DefaultJobPool"> <property key="job-pool-size">50000</property> </job-pool> <property key="pool-job-controller-restart">true</property> </job-controller> <job-logging-config> <job-logger-config logger-name="com.mycompany.batch.abc" logger-level="DEBUG"/> </job-logging-config> </job-config> <job-config job-name="process_file_xyz" job-status="active"> <job-controller job-controller-class-name="org.jmonks.batch.framework.controller.basic.BasicJobController"> <basic-job-processor basic-job-processor-class-name="org.jmonks.batch.framework.controller.basic.TestBasicJobProcessor" thread-count="5"> <property key="processor-config-key1">processor-config-value1</property> </basic-job-processor> <property key="controller-config-key1">controller-config-value1</property> </job-controller> <job-logging-config> <job-logger-config logger-name="org.jmonks.batch.framework.controller.basic" logger-level="TRACE"/> <job-logger-config logger-name="org.jmonks.batch.framework" logger-level="ERROR"/> </job-logging-config> </job-config> </batch-config> |
From: Suresh <sur...@us...> - 2006-09-16 15:47:14
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/repository/jdbc In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv1337 Removed Files: JdbcRepository.java Log Message: no message --- JdbcRepository.java DELETED --- |
From: Suresh <sur...@us...> - 2006-09-16 15:46:52
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/repository/db4o In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv968 Removed Files: ClientServerDb4oRepository.java Db4oJobControllerHolder.java Db4oJobControllerHolderPredicate.java Db4oJobDataTransferHolder.java Db4oJobMgmtMntrInfoHolder.java Db4oJobMgmtMntrInfoHolderPredicate.java Db4oJobStatisticsPredicate.java Db4oRepository.java Log Message: no message --- Db4oJobControllerHolder.java DELETED --- --- Db4oJobControllerHolderPredicate.java DELETED --- --- Db4oRepository.java DELETED --- --- Db4oJobMgmtMntrInfoHolder.java DELETED --- --- Db4oJobMgmtMntrInfoHolderPredicate.java DELETED --- --- Db4oJobStatisticsPredicate.java DELETED --- --- ClientServerDb4oRepository.java DELETED --- --- Db4oJobDataTransferHolder.java DELETED --- |
From: Suresh <sur...@us...> - 2006-09-15 22:04:45
|
Update of /cvsroot/batchserver/batchserver/test/org/jmonks/batch/framework In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv5850/framework Modified Files: LoggingManagerTest.java MainTest.java Log Message: no message Index: LoggingManagerTest.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/test/org/jmonks/batch/framework/LoggingManagerTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** LoggingManagerTest.java 15 Sep 2006 20:21:13 -0000 1.1 --- LoggingManagerTest.java 15 Sep 2006 22:04:43 -0000 1.2 *************** *** 9,17 **** import junit.framework.*; - import org.apache.log4j.Logger; - import org.jmonks.batch.framework.config.JobLoggingConfig; - import org.jmonks.batch.framework.config.JobConfigFactory; import org.jmonks.batch.framework.config.FrameworkConfig; ! import org.jmonks.batch.framework.config.JobConfig; /** --- 9,14 ---- import junit.framework.*; import org.jmonks.batch.framework.config.FrameworkConfig; ! /** *************** *** 50,71 **** public void testInitializeJobLogging() { ! assertNotNull(frameworkConfig); ! FrameworkConfig.FrameworkLoggingConfig loggingConfig=frameworkConfig.getFrameworkLoggingConfig(); ! assertNotNull(loggingConfig); ! FrameworkConfig.JobConfigFactoryConfig configFactoryConfig=frameworkConfig.getJobConfigFactoryConfig(); ! assertNotNull(configFactoryConfig); ! JobConfigFactory factory=JobConfigFactory.getJobConfigFactory(configFactoryConfig); ! assertNotNull(factory); ! JobConfig jobConfig=factory.getJobConfig("process_file_xyz"); ! assertNotNull(jobConfig); ! JobLoggingConfig jobLoggingConfig=jobConfig.getJobLoggingConfig(); ! assertNotNull(jobLoggingConfig); ! LoggingManager.initializeJobLogging("process_file_xyz", loggingConfig,jobLoggingConfig); ! ! Logger logger=Logger.getLogger(LoggingManagerTest.class); ! logger.debug("This is debug message after job initialization"); ! logger.info("This is info message after job initialization"); ! logger.warn("This is warn message after job initialization"); ! logger.error("This is error message after job initialization"); } --- 47,58 ---- public void testInitializeJobLogging() { ! try ! { ! LoggingManager.initializeJobLogging("process_file_xyz", null,null, null); ! fail("LoggingManager shouldn't have been initialized by other than Main."); ! } ! catch(SecurityException exception) ! { ! } } *************** *** 76,89 **** public void testInitializeFrameworkLogging() { ! assertNotNull(frameworkConfig); ! FrameworkConfig.FrameworkLoggingConfig loggingConfig=frameworkConfig.getFrameworkLoggingConfig(); ! assertNotNull(loggingConfig); ! LoggingManager.initializeFrameworkLogging(loggingConfig); ! Logger logger=Logger.getLogger(LoggingManagerTest.class); ! logger.debug("This is debug message"); ! logger.info("This is info message"); ! logger.warn("This is warn message"); ! logger.error("This is error message"); } - } --- 63,74 ---- public void testInitializeFrameworkLogging() { ! try ! { ! LoggingManager.initializeFrameworkLogging(null, null); ! fail("LoggingManager shouldn't have been initialized by other than Main."); ! } ! catch(SecurityException exception) ! { ! } } } Index: MainTest.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/test/org/jmonks/batch/framework/MainTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MainTest.java 15 Sep 2006 20:21:13 -0000 1.1 --- MainTest.java 15 Sep 2006 22:04:43 -0000 1.2 *************** *** 85,87 **** --- 85,89 ---- assertEquals(ErrorCode.JOB_IS_NOT_CONFIGURED.getCode(), exitCode); } + + } |
Update of /cvsroot/batchserver/batchserver/test/org/jmonks/batch/framework/config In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv5850/framework/config Modified Files: BasicJobControllerConfigTest.java FrameworkConfigTest.java JobControllerConfigTest.java PoolJobControllerConfigTest.java Log Message: no message Index: FrameworkConfigTest.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/test/org/jmonks/batch/framework/config/FrameworkConfigTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** FrameworkConfigTest.java 15 Sep 2006 20:24:20 -0000 1.1 --- FrameworkConfigTest.java 15 Sep 2006 22:04:43 -0000 1.2 *************** *** 145,149 **** FrameworkConfig.JobControllerConfig controllerConfig=frameworkConfig.getJobControllerConfig(); assertNotNull(controllerConfig); ! String configClassName=controllerConfig.getConfigClassName("org.jmonks.batchserver.framework.controller.pool.PoolJobController", "xml-factory-config-class-name"); System.out.println(configClassName); assertNotNull(configClassName); --- 145,149 ---- FrameworkConfig.JobControllerConfig controllerConfig=frameworkConfig.getJobControllerConfig(); assertNotNull(controllerConfig); ! String configClassName=controllerConfig.getConfigClassName("org.jmonks.batch.framework.controller.pool.PoolJobController", "xml-factory-config-class-name"); System.out.println(configClassName); assertNotNull(configClassName); Index: BasicJobControllerConfigTest.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/test/org/jmonks/batch/framework/config/BasicJobControllerConfigTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** BasicJobControllerConfigTest.java 15 Sep 2006 20:24:20 -0000 1.1 --- BasicJobControllerConfigTest.java 15 Sep 2006 22:04:43 -0000 1.2 *************** *** 78,108 **** } - /** - * Test case to make get prefix is not returning any null prefix. - */ - public void testGetJobControllerConfigPropertyPrefix() - { - FrameworkConfig frameworkConfig=FrameworkConfig.getInstance(); - assertNotNull(frameworkConfig); - FrameworkConfig.JobConfigFactoryConfig factoryConfig=frameworkConfig.getJobConfigFactoryConfig(); - assertNotNull(factoryConfig); - JobConfigFactory factory=JobConfigFactory.getJobConfigFactory(factoryConfig); - assertNotNull(factory); - JobConfig jobConfig=factory.getJobConfig("process_file_xyz"); - assertNotNull(jobConfig); - BasicJobControllerConfig controllerConfig=(BasicJobControllerConfig)jobConfig.getJobControllerConfig(); - assertNotNull(controllerConfig); - String prefix=controllerConfig.getJobControllerConfigPropertyPrefix(); - assertNotNull(prefix); - assertTrue(!"".equals(prefix)); - } - - /** - * Test to make sure that properties being overriden. - */ - public void testOverrideConfigProperties() - { - - } } --- 78,81 ---- Index: PoolJobControllerConfigTest.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/test/org/jmonks/batch/framework/config/PoolJobControllerConfigTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PoolJobControllerConfigTest.java 15 Sep 2006 20:24:20 -0000 1.1 --- PoolJobControllerConfigTest.java 15 Sep 2006 22:04:43 -0000 1.2 *************** *** 154,183 **** } - /** - * Test to make sure prefix will not be null. - */ - public void testGetJobControllerConfigPropertyPrefix() - { - FrameworkConfig frameworkConfig=FrameworkConfig.getInstance(); - assertNotNull(frameworkConfig); - FrameworkConfig.JobConfigFactoryConfig factoryConfig=frameworkConfig.getJobConfigFactoryConfig(); - assertNotNull(factoryConfig); - JobConfigFactory factory=JobConfigFactory.getJobConfigFactory(factoryConfig); - assertNotNull(factory); - JobConfig jobConfig=factory.getJobConfig("process_file_abc"); - assertNotNull(jobConfig); - PoolJobControllerConfig controllerConfig=(PoolJobControllerConfig)jobConfig.getJobControllerConfig(); - assertNotNull(controllerConfig); - String prefix=controllerConfig.getJobControllerConfigPropertyPrefix(); - assertNotNull(prefix); - assertTrue(!"".equals(prefix)); - } - - /** - * Test to make sure the new properties will be overriden. - */ - public void testOverrideConfigProperties() - { - } } --- 154,157 ---- Index: JobControllerConfigTest.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/test/org/jmonks/batch/framework/config/JobControllerConfigTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** JobControllerConfigTest.java 15 Sep 2006 20:24:20 -0000 1.1 --- JobControllerConfigTest.java 15 Sep 2006 22:04:43 -0000 1.2 *************** *** 77,135 **** } - /** - * Test to make sure that it overrides the given values and add the missing values. - */ - public void testOverrideConfigProperties() - { - FrameworkConfig frameworkConfig=FrameworkConfig.getInstance(); - assertNotNull(frameworkConfig); - FrameworkConfig.JobConfigFactoryConfig factoryConfig=frameworkConfig.getJobConfigFactoryConfig(); - assertNotNull(factoryConfig); - JobConfigFactory factory=JobConfigFactory.getJobConfigFactory(factoryConfig); - assertNotNull(factory); - JobConfig jobConfig=factory.getJobConfig("process_file_abc"); - assertNotNull(jobConfig); - JobControllerConfig controllerConfig=jobConfig.getJobControllerConfig(); - assertNotNull(controllerConfig); - Map controllerConfigProps=controllerConfig.getJobControllerConfigProperties(); - assertNotNull(controllerConfigProps); - - String introducingKey=controllerConfig.getJobControllerConfigPropertyPrefix()+"somekey"; - String introducingValue="Value being introduced"; - Map newProps=new HashMap(); - newProps.put(introducingKey,introducingValue); - controllerConfig.overrideConfigProperties(newProps); - String introducedValue=(String)controllerConfig.getJobControllerConfigProperties().get(introducingKey); - assertNotNull(introducedValue); - assertEquals(introducingValue,introducedValue); - - String overridingValue="Value being overriden"; - Map overridenProps=new HashMap(); - overridenProps.put(introducingKey,overridingValue); - controllerConfig.overrideConfigProperties(overridenProps); - String overridenValue=(String)controllerConfig.getJobControllerConfigProperties().get(introducingKey); - assertNotNull(overridenValue); - assertEquals(overridingValue,overridenValue); - } - - /** - * Test to make sure controller config doesnt return null or empty as common property prefix. - */ - public void testGetJobControllerConfigPropertyPrefix() - { - FrameworkConfig frameworkConfig=FrameworkConfig.getInstance(); - assertNotNull(frameworkConfig); - FrameworkConfig.JobConfigFactoryConfig factoryConfig=frameworkConfig.getJobConfigFactoryConfig(); - assertNotNull(factoryConfig); - JobConfigFactory factory=JobConfigFactory.getJobConfigFactory(factoryConfig); - assertNotNull(factory); - JobConfig jobConfig=factory.getJobConfig("process_file_abc"); - assertNotNull(jobConfig); - JobControllerConfig controllerConfig=jobConfig.getJobControllerConfig(); - assertNotNull(controllerConfig); - String prefixName=controllerConfig.getJobControllerConfigPropertyPrefix(); - assertNotNull(prefixName); - assertTrue(!"".equals(prefixName)); - } - } --- 77,79 ---- |
From: Suresh <sur...@us...> - 2006-09-15 22:04:45
|
Update of /cvsroot/batchserver/batchserver/test/org/jmonks/batch/framework/repository/db4o In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv5850/framework/repository/db4o Modified Files: Db4oRepositoryTest.java Log Message: no message Index: Db4oRepositoryTest.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/test/org/jmonks/batch/framework/repository/db4o/Db4oRepositoryTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Db4oRepositoryTest.java 15 Sep 2006 20:26:56 -0000 1.1 --- Db4oRepositoryTest.java 15 Sep 2006 22:04:43 -0000 1.2 *************** *** 7,10 **** --- 7,11 ---- package org.jmonks.batch.framework.repository.db4o; + import com.db4o.ObjectContainer; import com.db4o.ObjectSet; import java.util.Calendar; *************** *** 145,149 **** { Map configMap=new HashMap(); ! configMap.put(Db4oRepository.PROPERTY_REPOSIOTRY_LOCATION, "/batchserver/repository"); return configMap; } --- 146,150 ---- { Map configMap=new HashMap(); ! configMap.put(Db4oRepository.PROPERTY_DB4O_DIRECTORY, "/batchserver/repository"); return configMap; } *************** *** 174,177 **** --- 175,179 ---- Object registratInfo=null; + ObjectContainer container=super.createContainer(super.repositoryConfigProperties); if(container==null) registratInfo=null; *************** *** 186,189 **** --- 188,192 ---- else registratInfo=null; + container.close(); } //logger.trace("Exiting lookupJobMgmtMntrInfo"); *************** *** 200,204 **** JobStatistics[] statistics=null; ! if(container==null) statistics=new JobStatistics[0]; --- 203,207 ---- JobStatistics[] statistics=null; ! ObjectContainer container=super.createContainer(super.repositoryConfigProperties); if(container==null) statistics=new JobStatistics[0]; *************** *** 210,213 **** --- 213,217 ---- for(int i=0;statisticsResultSet.hasNext();i++) statistics[i]=(JobStatistics)statisticsResultSet.next(); + container.close(); } //logger.trace("Exiting getStatistics"); |
From: Suresh <sur...@us...> - 2006-09-15 22:04:25
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batch/framework/repository/db4o In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv5825/framework/repository/db4o Modified Files: Db4oRepository.java Log Message: no message Index: Db4oRepository.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batch/framework/repository/db4o/Db4oRepository.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Db4oRepository.java 15 Sep 2006 20:07:22 -0000 1.1 --- Db4oRepository.java 15 Sep 2006 22:04:23 -0000 1.2 *************** *** 24,28 **** * <pre> * <repository-config repository-class-name="org.jmonks.batch.framework.repository.db4o.Db4oRepository"> ! * <property key="db4o-filename">/batchserver/repository/batchserver_repository.db</property> * </repository-config> * </pre> --- 24,28 ---- * <pre> * <repository-config repository-class-name="org.jmonks.batch.framework.repository.db4o.Db4oRepository"> ! * <property key="db4o-directory">/batchserver/repository</property> * </repository-config> * </pre> *************** *** 32,35 **** --- 32,36 ---- * shown in the above XML configuration snippet. * </p> + * * @author Suresh Pragada * @version 1.0 *************** *** 40,46 **** private static Logger logger=Logger.getLogger(Db4oRepository.class); /** ! * Property identifies the db4o file name which <code>db4o-filename</code>. */ ! public static final String PROPERTY_DB4O_FILENAME = "db4o-filename"; /** * Map holds the configuration properties of repository. --- 41,51 ---- private static Logger logger=Logger.getLogger(Db4oRepository.class); /** ! * Property identifies the db4o directory name which is <code>db4o-directory</code>. */ ! public static final String PROPERTY_DB4O_DIRECTORY = "db4o-directory"; ! /** ! * Name of the DB4O repository file name which is <code>batchserver_repository.db</code>. ! */ ! public static final String DB4O_REPOSITORY_FILENAME = "batchserver_repository.db"; /** * Map holds the configuration properties of repository. *************** *** 65,75 **** * <p> * Initializes the Db4oRepository by accepting the map consist of properties ! * needed to setup the repository. This make sure repository-location property ! * has been defined and the value defined for this property is valid. * </p> * @param configProps Map contains the configuration properties. * ! * @throws ConfigurationException If repository-location property is not defined and ! * the value specified is invalid. * @throws IllegalArgumentException If given configProps is null. */ --- 70,81 ---- * <p> * Initializes the Db4oRepository by accepting the map consist of properties ! * needed to setup the repository. This validates for db4o-directory property ! * has been defined and the value defined for this property is valid. If the ! * configured directory name is not exists, it tries to create that directory. * </p> * @param configProps Map contains the configuration properties. * ! * @throws ConfigurationException If db4o-directory property is not defined and ! * the value specified is a file and not existing directory could not be created. * @throws IllegalArgumentException If given configProps is null. */ *************** *** 82,112 **** this.repositoryConfigProperties=new HashMap(configProps); ! String db4oFileName=(String)this.repositoryConfigProperties.get(Db4oRepository.PROPERTY_DB4O_FILENAME); ! if(db4oFileName==null || "".equals(db4oFileName)) throw new ConfigurationException(ConfigurationException.REPOSITORY_CONFIG, ! "db4o-filename is required for Db4oReposiotry implementation."); else { ! File repositoryFile=new File(db4oFileName); ! if(!repositoryFile.exists()) { try { ! boolean created=repositoryFile.createNewFile(); if(!created) ! throw new ConfigurationException(ConfigurationException.REPOSITORY_CONFIG, "Attempt to create Db4o filename " + db4oFileName + " is failed."); } ! catch(IOException exception) { exception.printStackTrace(); ! logger.fatal("Exception while trying to create not nonexistent file = " + db4oFileName, exception); throw new ConfigurationException(ConfigurationException.REPOSITORY_CONFIG, ! "Exception while trying to create non existing Db4o filename " + db4oFileName + ". Message = " + exception.getMessage()); } } ! else if(repositoryFile.isDirectory()) { ! throw new ConfigurationException(ConfigurationException.REPOSITORY_CONFIG, "Db4o file name " ! + db4oFileName + " defined is a directory. File name is expected."); } --- 88,118 ---- this.repositoryConfigProperties=new HashMap(configProps); ! String db4oDirectoryName=(String)this.repositoryConfigProperties.get(Db4oRepository.PROPERTY_DB4O_DIRECTORY); ! if(db4oDirectoryName==null || "".equals(db4oDirectoryName)) throw new ConfigurationException(ConfigurationException.REPOSITORY_CONFIG, ! "db4o-directory is required for Db4oReposiotry implementation."); else { ! File db4oDirectory=new File(db4oDirectoryName); ! if(!db4oDirectory.exists()) { try { ! boolean created=db4oDirectory.mkdirs(); if(!created) ! throw new ConfigurationException(ConfigurationException.REPOSITORY_CONFIG, "Attempt to create the directory for Db4o repository = " + db4oDirectoryName + " is failed."); } ! catch(SecurityException exception) { exception.printStackTrace(); ! logger.fatal("SecurityException while trying to create not nonexistent directory = " + db4oDirectoryName, exception); throw new ConfigurationException(ConfigurationException.REPOSITORY_CONFIG, ! "SecurityException while trying to create non existing Db4o directory " + db4oDirectoryName + ". Message = " + exception.getMessage()); } } ! else if(db4oDirectory.isFile()) { ! throw new ConfigurationException(ConfigurationException.REPOSITORY_CONFIG, "Configured value for db4o-directory property = " ! + db4oDirectoryName + " is a file. Directory name is expected."); } *************** *** 116,120 **** ObjectContainer container=this.createContainer(this.repositoryConfigProperties); if(container==null) ! throw new ConfigurationException(ConfigurationException.REPOSITORY_CONFIG, "Unable to create the file " + repositoryFile.getAbsoluteFile() + " to setup repository."); container.close(); } --- 122,126 ---- ObjectContainer container=this.createContainer(this.repositoryConfigProperties); if(container==null) ! throw new ConfigurationException(ConfigurationException.REPOSITORY_CONFIG, "Unable to create the file " + (db4oDirectoryName+File.separator+Db4oRepository.DB4O_REPOSITORY_FILENAME) + " to setup repository."); container.close(); } *************** *** 131,136 **** protected ObjectContainer createContainer(Map configProps) { ! String db4oFileName=(String)configProps.get(Db4oRepository.PROPERTY_DB4O_FILENAME); ! ObjectContainer container=Db4o.openFile(db4oFileName); return container; } --- 137,142 ---- protected ObjectContainer createContainer(Map configProps) { ! String db4oDirectoryName=(String)configProps.get(Db4oRepository.PROPERTY_DB4O_DIRECTORY); ! ObjectContainer container=Db4o.openFile(db4oDirectoryName+File.separator+Db4oRepository.DB4O_REPOSITORY_FILENAME); return container; } |
From: Suresh <sur...@us...> - 2006-09-15 20:29:40
|
Update of /cvsroot/batchserver/batchserver In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv29978 Modified Files: build.xml Log Message: no message Index: build.xml =================================================================== RCS file: /cvsroot/batchserver/batchserver/build.xml,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** build.xml 4 Mar 2006 04:16:40 -0000 1.4 --- build.xml 15 Sep 2006 20:29:38 -0000 1.5 *************** *** 1,3 **** ! <project name="batchserver" default="source-compile" basedir="."> <!-- ===================== Property Definitions =========================== --> --- 1,3 ---- ! <project name="batch-framework" default="source-compile" basedir="."> <!-- ===================== Property Definitions =========================== --> |
From: Suresh <sur...@us...> - 2006-09-15 20:27:16
|
Update of /cvsroot/batchserver/batchserver/test/org/jmonks/batch/framework/repository/jdbc In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv29204 Added Files: MySQLJdbcRepositoryTest.java OracleJdbcRepositoryTest.java Log Message: no message --- NEW FILE: OracleJdbcRepositoryTest.java --- /* * MySQLJdbcRepositoryTest.java * JUnit based test * * Created on September 10, 2006, 12:53 PM */ package org.jmonks.batch.framework.repository.jdbc; import java.io.InputStream; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.Calendar; import java.util.HashMap; import java.util.List; import java.util.Map; import junit.framework.*; import org.jmonks.batch.framework.ErrorCode; import org.jmonks.batch.framework.JobStatistics; import org.jmonks.batch.framework.util.JdbcConnectionHelper; /** * * @author Suresh Pragada */ public class OracleJdbcRepositoryTest extends TestCase { public OracleJdbcRepositoryTest(String testName) { super(testName); } protected void setUp() throws Exception { } protected void tearDown() throws Exception { } public static Test suite() { TestSuite suite = new TestSuite(); suite.addTest(new OracleJdbcRepositoryTest("testInit")); suite.addTest(new OracleJdbcRepositoryTest("testJobDataTransfer")); suite.addTest(new OracleJdbcRepositoryTest("testLogStatistics")); suite.addTest(new OracleJdbcRepositoryTest("testJobMgmtMntrInfo")); return suite; } /** * Test of init method, of class org.jmonks.batchserver.framework.repository.jdbc.JdbcRepository. */ public void testInit() { try { OracleJdbcRepository repository=new OracleJdbcRepository(); repository.init(getOracleConfigMap()); } catch(Exception exception) { fail("Oracle Jdbc Repository testInit was failed."); } } /** * Test of testJobDataTransfer method covers all the test cases related to the job data transfer. */ public void testJobDataTransfer() { try { OracleJdbcRepository repository1=new OracleJdbcRepository(); repository1.init(getOracleConfigMap()); repository1.setJobName("process_file_abc"); Map dataGoingToBeSend=new HashMap(); dataGoingToBeSend.put("author","suresh"); boolean sendStatus=repository1.sendDataToNextJob("ID1", "process_file_xyz", dataGoingToBeSend); assertTrue(sendStatus); OracleJdbcRepository repository2=new OracleJdbcRepository(); repository2.init(getOracleConfigMap()); repository2.setJobName("process_file_xyz"); Object dataSent=repository2.getDataFromPreviousJob("ID1", "process_file_abc"); assertNotNull(dataSent); Map dataSentMap=(Map)dataSent; String author=(String)dataSentMap.get("author"); assertEquals("suresh",author); boolean cleared=repository1.clearDataTransferredFromThisJob(); assertTrue(cleared); Object clearedDataSent=repository2.getDataFromPreviousJob("ID1", "process_file_abc"); assertNull(clearedDataSent); } catch(Exception exception) { fail("Oracle Jdbc Repository testJobDataTransfer was failed."); } } /** * Test of logStatistics method covers all the test cases related to logging the statistics. */ public void testLogStatistics() { try { OracleJdbcRepository repository1=new OracleJdbcRepository(); repository1.init(getOracleConfigMap()); repository1.setJobName("process_file_abc"); JobStatistics stats=new JobStatistics("process_file_abc"); stats.setStartTime(Calendar.getInstance().getTime()); stats.setEndTime(Calendar.getInstance().getTime()); stats.setExitCode(ErrorCode.createErrorCode(10001, "This is my error code.")); stats.setMaxMemeoryUsage(123456); stats.setRecordsProcessed(123456); boolean logged=repository1.logStatistics(stats); assertTrue(logged); JobStatistics[] loggedStats=repository1.getStatistics(); assertNotNull(loggedStats); assertTrue(loggedStats.length>=1); } catch(Exception exception) { fail("Oracle Jdbc Repository testLogStatistics was failed."); } } /** * Test of testJobMgmtMntrInfo method covers all the test cases pertained to the registation of * job management and monitoring. */ public void testJobMgmtMntrInfo() { try { OracleJdbcRepository repository1=new OracleJdbcRepository(); repository1.init(getOracleConfigMap()); repository1.setJobName("process_file_abc"); List list=new ArrayList(); list.add(0, "Suresh"); boolean registered=repository1.registerJobMgmtMntrInfo(list); assertTrue(registered); Object registeredInfo=repository1.lookupJobMgmtMntrInfo(); assertNotNull(registeredInfo); List retrievedList=(List)registeredInfo; assertTrue(retrievedList.size()>=1); String savedValue=(String)retrievedList.get(0); assertEquals("Suresh",savedValue); boolean unregistered=repository1.unregisterJobMgmtMntrInfo(); assertTrue(unregistered); registeredInfo=repository1.lookupJobMgmtMntrInfo(); assertNull(registeredInfo); } catch(Exception exception) { fail("Oracle Jdbc Repository testLogStatistics was failed."); } } private Map getOracleConfigMap() { Map configMap=new HashMap(); configMap.put(JdbcConnectionHelper.PROPERTY_JDBC_DRIVER_CLASS_NAME, "oracle.jdbc.driver.OracleDriver"); configMap.put(JdbcConnectionHelper.PROPERTY_JDBC_URL, "jdbc:oracle:thin:@himeros:1521:BRTST05"); configMap.put(JdbcConnectionHelper.PROPERTY_DATABASE_USER_NAME, "w951h8m"); configMap.put(JdbcConnectionHelper.PROPERTY_DATABASE_PASSWORD, "prag18"); return configMap; } class OracleJdbcRepository extends JdbcRepository { /** * Creates a new instance of OracleJdbcRepository */ public OracleJdbcRepository() { } public void init(Map configMap) { super.init(configMap); } public void setJobName(String jobName) { this.jobName=jobName; } public JobStatistics[] getStatistics() { // logger.trace("Entering getStatistics"); // logger.debug("getStatistics :: job name = " + jobName); // // if(jobName==null) // throw new IllegalArgumentException("job name cannot be null for querying the job statistics."); JobStatistics[] statistics=null; List jobStatisticsList=null; Connection connection=JdbcConnectionHelper.getConnection(this.jdbcConfigMap); if(connection==null) statistics=new JobStatistics[]{}; else { try { PreparedStatement statement=connection.prepareStatement("select job_start_time,job_end_time,job_exit_code,job_exit_reason,records_processed,memory_usage from job_statistics where job_name=?"); statement.setString(1, this.jobName); ResultSet rs=statement.executeQuery(); jobStatisticsList=new ArrayList(); while(rs.next()) { JobStatistics statistic=new JobStatistics(jobName); statistic.setStartTime(new java.util.Date(rs.getTimestamp(1).getTime())); statistic.setEndTime(new java.util.Date(rs.getTimestamp(2).getTime())); int exitCode=rs.getInt(3); String exitReason=rs.getString(4); ErrorCode errorCode=ErrorCode.createErrorCode(exitCode, exitReason==null?"":exitReason); statistic.setExitCode(errorCode); statistic.setRecordsProcessed(rs.getLong(5)); statistic.setMaxMemeoryUsage(rs.getLong(6)); jobStatisticsList.add(statistic); } rs.close(); statement.close(); } catch(SQLException exception) { exception.printStackTrace(); //logger.error("Exception while trying to get the job statistics for the job = " + this.jobName + ". Message = " + exception.getMessage(), exception); } finally { JdbcConnectionHelper.closeConnection(connection); if(jobStatisticsList!=null) { statistics=new JobStatistics[jobStatisticsList.size()]; jobStatisticsList.toArray(statistics); } else statistics=new JobStatistics[]{}; } } //logger.trace("Exiting getStatistics"); return statistics; } public Object lookupJobMgmtMntrInfo() { //logger.trace("Entering lookupJobMgmtMntrInfo"); //logger.debug("lookupJobMgmtMntrInfo :: job name = " + jobName); //if(jobName==null) //throw new IllegalArgumentException("jobName cannot be null to lookup the mgmt and mntr information."); Object registredInfo=null; Connection connection=JdbcConnectionHelper.getConnection(this.jdbcConfigMap); if(connection==null) registredInfo=null; else { try { PreparedStatement statement=connection.prepareStatement("select job_info from job_mgmt_mntr_info where job_name=?"); statement.setString(1, this.jobName); ResultSet rs=statement.executeQuery(); if(rs.next()) { InputStream inputStream=rs.getBinaryStream(1); registredInfo=deserializeObjectFromInputStream(inputStream); } else registredInfo=null; rs.close(); statement.close(); } catch(SQLException exception) { exception.printStackTrace(); //logger.error("Exception while trying to lookup mgmt and mntr info = " + this.jobName); registredInfo=null; } finally { JdbcConnectionHelper.closeConnection(connection); } } //logger.trace("Exiting lookupJobMgmtMntrInfo"); return registredInfo; } } } --- NEW FILE: MySQLJdbcRepositoryTest.java --- /* * MySQLJdbcRepositoryTest.java * JUnit based test * * Created on September 10, 2006, 12:53 PM */ package org.jmonks.batch.framework.repository.jdbc; import java.io.InputStream; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.Calendar; import java.util.HashMap; import java.util.List; import java.util.Map; import junit.framework.*; import org.jmonks.batch.framework.ErrorCode; import org.jmonks.batch.framework.JobStatistics; import org.jmonks.batch.framework.util.JdbcConnectionHelper; /** * * @author Suresh Pragada */ public class MySQLJdbcRepositoryTest extends TestCase { public MySQLJdbcRepositoryTest(String testName) { super(testName); } protected void setUp() throws Exception { } protected void tearDown() throws Exception { } public static Test suite() { TestSuite suite = new TestSuite(); suite.addTest(new MySQLJdbcRepositoryTest("testInit")); suite.addTest(new MySQLJdbcRepositoryTest("testJobDataTransfer")); suite.addTest(new MySQLJdbcRepositoryTest("testLogStatistics")); suite.addTest(new MySQLJdbcRepositoryTest("testJobMgmtMntrInfo")); return suite; } /** * Test of init method, of class org.jmonks.batchserver.framework.repository.jdbc.JdbcRepository. */ public void testInit() { try { MySQLJdbcRepository repository=new MySQLJdbcRepository(); repository.init(getMySQLConfigMap()); } catch(Exception exception) { fail("MySQL Jdbc Repository testInit was failed."); } } /** * Test of testJobDataTransfer covers all the cases for the job data transfer. */ public void testJobDataTransfer() { try { MySQLJdbcRepository repository1=new MySQLJdbcRepository(); repository1.init(getMySQLConfigMap()); repository1.setJobName("process_file_abc"); Map dataGoingToBeSend=new HashMap(); dataGoingToBeSend.put("author","suresh"); boolean sendStatus=repository1.sendDataToNextJob("ID1", "process_file_xyz", dataGoingToBeSend); assertEquals(true, sendStatus); MySQLJdbcRepository repository2=new MySQLJdbcRepository(); repository2.init(getMySQLConfigMap()); repository2.setJobName("process_file_xyz"); Object dataSent=repository2.getDataFromPreviousJob("ID1", "process_file_abc"); assertNotNull(dataSent); Map dataSentMap=(Map)dataSent; String author=(String)dataSentMap.get("author"); assertEquals("suresh",author); repository1.clearDataTransferredFromThisJob(); Object clearedDataSent=repository2.getDataFromPreviousJob("ID1", "process_file_abc"); assertNull(clearedDataSent); } catch(Exception exception) { fail("MySQL Jdbc Repository testJobDataTransfer was failed."); } } /** * Test of logStatistics method, of class org.jmonks.batchserver.framework.repository.jdbc.JdbcRepository. */ public void testLogStatistics() { try { MySQLJdbcRepository repository1=new MySQLJdbcRepository(); repository1.init(getMySQLConfigMap()); repository1.setJobName("process_file_abc"); JobStatistics stats=new JobStatistics("process_file_abc"); stats.setStartTime(Calendar.getInstance().getTime()); stats.setEndTime(Calendar.getInstance().getTime()); stats.setExitCode(ErrorCode.createErrorCode(10001, "This is my error code.")); stats.setMaxMemeoryUsage(123456); stats.setRecordsProcessed(123456); boolean logged=repository1.logStatistics(stats); assertTrue(logged); JobStatistics[] loggedStats=repository1.getStatistics(); assertNotNull(loggedStats); assertTrue(loggedStats.length>=1); } catch(Exception exception) { fail("MySQL Jdbc Repository testLogStatistics was failed."); } } /** * Test of testJobMgmtMntrInfo covers all the cases for the job mgmt and mntr updates. */ public void testJobMgmtMntrInfo() { try { MySQLJdbcRepository repository1=new MySQLJdbcRepository(); repository1.init(getMySQLConfigMap()); repository1.setJobName("process_file_abc"); List list=new ArrayList(); list.add(0, "Suresh"); boolean registered=repository1.registerJobMgmtMntrInfo(list); assertTrue(registered); Object registeredInfo=repository1.lookupJobMgmtMntrInfo(); assertNotNull(registeredInfo); List retrievedList=(List)registeredInfo; assertTrue(retrievedList.size()>=1); String savedValue=(String)retrievedList.get(0); assertEquals("Suresh",savedValue); boolean unregistered=repository1.unregisterJobMgmtMntrInfo(); assertTrue(unregistered); registeredInfo=repository1.lookupJobMgmtMntrInfo(); assertNull(registeredInfo); } catch(Exception exception) { fail("MySQL Jdbc Repository testLogStatistics was failed."); } } private Map getMySQLConfigMap() { Map configMap=new HashMap(); configMap.put(JdbcConnectionHelper.PROPERTY_JDBC_DRIVER_CLASS_NAME, "com.mysql.jdbc.Driver"); configMap.put(JdbcConnectionHelper.PROPERTY_JDBC_URL, "jdbc:mysql://localhost:3306/batchserver"); configMap.put(JdbcConnectionHelper.PROPERTY_DATABASE_USER_NAME, "root"); configMap.put(JdbcConnectionHelper.PROPERTY_DATABASE_PASSWORD, "ramesh"); return configMap; } class MySQLJdbcRepository extends JdbcRepository { public MySQLJdbcRepository() { } public void init(Map configMap) { super.init(configMap); } public void setJobName(String jobName) { this.jobName=jobName; } public JobStatistics[] getStatistics() { // logger.trace("Entering getStatistics"); // logger.debug("getStatistics :: job name = " + jobName); // // if(jobName==null) // throw new IllegalArgumentException("job name cannot be null for querying the job statistics."); JobStatistics[] statistics=null; List jobStatisticsList=null; Connection connection=JdbcConnectionHelper.getConnection(this.jdbcConfigMap); if(connection==null) statistics=new JobStatistics[]{}; else { try { PreparedStatement statement=connection.prepareStatement("select job_start_time,job_end_time,job_exit_code,job_exit_reason,records_processed,memory_usage from job_statistics where job_name=?"); statement.setString(1, this.jobName); ResultSet rs=statement.executeQuery(); jobStatisticsList=new ArrayList(); while(rs.next()) { JobStatistics statistic=new JobStatistics(jobName); statistic.setStartTime(new java.util.Date(rs.getTimestamp(1).getTime())); statistic.setEndTime(new java.util.Date(rs.getTimestamp(2).getTime())); int exitCode=rs.getInt(3); String exitReason=rs.getString(4); ErrorCode errorCode=ErrorCode.createErrorCode(exitCode, exitReason==null?"":exitReason); statistic.setExitCode(errorCode); statistic.setRecordsProcessed(rs.getLong(5)); statistic.setMaxMemeoryUsage(rs.getLong(6)); jobStatisticsList.add(statistic); } rs.close(); statement.close(); } catch(SQLException exception) { exception.printStackTrace(); //logger.error("Exception while trying to get the job statistics for the job = " + this.jobName + ". Message = " + exception.getMessage(), exception); } finally { JdbcConnectionHelper.closeConnection(connection); if(jobStatisticsList!=null) { statistics=new JobStatistics[jobStatisticsList.size()]; jobStatisticsList.toArray(statistics); } else statistics=new JobStatistics[]{}; } } //logger.trace("Exiting getStatistics"); return statistics; } public Object lookupJobMgmtMntrInfo() { //logger.trace("Entering lookupJobMgmtMntrInfo"); //logger.debug("lookupJobMgmtMntrInfo :: job name = " + jobName); //if(jobName==null) //throw new IllegalArgumentException("jobName cannot be null to lookup the mgmt and mntr information."); Object registredInfo=null; Connection connection=JdbcConnectionHelper.getConnection(this.jdbcConfigMap); if(connection==null) registredInfo=null; else { try { PreparedStatement statement=connection.prepareStatement("select job_info from job_mgmt_mntr_info where job_name=?"); statement.setString(1, this.jobName); ResultSet rs=statement.executeQuery(); if(rs.next()) { InputStream inputStream=rs.getBinaryStream(1); registredInfo=deserializeObjectFromInputStream(inputStream); } else registredInfo=null; rs.close(); statement.close(); } catch(SQLException exception) { exception.printStackTrace(); //logger.error("Exception while trying to lookup mgmt and mntr info = " + this.jobName); registredInfo=null; } finally { JdbcConnectionHelper.closeConnection(connection); } } //logger.trace("Exiting lookupJobMgmtMntrInfo"); return registredInfo; } } } |
From: Suresh <sur...@us...> - 2006-09-15 20:26:58
|
Update of /cvsroot/batchserver/batchserver/test/org/jmonks/batch/framework/repository/db4o In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv28821 Added Files: Db4oRepositoryTest.java Log Message: no message --- NEW FILE: Db4oRepositoryTest.java --- /* * Db4oRepositoryTest.java * JUnit based test * * Created on March 14, 2006, 3:54 PM */ package org.jmonks.batch.framework.repository.db4o; import com.db4o.ObjectSet; import java.util.Calendar; import java.util.HashMap; import java.util.Map; import junit.framework.*; import org.jmonks.batch.framework.ErrorCode; import org.jmonks.batch.framework.JobStatistics; /** * * @author w951h8m */ public class Db4oRepositoryTest extends TestCase { public Db4oRepositoryTest(String testName) { super(testName); } protected void setUp() throws Exception { } protected void tearDown() throws Exception { } public static Test suite() { TestSuite suite = new TestSuite(); suite.addTest(new Db4oRepositoryTest("testInit")); suite.addTest(new Db4oRepositoryTest("testLogJobStatistics")); suite.addTest(new Db4oRepositoryTest("testJobDataTransfer")); suite.addTest(new Db4oRepositoryTest("testJobMgmtMntrInfoHolder")); return suite; } /** * Test to make sure this is not returning null. */ public void testInit() { try { TestDb4oRepository repository=new TestDb4oRepository(); repository.init(getDb4oConfigMap()); assertNotNull(repository); } catch(Exception exception) { fail("Unable to initialize the db4o repository."); } } /** * Test method to test the logJobStatistics API of repository. */ public void testLogJobStatistics() { TestDb4oRepository repository=new TestDb4oRepository(); repository.init(getDb4oConfigMap()); repository.setJobName("process_file_xyz"); JobStatistics statistics=new JobStatistics("process_file_xyz"); statistics.setStartTime(Calendar.getInstance().getTime()); statistics.setEndTime(Calendar.getInstance().getTime()); statistics.setExitCode(ErrorCode.createErrorCode(10001, "This is my error code")); statistics.setMaxMemeoryUsage(1000); statistics.setRecordsProcessed(50000); boolean logged=repository.logStatistics(statistics); assertTrue(logged); JobStatistics[] loggedStats=repository.getStatistics(); assertNotNull(loggedStats); assertTrue(loggedStats.length>=1); } public void testJobDataTransfer() { TestDb4oRepository repository1=new TestDb4oRepository(); repository1.init(getDb4oConfigMap()); repository1.setJobName("process_file_abc"); Map data=new HashMap(); data.put("author", "Suresh"); boolean sent=repository1.sendDataToNextJob("first_data", "process_file_xyz", data); assertTrue(sent); TestDb4oRepository repository2=new TestDb4oRepository(); repository2.init(getDb4oConfigMap()); repository2.setJobName("process_file_xyz"); Object receivedData=repository2.getDataFromPreviousJob("first_data", "process_file_abc"); assertNotNull(receivedData); Map verifyMap=(Map)receivedData; assertEquals("Suresh",(String)verifyMap.get("author")); boolean cleared=repository1.clearDataTransferredFromThisJob(); assertTrue(cleared); receivedData=repository2.getDataFromPreviousJob("first_data", "process_file_abc"); assertNull(receivedData); } public void testJobMgmtMntrInfoHolder() { TestDb4oRepository repository1=new TestDb4oRepository(); repository1.init(getDb4oConfigMap()); repository1.setJobName("process_file_abc"); Map data=new HashMap(); data.put("author", "Suresh"); boolean registered=repository1.registerJobMgmtMntrInfo(data); assertTrue(registered); Object lookupData=repository1.lookupJobMgmtMntrInfo(); assertNotNull(lookupData); Map verifyMap=(Map)lookupData; assertEquals("Suresh",(String)verifyMap.get("author")); boolean unregistered=repository1.unregisterJobMgmtMntrInfo(); assertTrue(unregistered); lookupData=repository1.lookupJobMgmtMntrInfo(); assertNull(lookupData); } private Map getDb4oConfigMap() { Map configMap=new HashMap(); configMap.put(Db4oRepository.PROPERTY_REPOSIOTRY_LOCATION, "/batchserver/repository"); return configMap; } class TestDb4oRepository extends Db4oRepository { TestDb4oRepository() { } public void init(Map configMap) { super.init(configMap); } public void setJobName(String jobName) { this.jobName=jobName; } public Object lookupJobMgmtMntrInfo() { // logger.trace("Entering lookupJobMgmtMntrInfo"); // logger.debug("lookupJobMgmtMntrInfo :: job name = " + jobName); // // if(jobName==null) // throw new IllegalArgumentException("jobName cannot be null to lookup the mgmt and mntr information."); Object registratInfo=null; if(container==null) registratInfo=null; else { ObjectSet mgmtMntrInfoHolderResultSet=container.query(new Db4oJobMgmtMntrInfoHolderPredicate(this.jobName)); if(mgmtMntrInfoHolderResultSet.hasNext()) { registratInfo=((Db4oJobMgmtMntrInfoHolder)mgmtMntrInfoHolderResultSet.next()).getMgmtMntrInfo(); //logger.debug(jobName + " management and monitoring information has been found and being returned"); } else registratInfo=null; } //logger.trace("Exiting lookupJobMgmtMntrInfo"); return registratInfo; } public JobStatistics[] getStatistics() { // logger.trace("Entering getStatistics"); // logger.debug("getStatistics :: job name = " + jobName); // // if(jobName==null) // throw new IllegalArgumentException("job name cannot be null for querying the job statistics."); JobStatistics[] statistics=null; if(container==null) statistics=new JobStatistics[0]; else { ObjectSet statisticsResultSet=container.query(new Db4oJobStatisticsPredicate(this.jobName)); //logger.debug("Number of statistics objects = " + statisticsResultSet.size()); statistics=new JobStatistics[statisticsResultSet.size()]; for(int i=0;statisticsResultSet.hasNext();i++) statistics[i]=(JobStatistics)statisticsResultSet.next(); } //logger.trace("Exiting getStatistics"); return statistics; } } } |
From: Suresh <sur...@us...> - 2006-09-15 20:26:38
|
Update of /cvsroot/batchserver/batchserver/test/org/jmonks/batch/framework/repository/jdbc In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv28792/jdbc Log Message: Directory /cvsroot/batchserver/batchserver/test/org/jmonks/batch/framework/repository/jdbc added to the repository |
From: Suresh <sur...@us...> - 2006-09-15 20:25:55
|
Update of /cvsroot/batchserver/batchserver/test/org/jmonks/batch/framework/repository/db4o In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv28407/db4o Log Message: Directory /cvsroot/batchserver/batchserver/test/org/jmonks/batch/framework/repository/db4o added to the repository |
From: Suresh <sur...@us...> - 2006-09-15 20:25:19
|
Update of /cvsroot/batchserver/batchserver/test/org/jmonks/batch/framework/controller/pool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv28391 Added Files: CollectionJobPoolTest.java Log Message: no message --- NEW FILE: CollectionJobPoolTest.java --- /* * CollectionJobPoolTest.java * JUnit based test * * Created on May 13, 2006, 11:35 PM */ package org.jmonks.batch.framework.controller.pool; import java.util.HashMap; import junit.framework.*; /** * * @author Suresh Pragada */ public class CollectionJobPoolTest extends TestCase { public CollectionJobPoolTest(String testName) { super(testName); } public static Test suite() { TestSuite suite = new TestSuite(CollectionJobPoolTest.class); return suite; } /** * Method to test entire collection job pool. */ public void testCollectionJobPool() throws Exception { JobPool pool=new CollectionJobPool(); pool.initialize(new HashMap()); Thread loader=new Thread(this.getLoaderRunnable(pool)); Thread processor1=new Thread(this.getProcessorRunnable(pool)); Thread processor2=new Thread(this.getProcessorRunnable(pool)); Thread processor3=new Thread(this.getProcessorRunnable(pool)); loader.start(); processor1.start(); processor2.start(); processor3.start(); } private Runnable getLoaderRunnable(final JobPool pool) { return new Runnable() { public void run() { for(int i=0;i<100;i++) { System.out.println("Going to load " + i); boolean loaded=pool.loadJobData(new Integer(i)); System.out.println("Loader = " + i + " status = " + loaded); } System.out.println("Done loading the jobs"); pool.loadJobData(null); System.out.println("Done loading the null"); } }; } private Runnable getProcessorRunnable(final JobPool pool) { return new Runnable() { public void run() { Object data=null; while((data=pool.getNextJobData())!=null) { System.out.println(Thread.currentThread().getName() + " = " + ((Integer)data).intValue()); } System.out.println(Thread.currentThread().getName() + " Done reading all the jobs from the buffer"); } }; } } |
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."); } } |