[Batchserver-cvs] batchserver/test/org/jmonks/batchserver/framework JobStatisticsTest.java, NONE, 1
Brought to you by:
suresh_pragada
From: Suresh <sur...@us...> - 2006-09-14 05:06:02
|
Update of /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv27057 Modified Files: ErrorCodeTest.java FrameworkTestSuite.java RepositoryTest.java Added Files: JobStatisticsTest.java Log Message: no message Index: FrameworkTestSuite.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework/FrameworkTestSuite.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** FrameworkTestSuite.java 13 Sep 2006 23:30:46 -0000 1.10 --- FrameworkTestSuite.java 14 Sep 2006 05:05:58 -0000 1.11 *************** *** 19,23 **** import org.jmonks.batchserver.framework.config.JobControllerConfigTest; import org.jmonks.batchserver.framework.config.PoolJobControllerConfigTest; - import org.jmonks.batchserver.framework.RepositoryTest; import org.jmonks.batchserver.framework.repository.db4o.Db4oRepositoryTest; import org.jmonks.batchserver.framework.util.JdbcConnectionHelperTest; --- 19,22 ---- *************** *** 51,59 **** { TestSuite mainSuite = new TestSuite(); ! mainSuite.addTest(LoggingManagerTest.suite()); mainSuite.addTest(FrameworkUtilTest.suite()); mainSuite.addTest(JdbcConnectionHelperTest.suite()); - mainSuite.addTest(ErrorCodeTest.suite()); mainSuite.addTest(FrameworkConfigTest.suite()); mainSuite.addTest(ConfigurationExceptionTest.suite()); --- 50,60 ---- { 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()); *************** *** 63,67 **** mainSuite.addTest(BasicJobControllerConfigTest.suite()); mainSuite.addTest(PoolJobControllerConfigTest.suite()); ! mainSuite.addTest(RepositoryTest.suite()); mainSuite.addTest(Db4oRepositoryTest.suite()); mainSuite.addTest(MySQLJdbcRepositoryTest.suite()); --- 64,68 ---- mainSuite.addTest(BasicJobControllerConfigTest.suite()); mainSuite.addTest(PoolJobControllerConfigTest.suite()); ! mainSuite.addTest(Db4oRepositoryTest.suite()); mainSuite.addTest(MySQLJdbcRepositoryTest.suite()); Index: ErrorCodeTest.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework/ErrorCodeTest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ErrorCodeTest.java 13 Sep 2006 04:51:14 -0000 1.2 --- ErrorCodeTest.java 14 Sep 2006 05:05:58 -0000 1.3 *************** *** 94,96 **** --- 94,104 ---- 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.batchserver.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())); } } Index: RepositoryTest.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework/RepositoryTest.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** RepositoryTest.java 13 Sep 2006 23:30:46 -0000 1.3 --- RepositoryTest.java 14 Sep 2006 05:05:58 -0000 1.4 *************** *** 67,95 **** public void testCreateReport() { ! FrameworkConfig.RepositoryConfig repositoryConfig=FrameworkConfig.getInstance().getRepositoryConfig(); ! if(repositoryConfig!=null) { ! Repository.createRepository("process_file_abc", repositoryConfig); ! try ! { ! Repository.createRepository("process_file_abc", repositoryConfig); ! fail("No shout when trying to create the repository second time."); ! } ! catch(IllegalStateException exception) ! { ! } } ! else { - try - { - Repository.createRepository("process_file_abc", null); - fail("Repository has been created with no repository config."); - } - catch(ConfigurationException exception) - { - } } } - } --- 67,78 ---- public void testCreateReport() { ! try { ! Repository.createRepository("process_file_abc", null, null); ! fail("Should have thrown SecurityException."); } ! catch(SecurityException ex) { } } } |