Source Code Cross Referenced for PropertyTest.java in  » Database-JDBC-Connection-Pool » proxool » org » logicalcobwebs » proxool » 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 » proxool » org.logicalcobwebs.proxool 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * This software is released under a licence similar to the Apache Software Licence.
003:         * See org.logicalcobwebs.proxool.package.html for details.
004:         * The latest version is available at http://proxool.sourceforge.net
005:         */
006:        package org.logicalcobwebs.proxool;
007:
008:        import java.sql.Connection;
009:        import java.sql.DriverManager;
010:        import java.sql.ResultSet;
011:        import java.sql.ResultSetMetaData;
012:        import java.sql.SQLException;
013:        import java.sql.Statement;
014:        import java.util.Properties;
015:
016:        /**
017:         * Tests whether {@link ConnectionPoolDefinition} recognises properties
018:         * properly
019:         * @version $Revision: 1.3 $, $Date: 2006/03/24 00:18:46 $
020:         * @author billhorsman
021:         * @author $Author: billhorsman $ (current maintainer)
022:         * @since Proxool 0.8.2
023:         */
024:        public class PropertyTest extends AbstractProxoolTest {
025:
026:            public PropertyTest(String alias) {
027:                super (alias);
028:            }
029:
030:            /**
031:             * Test whether we are successfully passing properties onto the delegate driver. This
032:             * relies on a feature of Hypersonic 1.7.1 where ResultSetMetaData.isWritable() is
033:             * unsupported. The default behaviour, however, is just to return a value that maybe
034:             * incorrect but without throwing an exception. If you set the property jdbc.strict_md = true
035:             * then Hypersonic does throw an exception. This might change in future versions of Hypersonic
036:             * so we should keep an eye on this.
037:             * See <a href="http://hsqldb.sourceforge.net/doc/src/org/hsqldb/jdbcResultSet.html">http://hsqldb.sourceforge.net/doc/src/org/hsqldb/jdbcResultSet.html</a>
038:             */
039:            public void testDelegateProperty() throws Exception {
040:
041:                String testName = "delegateProperty";
042:                String alias = testName;
043:
044:                // Register pool
045:                String url = TestHelper.buildProxoolUrl(alias,
046:                        TestConstants.HYPERSONIC_DRIVER,
047:                        TestConstants.HYPERSONIC_TEST_URL);
048:                Properties info = new Properties();
049:                info.setProperty(ProxoolConstants.USER_PROPERTY,
050:                        TestConstants.HYPERSONIC_USER);
051:                info.setProperty(ProxoolConstants.PASSWORD_PROPERTY,
052:                        TestConstants.HYPERSONIC_PASSWORD);
053:                info.setProperty(
054:                        ProxoolConstants.HOUSE_KEEPING_TEST_SQL_PROPERTY,
055:                        TestConstants.HYPERSONIC_TEST_SQL);
056:
057:                Connection c = null;
058:                try {
059:                    c = DriverManager.getConnection(url, info);
060:                    Statement s = c.createStatement();
061:                    try {
062:                        s.execute("drop table z");
063:                    } catch (SQLException e) {
064:                        // Probably because it doesn't exist.
065:                    }
066:                    s.execute("create table z (a int)");
067:
068:                    s.execute("select * from z");
069:                    ResultSet rs = s.getResultSet();
070:                    ResultSetMetaData rsmd = rs.getMetaData();
071:                    // by default, this should work without error (even if the value returned is rubbish)
072:                    rsmd.isWritable(1);
073:                } finally {
074:                    if (c != null) {
075:                        c.close();
076:                        c = null;
077:                    }
078:                }
079:                /*
080:                 This doesn't work with HSQLDB 1.8.0. They don't seem to mention the strict_md propertry in their
081:                 documentation anymore.
082:
083:                 // And now test with the strict meta data
084:                 info.setProperty("jdbc.strict_md", "true");
085:                 try {
086:                 c = DriverManager.getConnection(url, info);
087:                 Statement s = c.createStatement();
088:                 s.execute("select * from z");
089:                 ResultSet rs = s.getResultSet();
090:                 ResultSetMetaData rsmd = rs.getMetaData();
091:                 try {
092:                 rsmd.isWritable(1);
093:                 fail("Expected isWritable() to throw unsupported exception");
094:                 } catch (SQLException e) {
095:                 // Expected an exception
096:                 }
097:                 } finally {
098:                 if (c != null) {
099:                 c.close();
100:                 }
101:                 }
102:                 */
103:
104:            }
105:        }
106:        /*
107:         Revision history:
108:         $Log: PropertyTest.java,v $
109:         Revision 1.3  2006/03/24 00:18:46  billhorsman
110:         Changes for HSQL 1.8
111:
112:         Revision 1.2  2004/05/26 17:19:09  brenuart
113:         Allow JUnit tests to be executed against another database.
114:         By default the test configuration will be taken from the 'testconfig-hsqldb.properties' file located in the org.logicalcobwebs.proxool package.
115:         This behavior can be overriden by setting the 'testConfig' environment property to another location.
116:
117:         Revision 1.1  2003/11/04 13:22:43  billhorsman
118:         New test for delegate properties
119:
120:         */
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.