1 8 9 package test.org.webdocwf.util.loader; 10 11 import java.sql.Connection ; 12 import java.sql.DriverManager ; 13 14 import org.webdocwf.util.loader.test.LoaderTestCase; 15 import org.webdocwf.util.loader.test.DatabaseOperation; 16 import org.webdocwf.util.loader.test.LoaderOperation; 17 import org.webdocwf.util.loader.Loader; 18 19 import junit.framework.TestCase; 20 import junit.framework.Test; 21 import junit.framework.TestSuite; 22 import junit.framework.TestResult; 23 24 28 public class LoaderTest2 extends LoaderTestCase 29 { 30 31 public LoaderTest2(String name) 32 { 33 super(name); 34 } 35 36 41 public Connection getConnection() throws Exception 42 { 43 44 Class driverClass = Class.forName("org.hsqldb.jdbcDriver"); 45 Connection jdbcConnection = DriverManager.getConnection( 46 "jdbc:hsqldb:test/LoaderTest2/LoaderTest2","sa",""); 47 48 return jdbcConnection; 49 } 50 51 56 public Loader getLoader() throws Exception 57 { 58 showHeader(); 59 Loader loadJob= new Loader("modules/Octopus/src/testdata/ObjectLoader/LoaderExample1.xml"); 60 loadJob.setUserID("admin"); 61 loadJob.setLogDirName("test"); 62 loadJob.setLogFileName("LoaderTest2.txt"); 63 64 65 return loadJob; 66 } 67 68 private static boolean isHeaderShown = false; 69 private void showHeader() { 70 if( !this.isHeaderShown ) { 71 System.out.println(); 72 System.out.println("****************************************************************"); 73 System.out.println(" Executing test: testMe 2 - SQL Statements as a source data"); 74 System.out.println("****************************************************************"); 75 this.isHeaderShown = true; 76 } 77 } 78 79 85 public DatabaseOperation[] getSetUpOperation() throws Exception 86 { 87 DatabaseOperation[] dbOperation = new DatabaseOperation[1]; 89 dbOperation[0]=new LoaderOperation(getLoader()); 90 91 return dbOperation; 92 } 93 94 100 public DatabaseOperation[] getTearDownOperation() throws Exception 101 { 102 DatabaseOperation[] dbOperation = new DatabaseOperation[1]; 104 dbOperation[0]=DatabaseOperation.DO_NOTHING; 105 106 return dbOperation; 107 } 108 109 110 public void testMe() throws Exception 111 { 112 113 } 114 115 public static Test suite() { 116 117 return new TestSuite(LoaderTest2.class); 118 } 119 120 121 public static void main(String args[]) { 122 TestResult result= (new LoaderTest2("testMe 2")).run(); 124 125 } 126 127 128 129 } 130 131 132 133 134 | Popular Tags |