1 8 9 package test.org.webdocwf.util.loader; 10 11 12 import java.sql.Connection ; 13 import java.sql.DriverManager ; 14 15 import org.webdocwf.util.loader.test.LoaderTestCase; 16 import org.webdocwf.util.loader.test.DatabaseOperation; 17 import org.webdocwf.util.loader.test.CreateDatabaseOperation; 18 import org.webdocwf.util.loader.test.DropDatabaseOperation; 19 import org.webdocwf.util.loader.test.LoaderOperation; 20 import org.webdocwf.util.loader.Loader; 21 22 import junit.framework.TestCase; 23 import junit.framework.Test; 24 import junit.framework.TestSuite; 25 import junit.framework.TestResult; 26 27 31 public class LoaderTest3 extends LoaderTestCase 32 { 33 34 public LoaderTest3(String name) 35 { 36 super(name); 37 } 38 39 44 public Connection getConnection() throws Exception 45 { 46 47 Class driverClass = Class.forName("org.hsqldb.jdbcDriver"); 48 Connection jdbcConnection = DriverManager.getConnection( 49 "jdbc:hsqldb:test/LoaderTest3/LoaderTest3","sa",""); 50 51 return jdbcConnection; 52 } 53 54 59 60 public String getDatabaseName() throws Exception 61 { 62 return "LoaderTest3"; 63 } 64 65 66 71 public Loader getLoader() throws Exception 72 { 73 74 showHeader(); 75 Loader loadJob= new Loader("modules/Octopus/src/testdata/ObjectLoader/CreateTables3.xml"); 76 loadJob.setUserID("admin"); 77 loadJob.setLogDirName("test"); 78 loadJob.setLogFileName("LoaderTest3.txt"); 79 80 81 return loadJob; 82 } 83 84 private static boolean isHeaderShown = false; 85 private void showHeader() { 86 if( !this.isHeaderShown ) { 87 System.out.println(); 88 System.out.println("******************************************************"); 89 System.out.println(" Executing test: test3 - "); 90 System.out.println("******************************************************"); 91 this.isHeaderShown = true; 92 } 93 } 94 95 101 public DatabaseOperation[] getSetUpOperation() throws Exception 102 { 103 DatabaseOperation[] dbOperation = new DatabaseOperation[3]; 105 107 dbOperation[0]=new LoaderOperation(getLoader()); 109 110 Loader loadJob1= new Loader("modules/Octopus/src/testdata/ObjectLoader/InsertData.xml"); 112 loadJob1.setUserID("admin"); 113 loadJob1.setLogDirName("test"); 114 loadJob1.setLogFileName("LoaderTest3.txt"); 115 dbOperation[1]=new LoaderOperation(loadJob1); 116 117 Loader loadJob2= new Loader("modules/Octopus/src/testdata/ObjectLoader/CreateIndex.xml"); 119 loadJob2.setLogDirName("test"); 120 loadJob2.setLogFileName("LoaderTest3_CreateIndex.txt"); 121 dbOperation[2]=new LoaderOperation(loadJob2); 122 123 124 return dbOperation; 125 } 126 127 133 public DatabaseOperation[] getTearDownOperation() throws Exception 134 { 135 DatabaseOperation[] dbOperation = new DatabaseOperation[1]; 137 dbOperation[0]=DatabaseOperation.DO_NOTHING; 138 139 return dbOperation; 140 } 141 142 143 public void testMe() throws Exception 144 { 145 146 } 147 148 149 public static Test suite() { 150 return new TestSuite(LoaderTest3.class); 151 } 152 153 154 public static void main(String args[]) { 155 156 TestResult result= (new LoaderTest3("testMe 3")).run(); 158 159 } 160 161 162 163 } 164 165 166 167 168 | Popular Tags |