batchserver-cvs Mailing List for Enterprise Batch Server (Page 5)
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-15 20:24:43
|
Update of /cvsroot/batchserver/batchserver/test/org/jmonks/batch/framework/controller/pool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv27990/pool Log Message: Directory /cvsroot/batchserver/batchserver/test/org/jmonks/batch/framework/controller/pool added to the repository |
From: Suresh <sur...@us...> - 2006-09-15 20:24:35
|
Update of /cvsroot/batchserver/batchserver/test/org/jmonks/batch/framework/controller/basic In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv27976/basic Log Message: Directory /cvsroot/batchserver/batchserver/test/org/jmonks/batch/framework/controller/basic added to the repository |
From: Suresh <sur...@us...> - 2006-09-15 20:24:24
|
Update of /cvsroot/batchserver/batchserver/test/org/jmonks/batch/framework/config In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv27965 Added Files: BasicJobControllerConfigTest.java ConfigurationExceptionTest.java FrameworkConfigTest.java JobConfigFactoryTest.java JobConfigTest.java JobControllerConfigTest.java PoolJobControllerConfigTest.java Log Message: no message --- NEW FILE: BasicJobControllerConfigTest.java --- /* * BasicJobControllerConfigTest.java * JUnit based test * * Created on March 8, 2006, 10:38 PM */ package org.jmonks.batch.framework.config; import java.util.HashMap; import java.util.Map; import junit.framework.*; /** * Test cases to test the BasicJobControllerConfig class. * @author Suresh Pragada */ public class BasicJobControllerConfigTest extends TestCase { public BasicJobControllerConfigTest(String testName) { super(testName); } protected void setUp() throws Exception { } protected void tearDown() throws Exception { } public static Test suite() { TestSuite suite = new TestSuite(BasicJobControllerConfigTest.class); return suite; } /** * Test to make sure that controller config never returns null. */ public void testGetBasicJobProcessorClassName() { 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 jobProcessorName=controllerConfig.getBasicJobProcessorClassName(); assertNotNull(jobProcessorName); } /** * Test to make sure that basic job processor config properties are not null. */ public void testGetBasicJobProcessorConfigProperties() { 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); Map configProps=controllerConfig.getBasicJobProcessorConfigProperties(); assertNotNull(configProps); } /** * 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() { } } --- NEW FILE: JobConfigTest.java --- /* * JobConfigTest.java * JUnit based test * * Created on March 8, 2006, 10:13 PM */ package org.jmonks.batch.framework.config; import junit.framework.*; import java.util.Map; /** * Test cases to test the JobConfig class. * @author Suresh Pragada */ public class JobConfigTest extends TestCase { public JobConfigTest(String testName) { super(testName); } protected void setUp() throws Exception { } protected void tearDown() throws Exception { } public static Test suite() { TestSuite suite = new TestSuite(JobConfigTest.class); return suite; } /** * Test case to make sure that JobConfig never returns null controller object. */ public void testGetJobControllerConfig() { 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); } /** * Test that getJobName doesnt return null and make sure it returns the same job name * that we requested. */ public void testGetJobName() { 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); String jobName=jobConfig.getJobName(); assertNotNull(jobName); assertEquals("process_file_abc",jobName); } } --- NEW FILE: ConfigurationExceptionTest.java --- /* * ConfigurationExceptionTest.java * JUnit based test * * Created on March 5, 2006, 5:14 PM */ package org.jmonks.batch.framework.config; import junit.framework.*; import org.jmonks.batch.framework.ErrorCode; /** * Test all the cases of Configuration Exception. * @author Suresh Pragada */ public class ConfigurationExceptionTest extends TestCase { public ConfigurationExceptionTest(String testName) { super(testName); } protected void setUp() throws Exception { } protected void tearDown() throws Exception { } public static Test suite() { TestSuite suite = new TestSuite(ConfigurationExceptionTest.class); return suite; } /** * Test that exception is not return null for the error code. */ public void testGetErrorCode() { ConfigurationException exception=new ConfigurationException(ConfigurationException.FRAMEWORK_CONFIG, "Some Message"); String cmpName=exception.getExceptionComponent(); assertNotNull(cmpName); } /** * Test that exception cannot be instantiated until unless the error code has been passed. */ public void testInstantiation() { try { ConfigurationException exception=(ConfigurationException)ConfigurationException.class.newInstance(); fail("ConfigurationException should not be instantiated."); } catch(InstantiationException ex) { /** * This is expected as ConfigurationException cannot be instantiated. */ } catch(IllegalAccessException ex) { /** * This is expected as the constructor of ConfigurationException is private. */ } } } --- NEW FILE: JobControllerConfigTest.java --- /* * JobControllerConfigTest.java * JUnit based test * * Created on March 8, 2006, 10:21 PM */ package org.jmonks.batch.framework.config; import java.util.HashMap; import junit.framework.*; import java.util.Map; /** * * @author Suresh Pragada */ public class JobControllerConfigTest extends TestCase { public JobControllerConfigTest(String testName) { super(testName); } protected void setUp() throws Exception { } protected void tearDown() throws Exception { } public static Test suite() { TestSuite suite = new TestSuite(JobControllerConfigTest.class); return suite; } /** * Test to make sure returned controller class name cannot be null. */ public void testGetJobControllerClasName() { 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 controllerClassName=controllerConfig.getJobControllerClasName(); assertNotNull(controllerClassName); } /** * Test to make sure controller config never returns null map. */ public void testGetJobControllerConfigProperties() { 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); } /** * 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)); } } --- NEW FILE: FrameworkConfigTest.java --- /* * FrameworkConfigTest.java * JUnit based test * * Created on March 5, 2006, 4:24 PM */ package org.jmonks.batch.framework.config; import junit.framework.*; /** * Test cases to test the FrameworkConfig class. * * @author Suresh Pragada */ public class FrameworkConfigTest extends TestCase { public FrameworkConfigTest(String testName) { super(testName); } protected void setUp() throws Exception { } protected void tearDown() throws Exception { } public static Test suite() { TestSuite suite=new TestSuite(FrameworkConfigTest.class); return suite; } /** * Test that FrameworkConfig cannot be instantiated. */ public void testInstantiation() { try { FrameworkConfig frameworkConfig=(FrameworkConfig)FrameworkConfig.class.newInstance(); fail("FrameworkConfig should not be instantiated."); } catch(InstantiationException ex) { /** * This is expected as FrameworkConfig cannot be instantiated. */ } catch(IllegalAccessException ex) { /** * This is expected as the constructor of FrameworkConfig is private. */ } } /** * Test that make sure getInstance never returns null object. */ public void testGetInstance() { FrameworkConfig config=FrameworkConfig.getInstance(); assertNotNull(config); System.out.println(config); } /** * Test that job-config-factory-config is configured properly in the framework-config.xml file * and it doestn return null factory class name and properties map. */ public void testGetJobConfigFactoryConfig() { FrameworkConfig frameworkConfig=FrameworkConfig.getInstance(); assertNotNull(frameworkConfig); FrameworkConfig.JobConfigFactoryConfig factoryConfig=frameworkConfig.getJobConfigFactoryConfig(); assertNotNull(factoryConfig); assertNotNull(factoryConfig.getJobConfigFactoryClassName()); assertNotNull(factoryConfig.getJobConfigFactoryProperties()); System.out.println(factoryConfig); } /** * Test that logging-config is configured properly in the framework-config.xml file and * make sure it defines all the required properties. */ public void testGetLoggingConfig() { FrameworkConfig frameworkConfig=FrameworkConfig.getInstance(); assertNotNull(frameworkConfig); FrameworkConfig.FrameworkLoggingConfig loggingConfig=frameworkConfig.getFrameworkLoggingConfig(); assertNotNull(loggingConfig); assertNotNull(loggingConfig.getJobLoggingDirecotry()); assertTrue(!loggingConfig.getJobLoggingDirecotry().equals("")); assertNotNull(loggingConfig.getFrameworkLoggingLevel()); assertNotNull(loggingConfig.getJobBasePackageName()); assertNotNull(loggingConfig.getJobLoggingLevel()); System.out.println(loggingConfig); } /** * Test that mgmt-mntr-config is properly configured and make sure it doesnt return null for * manager class name and properties. */ public void testGetMgmtMntrConfig() { FrameworkConfig frameworkConfig=FrameworkConfig.getInstance(); assertNotNull(frameworkConfig); FrameworkConfig.JobConnectorConfig mmConfig=frameworkConfig.getJobConnectorConfig(); assertNotNull(mmConfig); assertNotNull(mmConfig.getJobConnectorHelperClassName()); assertNotNull(mmConfig.getJobConnectorConfigProperties()); System.out.println(mmConfig); } /** * Test that repository-config is properly configured and make sure it doesnt return null * for the repository class name and properties. */ public void testGetRepositoryConfig() { FrameworkConfig frameworkConfig=FrameworkConfig.getInstance(); assertNotNull(frameworkConfig); FrameworkConfig.RepositoryConfig repConfig=frameworkConfig.getRepositoryConfig(); assertNotNull(repConfig); assertNotNull(repConfig.getRepositoryClassName()); assertNotNull(repConfig.getRepositoryConfigProperties()); System.out.println(repConfig); } /** * Test that job-controller-config is properly configured. */ public void testGetJobControllerConfig() { FrameworkConfig frameworkConfig=FrameworkConfig.getInstance(); assertNotNull(frameworkConfig); 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); System.out.println(controllerConfig); } } --- NEW FILE: PoolJobControllerConfigTest.java --- /* * PoolJobControllerConfigTest.java * JUnit based test * * Created on March 9, 2006, 6:59 PM */ package org.jmonks.batch.framework.config; import junit.framework.*; import java.util.HashMap; import java.util.Iterator; import java.util.Map; /** * Test cases to test PoolJobControllerConfig class. * @author Suresh Pragada */ public class PoolJobControllerConfigTest extends TestCase { public PoolJobControllerConfigTest(String testName) { super(testName); } protected void setUp() throws Exception { } protected void tearDown() throws Exception { } public static Test suite() { TestSuite suite = new TestSuite(PoolJobControllerConfigTest.class); return suite; } /** * Test to make sure that it is not returning null loader class name. */ public void testGetPoolJobLoaderClassName() { 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 loaderClassName=controllerConfig.getPoolJobLoaderClassName(); assertNotNull(loaderClassName); } /** * Test to make sure loader properties is not return null map. */ public void testGetPoolJobLoaderConfigProperties() { 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); Map configProps=controllerConfig.getPoolJobLoaderConfigProperties(); assertNotNull(configProps); } /** * Test to make sure that processor classname is not null. */ public void testGetPoolJobProcessorClassName() { 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 processorClassName=controllerConfig.getPoolJobProcessorClassName(); assertNotNull(processorClassName); } /** * Test to make sure that it wont return null properties. */ public void testGetPoolJobProcessorConfigProperties() { 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); Map configProps=controllerConfig.getPoolJobProcessorConfigProperties(); assertNotNull(configProps); } /** * Test to make sure, it doesnt return null pool class name. */ public void testGetPoolClassName() { 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 poolClassName=controllerConfig.getPoolClassName(); assertNotNull(poolClassName); } /** * Test to make sure pool config properities will not be null. */ public void testGetPoolConfigProperties() { 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); Map configProps=controllerConfig.getPoolConfigProperties(); assertNotNull(configProps); } /** * 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() { } } --- NEW FILE: JobConfigFactoryTest.java --- /* * JobConfigFactoryTest.java * JUnit based test * * Created on March 8, 2006, 8:01 PM */ package org.jmonks.batch.framework.config; import junit.framework.*; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.util.Map; import org.jmonks.batch.framework.ErrorCode; /** * Test cases to test the JobConfigFactory * @author Suresh Pragada */ public class JobConfigFactoryTest extends TestCase { public JobConfigFactoryTest(String testName) { super(testName); } protected void setUp() throws Exception { } protected void tearDown() throws Exception { } public static Test suite() { TestSuite suite = new TestSuite(JobConfigFactoryTest.class); //TestSuite suite=new TestSuite(); //suite.addTest(new JobConfigFactoryTest("testGetJobConfigFactory")); return suite; } /** * Test case will check the config factory returned property or not. */ public void testGetJobConfigFactory() { FrameworkConfig frameworkConfig=FrameworkConfig.getInstance(); assertNotNull(frameworkConfig); FrameworkConfig.JobConfigFactoryConfig jobConfigFactoryConfig=frameworkConfig.getJobConfigFactoryConfig(); assertNotNull(jobConfigFactoryConfig); JobConfigFactory configFactory=JobConfigFactory.getJobConfigFactory(jobConfigFactoryConfig); assertNotNull(configFactory); } /** * Test case to make sure requested job being returned or not. */ public void testGetJobConfig() { FrameworkConfig frameworkConfig=FrameworkConfig.getInstance(); assertNotNull(frameworkConfig); FrameworkConfig.JobConfigFactoryConfig jobConfigFactoryConfig=frameworkConfig.getJobConfigFactoryConfig(); assertNotNull(jobConfigFactoryConfig); JobConfigFactory configFactory=JobConfigFactory.getJobConfigFactory(jobConfigFactoryConfig); assertNotNull(configFactory); JobConfig jobConfigNotExist=configFactory.getJobConfig("job_not_exist"); assertNull(jobConfigNotExist); JobConfig jobProcessFileAbc=configFactory.getJobConfig("process_file_abc"); assertNotNull(jobProcessFileAbc); JobConfig jobProcessFileXyz=configFactory.getJobConfig("process_file_xyz"); assertNotNull(jobProcessFileXyz); } } |
From: Suresh <sur...@us...> - 2006-09-15 20:24:02
|
Update of /cvsroot/batchserver/batchserver/test/org/jmonks/batch/framework/repository In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv27593/repository Log Message: Directory /cvsroot/batchserver/batchserver/test/org/jmonks/batch/framework/repository added to the repository |
From: Suresh <sur...@us...> - 2006-09-15 20:23:55
|
Update of /cvsroot/batchserver/batchserver/test/org/jmonks/batch/framework/controller In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv27583/controller Log Message: Directory /cvsroot/batchserver/batchserver/test/org/jmonks/batch/framework/controller added to the repository |
From: Suresh <sur...@us...> - 2006-09-15 20:23:48
|
Update of /cvsroot/batchserver/batchserver/test/org/jmonks/batch/framework/config In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv27573/config Log Message: Directory /cvsroot/batchserver/batchserver/test/org/jmonks/batch/framework/config added to the repository |
From: Suresh <sur...@us...> - 2006-09-15 20:23:02
|
Update of /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework/repository/jdbc In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv27152/framework/repository/jdbc Removed Files: MySQLJdbcRepositoryTest.java OracleJdbcRepositoryTest.java Log Message: no message --- OracleJdbcRepositoryTest.java DELETED --- --- MySQLJdbcRepositoryTest.java DELETED --- |
From: Suresh <sur...@us...> - 2006-09-15 20:22:59
|
Update of /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/io/xml In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv27152/io/xml Removed Files: TestStax.java XMLFileReaderTest.java XMLFileWriterTest.java Log Message: no message --- XMLFileReaderTest.java DELETED --- --- XMLFileWriterTest.java DELETED --- --- TestStax.java DELETED --- |
From: Suresh <sur...@us...> - 2006-09-15 20:22:59
|
Update of /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/io In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv27152/io Removed Files: FileSpecTest.java IOTestSuite.java Log Message: no message --- IOTestSuite.java DELETED --- --- FileSpecTest.java DELETED --- |
From: Suresh <sur...@us...> - 2006-09-15 20:22:59
|
Update of /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework/util In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv27152/framework/util Removed Files: FrameworkUtilTest.java JdbcConnectionHelperTest.java Log Message: no message --- FrameworkUtilTest.java DELETED --- --- JdbcConnectionHelperTest.java DELETED --- |
From: Suresh <sur...@us...> - 2006-09-15 20:22:59
|
Update of /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv27152/framework Removed Files: ErrorCodeTest.java FrameworkTestSuite.java JobStatisticsTest.java LoggingManagerTest.java MainTest.java RepositoryTest.java Log Message: no message --- MainTest.java DELETED --- --- FrameworkTestSuite.java DELETED --- --- LoggingManagerTest.java DELETED --- --- ErrorCodeTest.java DELETED --- --- JobStatisticsTest.java DELETED --- --- RepositoryTest.java DELETED --- |
From: Suresh <sur...@us...> - 2006-09-15 20:22:59
|
Update of /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework/repository/db4o In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv27152/framework/repository/db4o Removed Files: Db4oRepositoryTest.java Log Message: no message --- Db4oRepositoryTest.java DELETED --- |
Update of /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/io/flat In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv27152/io/flat Removed Files: DelimitedFlatFileReaderTest.java DelimitedFlatFileWriterTest.java FixedWidthFlatFileReaderTest.java FixedWidthFlatFileWriterTest.java Log Message: no message --- FixedWidthFlatFileReaderTest.java DELETED --- --- DelimitedFlatFileReaderTest.java DELETED --- --- FixedWidthFlatFileWriterTest.java DELETED --- --- DelimitedFlatFileWriterTest.java DELETED --- |
From: Suresh <sur...@us...> - 2006-09-15 20:22:58
|
Update of /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework/config In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv27152/framework/config Removed Files: BasicJobControllerConfigTest.java ConfigurationExceptionTest.java FrameworkConfigTest.java JobConfigFactoryTest.java JobConfigTest.java JobControllerConfigTest.java PoolJobControllerConfigTest.java Log Message: no message --- BasicJobControllerConfigTest.java DELETED --- --- JobConfigTest.java DELETED --- --- ConfigurationExceptionTest.java DELETED --- --- JobControllerConfigTest.java DELETED --- --- FrameworkConfigTest.java DELETED --- --- PoolJobControllerConfigTest.java DELETED --- --- JobConfigFactoryTest.java DELETED --- |
From: Suresh <sur...@us...> - 2006-09-15 20:22:58
|
Update of /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework/controller/basic In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv27152/framework/controller/basic Removed Files: BasicJobControllerTest.java TestBasicJobProcessor.java Log Message: no message --- BasicJobControllerTest.java DELETED --- --- TestBasicJobProcessor.java DELETED --- |
From: Suresh <sur...@us...> - 2006-09-15 20:22:58
|
Update of /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework/controller/pool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv27152/framework/controller/pool Removed Files: CollectionJobPoolTest.java Log Message: no message --- CollectionJobPoolTest.java DELETED --- |
From: Suresh <sur...@us...> - 2006-09-15 20:22:18
|
Update of /cvsroot/batchserver/batchserver/test/org/jmonks/batch/framework/util In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv27118 Added Files: FrameworkUtilTest.java JdbcConnectionHelperTest.java Log Message: no message --- NEW FILE: FrameworkUtilTest.java --- package org.jmonks.batch.framework.util; import java.util.HashMap; import java.util.Map; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; public class FrameworkUtilTest extends TestCase { public FrameworkUtilTest(String testName) { super(testName); } /** * Test case to check that FrameworkUtil cannot be instantiated. */ public void testInstantiation() { try { FrameworkUtil utility=(FrameworkUtil)FrameworkUtil.class.newInstance(); fail("FrameworkUtil should not be instantiated."); } catch(InstantiationException ex) { /** * This is expected as Frameworkutil cannot be instantiated. */ } catch(IllegalAccessException ex) { /** * This is expected as the constructor of FrameworkUtil is private. */ } } /** * Test to make sure method "loadPropertiesFromElementToMap" is not accepting null * parameters as input and loading the properties as inteded. */ public void testLoadPropertiesFromElementToMap() throws Exception { Element configElement=null; Map propertyMap=null; try { FrameworkUtil.loadPropertiesFromElementToMap(configElement,propertyMap); fail("Accepting the null valuse as input parameters."); } catch(IllegalArgumentException exception) { /** * This is as expected. */ } try { FrameworkUtil.loadPropertiesFromElementToMap(configElement,new HashMap()); fail("Accepting the null element as input parameter "); } catch(IllegalArgumentException exception) { /** * This is as expected. */ } DocumentBuilderFactory builderFactory=DocumentBuilderFactory.newInstance(); DocumentBuilder documentBuilder=builderFactory.newDocumentBuilder(); Document document=documentBuilder.newDocument(); configElement=document.createElement("some-config"); Element propertyElement1=document.createElement("property"); propertyElement1.setAttribute("key","config-key1"); Node textNode1=document.createTextNode("config-value1"); propertyElement1.appendChild(textNode1); Element propertyElement2=document.createElement("property"); propertyElement2.setAttribute("key","config-key2"); Node textNode2=document.createCDATASection("This is CDATA section"); propertyElement2.appendChild(textNode2); configElement.appendChild(propertyElement1); configElement.appendChild(propertyElement2); try { FrameworkUtil.loadPropertiesFromElementToMap(configElement,propertyMap); fail("Accepting the property map uninitialized."); } catch(IllegalArgumentException exception) { /** * This is as expected. */ } propertyMap=new HashMap(); FrameworkUtil.loadPropertiesFromElementToMap(configElement, propertyMap); assertEquals(2,propertyMap.size()); } protected void tearDown() throws Exception { super.tearDown(); } protected void setUp() throws Exception { super.setUp(); } public static Test suite() { TestSuite suite=new TestSuite(FrameworkUtilTest.class); return suite; } } --- NEW FILE: JdbcConnectionHelperTest.java --- /* * JdbcConnectionHelperTest.java * JUnit based test * * Created on September 10, 2006, 5:18 PM */ package org.jmonks.batch.framework.util; import java.sql.Connection; import java.sql.SQLException; import java.util.HashMap; import junit.framework.*; import java.util.Map; /** * * @author Suresh Pragada */ public class JdbcConnectionHelperTest extends TestCase { public JdbcConnectionHelperTest(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 JdbcConnectionHelperTest("testGetConnection")); suite.addTest(new JdbcConnectionHelperTest("testCloseConnection")); return suite; } /** * Test of getConnection method, of class org.jmonks.batchserver.framework.util.JdbcConnectionHelper. */ public void testGetConnection() { try { 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"); Connection connection=JdbcConnectionHelper.getConnection(configMap); assertNotNull(connection); assertEquals(false, connection.getAutoCommit()); assertEquals(false, connection.isClosed()); JdbcConnectionHelper.closeConnection(connection); } catch(SQLException exception) { fail("Exception while trying to test JdbcConnectionHelper :: " + exception.getMessage()); } } /** * Test of closeConnection method, of class org.jmonks.batchserver.framework.util.JdbcConnectionHelper. */ public void testCloseConnection() { try { 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"); Connection connection=JdbcConnectionHelper.getConnection(configMap); assertNotNull(connection); assertEquals(false, connection.getAutoCommit()); assertEquals(false, connection.isClosed()); JdbcConnectionHelper.closeConnection(connection); assertEquals(true, connection.isClosed()); } catch(SQLException exception) { fail("Exception while trying to test JdbcConnectionHelper :: " + exception.getMessage()); } } } |
From: Suresh <sur...@us...> - 2006-09-15 20:21:24
|
Update of /cvsroot/batchserver/batchserver/test/org/jmonks/batch/framework/util In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv26737/util Log Message: Directory /cvsroot/batchserver/batchserver/test/org/jmonks/batch/framework/util added to the repository |
From: Suresh <sur...@us...> - 2006-09-15 20:21:16
|
Update of /cvsroot/batchserver/batchserver/test/org/jmonks/batch/framework In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv26727 Added Files: ErrorCodeTest.java FrameworkTestSuite.java JobStatisticsTest.java LoggingManagerTest.java MainTest.java RepositoryTest.java Log Message: no message --- NEW FILE: MainTest.java --- /* * MainTest.java * JUnit based test * * Created on September 5, 2006, 3:32 PM */ package org.jmonks.batch.framework; import java.util.HashMap; import java.util.Map; import junit.framework.*; /** * * @author w951h8m */ public class MainTest extends TestCase { public MainTest(String testName) { super(testName); } public static Test suite() { 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. */ public void testProcessNoArgs() { Map args=new HashMap(); ErrorCode returnCode=Main.process(args); assertNotNull(returnCode); int exitCode=returnCode.getCode(); assertEquals(ErrorCode.JOB_INVOKATION_CONFIGURAION_ERROR.getCode(), exitCode); } /** * Test of process method by passing the null configMap. */ public void testProcessNullArgs() { try { ErrorCode returnCode=Main.process(null); fail("Framework is accepting the null configMap"); } catch(IllegalArgumentException exception){} } /** * Test of process method by passing the wrong job name in config map. */ public void testProcessWrongJobName() { Map args=new HashMap(); args.put(Main.JOB_NAME_KEY_NAME, "NOT_AVAILABLE"); ErrorCode returnCode=Main.process(args); assertNotNull(returnCode); int exitCode=returnCode.getCode(); assertEquals(ErrorCode.JOB_IS_NOT_CONFIGURED.getCode(), exitCode); } } --- NEW FILE: FrameworkTestSuite.java --- /* * FrameworkTestSuite.java * JUnit based test * * Created on March 3, 2006, 8:29 PM */ package org.jmonks.batch.framework; import junit.framework.*; import org.jmonks.batch.framework.repository.jdbc.MySQLJdbcRepositoryTest; import org.jmonks.batch.framework.repository.jdbc.OracleJdbcRepositoryTest; import org.jmonks.batch.framework.util.FrameworkUtilTest; import org.jmonks.batch.framework.config.BasicJobControllerConfigTest; import org.jmonks.batch.framework.config.ConfigurationExceptionTest; import org.jmonks.batch.framework.config.FrameworkConfigTest; import org.jmonks.batch.framework.config.JobConfigFactoryTest; import org.jmonks.batch.framework.config.JobConfigTest; import org.jmonks.batch.framework.config.JobControllerConfigTest; import org.jmonks.batch.framework.config.PoolJobControllerConfigTest; import org.jmonks.batch.framework.repository.db4o.Db4oRepositoryTest; import org.jmonks.batch.framework.util.JdbcConnectionHelperTest; /** * This is the main suite for the framework. This actually decides which suites * needs to be considered as the framework suite. * * @author Suresh Pragada */ public class FrameworkTestSuite extends TestCase { public FrameworkTestSuite(String testName) { super(testName); } protected void setUp() throws Exception { } protected void tearDown() throws Exception { } /** * suite method returns all the suites to be considered as a framework suite. */ public static Test suite() { TestSuite mainSuite = new TestSuite(); mainSuite.addTest(ErrorCodeTest.suite()); mainSuite.addTest(JobStatisticsTest.suite()); mainSuite.addTest(RepositoryTest.suite()); mainSuite.addTest(LoggingManagerTest.suite()); mainSuite.addTest(FrameworkUtilTest.suite()); mainSuite.addTest(JdbcConnectionHelperTest.suite()); mainSuite.addTest(FrameworkConfigTest.suite()); mainSuite.addTest(ConfigurationExceptionTest.suite()); mainSuite.addTest(JobConfigTest.suite()); mainSuite.addTest(JobControllerConfigTest.suite()); mainSuite.addTest(JobConfigFactoryTest.suite()); 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; } } --- NEW FILE: LoggingManagerTest.java --- /* * LoggingManagerTest.java * JUnit based test * * Created on March 12, 2006, 1:31 PM */ package org.jmonks.batch.framework; 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; /** * * @author Suresh Pragada */ public class LoggingManagerTest extends TestCase { private FrameworkConfig frameworkConfig=null; public LoggingManagerTest(String testName) { super(testName); } protected void setUp() throws Exception { frameworkConfig=FrameworkConfig.getInstance(); } protected void tearDown() throws Exception { } public static Test suite() { //TestSuite suite = new TestSuite(LoggingManagerTest.class); TestSuite suite=new TestSuite(); suite.addTest(new LoggingManagerTest("testInitializeFrameworkLogging")); suite.addTest(new LoggingManagerTest("testInitializeJobLogging")); return suite; } /** * Test of initializeJobLogging method, of class org.jmonks.batchserver.framework.LoggingManager. */ 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"); } /** * Test of initializeLogging method, of class org.jmonks.batchserver.framework.LoggingManager. */ 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"); } } --- NEW FILE: ErrorCodeTest.java --- /* * ErrorCodeTest.java * JUnit based test * * Created on March 3, 2006, 8:12 PM */ package org.jmonks.batch.framework; import junit.framework.*; /** * Test cases to test the ErrorCode.java. * * @author Suresh Pragada */ public class ErrorCodeTest extends TestCase { public ErrorCodeTest(String testName) { super(testName); } protected void setUp() throws Exception { super.setUp(); } protected void tearDown() throws Exception { super.tearDown(); } public static Test suite() { TestSuite suite = new TestSuite(ErrorCodeTest.class); return suite; } /** * Test that getCode is returning the expected errorCode. */ public void testGetCode() { ErrorCode errorCode=ErrorCode.JOB_COMPLETED_SUCCESSFULLY; assertEquals(0,errorCode.getCode()); } /** * Test that getMessage is not returning null. */ public void testGetMessage() { ErrorCode errorCode=ErrorCode.JOB_COMPLETED_SUCCESSFULLY; assertNotNull(errorCode.getMessage()); } /** * Test that ErrorCode cannot be instantiated. */ public void testInstantiation() { try { ErrorCode errorCode=(ErrorCode)ErrorCode.class.newInstance(); fail("ErrorCode should not be instantiated."); } catch(InstantiationException ex) { /** * This is expected as ErrorCode cannot be instantiated. */ } catch(IllegalAccessException ex) { /** * This is expected as the constructor of ErrorCode is private. */ } } public void testCreateErrorCode() { ErrorCode errorCode=ErrorCode.createErrorCode(10001,"This is my error code."); assertNotNull(errorCode); assertEquals(10001, errorCode.getCode()); assertEquals("This is my error code.",errorCode.getMessage()); errorCode=errorCode.appendMessage("New Message"); assertTrue(errorCode.getMessage().startsWith("This is my error code.")); assertTrue(errorCode.getMessage().endsWith("New Message")); } public void testEquality() { ErrorCode errorCode1=ErrorCode.createErrorCode(10001,"This is my first error code."); ErrorCode errorCode2=ErrorCode.createErrorCode(10001,"This is my second error code."); assertTrue(errorCode1.equals(errorCode2)); assertFalse(errorCode1==errorCode2); } } --- NEW FILE: JobStatisticsTest.java --- /* * JobStatisticsTest.java * JUnit based test * * Created on September 13, 2006, 11:12 PM */ package org.jmonks.batch.framework; import java.util.Calendar; import junit.framework.*; /** * * @author Suresh Pragada */ public class JobStatisticsTest extends TestCase { public JobStatisticsTest(String testName) { super(testName); } protected void setUp() throws Exception { } protected void tearDown() throws Exception { } public static Test suite() { TestSuite suite = new TestSuite(JobStatisticsTest.class); return suite; } public void testJobStatistics() { 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(100001); stats.setRecordsProcessed(10001); assertEquals("process_file_abc",stats.getJobname()); assertNotNull(stats.getStartTime()); assertNotNull(stats.getEndTime()); assertEquals(100001, stats.getMaxMemoryUsage()); assertEquals(10001, stats.getRecordsProcessed()); assertTrue(ErrorCode.createErrorCode(10001, "This is my error code").equals(stats.getExitCode())); } } --- NEW FILE: RepositoryTest.java --- /* * RepositoryTest.java * JUnit based test * * Created on September 12, 2006, 10:16 PM */ package org.jmonks.batch.framework; import junit.framework.*; /** * * @author Suresh Pragada */ public class RepositoryTest extends TestCase { public RepositoryTest(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 RepositoryTest("testInstantiation")); suite.addTest(new RepositoryTest("testCreateReport")); return suite; } /** * Test to make sure repository cannot be instantiated. */ public void testInstantiation() { try { Repository repository=(Repository)Repository.class.newInstance(); fail("Repository should not be instantiated."); } catch(InstantiationException ex) { /** * This is expected as Repository cannot be instantiated. */ } catch(IllegalAccessException ex) { /** * This is expected as the constructor of Repository is protected. */ } } public void testCreateReport() { try { Repository.createRepository("process_file_abc", null, null); fail("Should have thrown SecurityException."); } catch(SecurityException ex) { } } } |
From: Suresh <sur...@us...> - 2006-09-15 20:20:18
|
Update of /cvsroot/batchserver/batchserver/test/org/jmonks/batch/io/xml In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv26276 Added Files: TestStax.java XMLFileReaderTest.java XMLFileWriterTest.java Log Message: no message --- NEW FILE: XMLFileReaderTest.java --- /* * XMLFileReaderTest.java * JUnit based test * * Created on June 5, 2006, 4:38 PM */ package org.jmonks.batch.io.xml; import java.io.FileInputStream; import java.util.Iterator; import java.util.List; import junit.framework.*; import org.jmonks.batch.io.FileReader; import org.jmonks.batch.io.RecordType; import org.jmonks.batch.io.ReaderRecord; import org.jmonks.batch.io.xml.XMLFileReader.XMLReaderRecord; /** * * @author w951h8m */ public class XMLFileReaderTest extends TestCase { public XMLFileReaderTest(String testName) { super(testName); } protected void setUp() throws Exception { } protected void tearDown() throws Exception { } public static Test suite() { TestSuite suite = new TestSuite(XMLFileReaderTest.class); return suite; } /** * Test of getNextRecord method, of class org.jmonks.batchserver.io.xml.XMLFileReader. */ public void testGetNextRecord() throws Exception { System.out.println("testGetNextRecord"); FileReader fileReader=FileReader.getFileReader(new FileInputStream("C:\\sample-xml-file_2.xml"),this.getClass().getResourceAsStream("sample-xml-file-spec.xml")); ReaderRecord readerRecord=null; while((readerRecord=fileReader.getNextRecord())!=null) { if(readerRecord.getRecordType().equals(RecordType.HEADER)) { // Simple elements in the records can be read using either readFiled or readSimpleElement. String fileType=(String)readerRecord.readField("file-type"); System.out.println("File type in header record = " + fileType); } else if(readerRecord.getRecordType().equals(RecordType.TRAILER)) { // Trying to show that simple elements can be read using readSimpleElement. String transactionCount=((XMLReaderRecord)readerRecord).readSimpleElement("transaction-count"); System.out.println(transactionCount); } else if(readerRecord.getRecordType().equals(RecordType.DETAIL)) { XMLReaderRecord xmlDetailRecord=(XMLReaderRecord)readerRecord; // Simple elements can be read using readSimpleElement method. String firstName=xmlDetailRecord.readSimpleElement("first-name"); String lastName=xmlDetailRecord.readSimpleElement("last-name"); System.out.println(firstName + " " + lastName); // Nested elements can be read using readComplexElement method. XMLReaderRecord deptInfoComplexRecord=(XMLReaderRecord)xmlDetailRecord.readComplexElement("dept-info"); String deptName=deptInfoComplexRecord.readSimpleElement("dept-name"); String deptLocation=deptInfoComplexRecord.readSimpleElement("dept-location"); System.out.println(deptName + " " + deptLocation); XMLReaderRecord addressesComplexRecord=(XMLReaderRecord)xmlDetailRecord.readComplexElement("addresses"); List addressesRepeatList=addressesComplexRecord.readRepeatElement("address"); for(Iterator iterator=addressesRepeatList.iterator();iterator.hasNext();) { Object addressRecord=iterator.next(); if(addressRecord instanceof XMLReaderRecord) { XMLReaderRecord addressComplexRecord=(XMLReaderRecord)addressRecord; String addressType=addressComplexRecord.readSimpleElement("address-type"); String city=addressComplexRecord.readSimpleElement("city"); String zipCode=addressComplexRecord.readSimpleElement("zip-code"); System.out.println(addressType + " " + city + " " + zipCode); } else if(addressRecord instanceof String) { System.out.println((String)addressRecord); } else System.out.println("Unknown type."); } } else System.out.println("Unknown record type = " + readerRecord.getRecordType().toString()); } fileReader.close(); } } --- NEW FILE: XMLFileWriterTest.java --- /* * XMLFileWriterTest.java * JUnit based test * * Created on June 6, 2006, 9:08 PM */ package org.jmonks.batch.io.xml; import java.io.FileOutputStream; import java.util.List; import junit.framework.*; import org.jmonks.batch.io.FileWriter; import org.jmonks.batch.io.RecordType; import org.jmonks.batch.io.xml.XMLFileWriter.XMLWriterRecord; /** * * @author Suresh Pragada */ public class XMLFileWriterTest extends TestCase { public XMLFileWriterTest(String testName) { super(testName); } protected void setUp() throws Exception { } protected void tearDown() throws Exception { } public static Test suite() { TestSuite suite = new TestSuite(XMLFileWriterTest.class); return suite; } /** * Test of writerRecord method, of class org.jmonks.batchserver.io.xml.XMLFileWriter. */ public void testWriterRecord() throws Exception { System.out.println("testWriterRecord"); //FileWriter fileWriter=FileWriter.getFileWriter(new FileOutputStream("D:\\sample-xml-file_2.xml"), new FileInputStream("D:\\workarea\\personal\\latestcvs\\batchserver\\src\\org\\jmonks\\batchserver\\io\\xml\\sample-xml-file-spec.xml")); // Get the file writer by providing the output stream to write the xml file and input stream to file spec. FileWriter fileWriter=FileWriter.getFileWriter(new FileOutputStream("C:\\sample-xml-file_2.xml"), this.getClass().getResourceAsStream("sample-xml-file-spec.xml")); // Create and write the header record. XMLWriterRecord headerRecord=(XMLWriterRecord)fileWriter.createWriterRecord(RecordType.HEADER); headerRecord.writeSimpleElement("file-type", "Employee Records & Details"); fileWriter.writeRecord(headerRecord); // Get the empty record you want to create by passing the record type you mentioned in file spec. XMLWriterRecord detailRecord=(XMLWriterRecord)fileWriter.createWriterRecord(RecordType.DETAIL); // Write the simple elements using either writeField or writeSimpleElement methods. detailRecord.writeSimpleElement("first-name", "Suresh"); detailRecord.writeField("last-name", "Pragada"); // Create the nested record by passing the nested element name. This automatically attached to detail record. No need to write it back to detail record. XMLWriterRecord deptComplexRecord=(XMLWriterRecord)detailRecord.createComplexElement("dept-info"); deptComplexRecord.writeSimpleElement("dept-name", "IT"); deptComplexRecord.writeSimpleElement("dept-location", "LOC1"); XMLWriterRecord addressesComplexRecord=(XMLWriterRecord)detailRecord.createComplexElement("addresses"); // Get the list to add all the elements needs to be written with the given name. List addressRepeatList=addressesComplexRecord.createRepeatElement("address"); // Empty nested element record can be created using any XMLWriterRecord instance. XMLWriterRecord homeAddressComplexRecord=(XMLWriterRecord)addressesComplexRecord.createComplexElement(); homeAddressComplexRecord.writeSimpleElement("address-type", "home"); homeAddressComplexRecord.writeSimpleElement("city", "Menomonee Falls"); homeAddressComplexRecord.writeSimpleElement("zip-code", "53051"); addressRepeatList.add(homeAddressComplexRecord); // Empty nested element record can be created using any XMLWriterRecord instance. XMLWriterRecord officeAddressComplexRecord=(XMLWriterRecord)addressesComplexRecord.createComplexElement(); officeAddressComplexRecord.writeSimpleElement("address-type", "office"); officeAddressComplexRecord.writeSimpleElement("city", "Menomonee Falls"); officeAddressComplexRecord.writeSimpleElement("zip-code", "53051"); addressRepeatList.add(officeAddressComplexRecord); // Feel free to drop simple elements value as well. addressRepeatList.add("Unidentified"); // Write the finished record into the file. fileWriter.writeRecord(detailRecord); // Create and write the trailer record. XMLWriterRecord trailerRecord=(XMLWriterRecord)fileWriter.createWriterRecord(RecordType.TRAILER); trailerRecord.writeSimpleElement("transaction-count", "1"); fileWriter.writeRecord(trailerRecord); fileWriter.close(); } } --- NEW FILE: TestStax.java --- /* * TestStax.java * * Created on June 1, 2006, 9:41 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.io.xml; import java.io.FileNotFoundException; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Stack; import javax.xml.stream.XMLEventReader; import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLStreamException; import javax.xml.stream.events.Characters; import javax.xml.stream.events.EndElement; import javax.xml.stream.events.StartElement; import javax.xml.stream.events.XMLEvent; /** * * @author Suresh Pragada */ public class TestStax { protected XMLFileSpec fileSpec=null; protected XMLEventReader eventReader=null; protected String xpath=""; public TestStax(String absoluteFilePath,org.jmonks.batch.io.FileSpec fileSpec) { this.fileSpec=(XMLFileSpec)fileSpec; try { XMLInputFactory inputFactory=XMLInputFactory.newInstance(); eventReader=inputFactory.createXMLEventReader(new java.io.FileReader(absoluteFilePath)); String rootElement=this.fileSpec.getRootElement(); if(this.validateRootElement(rootElement, eventReader)) xpath="/"+rootElement; else { eventReader.close(); throw new RuntimeException("Root tag doesnt match."); } } catch(FileNotFoundException exception) { exception.printStackTrace(); //logger.fatal(); this.eventReader=null; throw new RuntimeException("Exception while initializing the XML File reader = " + absoluteFilePath); } catch(XMLStreamException exception) { exception.printStackTrace(); //logger.fatal(); this.eventReader=null; throw new RuntimeException("Exception while initializing the XML File reader = " + absoluteFilePath); } } public org.jmonks.batch.io.ReaderRecord getNextRecord() { XMLReaderRecord readerRecord=null; if(this.eventReader==null) return readerRecord; else { try { while(eventReader.hasNext()) { XMLEvent event=eventReader.nextEvent(); if(event.isStartElement()) { StartElement startElement=(StartElement)event; String startElementName=startElement.getName().getLocalPart(); xpath=xpath+"/"+startElementName; XMLRecordSpec recordSpec=this.getRecordSpec(); if(recordSpec!=null) { //logger.debug("Found configured " + xpath); readerRecord=retrieveRecord(eventReader,recordSpec,startElementName); int index=xpath.lastIndexOf("/"+startElementName); if(index!=-1) xpath=xpath.substring(0, index); break; } } else if(event.isEndElement()) { EndElement endElement=(EndElement)event; String endElementName=endElement.getName().getLocalPart(); int index=xpath.lastIndexOf("/"+endElementName); if(index!=-1) xpath=xpath.substring(0, index); } } } catch(XMLStreamException exception) { exception.printStackTrace(); //logger.fatal(); throw new RuntimeException("Exception while reading the record. Message = " + exception.getMessage()); } } return readerRecord; } public void close() { if(this.eventReader!=null) { try { this.eventReader.close(); } catch(XMLStreamException exception) { //logger.debug("Streamexception while closing the reader. Message = " + exception.getMessage(),exception); } finally { this.eventReader=null; } } } public static void main(String args[]) throws Exception { org.jmonks.batch.io.FileSpec fileSpec=org.jmonks.batch.io.FileSpec.createFileSpec(TestStax.class.getResourceAsStream("sample-xml-file-spec.xml")); TestStax stax=new TestStax("C:\\sample-xml-file.xml",fileSpec); } private boolean validateRootElement(String rootElement,XMLEventReader reader) { boolean valid=false; try { while(reader.hasNext()) { XMLEvent event=reader.nextEvent(); if(event.isStartElement()) { StartElement startElement=(StartElement)event; if(rootElement.equalsIgnoreCase(startElement.getName().getLocalPart())) { valid=true; break; } } } } catch(XMLStreamException exception) { exception.printStackTrace(); //logger.fatal(); throw new RuntimeException("Exception while validating the root element. Message = " + exception.getMessage(),exception); } return valid; } private XMLRecordSpec getRecordSpec() { Collection recordSpecs=this.fileSpec.getRecordSpecs(); for(Iterator iterator=recordSpecs.iterator();iterator.hasNext();) { XMLRecordSpec recordSpec=(XMLRecordSpec)iterator.next(); if(recordSpec.isMatch(this.xpath)) return recordSpec; } return null; } private XMLReaderRecord retrieveRecord(XMLEventReader eventReader,XMLRecordSpec recordSpec,String recordElement) { XMLReaderRecord readerRecord=new XMLReaderRecord(recordSpec.getRecordType()); Stack elementStack=new Stack(); boolean isPreviousElementStart=false; try { while(eventReader.hasNext()) { XMLEvent nextEvent=eventReader.peek(); if(nextEvent.isStartElement()) { /** * If the previous element is also a start element, retrieve the * nested element and returns it as a nested record. */ if(isPreviousElementStart) { StartElement previousStartElement=(StartElement)elementStack.pop(); XMLReaderRecord nestedRecord=this.retrieveRecord(eventReader, recordSpec, previousStartElement.getName().getLocalPart()); readerRecord.writeElement(previousStartElement.getName().getLocalPart(),nestedRecord); isPreviousElementStart=false; } else { StartElement startElement=(StartElement)eventReader.nextEvent(); isPreviousElementStart=true; elementStack.push(startElement); } } else if(nextEvent.isEndElement()) { EndElement endElement=(EndElement)eventReader.nextEvent(); isPreviousElementStart=false; if(recordElement.equalsIgnoreCase(endElement.getName().getLocalPart())) break; else { /** * Check the value on top of the stack. If it is start element, no value has * been provided for this element in the file, otherwise pop the values and start element. */ Object topValue=elementStack.peek(); if(topValue instanceof StartElement) { StartElement startElement=(StartElement)elementStack.pop(); readerRecord.writeElement(startElement.getName().getLocalPart(),""); } else { Object fieldValue=elementStack.pop(); StartElement startElement=(StartElement)elementStack.pop(); readerRecord.writeElement(startElement.getName().getLocalPart(), fieldValue); } } } else if(nextEvent.isCharacters()) { Characters chars=(Characters)eventReader.nextEvent(); if(!chars.isWhiteSpace()) { isPreviousElementStart=false; elementStack.push(chars.getData()); } } else { /** * Ignore the other events for now. */ eventReader.nextEvent(); } } } catch(XMLStreamException exception) { throw new RuntimeException("XMLStream exception while retrieving the record. Message = " + exception.getMessage(), exception); } return readerRecord; } private void printRecord(XMLReaderRecord record) { System.out.println("*******************************************"); System.out.println(record); System.out.println("*******************************************"); } public class XMLReaderRecord extends org.jmonks.batch.io.ReaderRecord { private Map fieldMap=null; private XMLReaderRecord(org.jmonks.batch.io.RecordType recordType) { super(recordType); fieldMap=new HashMap(); } public Object readField(String fieldName) { return readElement(fieldName); } public Object readElement(String elementName) { return fieldMap.get(elementName); } protected void writeElement(String fieldName, Object fieldValue) { if(fieldMap.containsKey(fieldName)) { Object existingFieldValue=fieldMap.remove(fieldName); if(existingFieldValue instanceof List) { List existingFieldValueList=(List)existingFieldValue; existingFieldValueList.add(fieldValue); fieldMap.put(fieldName, existingFieldValueList); } else { List fieldValueList=new ArrayList(); fieldValueList.add(existingFieldValue); fieldValueList.add(fieldValue); fieldMap.put(fieldName,fieldValueList); } } else fieldMap.put(fieldName,fieldValue); } public String toString() { return this.fieldMap.toString(); } } } |
Update of /cvsroot/batchserver/batchserver/test/org/jmonks/batch/io/flat In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv25872 Added Files: DelimitedFlatFileReaderTest.java DelimitedFlatFileWriterTest.java FixedWidthFlatFileReaderTest.java FixedWidthFlatFileWriterTest.java Log Message: no message --- NEW FILE: FixedWidthFlatFileReaderTest.java --- /* * FixedWidthFlatFileReaderTest.java * JUnit based test * * Created on June 2, 2006, 4:02 PM */ package org.jmonks.batch.io.flat; import java.io.FileInputStream; import junit.framework.*; import org.jmonks.batch.io.FileReader; import org.jmonks.batch.io.RecordType; import org.jmonks.batch.io.ReaderRecord; /** * * @author w951h8m */ public class FixedWidthFlatFileReaderTest extends TestCase { public FixedWidthFlatFileReaderTest(String testName) { super(testName); } protected void setUp() throws Exception { } protected void tearDown() throws Exception { } public static Test suite() { TestSuite suite = new TestSuite(FixedWidthFlatFileReaderTest.class); return suite; } /** * Test of getNextRecord method, of class org.jmonks.batchserver.io.FixedWidthFlatFileReader. */ public void testGetNextRecord() throws Exception { System.out.println("testGetNextRecord"); FileReader fileReader=FileReader.getFileReader(new FileInputStream("C:\\sample_fixed.dat"), this.getClass().getResourceAsStream("sample-fixed-width-file-spec.xml")); ReaderRecord record=null; while((record=fileReader.getNextRecord())!=null) { if(record.getRecordType()==RecordType.DETAIL) { System.out.println(record.readField("field1") + " "); System.out.println(record.readField("field2") + " "); System.out.println(record.readField("field3") + " "); System.out.println(record.readField("field4")); } else if(record.getRecordType()==RecordType.HEADER) { System.out.println(record.readField("timestamp")); } else if(record.getRecordType()==RecordType.TRAILER) { System.out.println(record.readField("recordCount")); } else System.out.println(record.getRecordType().toString()); } } } --- NEW FILE: DelimitedFlatFileReaderTest.java --- /* * FixedWidthFlatFileReaderTest.java * JUnit based test * * Created on June 2, 2006, 4:02 PM */ package org.jmonks.batch.io.flat; import java.io.FileInputStream; import junit.framework.*; import org.jmonks.batch.io.FileReader; import org.jmonks.batch.io.ReaderRecord; /** * * @author w951h8m */ public class DelimitedFlatFileReaderTest extends TestCase { public DelimitedFlatFileReaderTest(String testName) { super(testName); } protected void setUp() throws Exception { } protected void tearDown() throws Exception { } public static Test suite() { TestSuite suite = new TestSuite(DelimitedFlatFileReaderTest.class); return suite; } /** * Test of getNextRecord method, of class org.jmonks.batchserver.io.DelimitedFlatFileReader. */ public void testGetNextRecord() throws Exception { System.out.println("testGetNextRecord"); FileReader fileReader=FileReader.getFileReader(new FileInputStream("C:\\sample_delimited.dat"), this.getClass().getResourceAsStream("sample-delimited-file-spec.xml")); ReaderRecord record=null; while((record=fileReader.getNextRecord())!=null) { System.out.println(record.readField("field1") + " "); System.out.println(record.readField("field2") + " "); System.out.println(record.readField("field3") + " "); System.out.println(record.readField("field4")); } } } --- NEW FILE: FixedWidthFlatFileWriterTest.java --- /* * FixedWidthFlatFileWriterTest.java * JUnit based test * * Created on June 6, 2006, 11:41 AM */ package org.jmonks.batch.io.flat; import java.io.FileOutputStream; import junit.framework.*; import org.jmonks.batch.io.FileWriter; import org.jmonks.batch.io.RecordType; import org.jmonks.batch.io.WriterRecord; /** * * @author w951h8m */ public class FixedWidthFlatFileWriterTest extends TestCase { public FixedWidthFlatFileWriterTest(String testName) { super(testName); } protected void setUp() throws Exception { } protected void tearDown() throws Exception { } public static Test suite() { TestSuite suite = new TestSuite(FixedWidthFlatFileWriterTest.class); return suite; } /** * Test of writeRecord method, of class org.jmonks.batchserver.io.flat.FixedWidthFlatFileWriter. */ public void testWriterRecord() throws Exception { System.out.println("testWriterRecord"); FileWriter fileWriter=FileWriter.getFileWriter(new FileOutputStream("C:\\sample_fixed.dat"), this.getClass().getResourceAsStream("sample-fixed-width-file-spec.xml")); WriterRecord headerRecord=fileWriter.createWriterRecord(RecordType.HEADER); headerRecord.writeField("timestamp", "20060812"); fileWriter.writeRecord(headerRecord); WriterRecord detailRecord=fileWriter.createWriterRecord(RecordType.DETAIL); detailRecord.writeField("field1", "VALUE1"); detailRecord.writeField("field2", "VALUE2"); detailRecord.writeField("field3", "VALUE3VALUE3VALUE3"); detailRecord.writeField("field4", "VALUE4"); fileWriter.writeRecord(detailRecord); WriterRecord trailerRecord=fileWriter.createWriterRecord(RecordType.TRAILER); trailerRecord.writeField("recordCount", "1"); fileWriter.writeRecord(trailerRecord); fileWriter.close(); } } --- NEW FILE: DelimitedFlatFileWriterTest.java --- /* * FixedWidthFlatFileWriterTest.java * JUnit based test * * Created on June 6, 2006, 11:41 AM */ package org.jmonks.batch.io.flat; import java.io.FileOutputStream; import junit.framework.*; import org.jmonks.batch.io.FileWriter; import org.jmonks.batch.io.RecordType; import org.jmonks.batch.io.WriterRecord; /** * * @author w951h8m */ public class DelimitedFlatFileWriterTest extends TestCase { public DelimitedFlatFileWriterTest(String testName) { super(testName); } protected void setUp() throws Exception { } protected void tearDown() throws Exception { } public static Test suite() { TestSuite suite = new TestSuite(DelimitedFlatFileWriterTest.class); return suite; } /** * Test of writeRecord method, of class org.jmonks.batchserver.io.flat.DelimitedFlatFileWriter. */ public void testWriterRecord() throws Exception { System.out.println("testWriterRecord"); FileWriter fileWriter=FileWriter.getFileWriter(new FileOutputStream("C:\\sample_delimited.dat"), this.getClass().getResourceAsStream("sample-delimited-file-spec.xml")); WriterRecord detailRecord1=fileWriter.createWriterRecord(RecordType.DETAIL); detailRecord1.writeField("field1", "VALUE1"); detailRecord1.writeField("field2", "VALUE2"); detailRecord1.writeField("field3", "VALUE3VALUE3VALUE3"); detailRecord1.writeField("field4", "VALUE4"); fileWriter.writeRecord(detailRecord1); WriterRecord detailRecord2=fileWriter.createWriterRecord(RecordType.DETAIL); detailRecord2.writeField("field1", "VALUE1"); detailRecord2.writeField("field2", "VALUE2"); detailRecord2.writeField("field3", "VALUE3VALUE3VALUE3"); detailRecord2.writeField("field4", "VALUE4"); fileWriter.writeRecord(detailRecord2); fileWriter.close(); } } |
From: Suresh <sur...@us...> - 2006-09-15 20:18:31
|
Update of /cvsroot/batchserver/batchserver/test/org/jmonks/batch/io In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv25301 Added Files: FileSpecTest.java IOTestSuite.java Log Message: no message --- NEW FILE: IOTestSuite.java --- /* * IOTestSuite.java * JUnit based test * * Created on March 3, 2006, 8:29 PM */ package org.jmonks.batch.io; import junit.framework.*; import org.jmonks.batch.io.flat.DelimitedFlatFileReaderTest; import org.jmonks.batch.io.flat.DelimitedFlatFileWriterTest; import org.jmonks.batch.io.flat.FixedWidthFlatFileReaderTest; import org.jmonks.batch.io.flat.FixedWidthFlatFileWriterTest; import org.jmonks.batch.io.xml.XMLFileReaderTest; import org.jmonks.batch.io.xml.XMLFileWriterTest; /** * This is the main suite for the framework. This actually decides which suites * needs to be considered as the framework suite. * * @author Suresh Pragada */ public class IOTestSuite extends TestCase { public IOTestSuite(String testName) { super(testName); } protected void setUp() throws Exception { } protected void tearDown() throws Exception { } /** * suite method returns all the suites to be considered as a IO suite. */ public static Test suite() { TestSuite ioSuite = new TestSuite(); ioSuite.addTest(FileSpecTest.suite()); ioSuite.addTest(XMLFileWriterTest.suite()); ioSuite.addTest(XMLFileReaderTest.suite()); ioSuite.addTest(DelimitedFlatFileWriterTest.suite()); ioSuite.addTest(DelimitedFlatFileReaderTest.suite()); ioSuite.addTest(FixedWidthFlatFileWriterTest.suite()); ioSuite.addTest(FixedWidthFlatFileReaderTest.suite()); return ioSuite; } } --- NEW FILE: FileSpecTest.java --- /* * FileSpecTest.java * JUnit based test * * Created on June 1, 2006, 8:02 PM */ package org.jmonks.batch.io; import junit.framework.*; import org.jmonks.batch.io.flat.FixedWidthFlatFileFileSpec; /** * * @author Suresh Pragada */ public class FileSpecTest extends TestCase { public FileSpecTest(String testName) { super(testName); } protected void setUp() throws Exception { } protected void tearDown() throws Exception { } public static Test suite() { TestSuite suite = new TestSuite(FileSpecTest.class); return suite; } /** * Test of createFileSpec method, of class org.jmonks.batchserver.io.FileSpec. */ public void testCreateFileSpec() { System.out.println("testCreateFileSpec"); FileSpec fileSpec=FileSpec.createFileSpec(FixedWidthFlatFileFileSpec.class.getResourceAsStream("sample-fixed-width-file-spec.xml")); assertNotNull(fileSpec); System.out.println(fileSpec.toString()); } } |
From: Suresh <sur...@us...> - 2006-09-15 20:18:11
|
Update of /cvsroot/batchserver/batchserver/test/org/jmonks/batch/io/xml In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv25266/xml Log Message: Directory /cvsroot/batchserver/batchserver/test/org/jmonks/batch/io/xml added to the repository |
From: Suresh <sur...@us...> - 2006-09-15 20:17:37
|
Update of /cvsroot/batchserver/batchserver/test/org/jmonks/batch/io/flat In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv24896/flat Log Message: Directory /cvsroot/batchserver/batchserver/test/org/jmonks/batch/io/flat added to the repository |
From: Suresh <sur...@us...> - 2006-09-15 20:17:26
|
Update of /cvsroot/batchserver/batchserver/test/org/jmonks/batch/io In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv24886/io Log Message: Directory /cvsroot/batchserver/batchserver/test/org/jmonks/batch/io added to the repository |