1 /*
2 * LoaderTest.java Sept 01, 2002
3 *
4 * Sample JUnit test using Loader for creating test database and
5 * inserting data into it.
6 *
7 */
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 /***
25 * @author Sinisa Milosevic
26 * @version $Revision: 1.1 $
27 */
28 public class LoaderTest2 extends LoaderTestCase
29 {
30
31 public LoaderTest2(String name)
32 {
33 super(name);
34 }
35
36 /***
37 * Returns the test database connection.
38 */
39 public Connection getConnection() throws Exception
40 {
41
42 Class driverClass = Class.forName("com.quadcap.jdbc.JdbcDriver");
43 Connection jdbcConnection = DriverManager.getConnection(
44 "jdbc:qed:test/LoaderTest2;create=true");
45
46 return jdbcConnection;
47 }
48
49 /***
50 * Returns the test Loader class (loaderjob).
51 */
52 public Loader getLoader() throws Exception
53 {
54 Loader loadJob= new Loader("modules/Octopus/src/testdata/ObjectLoader/LoaderExample1.xml");
55 loadJob.setUserID("admin");
56 loadJob.setLogDirName("test");
57 loadJob.setLogFileName("LoaderTest2.txt");
58
59
60 return loadJob;
61 }
62
63 /***
64 * Returns the database operations executed in test setup. First operation will be
65 * executed dbOperation[0], then dbOperation[1]...
66 */
67 public DatabaseOperation[] getSetUpOperation() throws Exception
68 {
69 // Executing loaderJob defined in xml file.
70 DatabaseOperation[] dbOperation = new DatabaseOperation[1];
71 dbOperation[0]=new LoaderOperation(getLoader());
72
73 return dbOperation;
74 }
75
76 /***
77 * Returns the database operation executed in test cleanup.
78 * First operation will be executed dbOperation[0], then dbOperation[1]...
79 */
80 public DatabaseOperation[] getTearDownOperation() throws Exception
81 {
82 // Do nothing...
83 DatabaseOperation[] dbOperation = new DatabaseOperation[1];
84 dbOperation[0]=DatabaseOperation.DO_NOTHING;
85
86 return dbOperation;
87 }
88
89
90 public void testMe() throws Exception
91 {
92 System.out.println("Executing test: testMe 2 - SQL Statements as a source data");
93 }
94
95 public static Test suite() {
96 return new TestSuite(LoaderTest2.class);
97 }
98
99
100 public static void main(String args[]) {
101 // junit.textui.TestRunner.run(suite());
102 TestResult result= (new LoaderTest2("testMe 2")).run();
103
104 }
105
106
107
108 }
109
110
111
112
113
This page automatically generated by Maven