Source Code Cross Referenced for LoaderTest3.java in  » Database-JDBC-Connection-Pool » octopus » test » org » webdocwf » util » loader » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database JDBC Connection Pool » octopus » test.org.webdocwf.util.loader 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * LoaderTest.java   Sept 01, 2002
003:         *
004:         * Sample JUnit test using Loader for creating test database and
005:         * inserting data into it.
006:         *
007:         */
008:
009:        package test.org.webdocwf.util.loader;
010:
011:        import java.sql.Connection;
012:        import java.sql.DriverManager;
013:
014:        import org.webdocwf.util.loader.test.LoaderTestCase;
015:        import org.webdocwf.util.loader.test.DatabaseOperation;
016:        import org.webdocwf.util.loader.test.CreateDatabaseOperation;
017:        import org.webdocwf.util.loader.test.DropDatabaseOperation;
018:        import org.webdocwf.util.loader.test.LoaderOperation;
019:        import org.webdocwf.util.loader.Loader;
020:
021:        import junit.framework.TestCase;
022:        import junit.framework.Test;
023:        import junit.framework.TestSuite;
024:        import junit.framework.TestResult;
025:
026:        /**
027:         * @author Sinisa Milosevic
028:         * @version $Revision: 1.1 $
029:         */
030:        public class LoaderTest3 extends LoaderTestCase {
031:
032:            public LoaderTest3(String name) {
033:                super (name);
034:            }
035:
036:            /**
037:             * Returns the test database connection.
038:             * @throws Exception
039:             * @return jdbc connection
040:             */
041:            public Connection getConnection() throws Exception {
042:
043:                Class driverClass = Class.forName("org.hsqldb.jdbcDriver");
044:                Connection jdbcConnection = DriverManager.getConnection(
045:                        "jdbc:hsqldb:test/LoaderTest3/LoaderTest3", "sa", "");
046:
047:                return jdbcConnection;
048:            }
049:
050:            /**
051:             * Returns the name of test database.
052:             * @throws Exception
053:             * @return string
054:             */
055:
056:            public String getDatabaseName() throws Exception {
057:                return "LoaderTest3";
058:            }
059:
060:            /**
061:             * Returns the test Loader class (loaderjob).
062:             * @throws Exception
063:             * @return Loader object
064:             */
065:            public Loader getLoader() throws Exception {
066:
067:                showHeader();
068:                Loader loadJob = new Loader(
069:                        "modules/Octopus/src/testdata/ObjectLoader/CreateTables3.xml");
070:                loadJob.setUserID("admin");
071:                loadJob.setLogDirName("test");
072:                loadJob.setLogFileName("LoaderTest3.txt");
073:
074:                return loadJob;
075:            }
076:
077:            private static boolean isHeaderShown = false;
078:
079:            private void showHeader() {
080:                if (!this .isHeaderShown) {
081:                    System.out.println();
082:                    System.out
083:                            .println("******************************************************");
084:                    System.out.println("   Executing test: test3 - ");
085:                    System.out
086:                            .println("******************************************************");
087:                    this .isHeaderShown = true;
088:                }
089:            }
090:
091:            /**
092:             * Returns the database operations executed in test setup. First operation will be
093:             * executed dbOperation[0], then dbOperation[1]...
094:             * @throws Exception
095:             * @return dbOperation parameter
096:             */
097:            public DatabaseOperation[] getSetUpOperation() throws Exception {
098:                //        Creating test database.....
099:                DatabaseOperation[] dbOperation = new DatabaseOperation[3];
100:                //        dbOperation[0]=new CreateDatabaseOperation(getDatabaseName());
101:
102:                //        Creating tables.....
103:                dbOperation[0] = new LoaderOperation(getLoader());
104:
105:                //		    Inserting data.....
106:                Loader loadJob1 = new Loader(
107:                        "modules/Octopus/src/testdata/ObjectLoader/InsertData.xml");
108:                loadJob1.setUserID("admin");
109:                loadJob1.setLogDirName("test");
110:                loadJob1.setLogFileName("LoaderTest3.txt");
111:                dbOperation[1] = new LoaderOperation(loadJob1);
112:
113:                //		    Creating indexes, foreign keys.....
114:                Loader loadJob2 = new Loader(
115:                        "modules/Octopus/src/testdata/ObjectLoader/CreateIndex.xml");
116:                loadJob2.setLogDirName("test");
117:                loadJob2.setLogFileName("LoaderTest3_CreateIndex.txt");
118:                dbOperation[2] = new LoaderOperation(loadJob2);
119:
120:                return dbOperation;
121:            }
122:
123:            /**
124:             * Returns the database operation executed in test cleanup.
125:             *  First operation will be executed dbOperation[0], then dbOperation[1]...
126:             * @throws Exception
127:             * @return dbOperation parameter
128:             */
129:            public DatabaseOperation[] getTearDownOperation() throws Exception {
130:                //		    Deleting test database.....
131:                DatabaseOperation[] dbOperation = new DatabaseOperation[1];
132:                dbOperation[0] = DatabaseOperation.DO_NOTHING;
133:
134:                return dbOperation;
135:            }
136:
137:            public void testMe() throws Exception {
138:
139:            }
140:
141:            public static Test suite() {
142:                return new TestSuite(LoaderTest3.class);
143:            }
144:
145:            public static void main(String args[]) {
146:
147:                //    	junit.textui.TestRunner.run(suite());
148:                TestResult result = (new LoaderTest3("testMe 3")).run();
149:
150:            }
151:
152:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.