Source Code Cross Referenced for OracleConnectionFactoryOnlineTest.java in  » GIS » GeoTools-2.4.1 » org » geotools » data » oracle » 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 » GIS » GeoTools 2.4.1 » org.geotools.data.oracle 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *    GeoTools - OpenSource mapping toolkit
003:         *    http://geotools.org
004:         *    (C) 2003-2006, Geotools Project Managment Committee (PMC)
005:         *
006:         *    This library is free software; you can redistribute it and/or
007:         *    modify it under the terms of the GNU Lesser General Public
008:         *    License as published by the Free Software Foundation; either
009:         *    version 2.1 of the License, or (at your option) any later version.
010:         *
011:         *    This library is distributed in the hope that it will be useful,
012:         *    but WITHOUT ANY WARRANTY; without even the implied warranty of
013:         *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014:         *    Lesser General Public License for more details.
015:         *    
016:         *    Created on 4/08/2003
017:         */
018:        package org.geotools.data.oracle;
019:
020:        import java.util.Properties;
021:
022:        import junit.framework.TestCase;
023:
024:        import org.geotools.data.jdbc.ConnectionPool;
025:        import org.geotools.data.jdbc.ConnectionPoolManager;
026:
027:        /**
028:         * Test the Connection poolings
029:         * 
030:         * @author Sean Geoghegan, Defence Science and Technology Organisation
031:         * @author $Author: seangeo $
032:         * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/unsupported/oracle-spatial/src/test/java/org/geotools/data/oracle/OracleConnectionFactoryOnlineTest.java $
033:         * @version $Id: OracleConnectionFactoryOnlineTest.java 25819 2007-06-12 20:13:56Z chorner $ Last
034:         *          Modified: $Date: 2003/08/15 00:42:02 $
035:         */
036:        public class OracleConnectionFactoryOnlineTest extends TestCase {
037:            /** The Oracle driver class name */
038:            private static final String JDBC_DRIVER = "oracle.jdbc.driver.OracleDriver";
039:            private Properties properties;
040:            boolean GO = true;
041:
042:            /**
043:             * Creates a new OracleConnectionFactory Test.
044:             * 
045:             * @throws ClassNotFoundException If the driver cannot be found
046:             */
047:            public OracleConnectionFactoryOnlineTest()
048:                    throws ClassNotFoundException {
049:                super ();
050:                try {
051:                    Class.forName(JDBC_DRIVER);
052:                } catch (Throwable t) {
053:                    GO = false;
054:                    // must be running off dummy jar!
055:                }
056:            }
057:
058:            /**
059:             * Creates a new OracleConnectionFactory Test.
060:             * 
061:             * @param arg0 name of the test
062:             * @throws ClassNotFoundException If the Oracle Driver cannot be found
063:             */
064:            public OracleConnectionFactoryOnlineTest(String arg0)
065:                    throws ClassNotFoundException {
066:                super (arg0);
067:                try {
068:                    Class.forName(JDBC_DRIVER);
069:                } catch (Throwable t) {
070:                    // must be running off dummy jar!
071:                }
072:            }
073:
074:            /**
075:             * Loads the properties
076:             * 
077:             * @throws Exception
078:             * @see junit.framework.TestCase#setUp()
079:             */
080:            protected void setUp() throws Exception {
081:                super .setUp();
082:                properties = new Properties();
083:                properties.load(this .getClass().getResourceAsStream(
084:                        "remote.properties"));
085:            }
086:
087:            /**
088:             * Removes the properties
089:             * 
090:             * @throws Exception
091:             * @see junit.framework.TestCase#tearDown()
092:             */
093:            protected void tearDown() throws Exception {
094:                super .tearDown();
095:                ConnectionPoolManager manager = ConnectionPoolManager
096:                        .getInstance();
097:                manager.closeAll();
098:                properties = null;
099:            }
100:
101:            public void testGetConnection() throws Exception {
102:                if (!GO)
103:                    return;
104:                OracleConnectionFactory cFact = new OracleConnectionFactory(
105:                        properties.getProperty("host"), properties
106:                                .getProperty("port"), properties
107:                                .getProperty("instance"));
108:                cFact.setLogin(properties.getProperty("user"), properties
109:                        .getProperty("passwd"));
110:
111:                // check that two connection pools from the same fact are the same
112:                try {
113:                    ConnectionPool pool1 = cFact.getConnectionPool();
114:                    ConnectionPool pool2 = cFact.getConnectionPool();
115:                    assertTrue("Connection pool was not equal", pool1 == pool2);
116:                    // check that two connection pools using the same url,user,pass but
117:                    // from different factories are the same
118:                    OracleConnectionFactory cFact2 = new OracleConnectionFactory(
119:                            properties.getProperty("host"), properties
120:                                    .getProperty("port"), properties
121:                                    .getProperty("instance"));
122:                    cFact2.setLogin(properties.getProperty("user"), properties
123:                            .getProperty("passwd"));
124:                    ConnectionPool pool3 = cFact2.getConnectionPool();
125:                    assertTrue("New factory returned different pool",
126:                            pool1 == pool3);
127:                } catch (Throwable t) {
128:                    // must be using dummy spatial
129:                }
130:            }
131:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.