Source Code Cross Referenced for RowIdNotImplementedTest.java in  » Database-DBMS » db-derby-10.2 » org » apache » derbyTesting » functionTests » tests » jdbc4 » 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 DBMS » db derby 10.2 » org.apache.derbyTesting.functionTests.tests.jdbc4 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *
003:         * Derby - Class RowIdNotImplementedTest
004:         *
005:         * Licensed to the Apache Software Foundation (ASF) under one or more
006:         * contributor license agreements.  See the NOTICE file distributed with
007:         * this work for additional information regarding copyright ownership.
008:         * The ASF licenses this file to you under the Apache License, Version 2.0
009:         * (the "License"); you may not use this file except in compliance with
010:         * the License.  You may obtain a copy of the License at
011:         *
012:         *    http://www.apache.org/licenses/LICENSE-2.0
013:         *
014:         * Unless required by applicable law or agreed to in writing, 
015:         * software distributed under the License is distributed on an 
016:         * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 
017:         * either express or implied. See the License for the specific 
018:         * language governing permissions and limitations under the License.
019:         */
020:
021:        package org.apache.derbyTesting.functionTests.tests.jdbc4;
022:
023:        import org.apache.derbyTesting.junit.BaseJDBCTestCase;
024:
025:        import junit.framework.*;
026:
027:        import java.sql.*;
028:
029:        /**
030:         * Test that all methods and functionality related to RowId reflect that it
031:         * has not yet been implemented.
032:         * The tests are written to be run with JDK 1.6.
033:         * All methods that throws SQLException, should utilize the 
034:         * SQLFeatureNotSupportedException-subclass. Methods unable to throw
035:         * SQLException, must throw java.lang.UnsupportedOperationException.
036:         * As RowId is implemented, tests demonstrating correctness of the API should
037:         * be moved into the proper test classes (for instance, test updateRowId in
038:         * the test class for ResultSet).
039:         * The reason for specifying all tests here was mainly because there were no
040:         * existing JUnit tests for the various classes implementing RowId methods.
041:         */
042:        public class RowIdNotImplementedTest extends BaseJDBCTestCase {
043:
044:            /**
045:             * Create test with given name.
046:             *
047:             * @param name name of test.
048:             */
049:            public RowIdNotImplementedTest(String name) {
050:                super (name);
051:            }
052:
053:            public void testRowIdInPreparedStatementSetRowId()
054:                    throws SQLException {
055:                PreparedStatement pStmt = prepareStatement("select count(*) from sys.systables");
056:                try {
057:                    pStmt.setRowId(1, null);
058:                    fail("PreparedStatement.setRowId should not be implemented");
059:                } catch (SQLFeatureNotSupportedException sfnse) {
060:                    // Do nothing, we are fine.
061:                }
062:            }
063:
064:            public void testRowIdInCallableStatementGetRowIdInt()
065:                    throws SQLException {
066:                CallableStatement cStmt = getCallableStatement();
067:                try {
068:                    cStmt.getRowId(1);
069:                    fail("CallableStatement.getRowId(int) should not be implemented.");
070:                } catch (SQLFeatureNotSupportedException sfnse) {
071:                    // Do nothing, we are fine.
072:                }
073:            }
074:
075:            public void testRowIdInCallableStatementGetRowIdString()
076:                    throws SQLException {
077:                CallableStatement cStmt = getCallableStatement();
078:                try {
079:                    cStmt.getRowId("some-parameter-name");
080:                    fail("CallableStatement.getRowId(String) should not be "
081:                            + "implemented.");
082:                } catch (SQLFeatureNotSupportedException sfnse) {
083:                    // Do nothing, we are fine.
084:                }
085:            }
086:
087:            public void testRowIdInCallableStatementSetRowId()
088:                    throws SQLException {
089:                CallableStatement cStmt = getCallableStatement();
090:                try {
091:                    cStmt.setRowId("some-parameter-name", null);
092:                    fail("CallableStatement.setRowId should not be implemented");
093:                } catch (SQLFeatureNotSupportedException sfnse) {
094:                    // Do nothing, we are fine.
095:                }
096:            }
097:
098:            public void testRowIdInResultSetGetRowIdInt() throws SQLException {
099:                ResultSet rs = getResultSet();
100:                try {
101:                    rs.getRowId(1);
102:                    fail("ResultSet.getRowId(int) should not be implemented");
103:                } catch (SQLFeatureNotSupportedException sfnse) {
104:                    // Do nothing, we are fine.
105:                }
106:            }
107:
108:            public void testRowIdInResultSetGetRowIdString()
109:                    throws SQLException {
110:                ResultSet rs = getResultSet();
111:                try {
112:                    rs.getRowId("some-parameter-name");
113:                    fail("ResultSet.getRowId(String) should not be implemented");
114:                } catch (SQLFeatureNotSupportedException sfnse) {
115:                    // Do nothing, we are fine.
116:                }
117:            }
118:
119:            public void testRowIdInResultSetUpdateRowIdInt()
120:                    throws SQLException {
121:                ResultSet rs = getResultSet();
122:                try {
123:                    rs.updateRowId(1, null);
124:                    fail("ResultSet.updateRowId(int) should not be implemented");
125:                } catch (SQLFeatureNotSupportedException sfnse) {
126:                    // Do nothing, we are fine.
127:                }
128:            }
129:
130:            public void testRowIdInResultSetUpdateRowIdString()
131:                    throws SQLException {
132:                ResultSet rs = getResultSet();
133:                try {
134:                    rs.updateRowId("some-parameter-name", null);
135:                    fail("ResultSet.updateRowId(String) should not be implemented");
136:                } catch (SQLFeatureNotSupportedException sfnse) {
137:                    // Do nothing, we are fine.
138:                }
139:            }
140:
141:            public void testRowIdInDatabaseMetaDataRowIdLifeTime()
142:                    throws SQLException {
143:                DatabaseMetaData meta = getConnection().getMetaData();
144:                RowIdLifetime rowIdLifetime = meta.getRowIdLifetime();
145:                assertEquals("RowIdLifetime should be ROWID_UNSUPPORTED",
146:                        RowIdLifetime.ROWID_UNSUPPORTED, rowIdLifetime);
147:                meta = null;
148:            }
149:
150:            /**
151:             * Create a callable statement.
152:             *
153:             * @return a <code>CallableStatement</code>
154:             * @throws SQLException if creation of CallableStatement fails.
155:             */
156:            private CallableStatement getCallableStatement()
157:                    throws SQLException {
158:                // No need to actuall call a stored procedure.
159:                return prepareCall("values 1");
160:            }
161:
162:            /**
163:             * Create a resultset.
164:             *
165:             * @return a <code>ResultSet</code>
166:             * @throws SQLException if creation of ResultSet fails.
167:             */
168:            private ResultSet getResultSet() throws SQLException {
169:                // Create a very simple resultset.
170:                return createStatement().executeQuery("values 1");
171:            }
172:
173:            /**
174:             * Return test suite.
175:             *
176:             * @return test suite.
177:             */
178:            public static Test suite() {
179:                return new TestSuite(RowIdNotImplementedTest.class,
180:                        "RowIdNotImplementedTest suite");
181:            }
182:
183:        } // End class RowIdNotImplementedTest
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.