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.Loader; 16 import org.webdocwf.util.loader.test.DatabaseOperation; 17 import org.webdocwf.util.loader.test.LoaderOperation; 18 19 20 import junit.framework.TestCase; 21 import junit.framework.Test; 22 import junit.framework.TestSuite; 23 import junit.framework.TestResult; 24 25 29 public class LoaderTest extends LoaderTestCase 30 { 31 public static final String DATABASE_LOCATION_PROPERTY="database.location"; 32 33 public LoaderTest(String name) 34 { 35 super(name); 36 } 37 38 43 public Connection getConnection() throws Exception 44 { 45 46 Class driverClass = Class.forName("org.hsqldb.jdbcDriver"); 47 java.sql.Connection jdbcConnection = java.sql.DriverManager.getConnection("jdbc:hsqldb:test/LoaderTest/LoaderTest","sa",""); 48 49 return jdbcConnection; 50 } 51 52 57 58 public String getDatabaseName() throws Exception 59 { 60 return "LoaderTest"; 61 } 62 63 64 65 71 public DatabaseOperation[] getSetUpOperation() throws Exception 72 { 73 DatabaseOperation[] dbOperation = new DatabaseOperation[1]; 75 77 dbOperation[0]=new LoaderOperation(getLoader()); 78 79 return dbOperation; 80 } 81 82 87 public Loader getLoader() throws Exception 88 { 89 showHeader(); 90 Loader loadJob= new Loader("modules/Octopus/src/testdata/ObjectLoader/LoadTestExample.xml"); 91 loadJob.setUserID("admin"); 92 loadJob.setLogDirName("test"); 93 loadJob.setLogFileName("LoaderTest.txt"); 94 95 return loadJob; 96 } 97 98 private static boolean isHeaderShown = false; 99 private void showHeader() { 100 if( !this.isHeaderShown ) { 101 System.out.println(); 102 System.out.println("**************************************************************************"); 103 System.out.println(" Executing test: testMe 1 - Transfering data and creating integrity"); 104 System.out.println("**************************************************************************"); 105 this.isHeaderShown = true; 106 } 107 } 108 109 115 public DatabaseOperation[] getTearDownOperation() throws Exception 116 { 117 DatabaseOperation[] dbOperation = new DatabaseOperation[1]; 119 dbOperation[0]=DatabaseOperation.DO_NOTHING; 120 121 return dbOperation; 122 } 123 124 public void testMe() throws Exception 125 { 126 127 } 128 129 public static Test suite() { 130 return new TestSuite(LoaderTest.class); 131 } 132 133 134 public static void main(String args[]) { 135 136 TestResult result= (new LoaderTest("testMe 1")).run(); 138 139 } 140 141 142 143 } 144 | Popular Tags |