[Batchserver-cvs] batchserver/test/org/jmonks/batchserver/framework/repository/jdbc OracleJdbcRepo
Brought to you by:
suresh_pragada
From: Suresh <sur...@us...> - 2006-09-12 23:25:25
|
Update of /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework/repository/jdbc In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv22306 Modified Files: MySQLJdbcRepositoryTest.java Added Files: 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.batchserver.framework.repository.jdbc; import java.util.Calendar; import java.util.HashMap; import java.util.Map; import junit.framework.*; import org.jmonks.batchserver.framework.ErrorCode; import org.jmonks.batchserver.framework.JobStatistics; import org.jmonks.batchserver.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")); 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); } 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() { } 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; } } } Index: MySQLJdbcRepositoryTest.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework/repository/jdbc/MySQLJdbcRepositoryTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MySQLJdbcRepositoryTest.java 12 Sep 2006 04:08:46 -0000 1.1 --- MySQLJdbcRepositoryTest.java 12 Sep 2006 23:25:23 -0000 1.2 *************** *** 75,83 **** MySQLJdbcRepository repository=new MySQLJdbcRepository(); repository.init(getMySQLConfigMap()); Map dataGoingToBeSend=new HashMap(); dataGoingToBeSend.put("author","suresh"); ! boolean sendStatus=repository.sendDataToNextJob("ID1", "process_file_abc", "process_file_xyz", dataGoingToBeSend); assertEquals(true, sendStatus); ! Object dataSent=repository.getDataFromPreviousJob("ID1", "process_file_abc", "process_file_xyz"); assertNotNull(dataSent); Map dataSentMap=(Map)dataSent; --- 75,84 ---- MySQLJdbcRepository repository=new MySQLJdbcRepository(); repository.init(getMySQLConfigMap()); + repository.setJobName("process_file_abc"); Map dataGoingToBeSend=new HashMap(); dataGoingToBeSend.put("author","suresh"); ! boolean sendStatus=repository.sendDataToNextJob("ID1", "process_file_xyz", dataGoingToBeSend); assertEquals(true, sendStatus); ! Object dataSent=repository.getDataFromPreviousJob("ID1", "process_file_xyz"); assertNotNull(dataSent); Map dataSentMap=(Map)dataSent; *************** *** 107,124 **** /** - * Test of getStatistics method, of class org.jmonks.batchserver.framework.repository.jdbc.JdbcRepository. - */ - public void testGetStatistics() - { - } - - /** - * Test of lookupJobMgmtMntrInfo method, of class org.jmonks.batchserver.framework.repository.jdbc.JdbcRepository. - */ - public void testLookupJobMgmtMntrInfo() - { - } - - /** * Test of unregisterJobMgmtMntrInfo method, of class org.jmonks.batchserver.framework.repository.jdbc.JdbcRepository. */ --- 108,111 ---- *************** *** 134,144 **** } - /** - * Test of getAllRegisteredMgmtMntrInfo method, of class org.jmonks.batchserver.framework.repository.jdbc.JdbcRepository. - */ - public void testGetAllRegisteredMgmtMntrInfo() - { - } - private Map getMySQLConfigMap() { --- 121,124 ---- *************** *** 166,169 **** --- 146,154 ---- super.init(configMap); } + + public void setJobName(String jobName) + { + this.jobName=jobName; + } } } |