From 7beb1017f0df558b52f304be768f33b70f71f2c4 Mon Sep 17 00:00:00 2001 From: kshefov Date: Fri, 29 May 2015 17:27:55 +0300 Subject: [PATCH] 8081479: Backport JDBC tests from JDK 9 from test/java/sql and test/javax/sql to JDK 8u. Reviewed-by: lancea Contributed-by: maxim.soloviev@oracle.com --- test/java/sql/testng/TEST.properties | 3 + .../test/sql/BatchUpdateExceptionTests.java | 326 +++ .../testng/test/sql/DataTruncationTests.java | 209 ++ test/java/sql/testng/test/sql/DateTests.java | 373 ++++ .../sql/DriverManagerPermissionsTests.java | 154 ++ .../testng/test/sql/DriverManagerTests.java | 354 +++ .../test/sql/SQLClientInfoExceptionTests.java | 227 ++ .../test/sql/SQLDataExceptionTests.java | 215 ++ .../testng/test/sql/SQLExceptionTests.java | 202 ++ .../SQLFeatureNotSupportedExceptionTests.java | 232 ++ ...rityConstraintViolationExceptionTests.java | 235 ++ ...nvalidAuthorizationSpecExceptionTests.java | 239 ++ ...LNonTransientConnectionExceptionTests.java | 235 ++ .../sql/SQLNonTransientExceptionTests.java | 209 ++ .../sql/SQLRecoverableExceptionTests.java | 209 ++ .../sql/SQLSyntaxErrorExceptionTests.java | 221 ++ .../test/sql/SQLTimeoutExceptionTests.java | 218 ++ .../SQLTransactionRollbackExceptionTests.java | 233 ++ .../SQLTransientConnectionExceptionTests.java | 233 ++ .../test/sql/SQLTransientExceptionTests.java | 207 ++ .../sql/testng/test/sql/SQLWarningTests.java | 249 +++ test/java/sql/testng/test/sql/TimeTests.java | 348 +++ .../sql/testng/test/sql/TimestampTests.java | 777 +++++++ test/java/sql/testng/util/BaseTest.java | 126 ++ .../sql/testng/util/DriverActionImpl.java | 43 + .../util/SerializedBatchUpdateException.java | 65 + test/java/sql/testng/util/StubConnection.java | 315 +++ test/java/sql/testng/util/StubDriver.java | 75 + test/java/sql/testng/util/StubDriverDA.java | 75 + test/java/sql/testng/util/TestPolicy.java | 142 ++ test/javax/sql/testng/TEST.properties | 7 + .../services/javax.sql.rowset.RowSetFactory | 1 + .../services/javax.sql.rowset.RowSetFactory | 1 + .../testng/test/rowset/BaseRowSetTests.java | 444 ++++ .../testng/test/rowset/CommonRowSetTests.java | 1372 ++++++++++++ .../test/rowset/RowSetFactoryTests.java | 119 + .../test/rowset/RowSetMetaDataTests.java | 555 +++++ .../test/rowset/RowSetProviderTests.java | 189 ++ .../test/rowset/RowSetWarningTests.java | 238 ++ .../cachedrowset/CachedRowSetTests.java | 35 + .../cachedrowset/CommonCachedRowSetTests.java | 1612 ++++++++++++++ .../rowset/filteredrowset/CityFilter.java | 100 + .../filteredrowset/FilteredRowSetTests.java | 140 ++ .../filteredrowset/PrimaryKeyFilter.java | 93 + .../rowset/joinrowset/JoinRowSetTests.java | 324 +++ .../test/rowset/serial/SQLInputImplTests.java | 211 ++ .../rowset/serial/SQLOutputImplTests.java | 199 ++ .../test/rowset/serial/SerialArrayTests.java | 236 ++ .../test/rowset/serial/SerialBlobTests.java | 399 ++++ .../test/rowset/serial/SerialClobTests.java | 499 +++++ .../rowset/serial/SerialDataLinkTests.java | 110 + .../rowset/serial/SerialExceptionTests.java | 113 + .../rowset/serial/SerialJavaObjectTests.java | 100 + .../test/rowset/serial/SerialRefTests.java | 131 ++ .../test/rowset/serial/SerialStructTests.java | 140 ++ .../rowset/spi/SyncFactoryExceptionTests.java | 113 + .../spi/SyncFactoryPermissionsTests.java | 179 ++ .../test/rowset/spi/SyncFactoryTests.java | 220 ++ .../spi/SyncProviderExceptionTests.java | 187 ++ .../webrowset/CommonWebRowSetTests.java | 400 ++++ .../test/rowset/webrowset/WebRowSetTests.java | 35 + .../sql/testng/util/PropertyStubProvider.java | 27 + test/javax/sql/testng/util/StubArray.java | 99 + .../javax/sql/testng/util/StubBaseRowSet.java | 1001 +++++++++ test/javax/sql/testng/util/StubBlob.java | 100 + .../sql/testng/util/StubCachedRowSetImpl.java | 1848 ++++++++++++++++ test/javax/sql/testng/util/StubClob.java | 113 + test/javax/sql/testng/util/StubContext.java | 220 ++ .../testng/util/StubFilteredRowSetImpl.java | 1892 ++++++++++++++++ .../sql/testng/util/StubJdbcRowSetImpl.java | 1672 ++++++++++++++ .../sql/testng/util/StubJoinRowSetImpl.java | 1962 +++++++++++++++++ test/javax/sql/testng/util/StubNClob.java | 29 + test/javax/sql/testng/util/StubRef.java | 60 + test/javax/sql/testng/util/StubRowId.java | 34 + .../sql/testng/util/StubRowSetFactory.java | 60 + test/javax/sql/testng/util/StubSQLXML.java | 81 + test/javax/sql/testng/util/StubStruct.java | 55 + .../sql/testng/util/StubSyncProvider.java | 92 + .../sql/testng/util/StubSyncResolver.java | 1616 ++++++++++++++ .../sql/testng/util/StubWebRowSetImpl.java | 1879 ++++++++++++++++ test/javax/sql/testng/util/SuperHero.java | 110 + .../sql/testng/util/TestRowSetListener.java | 64 + .../sql/testng/util/TestSQLDataImpl.java | 125 ++ test/javax/sql/testng/xml/COFFEE_ROWS.xml | 191 ++ .../sql/testng/xml/DELETED_COFFEE_ROWS.xml | 191 ++ .../sql/testng/xml/INSERTED_COFFEE_ROWS.xml | 207 ++ .../xml/MODFIED_DELETED_COFFEE_ROWS.xml | 191 ++ .../sql/testng/xml/UPDATED_COFFEE_ROWS.xml | 193 ++ .../xml/UPDATED_INSERTED_COFFEE_ROWS.xml | 201 ++ 89 files changed, 29564 insertions(+) create mode 100644 test/java/sql/testng/TEST.properties create mode 100644 test/java/sql/testng/test/sql/BatchUpdateExceptionTests.java create mode 100644 test/java/sql/testng/test/sql/DataTruncationTests.java create mode 100644 test/java/sql/testng/test/sql/DateTests.java create mode 100644 test/java/sql/testng/test/sql/DriverManagerPermissionsTests.java create mode 100644 test/java/sql/testng/test/sql/DriverManagerTests.java create mode 100644 test/java/sql/testng/test/sql/SQLClientInfoExceptionTests.java create mode 100644 test/java/sql/testng/test/sql/SQLDataExceptionTests.java create mode 100644 test/java/sql/testng/test/sql/SQLExceptionTests.java create mode 100644 test/java/sql/testng/test/sql/SQLFeatureNotSupportedExceptionTests.java create mode 100644 test/java/sql/testng/test/sql/SQLIntegrityConstraintViolationExceptionTests.java create mode 100644 test/java/sql/testng/test/sql/SQLInvalidAuthorizationSpecExceptionTests.java create mode 100644 test/java/sql/testng/test/sql/SQLNonTransientConnectionExceptionTests.java create mode 100644 test/java/sql/testng/test/sql/SQLNonTransientExceptionTests.java create mode 100644 test/java/sql/testng/test/sql/SQLRecoverableExceptionTests.java create mode 100644 test/java/sql/testng/test/sql/SQLSyntaxErrorExceptionTests.java create mode 100644 test/java/sql/testng/test/sql/SQLTimeoutExceptionTests.java create mode 100644 test/java/sql/testng/test/sql/SQLTransactionRollbackExceptionTests.java create mode 100644 test/java/sql/testng/test/sql/SQLTransientConnectionExceptionTests.java create mode 100644 test/java/sql/testng/test/sql/SQLTransientExceptionTests.java create mode 100644 test/java/sql/testng/test/sql/SQLWarningTests.java create mode 100644 test/java/sql/testng/test/sql/TimeTests.java create mode 100644 test/java/sql/testng/test/sql/TimestampTests.java create mode 100644 test/java/sql/testng/util/BaseTest.java create mode 100644 test/java/sql/testng/util/DriverActionImpl.java create mode 100644 test/java/sql/testng/util/SerializedBatchUpdateException.java create mode 100644 test/java/sql/testng/util/StubConnection.java create mode 100644 test/java/sql/testng/util/StubDriver.java create mode 100644 test/java/sql/testng/util/StubDriverDA.java create mode 100644 test/java/sql/testng/util/TestPolicy.java create mode 100644 test/javax/sql/testng/TEST.properties create mode 100644 test/javax/sql/testng/jars/badFactory/META-INF/services/javax.sql.rowset.RowSetFactory create mode 100644 test/javax/sql/testng/jars/goodFactory/META-INF/services/javax.sql.rowset.RowSetFactory create mode 100644 test/javax/sql/testng/test/rowset/BaseRowSetTests.java create mode 100644 test/javax/sql/testng/test/rowset/CommonRowSetTests.java create mode 100644 test/javax/sql/testng/test/rowset/RowSetFactoryTests.java create mode 100644 test/javax/sql/testng/test/rowset/RowSetMetaDataTests.java create mode 100644 test/javax/sql/testng/test/rowset/RowSetProviderTests.java create mode 100644 test/javax/sql/testng/test/rowset/RowSetWarningTests.java create mode 100644 test/javax/sql/testng/test/rowset/cachedrowset/CachedRowSetTests.java create mode 100644 test/javax/sql/testng/test/rowset/cachedrowset/CommonCachedRowSetTests.java create mode 100644 test/javax/sql/testng/test/rowset/filteredrowset/CityFilter.java create mode 100644 test/javax/sql/testng/test/rowset/filteredrowset/FilteredRowSetTests.java create mode 100644 test/javax/sql/testng/test/rowset/filteredrowset/PrimaryKeyFilter.java create mode 100644 test/javax/sql/testng/test/rowset/joinrowset/JoinRowSetTests.java create mode 100644 test/javax/sql/testng/test/rowset/serial/SQLInputImplTests.java create mode 100644 test/javax/sql/testng/test/rowset/serial/SQLOutputImplTests.java create mode 100644 test/javax/sql/testng/test/rowset/serial/SerialArrayTests.java create mode 100644 test/javax/sql/testng/test/rowset/serial/SerialBlobTests.java create mode 100644 test/javax/sql/testng/test/rowset/serial/SerialClobTests.java create mode 100644 test/javax/sql/testng/test/rowset/serial/SerialDataLinkTests.java create mode 100644 test/javax/sql/testng/test/rowset/serial/SerialExceptionTests.java create mode 100644 test/javax/sql/testng/test/rowset/serial/SerialJavaObjectTests.java create mode 100644 test/javax/sql/testng/test/rowset/serial/SerialRefTests.java create mode 100644 test/javax/sql/testng/test/rowset/serial/SerialStructTests.java create mode 100644 test/javax/sql/testng/test/rowset/spi/SyncFactoryExceptionTests.java create mode 100644 test/javax/sql/testng/test/rowset/spi/SyncFactoryPermissionsTests.java create mode 100644 test/javax/sql/testng/test/rowset/spi/SyncFactoryTests.java create mode 100644 test/javax/sql/testng/test/rowset/spi/SyncProviderExceptionTests.java create mode 100644 test/javax/sql/testng/test/rowset/webrowset/CommonWebRowSetTests.java create mode 100644 test/javax/sql/testng/test/rowset/webrowset/WebRowSetTests.java create mode 100644 test/javax/sql/testng/util/PropertyStubProvider.java create mode 100644 test/javax/sql/testng/util/StubArray.java create mode 100644 test/javax/sql/testng/util/StubBaseRowSet.java create mode 100644 test/javax/sql/testng/util/StubBlob.java create mode 100644 test/javax/sql/testng/util/StubCachedRowSetImpl.java create mode 100644 test/javax/sql/testng/util/StubClob.java create mode 100644 test/javax/sql/testng/util/StubContext.java create mode 100644 test/javax/sql/testng/util/StubFilteredRowSetImpl.java create mode 100644 test/javax/sql/testng/util/StubJdbcRowSetImpl.java create mode 100644 test/javax/sql/testng/util/StubJoinRowSetImpl.java create mode 100644 test/javax/sql/testng/util/StubNClob.java create mode 100644 test/javax/sql/testng/util/StubRef.java create mode 100644 test/javax/sql/testng/util/StubRowId.java create mode 100644 test/javax/sql/testng/util/StubRowSetFactory.java create mode 100644 test/javax/sql/testng/util/StubSQLXML.java create mode 100644 test/javax/sql/testng/util/StubStruct.java create mode 100644 test/javax/sql/testng/util/StubSyncProvider.java create mode 100644 test/javax/sql/testng/util/StubSyncResolver.java create mode 100644 test/javax/sql/testng/util/StubWebRowSetImpl.java create mode 100644 test/javax/sql/testng/util/SuperHero.java create mode 100644 test/javax/sql/testng/util/TestRowSetListener.java create mode 100644 test/javax/sql/testng/util/TestSQLDataImpl.java create mode 100644 test/javax/sql/testng/xml/COFFEE_ROWS.xml create mode 100644 test/javax/sql/testng/xml/DELETED_COFFEE_ROWS.xml create mode 100644 test/javax/sql/testng/xml/INSERTED_COFFEE_ROWS.xml create mode 100644 test/javax/sql/testng/xml/MODFIED_DELETED_COFFEE_ROWS.xml create mode 100644 test/javax/sql/testng/xml/UPDATED_COFFEE_ROWS.xml create mode 100644 test/javax/sql/testng/xml/UPDATED_INSERTED_COFFEE_ROWS.xml diff --git a/test/java/sql/testng/TEST.properties b/test/java/sql/testng/TEST.properties new file mode 100644 index 000000000..295505b90 --- /dev/null +++ b/test/java/sql/testng/TEST.properties @@ -0,0 +1,3 @@ +# JDBC unit tests uses TestNG +TestNG.dirs = . + diff --git a/test/java/sql/testng/test/sql/BatchUpdateExceptionTests.java b/test/java/sql/testng/test/sql/BatchUpdateExceptionTests.java new file mode 100644 index 000000000..2b1111b75 --- /dev/null +++ b/test/java/sql/testng/test/sql/BatchUpdateExceptionTests.java @@ -0,0 +1,326 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package test.sql; + +import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.ObjectInputStream; +import java.sql.BatchUpdateException; +import java.sql.SQLException; +import java.util.Arrays; +import static org.testng.Assert.*; +import org.testng.annotations.Test; +import util.SerializedBatchUpdateException; +import util.BaseTest; + +public class BatchUpdateExceptionTests extends BaseTest { + + private final int[] uc = {1, 2, 3}; + private final long[] luc = {1, 2, 3}; + + private final String testSrcDir = System.getProperty("test.src", ".") + + File.separatorChar; + + /** + * Create BatchUpdateException and setting all objects to null + */ + @Test + public void test() { + BatchUpdateException be = new BatchUpdateException(null, + null, errorCode, (int[]) null, null); + assertTrue(be.getMessage() == null && be.getSQLState() == null + && be.getUpdateCounts() == null && be.getCause() == null + && be.getLargeUpdateCounts() == null + && be.getErrorCode() == errorCode); + } + + /** + * Create BatchUpdateException with no-arg constructor + */ + @Test + public void test1() { + BatchUpdateException ex = new BatchUpdateException(); + assertTrue(ex.getMessage() == null + && ex.getSQLState() == null + && ex.getCause() == null + && ex.getErrorCode() == 0 + && ex.getUpdateCounts() == null + && ex.getLargeUpdateCounts() == null); + } + + /** + * Create BatchUpdateException with null Throwable + */ + @Test + public void test2() { + BatchUpdateException ex = new BatchUpdateException((Throwable) null); + assertTrue(ex.getMessage() == null + && ex.getSQLState() == null + && ex.getCause() == null + && ex.getErrorCode() == 0 + && ex.getUpdateCounts() == null + && ex.getLargeUpdateCounts() == null); + } + + /** + * Create BatchUpdateException with message and update counts + */ + @Test + public void test3() { + + BatchUpdateException ex = new BatchUpdateException(reason, uc); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState() == null + && ex.getCause() == null + && ex.getErrorCode() == 0 + && Arrays.equals(ex.getUpdateCounts(), uc) + && Arrays.equals(ex.getLargeUpdateCounts(), luc) + ); + } + + /** + * Create BatchUpdateException with update counts + */ + @Test + public void test4() { + BatchUpdateException ex = new BatchUpdateException(uc); + assertTrue(ex.getMessage() == null + && ex.getSQLState() == null + && ex.getCause() == null + && ex.getErrorCode() == 0 + && Arrays.equals(ex.getUpdateCounts(), uc) + && Arrays.equals(ex.getLargeUpdateCounts(), luc) + ); + } + + /** + * Create BatchUpdateException with Throwable and update counts + */ + @Test + public void test5() { + BatchUpdateException ex = new BatchUpdateException(uc, t); + assertTrue(ex.getMessage().equals(cause) + && ex.getSQLState() == null + && cause.equals(ex.getCause().toString()) + && ex.getErrorCode() == 0 + && Arrays.equals(ex.getUpdateCounts(), uc) + && Arrays.equals(ex.getLargeUpdateCounts(), luc) + ); + } + + /** + * Create BatchUpdateException with message, Throwable, and update counts + */ + @Test + public void test6() { + BatchUpdateException ex = new BatchUpdateException(reason, uc, t); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState() == null + && cause.equals(ex.getCause().toString()) + && ex.getErrorCode() == 0 + && Arrays.equals(ex.getUpdateCounts(), uc) + && Arrays.equals(ex.getLargeUpdateCounts(), luc) + ); + } + + /** + * Create BatchUpdateException with message, SQLState, Throwable, and update + * counts + */ + @Test + public void test7() { + BatchUpdateException ex = new BatchUpdateException(reason, state, uc, t); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState().equals(state) + && cause.equals(ex.getCause().toString()) + && ex.getErrorCode() == 0 + && Arrays.equals(ex.getUpdateCounts(), uc) + && Arrays.equals(ex.getLargeUpdateCounts(), luc) + ); + } + + /** + * Create BatchUpdateException with message, SQLState, errorCode code + * Throwable, and update counts + */ + @Test + public void test8() { + BatchUpdateException ex = new BatchUpdateException(reason, state, errorCode, + uc, t); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState().equals(state) + && cause.equals(ex.getCause().toString()) + && ex.getErrorCode() == errorCode + && Arrays.equals(ex.getUpdateCounts(), uc) + && Arrays.equals(ex.getLargeUpdateCounts(), luc) + ); + } + + /** + * Create BatchUpdateException with message, SQLState, errorCode code + * Throwable, and long [] update counts + */ + @Test + public void test9() { + BatchUpdateException ex = new BatchUpdateException(reason, state, errorCode, + luc, t); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState().equals(state) + && cause.equals(ex.getCause().toString()) + && ex.getErrorCode() == errorCode + && Arrays.equals(ex.getUpdateCounts(), uc) + && Arrays.equals(ex.getLargeUpdateCounts(), luc) + ); + } + + /** + * Validate that a copy of the update counts array is made + */ + @Test + public void test10() { + int[] uc1 = {1, 2}; + BatchUpdateException ex = new BatchUpdateException(uc1); + assertTrue(Arrays.equals(ex.getUpdateCounts(), uc1)); + uc1[0] = 6689; + assertFalse(Arrays.equals(ex.getUpdateCounts(), uc1)); + } + + /** + * Validate that if null is specified for the update count, it is returned + * as null + */ + @Test + public void test11() { + BatchUpdateException ex = new BatchUpdateException((int[]) null); + assertTrue(ex.getMessage() == null && ex.getSQLState() == null + && ex.getErrorCode() == 0 && ex.getUpdateCounts() == null + && ex.getLargeUpdateCounts() == null); + } + + /** + * Serialize a BatchUpdateException and make sure you can read it back + * properly + */ + @Test + public void test12() throws Exception { + BatchUpdateException be = new BatchUpdateException(reason, state, errorCode, + uc, t); + BatchUpdateException bue + = createSerializedException(be); + assertTrue(reason.equals(bue.getMessage()) + && bue.getSQLState().equals(state) + && cause.equals(bue.getCause().toString()) + && bue.getErrorCode() == errorCode + && Arrays.equals(bue.getLargeUpdateCounts(), luc) + && Arrays.equals(bue.getUpdateCounts(), uc)); + } + + + + /** + * De-Serialize a BatchUpdateException from JDBC 4.0 and make sure you can + * read it back properly + */ + @Test + public void test13() throws Exception { + String reason1 = "This was the error msg"; + String state1 = "user defined sqlState"; + String cause1 = "java.lang.Throwable: throw 1"; + int errorCode1 = 99999; + Throwable t = new Throwable("throw 1"); + int[] uc1 = {1, 2, 21}; + long[] luc1 = {1, 2, 21}; + + ObjectInputStream ois = new ObjectInputStream( + new ByteArrayInputStream(SerializedBatchUpdateException.DATA)); + BatchUpdateException bue = (BatchUpdateException) ois.readObject(); + assertTrue(reason1.equals(bue.getMessage()) + && bue.getSQLState().equals(state1) + && bue.getErrorCode() == errorCode1 + && cause1.equals(bue.getCause().toString()) + && Arrays.equals(bue.getLargeUpdateCounts(), luc1) + && Arrays.equals(bue.getUpdateCounts(), uc1)); + } + + /** + * Serialize a BatchUpdateException with an Integer.MAX_VALUE + 1 and + * validate you can read it back properly + */ + @Test + public void test14() throws Exception { + int[] uc1 = {Integer.MAX_VALUE, Integer.MAX_VALUE + 1}; + long[] luc1 = {Integer.MAX_VALUE, Integer.MAX_VALUE + 1}; + BatchUpdateException be = new BatchUpdateException(reason, state, errorCode, + luc1, t); + BatchUpdateException bue + = createSerializedException(be); + assertTrue(reason.equals(bue.getMessage()) + && bue.getSQLState().equals(state) + && cause.equals(bue.getCause().toString()) + && bue.getErrorCode() == errorCode + && Arrays.equals(bue.getLargeUpdateCounts(), luc1) + && Arrays.equals(bue.getUpdateCounts(), uc1)); + } + + /** + * Validate that the ordering of the returned Exceptions is correct + * using for-each loop + */ + @Test + public void test15() { + BatchUpdateException ex = new BatchUpdateException("Exception 1", uc, t1); + BatchUpdateException ex1 = new BatchUpdateException("Exception 2", uc); + BatchUpdateException ex2 = new BatchUpdateException("Exception 3", uc, t2); + ex.setNextException(ex1); + ex.setNextException(ex2); + int num = 0; + for (Throwable e : ex) { + assertTrue(msgs[num++].equals(e.getMessage())); + } + } + + /** + * Validate that the ordering of the returned Exceptions is correct + * using traditional while loop + */ + @Test + public void test16() { + BatchUpdateException ex = new BatchUpdateException("Exception 1", uc, t1); + BatchUpdateException ex1 = new BatchUpdateException("Exception 2", uc); + BatchUpdateException ex2 = new BatchUpdateException("Exception 3", uc, t2); + ex.setNextException(ex1); + ex.setNextException(ex2); + SQLException sqe = ex; + int num = 0; + while (sqe != null) { + assertTrue(msgs[num++].equals(sqe.getMessage())); + Throwable c = sqe.getCause(); + while (c != null) { + assertTrue(msgs[num++].equals(c.getMessage())); + c = c.getCause(); + } + sqe = sqe.getNextException(); + } + } + +} diff --git a/test/java/sql/testng/test/sql/DataTruncationTests.java b/test/java/sql/testng/test/sql/DataTruncationTests.java new file mode 100644 index 000000000..fbf7eebe9 --- /dev/null +++ b/test/java/sql/testng/test/sql/DataTruncationTests.java @@ -0,0 +1,209 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package test.sql; + +import java.sql.DataTruncation; +import java.sql.SQLException; +import static org.testng.Assert.*; +import org.testng.annotations.Test; +import util.BaseTest; + +public class DataTruncationTests extends BaseTest { + + private final String READ_TRUNCATION = "01004"; + private final String WRITE_TRUNCATION = "22001"; + private final String dtReason = "Data truncation"; + private final int dterrorCode = 0; + private final String[] dtmsgs = {dtReason, "cause 1", dtReason, + dtReason, "cause 2"}; + private boolean onRead = false; + private final boolean parameter = false; + private final int index = 21; + private final int dataSize = 25; + private final int transferSize = 10; + + /** + * Create DataTruncation object indicating a truncation on read + */ + @Test + public void test() { + onRead = true; + DataTruncation e = new DataTruncation(index, parameter, onRead, + dataSize, transferSize); + assertTrue(e.getMessage().equals(dtReason) + && e.getSQLState().equals(READ_TRUNCATION) + && e.getCause() == null + && e.getErrorCode() == dterrorCode + && e.getParameter() == parameter + && e.getRead() == onRead + && e.getDataSize() == dataSize + && e.getTransferSize() == transferSize + && e.getIndex() == index); + } + + /** + * Create DataTruncation object indicating a truncation on write + */ + @Test + public void test1() { + onRead = false; + DataTruncation e = new DataTruncation(index, parameter, onRead, + dataSize, transferSize); + assertTrue(e.getMessage().equals(dtReason) + && e.getSQLState().equals(WRITE_TRUNCATION) + && e.getCause() == null + && e.getErrorCode() == dterrorCode + && e.getParameter() == parameter + && e.getRead() == onRead + && e.getDataSize() == dataSize + && e.getTransferSize() == transferSize + && e.getIndex() == index); + } + + /** + * Create DataTruncation object indicating a truncation on read with a + * Throwable + */ + @Test + public void test2() { + onRead = true; + DataTruncation e = new DataTruncation(index, parameter, onRead, + dataSize, transferSize, t); + assertTrue(e.getMessage().equals(dtReason) + && e.getSQLState().equals(READ_TRUNCATION) + && cause.equals(e.getCause().toString()) + && e.getErrorCode() == dterrorCode + && e.getParameter() == parameter + && e.getRead() == onRead + && e.getDataSize() == dataSize + && e.getTransferSize() == transferSize + && e.getIndex() == index); + } + + /** + * Create DataTruncation object indicating a truncation on read with null + * specified for the Throwable + */ + @Test + public void test3() { + onRead = true;; + DataTruncation e = new DataTruncation(index, parameter, onRead, + dataSize, transferSize, null); + assertTrue(e.getMessage().equals(dtReason) + && e.getSQLState().equals(READ_TRUNCATION) + && e.getCause() == null + && e.getErrorCode() == dterrorCode + && e.getParameter() == parameter + && e.getRead() == onRead + && e.getDataSize() == dataSize + && e.getTransferSize() == transferSize + && e.getIndex() == index); + } + + /** + * Create DataTruncation object indicating a truncation on read and you can + * pass a -1 for the index + */ + @Test + public void test4() { + onRead = true; + int negIndex = -1; + DataTruncation e = new DataTruncation(negIndex, parameter, onRead, + dataSize, transferSize); + assertTrue(e.getMessage().equals(dtReason) + && e.getSQLState().equals(READ_TRUNCATION) + && e.getCause() == null + && e.getErrorCode() == dterrorCode + && e.getParameter() == parameter + && e.getRead() == onRead + && e.getDataSize() == dataSize + && e.getTransferSize() == transferSize + && e.getIndex() == negIndex); + } + + /** + * Serialize a DataTruncation and make sure you can read it back properly + */ + @Test + public void test5() throws Exception { + DataTruncation e = new DataTruncation(index, parameter, onRead, + dataSize, transferSize); + DataTruncation ex1 = createSerializedException(e); + assertTrue(e.getMessage().equals(dtReason) + && e.getSQLState().equals(READ_TRUNCATION) + && e.getCause() == null + && e.getErrorCode() == dterrorCode + && e.getParameter() == parameter + && e.getRead() == onRead + && e.getDataSize() == dataSize + && e.getTransferSize() == transferSize + && e.getIndex() == index); + } + + /** + * Validate that the ordering of the returned Exceptions is correct using + * for-each loop + */ + @Test + public void test11() { + DataTruncation ex = new DataTruncation(index, parameter, onRead, + dataSize, transferSize, t1); + DataTruncation ex1 = new DataTruncation(index, parameter, onRead, + dataSize, transferSize); + DataTruncation ex2 = new DataTruncation(index, parameter, onRead, + dataSize, transferSize, t2); + ex.setNextException(ex1); + ex.setNextException(ex2); + int num = 0; + for (Throwable e : ex) { + assertTrue(dtmsgs[num++].equals(e.getMessage())); + } + } + + /** + * Validate that the ordering of the returned Exceptions is correct using + * traditional while loop + */ + @Test + public void test12() { + DataTruncation ex = new DataTruncation(index, parameter, onRead, + dataSize, transferSize, t1); + DataTruncation ex1 = new DataTruncation(index, parameter, onRead, + dataSize, transferSize); + DataTruncation ex2 = new DataTruncation(index, parameter, onRead, + dataSize, transferSize, t2); + ex.setNextException(ex1); + ex.setNextException(ex2); + int num = 0; + SQLException sqe = ex; + while (sqe != null) { + assertTrue(dtmsgs[num++].equals(sqe.getMessage())); + Throwable c = sqe.getCause(); + while (c != null) { + assertTrue(dtmsgs[num++].equals(c.getMessage())); + c = c.getCause(); + } + sqe = sqe.getNextException(); + } + } +} diff --git a/test/java/sql/testng/test/sql/DateTests.java b/test/java/sql/testng/test/sql/DateTests.java new file mode 100644 index 000000000..ae6c276c4 --- /dev/null +++ b/test/java/sql/testng/test/sql/DateTests.java @@ -0,0 +1,373 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package test.sql; + +import java.sql.Date; +import java.time.Instant; +import java.time.LocalDate; +import static org.testng.Assert.*; +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; +import util.BaseTest; + +public class DateTests extends BaseTest { + + /* + * Validate an IllegalArgumentException is thrown for an invalid Date string + */ + @Test(dataProvider = "invalidDateValues", + expectedExceptions = IllegalArgumentException.class) + public void test(String d) throws Exception { + Date.valueOf(d); + } + + /* + * Test that a date created from a date string is equal to the value + * returned from toString() + */ + @Test(dataProvider = "validDateValues") + public void test00(String d, String expectedD) { + Date d1 = Date.valueOf(d); + Date d2 = Date.valueOf(expectedD); + assertTrue(d1.equals(d2) && d2.equals(d1) + && d1.toString().equals(expectedD), "Error d1 != d2"); + } + + /* + * Validate that a Date.after() returns false when same date is compared + */ + @Test + public void test01() { + Date d = Date.valueOf("1961-08-30"); + assertFalse(d.after(d), "Error d.after(d) = true"); + } + + /* + * Validate that a Date.after() returns true when later date is compared to + * earlier date + */ + @Test + public void test2() { + Date d = Date.valueOf("1961-08-30"); + Date d2 = new Date(System.currentTimeMillis()); + assertTrue(d2.after(d), "Error d2.after(d) = false"); + } + + /* + * Validate that a Date.after() returns false when earlier date is compared + * to later date + */ + @Test + public void test3() { + Date d = Date.valueOf("1961-08-30"); + Date d2 = new Date(d.getTime()); + assertFalse(d.after(d2), "Error d.after(d2) = true"); + } + + /* + * Validate that a Date.after() returns false when date compared to another + * date created from the original date + */ + @Test + public void test4() { + Date d = Date.valueOf("1961-08-30"); + Date d2 = new Date(d.getTime()); + assertFalse(d.after(d2), "Error d.after(d2) = true"); + assertFalse(d2.after(d), "Error d2.after(d) = true"); + } + + /* + * Validate that a Date.before() returns false when same date is compared + */ + @Test + public void test5() { + Date d = Date.valueOf("1961-08-30"); + assertFalse(d.before(d), "Error d.before(d) = true"); + } + + /* + * Validate that a Date.before() returns true when earlier date is compared + * to later date + */ + @Test + public void test6() { + Date d = Date.valueOf("1961-08-30"); + Date d2 = new Date(System.currentTimeMillis()); + assertTrue(d.before(d2), "Error d.before(d2) = false"); + } + + /* + * Validate that a Date.before() returns false when later date is compared + * to earlier date + */ + @Test + public void test7() { + Date d = Date.valueOf("1961-08-30"); + Date d2 = new Date(d.getTime()); + assertFalse(d2.before(d), "Error d2.before(d) = true"); + } + + /* + * Validate that a Date.before() returns false when date compared to another + * date created from the original date + */ + @Test + public void test8() { + Date d = Date.valueOf("1961-08-30"); + Date d2 = new Date(d.getTime()); + assertFalse(d.before(d2), "Error d.before(d2) = true"); + assertFalse(d2.before(d), "Error d2.before(d) = true"); + } + + /* + * Validate that a Date.compareTo returns 0 when both Date objects are the + * same + */ + @Test + public void test9() { + Date d = Date.valueOf("1961-08-30"); + assertTrue(d.compareTo(d) == 0, "Error d.compareTo(d) !=0"); + } + + /* + * Validate that a Date.compareTo returns 0 when both Date objects represent + * the same date + */ + @Test + public void test10() { + Date d = Date.valueOf("1961-08-30"); + Date d2 = new Date(d.getTime()); + assertTrue(d.compareTo(d2) == 0, "Error d.compareTo(d2) !=0"); + } + + /* + * Validate that a Date.compareTo returns -1 when comparing a date to a + * later date + */ + @Test + public void test11() { + Date d = Date.valueOf("1961-08-30"); + Date d2 = new Date(System.currentTimeMillis()); + assertTrue(d.compareTo(d2) == -1, "Error d.compareTo(d2) != -1"); + } + + /* + * Validate that a Date.compareTo returns 1 when comparing a date to an + * earlier date + */ + @Test + public void test12() { + Date d = Date.valueOf("1961-08-30"); + Date d2 = new Date(System.currentTimeMillis()); + assertTrue(d2.compareTo(d) == 1, "Error d.compareTo(d2) != 1"); + } + + /* + * Validate that a Date made from a LocalDate are equal + */ + @Test + public void test13() { + Date d = Date.valueOf("1961-08-30"); + LocalDate ldt = d.toLocalDate(); + Date d2 = Date.valueOf(ldt); + assertTrue(d.equals(d2), "Error d != d2"); + } + + /* + * Validate that a Date LocalDate value, made from a LocalDate are equal + */ + @Test + public void test14() { + LocalDate ldt = LocalDate.now(); + Date d = Date.valueOf(ldt); + assertTrue(ldt.equals(d.toLocalDate()), + "Error LocalDate values are not equal"); + } + + /* + * Validate an NPE occurs when a null LocalDate is passed to valueOf + */ + @Test(expectedExceptions = NullPointerException.class) + public void test15() throws Exception { + LocalDate ld = null; + Date.valueOf(ld); + } + + /* + * Validate an UnsupportedOperationException occurs when toInstant() is + * called + */ + @Test(expectedExceptions = UnsupportedOperationException.class) + public void test16() throws Exception { + Date d = Date.valueOf("1961-08-30"); + Instant instant = d.toInstant(); + } + + /* + * Validate that two Date objects are equal when one is created from the + * toString() of the other + */ + @Test + public void test17() { + Date d = Date.valueOf("1961-08-30"); + Date d2 = Date.valueOf(d.toString()); + assertTrue(d.equals(d2) && d2.equals(d), "Error d != d2"); + } + + /* + * Validate that two Date values one created using valueOf and another via a + * constructor are equal + */ + @Test + public void test18() { + + Date d = Date.valueOf("1961-08-30"); + Date d2 = new Date(61, 7, 30); + assertTrue(d.equals(d2), "Error d != d2"); + } + + /* + * Validate that two Date values one created using getTime() of the other + * are equal + */ + @Test + public void test19() { + + Date d = Date.valueOf("1961-08-30"); + Date d2 = new Date(d.getTime()); + assertTrue(d.equals(d2), "Error d != d2"); + } + + /* + * Validate that a Date value is equal to itself + */ + @Test + public void test20() { + + Date d = Date.valueOf("1961-08-30"); + assertTrue(d.equals(d), "Error d != d"); + } + + /* + * Validate an IllegalArgumentException is thrown for calling getHours + */ + @Test(expectedExceptions = IllegalArgumentException.class) + public void test21() throws Exception { + Date d = Date.valueOf("1961-08-30"); + d.getHours(); + } + + /* + * Validate an IllegalArgumentException is thrown for calling getMinutes + */ + @Test(expectedExceptions = IllegalArgumentException.class) + public void test22() throws Exception { + Date d = Date.valueOf("1961-08-30"); + d.getMinutes(); + } + + /* + * Validate an IllegalArgumentException is thrown for calling getSeconds + */ + @Test(expectedExceptions = IllegalArgumentException.class) + public void test23() throws Exception { + Date d = Date.valueOf("1961-08-30"); + d.getSeconds(); + } + + /* + * Validate an IllegalArgumentException is thrown for calling setHours + */ + @Test(expectedExceptions = IllegalArgumentException.class) + public void test24() throws Exception { + Date d = Date.valueOf("1961-08-30"); + d.setHours(8); + } + + /* + * Validate an IllegalArgumentException is thrown for calling setMinutes + */ + @Test(expectedExceptions = IllegalArgumentException.class) + public void test25() throws Exception { + Date d = Date.valueOf("1961-08-30"); + d.setMinutes(0); + } + + /* + * Validate an IllegalArgumentException is thrown for calling setSeconds + */ + @Test(expectedExceptions = IllegalArgumentException.class) + public void test26() throws Exception { + Date d = Date.valueOf("1961-08-30"); + d.setSeconds(0); + } + + /* + * DataProvider used to provide Date which are not valid and are used + * to validate that an IllegalArgumentException will be thrown from the + * valueOf method + */ + @DataProvider(name = "invalidDateValues") + private Object[][] invalidDateValues() { + return new Object[][]{ + {"20009-11-01"}, + {"09-11-01"}, + {"-11-01"}, + {"2009-111-01"}, + {"2009--01"}, + {"2009-13-01"}, + {"2009-11-011"}, + {"2009-11-"}, + {"2009-11-00"}, + {"2009-11-33"}, + {"--"}, + {""}, + {null}, + {"-"}, + {"2009"}, + {"2009-01"}, + {"---"}, + {"2009-13--1"}, + {"1900-1-0"}, + {"2009-01-01 10:50:01"}, + {"1996-12-10 12:26:19.1"}, + {"10:50:01"} + }; + } + + /* + * DataProvider used to provide Dates which are valid and are used + * to validate that an IllegalArgumentException will not be thrown from the + * valueOf method and the corect value from toString() is returned + */ + @DataProvider(name = "validDateValues") + private Object[][] validDateValues() { + return new Object[][]{ + {"2009-08-30", "2009-08-30"}, + {"2009-01-8", "2009-01-08"}, + {"2009-1-01", "2009-01-01"}, + {"2009-1-1", "2009-01-01"} + + }; + } +} diff --git a/test/java/sql/testng/test/sql/DriverManagerPermissionsTests.java b/test/java/sql/testng/test/sql/DriverManagerPermissionsTests.java new file mode 100644 index 000000000..73a8923d8 --- /dev/null +++ b/test/java/sql/testng/test/sql/DriverManagerPermissionsTests.java @@ -0,0 +1,154 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package test.sql; + +import java.security.AccessControlException; +import java.security.Policy; +import java.sql.DriverManager; +import java.sql.SQLException; +import org.testng.annotations.AfterClass; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; +import util.BaseTest; +import util.StubDriver; +import util.TestPolicy; + +public class DriverManagerPermissionsTests extends BaseTest { + + private static Policy policy; + private static SecurityManager sm; + + /* + * Install a SecurityManager along with a base Policy to allow testNG to run + */ + @BeforeClass + public static void setUpClass() throws Exception { + setPolicy(new TestPolicy()); + System.setSecurityManager(new SecurityManager()); + } + + /* + * Install the original Policy and SecurityManager + */ + @AfterClass + public static void tearDownClass() throws Exception { + System.setSecurityManager(sm); + setPolicy(policy); + } + + /* + * Save off the original Policy and SecurityManager + */ + public DriverManagerPermissionsTests() { + policy = Policy.getPolicy(); + sm = System.getSecurityManager(); + } + + /* + * Validate that AccessControlException is thrown if SQLPermission("setLog") + * has not been granted + */ + @Test(expectedExceptions = AccessControlException.class) + public void test() { + setPolicy(new TestPolicy()); + DriverManager.setLogStream(null); + } + + /* + * Validate that setLogStream succeeds if SQLPermission("setLog") has been + * granted + */ + @Test + public void test1() { + Policy.setPolicy(new TestPolicy("setLog")); + DriverManager.setLogStream(null); + } + + /* + * Validate that setLogStream succeeds if AllPermissions has been granted + */ + @Test + public void test2() { + setPolicy(new TestPolicy("all")); + DriverManager.setLogStream(null); + } + + /* + * Validate that AccessControlException is thrown if SQLPermission("setLog") + * has not been granted + */ + @Test(expectedExceptions = AccessControlException.class) + public void test4() { + setPolicy(new TestPolicy()); + DriverManager.setLogWriter(null); + } + + /* + * Validate that setLogWriter succeeds if SQLPermission("setLog") has been + * granted + */ + @Test + public void test5() { + setPolicy(new TestPolicy("setLog")); + DriverManager.setLogWriter(null); + } + + /* + * Validate that setLogWriter succeeds if AllPermissions has been granted + */ + @Test + public void test6() { + setPolicy(new TestPolicy("all")); + DriverManager.setLogWriter(null); + } + + /* + * Validate that AccessControlException is thrown if + * SQLPermission("deregisterDriver") has not been granted + */ + @Test(expectedExceptions = AccessControlException.class) + public void test7() throws SQLException { + setPolicy(new TestPolicy()); + DriverManager.deregisterDriver(new StubDriver()); + } + + /* + * Validate that deregisterDriver succeeds if + * SQLPermission("deregisterDriver") has been granted + */ + @Test + public void test8() throws SQLException { + setPolicy(new TestPolicy("deregisterDriver")); + DriverManager.deregisterDriver(new StubDriver()); + } + + /* + * Validate that deregisterDriver succeeds if AllPermissions has been + * granted + */ + @Test + public void test9() throws SQLException { + setPolicy(new TestPolicy("all")); + DriverManager.deregisterDriver(new StubDriver()); + } +} diff --git a/test/java/sql/testng/test/sql/DriverManagerTests.java b/test/java/sql/testng/test/sql/DriverManagerTests.java new file mode 100644 index 000000000..938f23e38 --- /dev/null +++ b/test/java/sql/testng/test/sql/DriverManagerTests.java @@ -0,0 +1,354 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package test.sql; + +import java.io.BufferedReader; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.CharArrayReader; +import java.io.CharArrayWriter; +import java.io.File; +import java.io.InputStreamReader; +import java.io.PrintStream; +import java.io.PrintWriter; +import java.sql.Driver; +import java.sql.DriverManager; +import java.sql.SQLException; +import java.util.Properties; +import static org.testng.Assert.*; +import org.testng.annotations.AfterClass; +import org.testng.annotations.AfterMethod; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; +import util.StubDriver; + +public class DriverManagerTests { + + private final String StubDriverURL = "jdbc:tennis:boy"; + private final String StubDriverDAURL = "jdbc:luckydog:tennis"; + private final String InvalidURL = "jdbc:cardio:tennis"; + private String[] results = {"output", "more output", "and more", "the end"}; + private String noOutput = "should not find this"; + + public DriverManagerTests() { + } + + @BeforeClass + public static void setUpClass() throws Exception { + } + + @AfterClass + public static void tearDownClass() throws Exception { + } + + @BeforeMethod + public void setUpMethod() throws Exception { + removeAllDrivers(); + } + + @AfterMethod + public void tearDownMethod() throws Exception { + } + + /** + * Utility method to remove all registered drivers + */ + private static void removeAllDrivers() { + java.util.Enumeration e = DriverManager.getDrivers(); + while (e.hasMoreElements()) { + try { + DriverManager.deregisterDriver((Driver) (e.nextElement())); + } catch (SQLException ex) { + System.out.print(ex.getMessage()); + } + } + } + + /** + * Utility method to see if a driver is registered + */ + private boolean isDriverRegistered(Driver d) { + boolean foundDriver = false; + java.util.Enumeration e = DriverManager.getDrivers(); + while (e.hasMoreElements()) { + if (d == (Driver) e.nextElement()) { + foundDriver = true; + break; + } + } + return foundDriver; + } + + /** + * Validate that values set using setLoginTimeout will be returned by + * getLoginTimeout + */ + @Test + public void test() { + int[] vals = {-1, 0, 5}; + for (int val : vals) { + DriverManager.setLoginTimeout(val); + assertEquals(val, DriverManager.getLoginTimeout()); + } + } + + /** + * Validate that NullPointerException is thrown when null is passed to + * registerDriver + */ + @Test(expectedExceptions = NullPointerException.class) + public void test1() throws Exception { + Driver d = null; + DriverManager.registerDriver(d); + } + + /** + * Validate that NullPointerException is thrown when null is passed to + * registerDriver + */ + @Test(expectedExceptions = NullPointerException.class) + public void test2() throws Exception { + Driver d = null; + DriverManager.registerDriver(d, null); + } + + /** + * Validate that a null value allows for deRegisterDriver to return + */ + @Test + public void test3() throws Exception { + DriverManager.deregisterDriver(null); + + } + + /** + * Validate that SQLException is thrown when there is no Driver to service + * the URL + */ + @Test(expectedExceptions = SQLException.class) + public void test4() throws Exception { + DriverManager.getConnection(InvalidURL); + } + + /** + * Validate that SQLException is thrown when there is no Driver to service + * the URL + */ + @Test(expectedExceptions = SQLException.class) + public void test5() throws Exception { + DriverManager.getConnection(InvalidURL, new Properties()); + } + + /** + * Validate that SQLException is thrown when there is no Driver to service + * the URL + */ + @Test(expectedExceptions = SQLException.class) + public void test6() throws Exception { + DriverManager.getConnection(InvalidURL, "LuckyDog", "tennisanyone"); + } + + /** + * Validate that SQLException is thrown when null is passed for the URL + */ + @Test(expectedExceptions = SQLException.class) + public void test7() throws Exception { + DriverManager.getConnection(null); + } + + /** + * Validate that SQLException is thrown when null is passed for the URL + */ + @Test(expectedExceptions = SQLException.class) + public void test8() throws Exception { + DriverManager.getConnection(null, new Properties()); + } + + /** + * Validate that SQLException is thrown when null is passed for the URL + */ + @Test(expectedExceptions = SQLException.class) + public void test9() throws Exception { + DriverManager.getConnection(null, "LuckyDog", "tennisanyone"); + } + + /** + * Validate that SQLException is thrown when there is no Driver to service + * the URL + */ + @Test(expectedExceptions = SQLException.class) + public void test10() throws Exception { + DriverManager.getDriver(InvalidURL); + } + + /** + * Validate that SQLException is thrown when null is passed for the URL + */ + @Test(expectedExceptions = SQLException.class) + public void test11() throws Exception { + DriverManager.getDriver(null); + } + + /** + * Validate that a non-null Driver is returned by getDriver when a valid URL + * is specified + */ + @Test + public void test12() throws Exception { + + DriverManager.registerDriver(new StubDriver()); + assertTrue(DriverManager.getDriver(StubDriverURL) != null); + } + + /** + * Validate that SQLException is thrown when the URL is not valid for any of + * the registered drivers + */ + @Test(expectedExceptions = SQLException.class) + public void test13() throws Exception { + DriverManager.registerDriver(new StubDriver()); + DriverManager.getDriver(InvalidURL); + } + + /** + * Validate that a Connection object is returned when a valid URL is + * specified to getConnection + * + */ + @Test + public void test14() throws Exception { + + DriverManager.registerDriver(new StubDriver()); + assertTrue( + DriverManager.getConnection(StubDriverURL) != null); + assertTrue(DriverManager.getConnection(StubDriverURL, + "LuckyDog", "tennisanyone") != null); + Properties props = new Properties(); + props.put("user", "LuckyDog"); + props.put("password", "tennisanyone"); + assertTrue( + DriverManager.getConnection(StubDriverURL, + props) != null); + } + + /** + * Register a driver and make sure you find it via its URL. Deregister the + * driver and validate it is not longer registered + * + * @throws Exception + */ + @Test() + public void test15() throws Exception { + DriverManager.registerDriver(new StubDriver()); + Driver d = DriverManager.getDriver(StubDriverURL); + assertTrue(d != null); + assertTrue(isDriverRegistered(d)); + DriverManager.deregisterDriver(d); + assertFalse(isDriverRegistered(d)); + } + + /** + * Validate that DriverAction.release is called when a driver is registered + * via registerDriver(Driver, DriverAction) + * + * @throws Exception + */ + @Test + public void test16() throws Exception { + File file = new File(util.StubDriverDA.DriverActionCalled); + file.delete(); + assertFalse(file.exists()); + Driver d = null; + Class.forName("util.StubDriverDA"); + d = DriverManager.getDriver(StubDriverDAURL); + DriverManager.deregisterDriver(d); + assertFalse(isDriverRegistered(d), "Driver is registered"); + assertTrue(file.exists()); + } + + /** + * Create a PrintStream and use to send output via DriverManager.println + * Validate that if you disable the stream, the output sent is not present + */ + @Test + public void tests17() throws Exception { + ByteArrayOutputStream os = new ByteArrayOutputStream(); + PrintStream ps = new PrintStream(os); + DriverManager.setLogStream(ps); + assertTrue(DriverManager.getLogStream() == ps); + + DriverManager.println(results[0]); + DriverManager.setLogStream((PrintStream) null); + assertTrue(DriverManager.getLogStream() == null); + DriverManager.println(noOutput); + DriverManager.setLogStream(ps); + DriverManager.println(results[1]); + DriverManager.println(results[2]); + DriverManager.println(results[3]); + DriverManager.setLogStream((PrintStream) null); + DriverManager.println(noOutput); + + /* + * Check we do not get the output when the stream is disabled + */ + InputStreamReader is + = new InputStreamReader(new ByteArrayInputStream(os.toByteArray())); + BufferedReader reader = new BufferedReader(is); + for (String result : results) { + assertTrue(result.equals(reader.readLine())); + } + } + + /** + * Create a PrintWriter and use to to send output via DriverManager.println + * Validate that if you disable the writer, the output sent is not present + */ + @Test + public void tests18() throws Exception { + CharArrayWriter cw = new CharArrayWriter(); + PrintWriter pw = new PrintWriter(cw); + DriverManager.setLogWriter(pw); + assertTrue(DriverManager.getLogWriter() == pw); + + DriverManager.println(results[0]); + DriverManager.setLogWriter(null); + assertTrue(DriverManager.getLogWriter() == null); + DriverManager.println(noOutput); + DriverManager.setLogWriter(pw); + DriverManager.println(results[1]); + DriverManager.println(results[2]); + DriverManager.println(results[3]); + DriverManager.setLogWriter(null); + DriverManager.println(noOutput); + + /* + * Check we do not get the output when the stream is disabled + */ + BufferedReader reader + = new BufferedReader(new CharArrayReader(cw.toCharArray())); + for (String result : results) { + assertTrue(result.equals(reader.readLine())); + } + } +} diff --git a/test/java/sql/testng/test/sql/SQLClientInfoExceptionTests.java b/test/java/sql/testng/test/sql/SQLClientInfoExceptionTests.java new file mode 100644 index 000000000..84230b867 --- /dev/null +++ b/test/java/sql/testng/test/sql/SQLClientInfoExceptionTests.java @@ -0,0 +1,227 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package test.sql; + +import java.sql.ClientInfoStatus; +import java.sql.SQLClientInfoException; +import java.sql.SQLException; +import java.util.HashMap; +import static org.testng.Assert.*; +import org.testng.annotations.Test; +import util.BaseTest; + +public class SQLClientInfoExceptionTests extends BaseTest { + + private final HashMap map = new HashMap<>(); + + public SQLClientInfoExceptionTests() { + map.put("1", ClientInfoStatus.REASON_UNKNOWN_PROPERTY); + map.put("21", ClientInfoStatus.REASON_UNKNOWN_PROPERTY); + } + + /** + * Create SQLClientInfoException and setting all objects to null + */ + @Test + public void test() { + SQLClientInfoException e = new SQLClientInfoException(null); + assertTrue(e.getMessage() == null && e.getSQLState() == null + && e.getCause() == null && e.getErrorCode() == 0 + && e.getFailedProperties() == null); + } + + /** + * Create SQLClientInfoException with no-arg constructor + */ + @Test + public void test1() { + SQLClientInfoException ex = new SQLClientInfoException(); + assertTrue(ex.getMessage() == null + && ex.getSQLState() == null + && ex.getCause() == null + && ex.getErrorCode() == 0 + && ex.getFailedProperties() == null); + } + + /** + * Create SQLClientInfoException with null Throwable + */ + @Test + public void test2() { + + SQLClientInfoException ex = new SQLClientInfoException(map, null); + assertTrue(ex.getMessage() == null + && ex.getSQLState() == null + && ex.getCause() == null + && ex.getErrorCode() == 0 + && ex.getFailedProperties().equals(map)); + } + + /** + * Create SQLClientInfoException with message + */ + @Test + public void test3() { + SQLClientInfoException ex = new SQLClientInfoException(reason, map); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState() == null + && ex.getCause() == null + && ex.getErrorCode() == 0 + && ex.getFailedProperties().equals(map)); + } + + /** + * Create SQLClientInfoException with null Throwable + */ + @Test + public void test4() { + SQLClientInfoException ex = new SQLClientInfoException(reason, map, null); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState() == null + && ex.getCause() == null + && ex.getErrorCode() == 0 + && ex.getFailedProperties().equals(map)); + } + + /** + * Create SQLClientInfoException with message, and SQLState + */ + @Test + public void test5() { + SQLClientInfoException ex = new SQLClientInfoException(reason, state, + map); + + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState().equals(state) + && ex.getCause() == null + && ex.getErrorCode() == 0 + && ex.getFailedProperties().equals(map)); + } + + /** + * Create SQLClientInfoException with message, and SQLState + */ + @Test + public void test6() { + SQLClientInfoException ex = new SQLClientInfoException(reason, state, + map, t); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState().equals(state) + && cause.equals(ex.getCause().toString()) + && ex.getErrorCode() == 0 + && ex.getFailedProperties().equals(map)); + } + + /** + * Create SQLClientInfoException with message, SQLState, errorCode, and + * Throwable + */ + @Test + public void test7() { + SQLClientInfoException ex = new SQLClientInfoException(reason, state, + errorCode, map); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState().equals(state) + && ex.getCause() == null + && ex.getErrorCode() == errorCode + && ex.getFailedProperties().equals(map)); + } + + /** + * Create SQLClientInfoException with message, SQLState, and error code + */ + @Test + public void test8() { + SQLClientInfoException ex = new SQLClientInfoException(reason, state, + errorCode, map, t); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState().equals(state) + && cause.equals(ex.getCause().toString()) + && ex.getErrorCode() == errorCode + && ex.getFailedProperties().equals(map)); + } + + /** + * Serialize a SQLClientInfoException and make sure you can read it back + * properly + */ + @Test + public void test10() throws Exception { + SQLClientInfoException e = new SQLClientInfoException(reason, state, + errorCode, map, t); + SQLClientInfoException ex1 = + createSerializedException(e); + assertTrue(reason.equals(ex1.getMessage()) + && ex1.getSQLState().equals(state) + && cause.equals(ex1.getCause().toString()) + && ex1.getErrorCode() == errorCode + && ex1.getFailedProperties().equals(map)); + } + + /** + * Validate that the ordering of the returned Exceptions is correct using + * for-each loop + */ + @Test + public void test11() { + SQLClientInfoException ex = new SQLClientInfoException("Exception 1", + map, t1); + SQLClientInfoException ex1 = new SQLClientInfoException("Exception 2", + map); + SQLClientInfoException ex2 = new SQLClientInfoException("Exception 3", + map, t2); + ex.setNextException(ex1); + ex.setNextException(ex2); + int num = 0; + for (Throwable e : ex) { + assertTrue(msgs[num++].equals(e.getMessage())); + } + } + + /** + * Validate that the ordering of the returned Exceptions is correct using + * traditional while loop + */ + @Test + public void test12() { + SQLClientInfoException ex = new SQLClientInfoException("Exception 1", + map, t1); + SQLClientInfoException ex1 = new SQLClientInfoException("Exception 2", + map); + SQLClientInfoException ex2 = new SQLClientInfoException("Exception 3", + map, t2); + ex.setNextException(ex1); + ex.setNextException(ex2); + int num = 0; + SQLException sqe = ex; + while (sqe != null) { + assertTrue(msgs[num++].equals(sqe.getMessage())); + Throwable c = sqe.getCause(); + while (c != null) { + assertTrue(msgs[num++].equals(c.getMessage())); + c = c.getCause(); + } + sqe = sqe.getNextException(); + } + } +} diff --git a/test/java/sql/testng/test/sql/SQLDataExceptionTests.java b/test/java/sql/testng/test/sql/SQLDataExceptionTests.java new file mode 100644 index 000000000..8a5f8d1a2 --- /dev/null +++ b/test/java/sql/testng/test/sql/SQLDataExceptionTests.java @@ -0,0 +1,215 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package test.sql; + +import java.sql.SQLDataException; +import java.sql.SQLException; +import java.sql.SQLNonTransientException; +import static org.testng.Assert.*; +import org.testng.annotations.Test; +import util.BaseTest; + +public class SQLDataExceptionTests extends BaseTest { + + /** + * Create SQLDataException and setting all objects to null + */ + @Test + public void test() { + SQLDataException e = new SQLDataException(null, null, errorCode, null); + assertTrue(e.getMessage() == null && e.getSQLState() == null + && e.getCause() == null && e.getErrorCode() == errorCode); + } + + /** + * Create SQLDataException with no-arg constructor + */ + @Test + public void test1() { + SQLDataException ex = new SQLDataException(); + assertTrue(ex.getMessage() == null + && ex.getSQLState() == null + && ex.getCause() == null + && ex.getErrorCode() == 0); + } + + /** + * Create SQLDataException with message + */ + @Test + public void test2() { + SQLDataException ex = new SQLDataException(reason); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState() == null + && ex.getCause() == null + && ex.getErrorCode() == 0); + } + + /** + * Create SQLDataException with message, and SQLState + */ + @Test + public void test3() { + SQLDataException ex = new SQLDataException(reason, state); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState().equals(state) + && ex.getCause() == null + && ex.getErrorCode() == 0); + } + + /** + * Create SQLDataException with message, SQLState, and error code + */ + @Test + public void test4() { + SQLDataException ex = new SQLDataException(reason, state, errorCode); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState().equals(state) + && ex.getCause() == null + && ex.getErrorCode() == errorCode); + } + + /** + * Create SQLDataException with message, SQLState, errorCode, and Throwable + */ + @Test + public void test5() { + SQLDataException ex = new SQLDataException(reason, state, errorCode, t); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState().equals(state) + && cause.equals(ex.getCause().toString()) + && ex.getErrorCode() == errorCode); + } + + /** + * Create SQLDataException with message, SQLState, and Throwable + */ + @Test + public void test6() { + SQLDataException ex = new SQLDataException(reason, state, t); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState().equals(state) + && cause.equals(ex.getCause().toString()) + && ex.getErrorCode() == 0); + } + + /** + * Create SQLDataException with message, and Throwable + */ + @Test + public void test7() { + SQLDataException ex = new SQLDataException(reason, t); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState() == null + && cause.equals(ex.getCause().toString()) + && ex.getErrorCode() == 0); + } + + /** + * Create SQLDataException with null Throwable + */ + @Test + public void test8() { + SQLDataException ex = new SQLDataException((Throwable)null); + assertTrue(ex.getMessage() == null + && ex.getSQLState() == null + && ex.getCause() == null + && ex.getErrorCode() == 0); + } + + /** + * Create SQLDataException with Throwable + */ + @Test + public void test9() { + SQLDataException ex = new SQLDataException(t); + assertTrue(ex.getMessage().equals(cause) + && ex.getSQLState() == null + && cause.equals(ex.getCause().toString()) + && ex.getErrorCode() == 0); + } + + /** + * Serialize a SQLDataException and make sure you can read it back properly + */ + @Test + public void test10() throws Exception { + SQLDataException e = new SQLDataException(reason, state, errorCode, t); + SQLDataException ex1 = createSerializedException(e); + assertTrue(reason.equals(ex1.getMessage()) + && ex1.getSQLState().equals(state) + && cause.equals(ex1.getCause().toString()) + && ex1.getErrorCode() == errorCode); + } + + /** + * Validate that the ordering of the returned Exceptions is correct + * using for-each loop + */ + @Test + public void test11() { + SQLDataException ex = new SQLDataException("Exception 1", t1); + SQLDataException ex1 = new SQLDataException("Exception 2"); + SQLDataException ex2 = new SQLDataException("Exception 3", t2); + ex.setNextException(ex1); + ex.setNextException(ex2); + int num = 0; + for (Throwable e : ex) { + assertTrue(msgs[num++].equals(e.getMessage())); + } + } + + /** + * Validate that the ordering of the returned Exceptions is correct + * using traditional while loop + */ + @Test + public void test12() { + SQLDataException ex = new SQLDataException("Exception 1", t1); + SQLDataException ex1 = new SQLDataException("Exception 2"); + SQLDataException ex2 = new SQLDataException("Exception 3", t2); + ex.setNextException(ex1); + ex.setNextException(ex2); + int num = 0; + SQLException sqe = ex; + while (sqe != null) { + assertTrue(msgs[num++].equals(sqe.getMessage())); + Throwable c = sqe.getCause(); + while (c != null) { + assertTrue(msgs[num++].equals(c.getMessage())); + c = c.getCause(); + } + sqe = sqe.getNextException(); + } + } + + /** + * Create SQLDataException and validate it is an instance of + * SQLNonTransientException + */ + @Test + public void test13() { + Exception ex = new SQLDataException(); + assertTrue(ex instanceof SQLNonTransientException); + } +} diff --git a/test/java/sql/testng/test/sql/SQLExceptionTests.java b/test/java/sql/testng/test/sql/SQLExceptionTests.java new file mode 100644 index 000000000..e3643ef11 --- /dev/null +++ b/test/java/sql/testng/test/sql/SQLExceptionTests.java @@ -0,0 +1,202 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package test.sql; + +import java.sql.SQLException; +import static org.testng.Assert.*; +import org.testng.annotations.Test; +import util.BaseTest; + +public class SQLExceptionTests extends BaseTest { + + /** + * Create SQLException and setting all objects to null + */ + @Test + public void test() { + SQLException e = new SQLException(null, null, errorCode, null); + assertTrue(e.getMessage() == null && e.getSQLState() == null + && e.getCause() == null && e.getErrorCode() == errorCode); + } + + /** + * Create SQLException with no-arg constructor + */ + @Test + public void test1() { + SQLException ex = new SQLException(); + assertTrue(ex.getMessage() == null + && ex.getSQLState() == null + && ex.getCause() == null + && ex.getErrorCode() == 0); + } + + /** + * Create SQLException with message + */ + @Test + public void test2() { + SQLException ex = new SQLException(reason); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState() == null + && ex.getCause() == null + && ex.getErrorCode() == 0); + } + + /** + * Create SQLException with message, and SQLState + */ + @Test + public void test3() { + SQLException ex = new SQLException(reason, state); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState().equals(state) + && ex.getCause() == null + && ex.getErrorCode() == 0); + } + + /** + * Create SQLException with message, SQLState, and error code + */ + @Test + public void test4() { + SQLException ex = new SQLException(reason, state, errorCode); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState().equals(state) + && ex.getCause() == null + && ex.getErrorCode() == errorCode); + } + + /** + * Create SQLException with message, SQLState, errorCode, and Throwable + */ + @Test + public void test5() { + SQLException ex = new SQLException(reason, state, errorCode, t); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState().equals(state) + && cause.equals(ex.getCause().toString()) + && ex.getErrorCode() == errorCode); + } + + /** + * Create SQLException with message, SQLState, and Throwable + */ + @Test + public void test6() { + SQLException ex = new SQLException(reason, state, t); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState().equals(state) + && cause.equals(ex.getCause().toString()) + && ex.getErrorCode() == 0); + } + + /** + * Create SQLException with message, and Throwable + */ + @Test + public void test7() { + SQLException ex = new SQLException(reason, t); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState() == null + && cause.equals(ex.getCause().toString()) + && ex.getErrorCode() == 0); + } + + /** + * Create SQLException with null Throwable + */ + @Test + public void test8() { + SQLException ex = new SQLException((Throwable)null); + assertTrue(ex.getMessage() == null + && ex.getSQLState() == null + && ex.getCause() == null + && ex.getErrorCode() == 0); + } + + /** + * Create SQLException with Throwable + */ + @Test + public void test9() { + SQLException ex = new SQLException(t); + assertTrue(ex.getMessage().equals(cause) + && ex.getSQLState() == null + && cause.equals(ex.getCause().toString()) + && ex.getErrorCode() == 0); + } + + /** + * Serialize a SQLException and make sure you can read it back properly + */ + @Test + public void test10() throws Exception { + SQLException e = new SQLException(reason, state, errorCode, t); + SQLException ex1 = createSerializedException(e); + assertTrue(reason.equals(ex1.getMessage()) + && ex1.getSQLState().equals(state) + && cause.equals(ex1.getCause().toString()) + && ex1.getErrorCode() == errorCode); + } + + /** + * Validate that the ordering of the returned Exceptions is correct + * using for-each loop + */ + @Test + public void test11() { + SQLException ex = new SQLException("Exception 1", t1); + SQLException ex1 = new SQLException("Exception 2"); + SQLException ex2 = new SQLException("Exception 3", t2); + ex.setNextException(ex1); + ex.setNextException(ex2); + int num = 0; + for (Throwable e : ex) { + assertTrue(msgs[num++].equals(e.getMessage())); + } + } + + /** + * Validate that the ordering of the returned Exceptions is correct + * using traditional while loop + */ + @Test + public void test12() { + SQLException ex = new SQLException("Exception 1", t1); + SQLException ex1 = new SQLException("Exception 2"); + SQLException ex2 = new SQLException("Exception 3", t2); + ex.setNextException(ex1); + ex.setNextException(ex2); + int num = 0; + while (ex != null) { + assertTrue(msgs[num++].equals(ex.getMessage())); + Throwable c = ex.getCause(); + while (c != null) { + assertTrue(msgs[num++].equals(c.getMessage())); + c = c.getCause(); + } + ex = ex.getNextException(); + } + } +} diff --git a/test/java/sql/testng/test/sql/SQLFeatureNotSupportedExceptionTests.java b/test/java/sql/testng/test/sql/SQLFeatureNotSupportedExceptionTests.java new file mode 100644 index 000000000..5b9589441 --- /dev/null +++ b/test/java/sql/testng/test/sql/SQLFeatureNotSupportedExceptionTests.java @@ -0,0 +1,232 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package test.sql; + +import java.sql.SQLException; +import java.sql.SQLFeatureNotSupportedException; +import java.sql.SQLNonTransientException; +import static org.testng.Assert.*; +import org.testng.annotations.Test; +import util.BaseTest; + +public class SQLFeatureNotSupportedExceptionTests extends BaseTest { + + /** + * Create SQLFeatureNotSupportedException and setting all objects to null + */ + @Test + public void test() { + SQLFeatureNotSupportedException e = + new SQLFeatureNotSupportedException(null, null, errorCode, null); + assertTrue(e.getMessage() == null && e.getSQLState() == null + && e.getCause() == null && e.getErrorCode() == errorCode); + } + + /** + * Create SQLFeatureNotSupportedException with no-arg constructor + */ + @Test + public void test1() { + SQLFeatureNotSupportedException ex = new SQLFeatureNotSupportedException(); + assertTrue(ex.getMessage() == null + && ex.getSQLState() == null + && ex.getCause() == null + && ex.getErrorCode() == 0); + } + + /** + * Create SQLFeatureNotSupportedException with message + */ + @Test + public void test2() { + SQLFeatureNotSupportedException ex = + new SQLFeatureNotSupportedException(reason); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState() == null + && ex.getCause() == null + && ex.getErrorCode() == 0); + } + + /** + * Create SQLFeatureNotSupportedException with message, and SQLState + */ + @Test + public void test3() { + SQLFeatureNotSupportedException ex = + new SQLFeatureNotSupportedException(reason, state); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState().equals(state) + && ex.getCause() == null + && ex.getErrorCode() == 0); + } + + /** + * Create SQLFeatureNotSupportedException with message, SQLState, and error code + */ + @Test + public void test4() { + SQLFeatureNotSupportedException ex = + new SQLFeatureNotSupportedException(reason, state, errorCode); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState().equals(state) + && ex.getCause() == null + && ex.getErrorCode() == errorCode); + } + + /** + * Create SQLFeatureNotSupportedException with message, SQLState, errorCode, and Throwable + */ + @Test + public void test5() { + SQLFeatureNotSupportedException ex = + new SQLFeatureNotSupportedException(reason, state, errorCode, t); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState().equals(state) + && cause.equals(ex.getCause().toString()) + && ex.getErrorCode() == errorCode); + } + + /** + * Create SQLFeatureNotSupportedException with message, SQLState, and Throwable + */ + @Test + public void test6() { + SQLFeatureNotSupportedException ex = + new SQLFeatureNotSupportedException(reason, state, t); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState().equals(state) + && cause.equals(ex.getCause().toString()) + && ex.getErrorCode() == 0); + } + + /** + * Create SQLFeatureNotSupportedException with message, and Throwable + */ + @Test + public void test7() { + SQLFeatureNotSupportedException ex = + new SQLFeatureNotSupportedException(reason, t); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState() == null + && cause.equals(ex.getCause().toString()) + && ex.getErrorCode() == 0); + } + + /** + * Create SQLFeatureNotSupportedException with null Throwable + */ + @Test + public void test8() { + SQLFeatureNotSupportedException ex = + new SQLFeatureNotSupportedException((Throwable) null); + assertTrue(ex.getMessage() == null + && ex.getSQLState() == null + && ex.getCause() == null + && ex.getErrorCode() == 0); + } + + /** + * Create SQLFeatureNotSupportedException with Throwable + */ + @Test + public void test9() { + SQLFeatureNotSupportedException ex = + new SQLFeatureNotSupportedException(t); + assertTrue(ex.getMessage().equals(cause) + && ex.getSQLState() == null + && cause.equals(ex.getCause().toString()) + && ex.getErrorCode() == 0); + } + + /** + * Serialize a SQLFeatureNotSupportedException and make sure you can read it back properly + */ + @Test + public void test10() throws Exception { + SQLFeatureNotSupportedException e = + new SQLFeatureNotSupportedException(reason, state, errorCode, t); + SQLFeatureNotSupportedException ex1 = + createSerializedException(e); + assertTrue(reason.equals(ex1.getMessage()) + && ex1.getSQLState().equals(state) + && cause.equals(ex1.getCause().toString()) + && ex1.getErrorCode() == errorCode); + } + + /** + * Validate that the ordering of the returned Exceptions is correct + * using for-each loop + */ + @Test + public void test11() { + SQLFeatureNotSupportedException ex = + new SQLFeatureNotSupportedException("Exception 1", t1); + SQLFeatureNotSupportedException ex1 = + new SQLFeatureNotSupportedException("Exception 2"); + SQLFeatureNotSupportedException ex2 = + new SQLFeatureNotSupportedException("Exception 3", t2); + ex.setNextException(ex1); + ex.setNextException(ex2); + int num = 0; + for (Throwable e : ex) { + assertTrue(msgs[num++].equals(e.getMessage())); + } + } + + /** + * Validate that the ordering of the returned Exceptions is correct + * using traditional while loop + */ + @Test + public void test12() { + SQLFeatureNotSupportedException ex = + new SQLFeatureNotSupportedException("Exception 1", t1); + SQLFeatureNotSupportedException ex1 = + new SQLFeatureNotSupportedException("Exception 2"); + SQLFeatureNotSupportedException ex2 = + new SQLFeatureNotSupportedException("Exception 3", t2); + ex.setNextException(ex1); + ex.setNextException(ex2); + int num = 0; + SQLException sqe = ex; + while (sqe != null) { + assertTrue(msgs[num++].equals(sqe.getMessage())); + Throwable c = sqe.getCause(); + while (c != null) { + assertTrue(msgs[num++].equals(c.getMessage())); + c = c.getCause(); + } + sqe = sqe.getNextException(); + } + } + + /** + * Create SQLFeatureNotSupportedException and validate it is an instance of + * SQLNonTransientException + */ + @Test + public void test13() { + Exception ex = new SQLFeatureNotSupportedException(); + assertTrue(ex instanceof SQLNonTransientException); + } +} diff --git a/test/java/sql/testng/test/sql/SQLIntegrityConstraintViolationExceptionTests.java b/test/java/sql/testng/test/sql/SQLIntegrityConstraintViolationExceptionTests.java new file mode 100644 index 000000000..082e0af15 --- /dev/null +++ b/test/java/sql/testng/test/sql/SQLIntegrityConstraintViolationExceptionTests.java @@ -0,0 +1,235 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package test.sql; + +import java.sql.SQLException; +import java.sql.SQLIntegrityConstraintViolationException; +import java.sql.SQLNonTransientException; +import static org.testng.Assert.*; +import org.testng.annotations.Test; +import util.BaseTest; + +public class SQLIntegrityConstraintViolationExceptionTests extends BaseTest { + + /** + * Create SQLIntegrityConstraintViolationException and setting all objects to null + */ + @Test + public void test() { + SQLIntegrityConstraintViolationException e = + new SQLIntegrityConstraintViolationException(null, + null, errorCode, null); + assertTrue(e.getMessage() == null && e.getSQLState() == null + && e.getCause() == null && e.getErrorCode() == errorCode); + } + + /** + * Create SQLIntegrityConstraintViolationException with no-arg constructor + */ + @Test + public void test1() { + SQLIntegrityConstraintViolationException ex = + new SQLIntegrityConstraintViolationException(); + assertTrue(ex.getMessage() == null + && ex.getSQLState() == null + && ex.getCause() == null + && ex.getErrorCode() == 0); + } + + /** + * Create SQLIntegrityConstraintViolationException with message + */ + @Test + public void test2() { + SQLIntegrityConstraintViolationException ex = + new SQLIntegrityConstraintViolationException(reason); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState() == null + && ex.getCause() == null + && ex.getErrorCode() == 0); + } + + /** + * Create SQLIntegrityConstraintViolationException with message, and SQLState + */ + @Test + public void test3() { + SQLIntegrityConstraintViolationException ex = + new SQLIntegrityConstraintViolationException(reason, state); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState().equals(state) + && ex.getCause() == null + && ex.getErrorCode() == 0); + } + + /** + * Create SQLIntegrityConstraintViolationException with message, SQLState, and error code + */ + @Test + public void test4() { + SQLIntegrityConstraintViolationException ex = + new SQLIntegrityConstraintViolationException(reason, state, errorCode); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState().equals(state) + && ex.getCause() == null + && ex.getErrorCode() == errorCode); + } + + /** + * Create SQLIntegrityConstraintViolationException with message, SQLState, errorCode, and Throwable + */ + @Test + public void test5() { + SQLIntegrityConstraintViolationException ex = + new SQLIntegrityConstraintViolationException(reason, state, errorCode, t); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState().equals(state) + && cause.equals(ex.getCause().toString()) + && ex.getErrorCode() == errorCode); + } + + /** + * Create SQLIntegrityConstraintViolationException with message, SQLState, and Throwable + */ + @Test + public void test6() { + SQLIntegrityConstraintViolationException ex = + new SQLIntegrityConstraintViolationException(reason, state, t); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState().equals(state) + && cause.equals(ex.getCause().toString()) + && ex.getErrorCode() == 0); + } + + /** + * Create SQLIntegrityConstraintViolationException with message, and Throwable + */ + @Test + public void test7() { + SQLIntegrityConstraintViolationException ex = + new SQLIntegrityConstraintViolationException(reason, t); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState() == null + && cause.equals(ex.getCause().toString()) + && ex.getErrorCode() == 0); + } + + /** + * Create SQLIntegrityConstraintViolationException with null Throwable + */ + @Test + public void test8() { + SQLIntegrityConstraintViolationException ex = + new SQLIntegrityConstraintViolationException((Throwable)null); + assertTrue(ex.getMessage() == null + && ex.getSQLState() == null + && ex.getCause() == null + && ex.getErrorCode() == 0); + } + + /** + * Create SQLIntegrityConstraintViolationException with Throwable + */ + @Test + public void test9() { + SQLIntegrityConstraintViolationException ex = + new SQLIntegrityConstraintViolationException(t); + assertTrue(ex.getMessage().equals(cause) + && ex.getSQLState() == null + && cause.equals(ex.getCause().toString()) + && ex.getErrorCode() == 0); + } + + /** + * Serialize a SQLIntegrityConstraintViolationException and make sure + * you can read it back properly + */ + @Test + public void test10() throws Exception { + SQLIntegrityConstraintViolationException e = + new SQLIntegrityConstraintViolationException(reason, state, errorCode, t); + SQLIntegrityConstraintViolationException ex1 = + createSerializedException(e); + assertTrue(reason.equals(ex1.getMessage()) + && ex1.getSQLState().equals(state) + && cause.equals(ex1.getCause().toString()) + && ex1.getErrorCode() == errorCode); + } + + /** + * Validate that the ordering of the returned Exceptions is correct + * using for-each loop + */ + @Test + public void test11() { + SQLIntegrityConstraintViolationException ex = + new SQLIntegrityConstraintViolationException("Exception 1", t1); + SQLIntegrityConstraintViolationException ex1 = + new SQLIntegrityConstraintViolationException("Exception 2"); + SQLIntegrityConstraintViolationException ex2 = + new SQLIntegrityConstraintViolationException("Exception 3", t2); + ex.setNextException(ex1); + ex.setNextException(ex2); + int num = 0; + for (Throwable e : ex) { + assertTrue(msgs[num++].equals(e.getMessage())); + } + } + + /** + * Validate that the ordering of the returned Exceptions is correct + * using traditional while loop + */ + @Test + public void test12() { + SQLIntegrityConstraintViolationException ex = + new SQLIntegrityConstraintViolationException("Exception 1", t1); + SQLIntegrityConstraintViolationException ex1 = + new SQLIntegrityConstraintViolationException("Exception 2"); + SQLIntegrityConstraintViolationException ex2 = + new SQLIntegrityConstraintViolationException("Exception 3", t2); + ex.setNextException(ex1); + ex.setNextException(ex2); + int num = 0; + SQLException sqe = ex; + while (sqe != null) { + assertTrue(msgs[num++].equals(sqe.getMessage())); + Throwable c = sqe.getCause(); + while (c != null) { + assertTrue(msgs[num++].equals(c.getMessage())); + c = c.getCause(); + } + sqe = sqe.getNextException(); + } + } + + /** + * Create SQLIntegrityConstraintViolationException and validate it is an instance of + * SQLNonTransientException + */ + @Test + public void test13() { + Exception ex = new SQLIntegrityConstraintViolationException(); + assertTrue(ex instanceof SQLNonTransientException); + } +} diff --git a/test/java/sql/testng/test/sql/SQLInvalidAuthorizationSpecExceptionTests.java b/test/java/sql/testng/test/sql/SQLInvalidAuthorizationSpecExceptionTests.java new file mode 100644 index 000000000..6e4eaa567 --- /dev/null +++ b/test/java/sql/testng/test/sql/SQLInvalidAuthorizationSpecExceptionTests.java @@ -0,0 +1,239 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package test.sql; + +import java.sql.SQLException; +import java.sql.SQLInvalidAuthorizationSpecException; +import java.sql.SQLNonTransientException; +import static org.testng.Assert.*; +import org.testng.annotations.Test; +import util.BaseTest; + +public class SQLInvalidAuthorizationSpecExceptionTests extends BaseTest { + + /** + * Create SQLInvalidAuthorizationSpecException and setting all objects to + * null + */ + @Test + public void test() { + SQLInvalidAuthorizationSpecException e + = new SQLInvalidAuthorizationSpecException(null, + null, errorCode, null); + assertTrue(e.getMessage() == null && e.getSQLState() == null + && e.getCause() == null && e.getErrorCode() == errorCode); + } + + /** + * Create SQLInvalidAuthorizationSpecException with no-arg constructor + */ + @Test + public void test1() { + SQLInvalidAuthorizationSpecException ex + = new SQLInvalidAuthorizationSpecException(); + assertTrue(ex.getMessage() == null + && ex.getSQLState() == null + && ex.getCause() == null + && ex.getErrorCode() == 0); + } + + /** + * Create SQLInvalidAuthorizationSpecException with message + */ + @Test + public void test2() { + SQLInvalidAuthorizationSpecException ex + = new SQLInvalidAuthorizationSpecException(reason); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState() == null + && ex.getCause() == null + && ex.getErrorCode() == 0); + } + + /** + * Create SQLInvalidAuthorizationSpecException with message, and SQLState + */ + @Test + public void test3() { + SQLInvalidAuthorizationSpecException ex + = new SQLInvalidAuthorizationSpecException(reason, state); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState().equals(state) + && ex.getCause() == null + && ex.getErrorCode() == 0); + } + + /** + * Create SQLInvalidAuthorizationSpecException with message, SQLState, and + * error code + */ + @Test + public void test4() { + SQLInvalidAuthorizationSpecException ex + = new SQLInvalidAuthorizationSpecException(reason, state, errorCode); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState().equals(state) + && ex.getCause() == null + && ex.getErrorCode() == errorCode); + } + + /** + * Create SQLInvalidAuthorizationSpecException with message, SQLState, + * errorCode, and Throwable + */ + @Test + public void test5() { + SQLInvalidAuthorizationSpecException ex + = new SQLInvalidAuthorizationSpecException(reason, state, errorCode, t); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState().equals(state) + && cause.equals(ex.getCause().toString()) + && ex.getErrorCode() == errorCode); + } + + /** + * Create SQLInvalidAuthorizationSpecException with message, SQLState, and + * Throwable + */ + @Test + public void test6() { + SQLInvalidAuthorizationSpecException ex + = new SQLInvalidAuthorizationSpecException(reason, state, t); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState().equals(state) + && cause.equals(ex.getCause().toString()) + && ex.getErrorCode() == 0); + } + + /** + * Create SQLInvalidAuthorizationSpecException with message, and Throwable + */ + @Test + public void test7() { + SQLInvalidAuthorizationSpecException ex + = new SQLInvalidAuthorizationSpecException(reason, t); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState() == null + && cause.equals(ex.getCause().toString()) + && ex.getErrorCode() == 0); + } + + /** + * Create SQLInvalidAuthorizationSpecException with null Throwable + */ + @Test + public void test8() { + SQLInvalidAuthorizationSpecException ex + = new SQLInvalidAuthorizationSpecException((Throwable) null); + assertTrue(ex.getMessage() == null + && ex.getSQLState() == null + && ex.getCause() == null + && ex.getErrorCode() == 0); + } + + /** + * Create SQLInvalidAuthorizationSpecException with Throwable + */ + @Test + public void test9() { + SQLInvalidAuthorizationSpecException ex + = new SQLInvalidAuthorizationSpecException(t); + assertTrue(ex.getMessage().equals(cause) + && ex.getSQLState() == null + && cause.equals(ex.getCause().toString()) + && ex.getErrorCode() == 0); + } + + /** + * Serialize a SQLInvalidAuthorizationSpecException and make sure you can + * read it back properly + */ + @Test + public void test10() throws Exception { + SQLInvalidAuthorizationSpecException e + = new SQLInvalidAuthorizationSpecException(reason, state, errorCode, t); + SQLInvalidAuthorizationSpecException ex1 = + createSerializedException(e); + assertTrue(reason.equals(ex1.getMessage()) + && ex1.getSQLState().equals(state) + && cause.equals(ex1.getCause().toString()) + && ex1.getErrorCode() == errorCode); + } + + /** + * Validate that the ordering of the returned Exceptions is correct using + * for-each loop + */ + @Test + public void test11() { + SQLInvalidAuthorizationSpecException ex + = new SQLInvalidAuthorizationSpecException("Exception 1", t1); + SQLInvalidAuthorizationSpecException ex1 + = new SQLInvalidAuthorizationSpecException("Exception 2"); + SQLInvalidAuthorizationSpecException ex2 + = new SQLInvalidAuthorizationSpecException("Exception 3", t2); + ex.setNextException(ex1); + ex.setNextException(ex2); + int num = 0; + for (Throwable e : ex) { + assertTrue(msgs[num++].equals(e.getMessage())); + } + } + + /** + * Validate that the ordering of the returned Exceptions is correct using + * traditional while loop + */ + @Test + public void test12() { + SQLInvalidAuthorizationSpecException ex + = new SQLInvalidAuthorizationSpecException("Exception 1", t1); + SQLInvalidAuthorizationSpecException ex1 + = new SQLInvalidAuthorizationSpecException("Exception 2"); + SQLInvalidAuthorizationSpecException ex2 + = new SQLInvalidAuthorizationSpecException("Exception 3", t2); + ex.setNextException(ex1); + ex.setNextException(ex2); + int num = 0; + SQLException sqe = ex; + while (sqe != null) { + assertTrue(msgs[num++].equals(sqe.getMessage())); + Throwable c = sqe.getCause(); + while (c != null) { + assertTrue(msgs[num++].equals(c.getMessage())); + c = c.getCause(); + } + sqe = sqe.getNextException(); + } + } + + /** + * Create SQLInvalidAuthorizationSpecException and validate it is an + * instance of SQLNonTransientException + */ + @Test + public void test13() { + Exception ex = new SQLInvalidAuthorizationSpecException(); + assertTrue(ex instanceof SQLNonTransientException); + } +} diff --git a/test/java/sql/testng/test/sql/SQLNonTransientConnectionExceptionTests.java b/test/java/sql/testng/test/sql/SQLNonTransientConnectionExceptionTests.java new file mode 100644 index 000000000..dbd8b6858 --- /dev/null +++ b/test/java/sql/testng/test/sql/SQLNonTransientConnectionExceptionTests.java @@ -0,0 +1,235 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package test.sql; + +import java.sql.SQLException; +import java.sql.SQLNonTransientConnectionException; +import java.sql.SQLNonTransientException; +import static org.testng.Assert.*; +import org.testng.annotations.Test; +import util.BaseTest; + +public class SQLNonTransientConnectionExceptionTests extends BaseTest { + + /** + * Create SQLNonTransientConnectionException and setting all objects to null + */ + @Test + public void test() { + SQLNonTransientConnectionException e = + new SQLNonTransientConnectionException(null, + null, errorCode, null); + assertTrue(e.getMessage() == null && e.getSQLState() == null + && e.getCause() == null && e.getErrorCode() == errorCode); + } + + /** + * Create SQLNonTransientConnectionException with no-arg constructor + */ + @Test + public void test1() { + SQLNonTransientConnectionException ex = + new SQLNonTransientConnectionException(); + assertTrue(ex.getMessage() == null + && ex.getSQLState() == null + && ex.getCause() == null + && ex.getErrorCode() == 0); + } + + /** + * Create SQLNonTransientConnectionException with message + */ + @Test + public void test2() { + SQLNonTransientConnectionException ex = + new SQLNonTransientConnectionException(reason); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState() == null + && ex.getCause() == null + && ex.getErrorCode() == 0); + } + + /** + * Create SQLNonTransientConnectionException with message, and SQLState + */ + @Test + public void test3() { + SQLNonTransientConnectionException ex = + new SQLNonTransientConnectionException(reason, state); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState().equals(state) + && ex.getCause() == null + && ex.getErrorCode() == 0); + } + + /** + * Create SQLNonTransientConnectionException with message, SQLState, and error code + */ + @Test + public void test4() { + SQLNonTransientConnectionException ex = + new SQLNonTransientConnectionException(reason, state, errorCode); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState().equals(state) + && ex.getCause() == null + && ex.getErrorCode() == errorCode); + } + + /** + * Create SQLNonTransientConnectionException with message, SQLState, errorCode, and Throwable + */ + @Test + public void test5() { + SQLNonTransientConnectionException ex = + new SQLNonTransientConnectionException(reason, state, errorCode, t); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState().equals(state) + && cause.equals(ex.getCause().toString()) + && ex.getErrorCode() == errorCode); + } + + /** + * Create SQLNonTransientConnectionException with message, SQLState, and Throwable + */ + @Test + public void test6() { + SQLNonTransientConnectionException ex = + new SQLNonTransientConnectionException(reason, state, t); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState().equals(state) + && cause.equals(ex.getCause().toString()) + && ex.getErrorCode() == 0); + } + + /** + * Create SQLNonTransientConnectionException with message, and Throwable + */ + @Test + public void test7() { + SQLNonTransientConnectionException ex = + new SQLNonTransientConnectionException(reason, t); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState() == null + && cause.equals(ex.getCause().toString()) + && ex.getErrorCode() == 0); + } + + /** + * Create SQLNonTransientConnectionException with null Throwable + */ + @Test + public void test8() { + SQLNonTransientConnectionException ex = + new SQLNonTransientConnectionException((Throwable)null); + assertTrue(ex.getMessage() == null + && ex.getSQLState() == null + && ex.getCause() == null + && ex.getErrorCode() == 0); + } + + /** + * Create SQLNonTransientConnectionException with Throwable + */ + @Test + public void test9() { + SQLNonTransientConnectionException ex = + new SQLNonTransientConnectionException(t); + assertTrue(ex.getMessage().equals(cause) + && ex.getSQLState() == null + && cause.equals(ex.getCause().toString()) + && ex.getErrorCode() == 0); + } + + /** + * Serialize a SQLNonTransientConnectionException and make sure you can + * read it back properly + */ + @Test + public void test10() throws Exception { + SQLNonTransientConnectionException e = + new SQLNonTransientConnectionException(reason, state, errorCode, t); + SQLNonTransientConnectionException ex1 = + createSerializedException(e); + assertTrue(reason.equals(ex1.getMessage()) + && ex1.getSQLState().equals(state) + && cause.equals(ex1.getCause().toString()) + && ex1.getErrorCode() == errorCode); + } + + /** + * Validate that the ordering of the returned Exceptions is correct + * using for-each loop + */ + @Test + public void test11() { + SQLNonTransientConnectionException ex = + new SQLNonTransientConnectionException("Exception 1", t1); + SQLNonTransientConnectionException ex1 = + new SQLNonTransientConnectionException("Exception 2"); + SQLNonTransientConnectionException ex2 = + new SQLNonTransientConnectionException("Exception 3", t2); + ex.setNextException(ex1); + ex.setNextException(ex2); + int num = 0; + for (Throwable e : ex) { + assertTrue(msgs[num++].equals(e.getMessage())); + } + } + + /** + * Validate that the ordering of the returned Exceptions is correct + * using traditional while loop + */ + @Test + public void test12() { + SQLNonTransientConnectionException ex = + new SQLNonTransientConnectionException("Exception 1", t1); + SQLNonTransientConnectionException ex1 = + new SQLNonTransientConnectionException("Exception 2"); + SQLNonTransientConnectionException ex2 = + new SQLNonTransientConnectionException("Exception 3", t2); + ex.setNextException(ex1); + ex.setNextException(ex2); + int num = 0; + SQLException sqe = ex; + while (sqe != null) { + assertTrue(msgs[num++].equals(sqe.getMessage())); + Throwable c = sqe.getCause(); + while (c != null) { + assertTrue(msgs[num++].equals(c.getMessage())); + c = c.getCause(); + } + sqe = sqe.getNextException(); + } + } + + /** + * Create SQLNonTransientConnectionException and validate it is an instance of + * SQLNonTransientException + */ + @Test + public void test13() { + Exception ex = new SQLNonTransientConnectionException(); + assertTrue(ex instanceof SQLNonTransientException); + } +} diff --git a/test/java/sql/testng/test/sql/SQLNonTransientExceptionTests.java b/test/java/sql/testng/test/sql/SQLNonTransientExceptionTests.java new file mode 100644 index 000000000..061ffe208 --- /dev/null +++ b/test/java/sql/testng/test/sql/SQLNonTransientExceptionTests.java @@ -0,0 +1,209 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package test.sql; + +import java.sql.SQLException; +import java.sql.SQLNonTransientException; +import static org.testng.Assert.*; +import org.testng.annotations.Test; +import util.BaseTest; + +public class SQLNonTransientExceptionTests extends BaseTest { + + /** + * Create SQLNonTransientException and setting all objects to null + */ + @Test + public void test() { + SQLNonTransientException e = new SQLNonTransientException(null, + null, errorCode, null); + assertTrue(e.getMessage() == null && e.getSQLState() == null + && e.getCause() == null && e.getErrorCode() == errorCode); + } + + /** + * Create SQLNonTransientException with no-arg constructor + */ + @Test + public void test1() { + SQLNonTransientException ex = new SQLNonTransientException(); + assertTrue(ex.getMessage() == null + && ex.getSQLState() == null + && ex.getCause() == null + && ex.getErrorCode() == 0); + } + + /** + * Create SQLNonTransientException with message + */ + @Test + public void test2() { + SQLNonTransientException ex = new SQLNonTransientException(reason); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState() == null + && ex.getCause() == null + && ex.getErrorCode() == 0); + } + + /** + * Create SQLNonTransientException with message, and SQLState + */ + @Test + public void test3() { + SQLNonTransientException ex = new SQLNonTransientException(reason, state); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState().equals(state) + && ex.getCause() == null + && ex.getErrorCode() == 0); + } + + /** + * Create SQLNonTransientException with message, SQLState, and error code + */ + @Test + public void test4() {; + SQLNonTransientException ex = + new SQLNonTransientException(reason, state, errorCode); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState().equals(state) + && ex.getCause() == null + && ex.getErrorCode() == errorCode); + } + + /** + * Create SQLNonTransientException with message, SQLState, errorCode, and Throwable + */ + @Test + public void test5() { + SQLNonTransientException ex = + new SQLNonTransientException(reason, state, errorCode, t); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState().equals(state) + && cause.equals(ex.getCause().toString()) + && ex.getErrorCode() == errorCode); + } + + /** + * Create SQLNonTransientException with message, SQLState, and Throwable + */ + @Test + public void test6() { + SQLNonTransientException ex = new SQLNonTransientException(reason, state, t); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState().equals(state) + && cause.equals(ex.getCause().toString()) + && ex.getErrorCode() == 0); + } + + /** + * Create SQLNonTransientException with message, and Throwable + */ + @Test + public void test7() { + SQLNonTransientException ex = new SQLNonTransientException(reason, t); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState() == null + && cause.equals(ex.getCause().toString()) + && ex.getErrorCode() == 0); + } + + /** + * Create SQLNonTransientException with null Throwable + */ + @Test + public void test8() { + SQLNonTransientException ex = new SQLNonTransientException((Throwable)null); + assertTrue(ex.getMessage() == null + && ex.getSQLState() == null + && ex.getCause() == null + && ex.getErrorCode() == 0); + } + + /** + * Create SQLNonTransientException with Throwable + */ + @Test + public void test9() { + SQLNonTransientException ex = new SQLNonTransientException(t); + assertTrue(ex.getMessage().equals(cause) + && ex.getSQLState() == null + && cause.equals(ex.getCause().toString()) + && ex.getErrorCode() == 0); + } + + /** + * Serialize a SQLNonTransientException and make sure you can read it back properly + */ + @Test + public void test10() throws Exception { + SQLNonTransientException e = + new SQLNonTransientException(reason, state, errorCode, t); + SQLNonTransientException ex1 = + createSerializedException(e); + assertTrue(reason.equals(ex1.getMessage()) + && ex1.getSQLState().equals(state) + && cause.equals(ex1.getCause().toString()) + && ex1.getErrorCode() == errorCode); + } + + /** + * Validate that the ordering of the returned Exceptions is correct + * using for-each loop + */ + @Test + public void test11() { + SQLNonTransientException ex = new SQLNonTransientException("Exception 1", t1); + SQLNonTransientException ex1 = new SQLNonTransientException("Exception 2"); + SQLNonTransientException ex2 = new SQLNonTransientException("Exception 3", t2); + ex.setNextException(ex1); + ex.setNextException(ex2); + int num = 0; + for (Throwable e : ex) { + assertTrue(msgs[num++].equals(e.getMessage())); + } + } + + /** + * Validate that the ordering of the returned Exceptions is correct + * using traditional while loop + */ + @Test + public void test12() { + SQLNonTransientException ex = new SQLNonTransientException("Exception 1", t1); + SQLNonTransientException ex1 = new SQLNonTransientException("Exception 2"); + SQLNonTransientException ex2 = new SQLNonTransientException("Exception 3", t2); + ex.setNextException(ex1); + ex.setNextException(ex2); + int num = 0; + SQLException sqe = ex; + while (sqe != null) { + assertTrue(msgs[num++].equals(sqe.getMessage())); + Throwable c = sqe.getCause(); + while (c != null) { + assertTrue(msgs[num++].equals(c.getMessage())); + c = c.getCause(); + } + sqe = sqe.getNextException(); + } + } +} diff --git a/test/java/sql/testng/test/sql/SQLRecoverableExceptionTests.java b/test/java/sql/testng/test/sql/SQLRecoverableExceptionTests.java new file mode 100644 index 000000000..d23a131db --- /dev/null +++ b/test/java/sql/testng/test/sql/SQLRecoverableExceptionTests.java @@ -0,0 +1,209 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package test.sql; + +import java.sql.SQLException; +import java.sql.SQLRecoverableException; +import static org.testng.Assert.*; +import org.testng.annotations.Test; +import util.BaseTest; + +public class SQLRecoverableExceptionTests extends BaseTest { + + /** + * Create SQLRecoverableException and setting all objects to null + */ + @Test + public void test() { + SQLRecoverableException e = new SQLRecoverableException(null, + null, errorCode, null); + assertTrue(e.getMessage() == null && e.getSQLState() == null + && e.getCause() == null && e.getErrorCode() == errorCode); + } + + /** + * Create SQLRecoverableException with no-arg constructor + */ + @Test + public void test1() { + SQLRecoverableException ex = new SQLRecoverableException(); + assertTrue(ex.getMessage() == null + && ex.getSQLState() == null + && ex.getCause() == null + && ex.getErrorCode() == 0); + } + + /** + * Create SQLRecoverableException with message + */ + @Test + public void test2() { + SQLRecoverableException ex = new SQLRecoverableException(reason); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState() == null + && ex.getCause() == null + && ex.getErrorCode() == 0); + } + + /** + * Create SQLRecoverableException with message, and SQLState + */ + @Test + public void test3() { + SQLRecoverableException ex = new SQLRecoverableException(reason, state); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState().equals(state) + && ex.getCause() == null + && ex.getErrorCode() == 0); + } + + /** + * Create SQLRecoverableException with message, SQLState, and error code + */ + @Test + public void test4() { + SQLRecoverableException ex = + new SQLRecoverableException(reason, state, errorCode); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState().equals(state) + && ex.getCause() == null + && ex.getErrorCode() == errorCode); + } + + /** + * Create SQLRecoverableException with message, SQLState, errorCode, and Throwable + */ + @Test + public void test5() { + SQLRecoverableException ex = + new SQLRecoverableException(reason, state, errorCode, t); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState().equals(state) + && cause.equals(ex.getCause().toString()) + && ex.getErrorCode() == errorCode); + } + + /** + * Create SQLRecoverableException with message, SQLState, and Throwable + */ + @Test + public void test6() { + SQLRecoverableException ex = new SQLRecoverableException(reason, state, t); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState().equals(state) + && cause.equals(ex.getCause().toString()) + && ex.getErrorCode() == 0); + } + + /** + * Create SQLRecoverableException with message, and Throwable + */ + @Test + public void test7() { + SQLRecoverableException ex = new SQLRecoverableException(reason, t); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState() == null + && cause.equals(ex.getCause().toString()) + && ex.getErrorCode() == 0); + } + + /** + * Create SQLRecoverableException with null Throwable + */ + @Test + public void test8() { + SQLRecoverableException ex = new SQLRecoverableException((Throwable)null); + assertTrue(ex.getMessage() == null + && ex.getSQLState() == null + && ex.getCause() == null + && ex.getErrorCode() == 0); + } + + /** + * Create SQLRecoverableException with Throwable + */ + @Test + public void test9() { + SQLRecoverableException ex = new SQLRecoverableException(t); + assertTrue(ex.getMessage().equals(cause) + && ex.getSQLState() == null + && cause.equals(ex.getCause().toString()) + && ex.getErrorCode() == 0); + } + + /** + * Serialize a SQLRecoverableException and make sure you can read it back properly + */ + @Test + public void test10() throws Exception { + SQLRecoverableException e = + new SQLRecoverableException(reason, state, errorCode, t); + SQLRecoverableException ex1 = + createSerializedException(e); + assertTrue(reason.equals(ex1.getMessage()) + && ex1.getSQLState().equals(state) + && cause.equals(ex1.getCause().toString()) + && ex1.getErrorCode() == errorCode); + } + + /** + * Validate that the ordering of the returned Exceptions is correct + * using for-each loop + */ + @Test + public void test11() { + SQLRecoverableException ex = new SQLRecoverableException("Exception 1", t1); + SQLRecoverableException ex1 = new SQLRecoverableException("Exception 2"); + SQLRecoverableException ex2 = new SQLRecoverableException("Exception 3", t2); + ex.setNextException(ex1); + ex.setNextException(ex2); + int num = 0; + for (Throwable e : ex) { + assertTrue(msgs[num++].equals(e.getMessage())); + } + } + + /** + * Validate that the ordering of the returned Exceptions is correct + * using traditional while loop + */ + @Test + public void test12() { + SQLRecoverableException ex = new SQLRecoverableException("Exception 1", t1); + SQLRecoverableException ex1 = new SQLRecoverableException("Exception 2"); + SQLRecoverableException ex2 = new SQLRecoverableException("Exception 3", t2); + ex.setNextException(ex1); + ex.setNextException(ex2); + int num = 0; + SQLException sqe = ex; + while (sqe != null) { + assertTrue(msgs[num++].equals(sqe.getMessage())); + Throwable c = sqe.getCause(); + while (c != null) { + assertTrue(msgs[num++].equals(c.getMessage())); + c = c.getCause(); + } + sqe = sqe.getNextException(); + } + } +} diff --git a/test/java/sql/testng/test/sql/SQLSyntaxErrorExceptionTests.java b/test/java/sql/testng/test/sql/SQLSyntaxErrorExceptionTests.java new file mode 100644 index 000000000..863213cfc --- /dev/null +++ b/test/java/sql/testng/test/sql/SQLSyntaxErrorExceptionTests.java @@ -0,0 +1,221 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package test.sql; + +import java.sql.SQLException; +import java.sql.SQLNonTransientException; +import java.sql.SQLSyntaxErrorException; +import static org.testng.Assert.*; +import org.testng.annotations.Test; +import util.BaseTest; + +public class SQLSyntaxErrorExceptionTests extends BaseTest { + + /** + * Create SQLSyntaxErrorException and setting all objects to null + */ + @Test + public void test() { + SQLSyntaxErrorException e = new SQLSyntaxErrorException(null, + null, errorCode, null); + assertTrue(e.getMessage() == null && e.getSQLState() == null + && e.getCause() == null && e.getErrorCode() == errorCode); + } + + /** + * Create SQLSyntaxErrorException with no-arg constructor + */ + @Test + public void test1() { + SQLSyntaxErrorException ex = new SQLSyntaxErrorException(); + assertTrue(ex.getMessage() == null + && ex.getSQLState() == null + && ex.getCause() == null + && ex.getErrorCode() == 0); + } + + /** + * Create SQLSyntaxErrorException with message + */ + @Test + public void test2() { + SQLSyntaxErrorException ex = new SQLSyntaxErrorException(reason); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState() == null + && ex.getCause() == null + && ex.getErrorCode() == 0); + } + + /** + * Create SQLSyntaxErrorException with message, and SQLState + */ + @Test + public void test3() { + SQLSyntaxErrorException ex = new SQLSyntaxErrorException(reason, state); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState().equals(state) + && ex.getCause() == null + && ex.getErrorCode() == 0); + } + + /** + * Create SQLSyntaxErrorException with message, SQLState, and error code + */ + @Test + public void test4() { + SQLSyntaxErrorException ex = + new SQLSyntaxErrorException(reason, state, errorCode); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState().equals(state) + && ex.getCause() == null + && ex.getErrorCode() == errorCode); + } + + /** + * Create SQLSyntaxErrorException with message, SQLState, errorCode, and Throwable + */ + @Test + public void test5() { + SQLSyntaxErrorException ex = + new SQLSyntaxErrorException(reason, state, errorCode, t); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState().equals(state) + && cause.equals(ex.getCause().toString()) + && ex.getErrorCode() == errorCode); + } + + /** + * Create SQLSyntaxErrorException with message, SQLState, and Throwable + */ + @Test + public void test6() { + SQLSyntaxErrorException ex = new SQLSyntaxErrorException(reason, state, t); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState().equals(state) + && cause.equals(ex.getCause().toString()) + && ex.getErrorCode() == 0); + } + + /** + * Create SQLSyntaxErrorException with message, and Throwable + */ + @Test + public void test7() { + SQLSyntaxErrorException ex = new SQLSyntaxErrorException(reason, t); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState() == null + && cause.equals(ex.getCause().toString()) + && ex.getErrorCode() == 0); + } + + /** + * Create SQLSyntaxErrorException with null Throwable + */ + @Test + public void test8() { + SQLSyntaxErrorException ex = new SQLSyntaxErrorException((Throwable)null); + assertTrue(ex.getMessage() == null + && ex.getSQLState() == null + && ex.getCause() == null + && ex.getErrorCode() == 0); + } + + /** + * Create SQLSyntaxErrorException with Throwable + */ + @Test + public void test9() { + SQLSyntaxErrorException ex = new SQLSyntaxErrorException(t); + assertTrue(ex.getMessage().equals(cause) + && ex.getSQLState() == null + && cause.equals(ex.getCause().toString()) + && ex.getErrorCode() == 0); + } + + /** + * Serialize a SQLSyntaxErrorException and make sure you can read it back properly + */ + @Test + public void test10() throws Exception { + + SQLSyntaxErrorException e = + new SQLSyntaxErrorException(reason, state, errorCode, t); + SQLSyntaxErrorException ex1 = + createSerializedException(e); + assertTrue(reason.equals(ex1.getMessage()) + && ex1.getSQLState().equals(state) + && cause.equals(ex1.getCause().toString()) + && ex1.getErrorCode() == errorCode); + } + + /** + * Validate that the ordering of the returned Exceptions is correct + * using for-each loop + */ + @Test + public void test11() { + SQLSyntaxErrorException ex = new SQLSyntaxErrorException("Exception 1", t1); + SQLSyntaxErrorException ex1 = new SQLSyntaxErrorException("Exception 2"); + SQLSyntaxErrorException ex2 = new SQLSyntaxErrorException("Exception 3", t2); + ex.setNextException(ex1); + ex.setNextException(ex2); + int num = 0; + for (Throwable e : ex) { + assertTrue(msgs[num++].equals(e.getMessage())); + } + } + + /** + * Validate that the ordering of the returned Exceptions is correct + * using traditional while loop + */ + @Test + public void test12() { + SQLSyntaxErrorException ex = new SQLSyntaxErrorException("Exception 1", t1); + SQLSyntaxErrorException ex1 = new SQLSyntaxErrorException("Exception 2"); + SQLSyntaxErrorException ex2 = new SQLSyntaxErrorException("Exception 3", t2); + ex.setNextException(ex1); + ex.setNextException(ex2); + int num = 0; + SQLException sqe = ex; + while (sqe != null) { + assertTrue(msgs[num++].equals(sqe.getMessage())); + Throwable c = sqe.getCause(); + while (c != null) { + assertTrue(msgs[num++].equals(c.getMessage())); + c = c.getCause(); + } + sqe = sqe.getNextException(); + } + } + + /** + * Create SQLSyntaxErrorException and validate it is an instance of + * SQLNonTransientException + */ + @Test + public void test13() { + Exception ex = new SQLSyntaxErrorException(); + assertTrue(ex instanceof SQLNonTransientException); + } +} diff --git a/test/java/sql/testng/test/sql/SQLTimeoutExceptionTests.java b/test/java/sql/testng/test/sql/SQLTimeoutExceptionTests.java new file mode 100644 index 000000000..dfe341545 --- /dev/null +++ b/test/java/sql/testng/test/sql/SQLTimeoutExceptionTests.java @@ -0,0 +1,218 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package test.sql; + +import java.sql.SQLException; +import java.sql.SQLTimeoutException; +import java.sql.SQLTransientException; +import static org.testng.Assert.*; +import org.testng.annotations.Test; +import util.BaseTest; + +public class SQLTimeoutExceptionTests extends BaseTest { + + /** + * Create SQLTimeoutException and setting all objects to null + */ + @Test + public void test() { + SQLTimeoutException e = new SQLTimeoutException(null, + null, errorCode, null); + assertTrue(e.getMessage() == null && e.getSQLState() == null + && e.getCause() == null && e.getErrorCode() == errorCode); + } + + /** + * Create SQLTimeoutException with no-arg constructor + */ + @Test + public void test1() { + SQLTimeoutException ex = new SQLTimeoutException(); + assertTrue(ex.getMessage() == null + && ex.getSQLState() == null + && ex.getCause() == null + && ex.getErrorCode() == 0); + } + + /** + * Create SQLTimeoutException with message + */ + @Test + public void test2() { + SQLTimeoutException ex = new SQLTimeoutException(reason); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState() == null + && ex.getCause() == null + && ex.getErrorCode() == 0); + } + + /** + * Create SQLTimeoutException with message, and SQLState + */ + @Test + public void test3() { + SQLTimeoutException ex = new SQLTimeoutException(reason, state); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState().equals(state) + && ex.getCause() == null + && ex.getErrorCode() == 0); + } + + /** + * Create SQLTimeoutException with message, SQLState, and error code + */ + @Test + public void test4() { + SQLTimeoutException ex = new SQLTimeoutException(reason, state, errorCode); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState().equals(state) + && ex.getCause() == null + && ex.getErrorCode() == errorCode); + } + + /** + * Create SQLTimeoutException with message, SQLState, errorCode, and Throwable + */ + @Test + public void test5() { + SQLTimeoutException ex = new SQLTimeoutException(reason, state, errorCode, t); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState().equals(state) + && cause.equals(ex.getCause().toString()) + && ex.getErrorCode() == errorCode); + } + + /** + * Create SQLTimeoutException with message, SQLState, and Throwable + */ + @Test + public void test6() { + SQLTimeoutException ex = new SQLTimeoutException(reason, state, t); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState().equals(state) + && cause.equals(ex.getCause().toString()) + && ex.getErrorCode() == 0); + } + + /** + * Create SQLTimeoutException with message, and Throwable + */ + @Test + public void test7() { + SQLTimeoutException ex = new SQLTimeoutException(reason, t); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState() == null + && cause.equals(ex.getCause().toString()) + && ex.getErrorCode() == 0); + } + + /** + * Create SQLTimeoutException with null Throwable + */ + @Test + public void test8() { + SQLTimeoutException ex = new SQLTimeoutException((Throwable)null); + assertTrue(ex.getMessage() == null + && ex.getSQLState() == null + && ex.getCause() == null + && ex.getErrorCode() == 0); + } + + /** + * Create SQLTimeoutException with Throwable + */ + @Test + public void test9() { + SQLTimeoutException ex = new SQLTimeoutException(t); + assertTrue(ex.getMessage().equals(cause) + && ex.getSQLState() == null + && cause.equals(ex.getCause().toString()) + && ex.getErrorCode() == 0); + } + + /** + * Serialize a SQLTimeoutException and make sure you can read it back properly + */ + @Test + public void test10() throws Exception { + SQLTimeoutException e = + new SQLTimeoutException(reason, state, errorCode, t); + SQLTimeoutException ex1 = + createSerializedException(e); + assertTrue(reason.equals(ex1.getMessage()) + && ex1.getSQLState().equals(state) + && cause.equals(ex1.getCause().toString()) + && ex1.getErrorCode() == errorCode); + } + + /** + * Validate that the ordering of the returned Exceptions is correct + * using for-each loop + */ + @Test + public void test11() { + SQLTimeoutException ex = new SQLTimeoutException("Exception 1", t1); + SQLTimeoutException ex1 = new SQLTimeoutException("Exception 2"); + SQLTimeoutException ex2 = new SQLTimeoutException("Exception 3", t2); + ex.setNextException(ex1); + ex.setNextException(ex2); + int num = 0; + for (Throwable e : ex) { + assertTrue(msgs[num++].equals(e.getMessage())); + } + } + + /** + * Validate that the ordering of the returned Exceptions is correct + * using traditional while loop + */ + @Test + public void test12() { + SQLTimeoutException ex = new SQLTimeoutException("Exception 1", t1); + SQLTimeoutException ex1 = new SQLTimeoutException("Exception 2"); + SQLTimeoutException ex2 = new SQLTimeoutException("Exception 3", t2); + ex.setNextException(ex1); + ex.setNextException(ex2); + int num = 0; + SQLException sqe = ex; + while (sqe != null) { + assertTrue(msgs[num++].equals(sqe.getMessage())); + Throwable c = sqe.getCause(); + while (c != null) { + assertTrue(msgs[num++].equals(c.getMessage())); + c = c.getCause(); + } + sqe = sqe.getNextException(); + } + } + + /** + * Create SQLTimeoutException and validate it is an instance of + * SQLNonTransientException + */ + @Test + public void test13() { + Exception ex = new SQLTimeoutException(); + assertTrue(ex instanceof SQLTransientException); + } +} diff --git a/test/java/sql/testng/test/sql/SQLTransactionRollbackExceptionTests.java b/test/java/sql/testng/test/sql/SQLTransactionRollbackExceptionTests.java new file mode 100644 index 000000000..8453ebe13 --- /dev/null +++ b/test/java/sql/testng/test/sql/SQLTransactionRollbackExceptionTests.java @@ -0,0 +1,233 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package test.sql; + +import java.sql.SQLException; +import java.sql.SQLTransactionRollbackException; +import java.sql.SQLTransientException; +import static org.testng.Assert.*; +import org.testng.annotations.Test; +import util.BaseTest; + +public class SQLTransactionRollbackExceptionTests extends BaseTest { + + /** + * Create SQLTransactionRollbackException and setting all objects to null + */ + @Test + public void test() { + SQLTransactionRollbackException e = + new SQLTransactionRollbackException(null, + null, errorCode, null); + assertTrue(e.getMessage() == null && e.getSQLState() == null + && e.getCause() == null && e.getErrorCode() == errorCode); + } + + /** + * Create SQLTransactionRollbackException with no-arg constructor + */ + @Test + public void test1() { + SQLTransactionRollbackException ex = new SQLTransactionRollbackException(); + assertTrue(ex.getMessage() == null + && ex.getSQLState() == null + && ex.getCause() == null + && ex.getErrorCode() == 0); + } + + /** + * Create SQLTransactionRollbackException with message + */ + @Test + public void test2() { + SQLTransactionRollbackException ex = + new SQLTransactionRollbackException(reason); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState() == null + && ex.getCause() == null + && ex.getErrorCode() == 0); + } + + /** + * Create SQLTransactionRollbackException with message, and SQLState + */ + @Test + public void test3() { + SQLTransactionRollbackException ex = + new SQLTransactionRollbackException(reason, state); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState().equals(state) + && ex.getCause() == null + && ex.getErrorCode() == 0); + } + + /** + * Create SQLTransactionRollbackException with message, SQLState, and error code + */ + @Test + public void test4() { + SQLTransactionRollbackException ex = + new SQLTransactionRollbackException(reason, state, errorCode); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState().equals(state) + && ex.getCause() == null + && ex.getErrorCode() == errorCode); + } + + /** + * Create SQLTransactionRollbackException with message, SQLState, errorCode, and Throwable + */ + @Test + public void test5() { + SQLTransactionRollbackException ex = + new SQLTransactionRollbackException(reason, state, errorCode, t); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState().equals(state) + && cause.equals(ex.getCause().toString()) + && ex.getErrorCode() == errorCode); + } + + /** + * Create SQLTransactionRollbackException with message, SQLState, and Throwable + */ + @Test + public void test6() { + SQLTransactionRollbackException ex = + new SQLTransactionRollbackException(reason, state, t); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState().equals(state) + && cause.equals(ex.getCause().toString()) + && ex.getErrorCode() == 0); + } + + /** + * Create SQLTransactionRollbackException with message, and Throwable + */ + @Test + public void test7() { + SQLTransactionRollbackException ex = + new SQLTransactionRollbackException(reason, t); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState() == null + && cause.equals(ex.getCause().toString()) + && ex.getErrorCode() == 0); + } + + /** + * Create SQLTransactionRollbackException with null Throwable + */ + @Test + public void test8() { + SQLTransactionRollbackException ex = + new SQLTransactionRollbackException((Throwable)null); + assertTrue(ex.getMessage() == null + && ex.getSQLState() == null + && ex.getCause() == null + && ex.getErrorCode() == 0); + } + + /** + * Create SQLTransactionRollbackException with Throwable + */ + @Test + public void test9() { + SQLTransactionRollbackException ex = + new SQLTransactionRollbackException(t); + assertTrue(ex.getMessage().equals(cause) + && ex.getSQLState() == null + && cause.equals(ex.getCause().toString()) + && ex.getErrorCode() == 0); + } + + /** + * Serialize a SQLTransactionRollbackException and make sure you can read it back properly + */ + @Test + public void test10() throws Exception { + SQLTransactionRollbackException e = + new SQLTransactionRollbackException(reason, state, errorCode, t); + SQLTransactionRollbackException ex1 = + createSerializedException(e); + assertTrue(reason.equals(ex1.getMessage()) + && ex1.getSQLState().equals(state) + && cause.equals(ex1.getCause().toString()) + && ex1.getErrorCode() == errorCode); + } + + /** + * Validate that the ordering of the returned Exceptions is correct + * using for-each loop + */ + @Test + public void test11() { + SQLTransactionRollbackException ex = + new SQLTransactionRollbackException("Exception 1", t1); + SQLTransactionRollbackException ex1 = + new SQLTransactionRollbackException("Exception 2"); + SQLTransactionRollbackException ex2 = + new SQLTransactionRollbackException("Exception 3", t2); + ex.setNextException(ex1); + ex.setNextException(ex2); + int num = 0; + for (Throwable e : ex) { + assertTrue(msgs[num++].equals(e.getMessage())); + } + } + + /** + * Validate that the ordering of the returned Exceptions is correct + * using traditional while loop + */ + @Test + public void test12() { + SQLTransactionRollbackException ex = + new SQLTransactionRollbackException("Exception 1", t1); + SQLTransactionRollbackException ex1 = + new SQLTransactionRollbackException("Exception 2"); + SQLTransactionRollbackException ex2 = + new SQLTransactionRollbackException("Exception 3", t2); + ex.setNextException(ex1); + ex.setNextException(ex2); + int num = 0; + SQLException sqe = ex; + while (sqe != null) { + assertTrue(msgs[num++].equals(sqe.getMessage())); + Throwable c = sqe.getCause(); + while (c != null) { + assertTrue(msgs[num++].equals(c.getMessage())); + c = c.getCause(); + } + sqe = sqe.getNextException(); + } + } + + /** + * Create SQLTransactionRollbackException and validate it is an instance of + * SQLNonTransientException + */ + @Test + public void test13() { + Exception ex = new SQLTransactionRollbackException(); + assertTrue(ex instanceof SQLTransientException); + } +} diff --git a/test/java/sql/testng/test/sql/SQLTransientConnectionExceptionTests.java b/test/java/sql/testng/test/sql/SQLTransientConnectionExceptionTests.java new file mode 100644 index 000000000..7999253b1 --- /dev/null +++ b/test/java/sql/testng/test/sql/SQLTransientConnectionExceptionTests.java @@ -0,0 +1,233 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package test.sql; + +import java.sql.SQLException; +import java.sql.SQLTransientConnectionException; +import java.sql.SQLTransientException; +import static org.testng.Assert.*; +import org.testng.annotations.Test; +import util.BaseTest; + +public class SQLTransientConnectionExceptionTests extends BaseTest { + + /** + * Create SQLTransientConnectionException and setting all objects to null + */ + @Test + public void test() { + SQLTransientConnectionException e = + new SQLTransientConnectionException( null, + null, errorCode, null); + assertTrue(e.getMessage() == null && e.getSQLState() == null + && e.getCause() == null && e.getErrorCode() == errorCode); + } + + /** + * Create SQLTransientConnectionException with no-arg constructor + */ + @Test + public void test1() { + SQLTransientConnectionException ex = new SQLTransientConnectionException(); + assertTrue(ex.getMessage() == null + && ex.getSQLState() == null + && ex.getCause() == null + && ex.getErrorCode() == 0); + } + + /** + * Create SQLTransientConnectionException with message + */ + @Test + public void test2() { + SQLTransientConnectionException ex = + new SQLTransientConnectionException(reason); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState() == null + && ex.getCause() == null + && ex.getErrorCode() == 0); + } + + /** + * Create SQLTransientConnectionException with message, and SQLState + */ + @Test + public void test3() { + SQLTransientConnectionException ex = + new SQLTransientConnectionException(reason, state); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState().equals(state) + && ex.getCause() == null + && ex.getErrorCode() == 0); + } + + /** + * Create SQLTransientConnectionException with message, SQLState, and error code + */ + @Test + public void test4() {; + SQLTransientConnectionException ex = + new SQLTransientConnectionException(reason, state, errorCode); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState().equals(state) + && ex.getCause() == null + && ex.getErrorCode() == errorCode); + } + + /** + * Create SQLTransientConnectionException with message, SQLState, errorCode, and Throwable + */ + @Test + public void test5() { + SQLTransientConnectionException ex = + new SQLTransientConnectionException(reason, state, errorCode, t); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState().equals(state) + && cause.equals(ex.getCause().toString()) + && ex.getErrorCode() == errorCode); + } + + /** + * Create SQLTransientConnectionException with message, SQLState, and Throwable + */ + @Test + public void test6() { + SQLTransientConnectionException ex = + new SQLTransientConnectionException(reason, state, t); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState().equals(state) + && cause.equals(ex.getCause().toString()) + && ex.getErrorCode() == 0); + } + + /** + * Create SQLTransientConnectionException with message, and Throwable + */ + @Test + public void test7() { + SQLTransientConnectionException ex = + new SQLTransientConnectionException(reason, t); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState() == null + && cause.equals(ex.getCause().toString()) + && ex.getErrorCode() == 0); + } + + /** + * Create SQLTransientConnectionException with null Throwable + */ + @Test + public void test8() { + SQLTransientConnectionException ex = + new SQLTransientConnectionException((Throwable)null); + assertTrue(ex.getMessage() == null + && ex.getSQLState() == null + && ex.getCause() == null + && ex.getErrorCode() == 0); + } + + /** + * Create SQLTransientConnectionException with Throwable + */ + @Test + public void test9() { + SQLTransientConnectionException ex = + new SQLTransientConnectionException(t); + assertTrue(ex.getMessage().equals(cause) + && ex.getSQLState() == null + && cause.equals(ex.getCause().toString()) + && ex.getErrorCode() == 0); + } + + /** + * Serialize a SQLTransientConnectionException and make sure you can read it back properly + */ + @Test + public void test10() throws Exception { + SQLTransientConnectionException e = + new SQLTransientConnectionException(reason, state, errorCode, t); + SQLTransientConnectionException ex1 = + createSerializedException(e); + assertTrue(reason.equals(ex1.getMessage()) + && ex1.getSQLState().equals(state) + && cause.equals(ex1.getCause().toString()) + && ex1.getErrorCode() == errorCode); + } + + /** + * Validate that the ordering of the returned Exceptions is correct + * using for-each loop + */ + @Test + public void test11() { + SQLTransientConnectionException ex = + new SQLTransientConnectionException("Exception 1", t1); + SQLTransientConnectionException ex1 = + new SQLTransientConnectionException("Exception 2"); + SQLTransientConnectionException ex2 = + new SQLTransientConnectionException("Exception 3", t2); + ex.setNextException(ex1); + ex.setNextException(ex2); + int num = 0; + for (Throwable e : ex) { + assertTrue(msgs[num++].equals(e.getMessage())); + } + } + + /** + * Validate that the ordering of the returned Exceptions is correct + * using traditional while loop + */ + @Test + public void test12() { + SQLTransientConnectionException ex = + new SQLTransientConnectionException("Exception 1", t1); + SQLTransientConnectionException ex1 = + new SQLTransientConnectionException("Exception 2"); + SQLTransientConnectionException ex2 = + new SQLTransientConnectionException("Exception 3", t2); + ex.setNextException(ex1); + ex.setNextException(ex2); + int num = 0; + SQLException sqe = ex; + while (sqe != null) { + assertTrue(msgs[num++].equals(sqe.getMessage())); + Throwable c = sqe.getCause(); + while (c != null) { + assertTrue(msgs[num++].equals(c.getMessage())); + c = c.getCause(); + } + sqe = sqe.getNextException(); + } + } + + /** + * Create SQLTransientConnectionException and validate it is an instance of + * SQLNonTransientException + */ + @Test + public void test13() { + Exception ex = new SQLTransientConnectionException(); + assertTrue(ex instanceof SQLTransientException); + } +} diff --git a/test/java/sql/testng/test/sql/SQLTransientExceptionTests.java b/test/java/sql/testng/test/sql/SQLTransientExceptionTests.java new file mode 100644 index 000000000..d86f86b8f --- /dev/null +++ b/test/java/sql/testng/test/sql/SQLTransientExceptionTests.java @@ -0,0 +1,207 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package test.sql; + +import java.sql.SQLException; +import java.sql.SQLTransientException; +import static org.testng.Assert.*; +import org.testng.annotations.Test; +import util.BaseTest; + +public class SQLTransientExceptionTests extends BaseTest { + + /** + * Create SQLTransientException and setting all objects to null + */ + @Test + public void test() { + SQLTransientException e = new SQLTransientException(null, + null, errorCode, null); + assertTrue(e.getMessage() == null && e.getSQLState() == null + && e.getCause() == null && e.getErrorCode() == errorCode); + } + + /** + * Create SQLTransientException with no-arg constructor + */ + @Test + public void test1() { + SQLTransientException ex = new SQLTransientException(); + assertTrue(ex.getMessage() == null + && ex.getSQLState() == null + && ex.getCause() == null + && ex.getErrorCode() == 0); + } + + /** + * Create SQLTransientException with message + */ + @Test + public void test2() { + SQLTransientException ex = new SQLTransientException(reason); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState() == null + && ex.getCause() == null + && ex.getErrorCode() == 0); + } + + /** + * Create SQLTransientException with message, and SQLState + */ + @Test + public void test3() { + SQLTransientException ex = new SQLTransientException(reason, state); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState().equals(state) + && ex.getCause() == null + && ex.getErrorCode() == 0); + } + + /** + * Create SQLTransientException with message, SQLState, and error code + */ + @Test + public void test4() { + SQLTransientException ex = new SQLTransientException(reason, state, errorCode); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState().equals(state) + && ex.getCause() == null + && ex.getErrorCode() == errorCode); + } + + /** + * Create SQLTransientException with message, SQLState, errorCode, and Throwable + */ + @Test + public void test5() { + SQLTransientException ex = + new SQLTransientException(reason, state, errorCode, t); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState().equals(state) + && cause.equals(ex.getCause().toString()) + && ex.getErrorCode() == errorCode); + } + + /** + * Create SQLTransientException with message, SQLState, and Throwable + */ + @Test + public void test6() { + SQLTransientException ex = new SQLTransientException(reason, state, t); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState().equals(state) + && cause.equals(ex.getCause().toString()) + && ex.getErrorCode() == 0); + } + + /** + * Create SQLTransientException with message, and Throwable + */ + @Test + public void test7() { + SQLTransientException ex = new SQLTransientException(reason, t); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState() == null + && cause.equals(ex.getCause().toString()) + && ex.getErrorCode() == 0); + } + + /** + * Create SQLTransientException with null Throwable + */ + @Test + public void test8() { + SQLTransientException ex = new SQLTransientException((Throwable)null); + assertTrue(ex.getMessage() == null + && ex.getSQLState() == null + && ex.getCause() == null + && ex.getErrorCode() == 0); + } + + /** + * Create SQLTransientException with Throwable + */ + @Test + public void test9() { + SQLTransientException ex = new SQLTransientException(t); + assertTrue(ex.getMessage().equals(cause) + && ex.getSQLState() == null + && cause.equals(ex.getCause().toString()) + && ex.getErrorCode() == 0); + } + + /** + * Serialize a SQLTransientException and make sure you can read it back properly + */ + @Test + public void test10() throws Exception { + SQLTransientException e = + new SQLTransientException(reason, state, errorCode, t); + SQLTransientException ex1 = createSerializedException(e); + assertTrue(reason.equals(ex1.getMessage()) + && ex1.getSQLState().equals(state) + && cause.equals(ex1.getCause().toString()) + && ex1.getErrorCode() == errorCode); + } + + /** + * Validate that the ordering of the returned Exceptions is correct + * using for-each loop + */ + @Test + public void test11() { + SQLTransientException ex = new SQLTransientException("Exception 1", t1); + SQLTransientException ex1 = new SQLTransientException("Exception 2"); + SQLTransientException ex2 = new SQLTransientException("Exception 3", t2); + ex.setNextException(ex1); + ex.setNextException(ex2); + int num = 0; + for (Throwable e : ex) { + assertTrue(msgs[num++].equals(e.getMessage())); + } + } + + /** + * Validate that the ordering of the returned Exceptions is correct + * using traditional while loop + */ + @Test + public void test12() { + SQLTransientException ex = new SQLTransientException("Exception 1", t1); + SQLTransientException ex1 = new SQLTransientException("Exception 2"); + SQLTransientException ex2 = new SQLTransientException("Exception 3", t2); + ex.setNextException(ex1); + ex.setNextException(ex2); + int num = 0; + SQLException sqe = ex; + while (sqe != null) { + assertTrue(msgs[num++].equals(sqe.getMessage())); + Throwable c = sqe.getCause(); + while (c != null) { + assertTrue(msgs[num++].equals(c.getMessage())); + c = c.getCause(); + } + sqe = sqe.getNextException(); + } + } +} diff --git a/test/java/sql/testng/test/sql/SQLWarningTests.java b/test/java/sql/testng/test/sql/SQLWarningTests.java new file mode 100644 index 000000000..2856742dc --- /dev/null +++ b/test/java/sql/testng/test/sql/SQLWarningTests.java @@ -0,0 +1,249 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package test.sql; + +import java.sql.SQLException; +import java.sql.SQLWarning; +import static org.testng.Assert.*; +import org.testng.annotations.Test; +import util.BaseTest; + +public class SQLWarningTests extends BaseTest { + + private final String[] warnings = {"Warning 1", "cause 1", "Warning 2", + "Warning 3", "cause 2"}; + + /** + * Create SQLWarning and setting all objects to null + */ + @Test + public void test() { + SQLWarning e = new SQLWarning(null, null, errorCode, null); + assertTrue(e.getMessage() == null && e.getSQLState() == null + && e.getCause() == null && e.getErrorCode() == errorCode); + } + + /** + * Create SQLWarning with no-arg constructor + */ + @Test + public void test1() { + SQLWarning ex = new SQLWarning(); + assertTrue(ex.getMessage() == null + && ex.getSQLState() == null + && ex.getCause() == null + && ex.getErrorCode() == 0); + } + + /** + * Create SQLWarning with message + */ + @Test + public void test2() { + SQLWarning ex = new SQLWarning(reason); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState() == null + && ex.getCause() == null + && ex.getErrorCode() == 0); + } + + /** + * Create SQLWarning with message, and SQLState + */ + @Test + public void test3() { + + SQLWarning ex = new SQLWarning(reason, state); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState().equals(state) + && ex.getCause() == null + && ex.getErrorCode() == 0); + } + + /** + * Create SQLWarning with message, SQLState, and error code + */ + @Test + public void test4() { + SQLWarning ex = new SQLWarning(reason, state, errorCode); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState().equals(state) + && ex.getCause() == null + && ex.getErrorCode() == errorCode); + } + + /** + * Create SQLWarning with message, SQLState, errorCode, and Throwable + */ + @Test + public void test5() { + SQLWarning ex = new SQLWarning(reason, state, errorCode, t); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState().equals(state) + && cause.equals(ex.getCause().toString()) + && ex.getErrorCode() == errorCode); + } + + /** + * Create SQLWarning with message, SQLState, and Throwable + */ + @Test + public void test6() { + SQLWarning ex = new SQLWarning(reason, state, t); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState().equals(state) + && cause.equals(ex.getCause().toString()) + && ex.getErrorCode() == 0); + } + + /** + * Create SQLWarning with message, and Throwable + */ + @Test + public void test7() { + SQLWarning ex = new SQLWarning(reason, t); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState() == null + && cause.equals(ex.getCause().toString()) + && ex.getErrorCode() == 0); + } + + /** + * Create SQLWarning with null Throwable + */ + @Test + public void test8() { + SQLWarning ex = new SQLWarning((Throwable) null); + assertTrue(ex.getMessage() == null + && ex.getSQLState() == null + && ex.getCause() == null + && ex.getErrorCode() == 0); + } + + /** + * Create SQLWarning with Throwable + */ + @Test + public void test9() { + SQLWarning ex = new SQLWarning(t); + assertTrue(ex.getMessage().equals(cause) + && ex.getSQLState() == null + && cause.equals(ex.getCause().toString()) + && ex.getErrorCode() == 0); + } + + /** + * Serialize a SQLWarning and make sure you can read it back properly + */ + @Test + public void test10() throws Exception { + SQLWarning e = new SQLWarning(reason, state, errorCode, t); + SQLWarning ex1 = createSerializedException(e); + assertTrue(reason.equals(ex1.getMessage()) + && ex1.getSQLState().equals(state) + && cause.equals(ex1.getCause().toString()) + && ex1.getErrorCode() == errorCode); + } + + /** + * Validate that the ordering of the returned Exceptions is correct using + * for-each loop + */ + @Test + public void test11() { + SQLWarning ex = new SQLWarning("Exception 1", t1); + SQLWarning ex1 = new SQLWarning("Exception 2"); + SQLWarning ex2 = new SQLWarning("Exception 3", t2); + ex.setNextException(ex1); + ex.setNextException(ex2); + int num = 0; + for (Throwable e : ex) { + assertTrue(msgs[num++].equals(e.getMessage())); + } + } + + /** + * Validate that the ordering of the returned Exceptions is correct using + * traditional while loop + */ + @Test + public void test12() { + SQLWarning ex = new SQLWarning("Exception 1", t1); + SQLWarning ex1 = new SQLWarning("Exception 2"); + SQLWarning ex2 = new SQLWarning("Exception 3", t2); + ex.setNextException(ex1); + ex.setNextException(ex2); + int num = 0; + SQLException sqe = ex; + while (sqe != null) { + assertTrue(msgs[num++].equals(sqe.getMessage())); + Throwable c = sqe.getCause(); + while (c != null) { + assertTrue(msgs[num++].equals(c.getMessage())); + c = c.getCause(); + } + sqe = sqe.getNextException(); + } + } + + /** + * Validate that the ordering of the returned SQLWarning is correct using + * for-each loop + */ + @Test + public void test13() { + SQLWarning ex = new SQLWarning("Warning 1", t1); + SQLWarning ex1 = new SQLWarning("Warning 2"); + SQLWarning ex2 = new SQLWarning("Warning 3", t2); + ex.setNextWarning(ex1); + ex.setNextWarning(ex2); + int num = 0; + for (Throwable e : ex) { + assertTrue(warnings[num++].equals(e.getMessage())); + } + } + + /** + * Validate that the ordering of the returned SQLWarning is correct using + * traditional while loop + */ + @Test + public void test14() { + SQLWarning ex = new SQLWarning("Warning 1", t1); + SQLWarning ex1 = new SQLWarning("Warning 2"); + SQLWarning ex2 = new SQLWarning("Warning 3", t2); + ex.setNextWarning(ex1); + ex.setNextWarning(ex2); + int num = 0; + SQLWarning sqe = ex; + while (sqe != null) { + assertTrue(warnings[num++].equals(sqe.getMessage())); + Throwable c = sqe.getCause(); + while (c != null) { + assertTrue(msgs[num++].equals(c.getMessage())); + c = c.getCause(); + } + sqe = sqe.getNextWarning(); + } + } +} diff --git a/test/java/sql/testng/test/sql/TimeTests.java b/test/java/sql/testng/test/sql/TimeTests.java new file mode 100644 index 000000000..7b9967975 --- /dev/null +++ b/test/java/sql/testng/test/sql/TimeTests.java @@ -0,0 +1,348 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package test.sql; + +import java.sql.Time; +import java.time.LocalTime; +import static org.testng.Assert.*; +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; +import util.BaseTest; + +public class TimeTests extends BaseTest { + + /* + * Validate an IllegalArgumentException is thrown for calling getYear + */ + @Test(expectedExceptions = IllegalArgumentException.class) + public void test01() { + Time t = Time.valueOf("08:30:59"); + t.getYear(); + } + + /* + * Validate an IllegalArgumentException is thrown for calling getMonth + */ + @Test(expectedExceptions = IllegalArgumentException.class) + public void test02() { + Time t = Time.valueOf("08:30:59"); + t.getMonth(); + } + + /* + * Validate an IllegalArgumentException is thrown for calling getDay + */ + @Test(expectedExceptions = IllegalArgumentException.class) + public void test03() { + Time t = Time.valueOf("08:30:59"); + t.getDay(); + } + + /** + * Validate an IllegalArgumentException is thrown for calling getDate + */ + @Test(expectedExceptions = IllegalArgumentException.class) + public void test04() { + Time t = Time.valueOf("08:30:59"); + t.getDate(); + } + + /* + * Validate an IllegalArgumentException is thrown for calling setYear + */ + @Test(expectedExceptions = IllegalArgumentException.class) + public void test05() { + Time t = Time.valueOf("08:30:59"); + t.setYear(8); + } + + /* + * Validate an IllegalArgumentException is thrown for calling setMonth + */ + @Test(expectedExceptions = IllegalArgumentException.class) + public void test06() { + Time t = Time.valueOf("08:30:59"); + t.setMonth(8); + } + + /* + * Validate an IllegalArgumentException is thrown for calling setDate + */ + @Test(expectedExceptions = IllegalArgumentException.class) + public void test07() { + Time t = Time.valueOf("08:30:59"); + t.setDate(30); + } + + /* + * Validate an IllegalArgumentException is thrown for calling getDate + */ + @Test(expectedExceptions = IllegalArgumentException.class) + public void test08() { + Time t = Time.valueOf("08:30:59"); + t.getDate(); + } + + /* + * Validate that a Time made from a toLocalTime() LocalTime are equal + */ + @Test + public void test09() { + Time t = Time.valueOf("08:30:59"); + Time t2 = Time.valueOf(t.toLocalTime()); + assertTrue(t.equals(t2), "Error t != t2"); + } + + /* + * Validate that a Time LocalTime value, made from a LocalTime are equal + */ + @Test + public void test10() { + LocalTime lt = LocalTime.of(8, 30, 59); + Time t = Time.valueOf(lt); + System.out.println("lt=" + lt + ",t=" + t.toLocalTime()); + assertTrue(lt.equals(t.toLocalTime()), + "Error LocalTime values are not equal"); + } + + /* + * Validate an NPE occurs when a null LocalDate is passed to valueOf + */ + @Test(expectedExceptions = NullPointerException.class) + public void test11() throws Exception { + LocalTime ld = null; + Time.valueOf(ld); + } + + /* + * Validate an UnsupportedOperationException occurs when toInstant() is + * called + */ + @Test(expectedExceptions = UnsupportedOperationException.class) + public void test12() throws Exception { + Time t = new Time(System.currentTimeMillis()); + t.toInstant(); + } + + /* + * Validate that two Time objects are equal when one is created from the + * toString() of the other and that the correct value is returned from + * toString() + */ + @Test(dataProvider = "validTimeValues") + public void test13(String time, String expected) { + Time t1 = Time.valueOf(time); + Time t2 = Time.valueOf(t1.toString()); + assertTrue(t1.equals(t2) && t2.equals(t1) + && t1.toString().equals(expected), "Error t1 != t2"); + } + + /* + * Validate that two Time values one created using valueOf and another via a + * constructor are equal + */ + @Test + public void test14() { + Time t = Time.valueOf("08:30:59"); + Time t2 = new Time(8, 30, 59); + assertTrue(t.equals(t2) && t2.equals(t), "Error t != t2"); + } + + /* + * Validate that two Time values one created using valueOf and another via a + * constructor are equal + */ + @Test + public void test15() { + Time t = Time.valueOf("08:30:59"); + Time t2 = new Time(t.getTime()); + assertTrue(t.equals(t2) && t2.equals(t), "Error t != t2"); + } + + /* + * Validate an IllegalArgumentException is thrown for an invalid Time string + */ + @Test(dataProvider = "invalidTimeValues", + expectedExceptions = IllegalArgumentException.class) + public void test16(String time) throws Exception { + Time.valueOf(time); + } + + /* + * Validate that Time.after() returns false when same date is compared + */ + @Test + public void test17() { + Time t = Time.valueOf("08:30:59"); + assertFalse(t.after(t), "Error t.after(t) = true"); + } + + /* + * Validate that Time.after() returns true when later date is compared to + * earlier date + */ + @Test + public void test18() { + Time t = Time.valueOf("08:30:59"); + Time t2 = new Time(System.currentTimeMillis()); + assertTrue(t2.after(t), "Error t2.after(t) = false"); + } + + /* + * Validate that Time.after() returns false when earlier date is compared to + * itself + */ + @Test + public void test19() { + Time t = Time.valueOf("08:30:59"); + Time t2 = new Time(t.getTime()); + assertFalse(t.after(t2), "Error t.after(t2) = true"); + assertFalse(t2.after(t), "Error t2.after(t) = true"); + } + + /* + * Validate that Time.before() returns false when same date is compared + */ + @Test + public void test20() { + Time t = Time.valueOf("08:30:59"); + assertFalse(t.before(t), "Error t.before(t) = true"); + } + + /* + * Validate that Time.before() returns true when earlier date is compared to + * later date + */ + @Test + public void test21() { + Time t = Time.valueOf("08:30:59"); + Time t2 = new Time(System.currentTimeMillis()); + assertTrue(t.before(t2), "Error t.before(t2) = false"); + } + + /* + * Validate that Time.before() returns false when earlier date is compared + * to itself + */ + @Test + public void test22() { + Time t = Time.valueOf("08:30:59"); + Time t2 = new Time(t.getTime()); + assertFalse(t.before(t2), "Error t.after(t2) = true"); + assertFalse(t2.before(t), "Error t2.after(t) = true"); + } + + /* + * Validate that Time.compareTo returns 0 when both Date objects are the + * same + */ + @Test + public void test23() { + Time t = Time.valueOf("08:30:59"); + assertTrue(t.compareTo(t) == 0, "Error t.compareTo(t) !=0"); + } + + /* + * Validate thatTime.compareTo returns 0 when both Time objects are the same + */ + @Test + public void test24() { + Time t = Time.valueOf("08:30:59"); + Time t2 = new Time(t.getTime()); + assertTrue(t.compareTo(t2) == 0, "Error t.compareTo(t2) !=0"); + } + + /* + * Validate that Time.compareTo returns 1 when comparing a later Time to an + * earlier Time + */ + @Test + public void test25() { + Time t = Time.valueOf("08:30:59"); + Time t2 = new Time(t.getTime() + 1); + assertTrue(t2.compareTo(t) == 1, "Error t2.compareTo(t) !=1"); + } + + /* + * Validate thatTime.compareTo returns 1 when comparing a later Time to an + * earlier Time + */ + @Test + public void test26() { + Time t = Time.valueOf("08:30:59"); + Time t2 = new Time(t.getTime() + 1); + assertTrue(t.compareTo(t2) == -1, "Error t.compareTo(t2) != -1"); + } + + /* + * DataProvider used to provide Time values which are not valid and are used + * to validate that an IllegalArgumentException will be thrown from the + * valueOf method + */ + @DataProvider(name = "invalidTimeValues") + private Object[][] invalidTimeValues() { + return new Object[][]{ + {"2009-11-01 10:50:01"}, + {"1961-08-30 10:50:01.1"}, + {"1961-08-30"}, + {"00:00:00."}, + {"10:50:0.1"}, + {":00:00"}, + {"00::00"}, + {"00:00:"}, + {"::"}, + {" : : "}, + {"0a:00:00"}, + {"00:bb:00"}, + {"00:01:cc"}, + {"08:10:Batman"}, + {"08:10:10:10"}, + {"08:10"}, + {"a:b:c"}, + {null}, + {"8:"} + }; + } + + /* + * DataProvider used to provide Time values which are valid and are used + * to validate that an IllegalArgumentException will not be thrown from the + * valueOf method. It also contains the expected return value from + * toString() + */ + @DataProvider(name = "validTimeValues") + private Object[][] validTimeValues() { + return new Object[][]{ + {"10:50:01", "10:50:01"}, + {"01:1:1", "01:01:01"}, + {"01:01:1", "01:01:01"}, + {"1:01:1", "01:01:01"}, + {"2:02:02", "02:02:02"}, + {"2:02:2", "02:02:02"}, + {"10:50:1", "10:50:01"}, + {"00:00:00", "00:00:00"}, + {"08:30:59", "08:30:59"}, + {"9:0:1", "09:00:01"} + }; + } +} diff --git a/test/java/sql/testng/test/sql/TimestampTests.java b/test/java/sql/testng/test/sql/TimestampTests.java new file mode 100644 index 000000000..7766b5a2b --- /dev/null +++ b/test/java/sql/testng/test/sql/TimestampTests.java @@ -0,0 +1,777 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package test.sql; + +import java.sql.Date; +import java.sql.Time; +import java.sql.Timestamp; +import java.time.Instant; +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.util.Calendar; +import java.util.TimeZone; +import static org.testng.Assert.*; +import org.testng.annotations.AfterClass; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; +import util.BaseTest; + +public class TimestampTests extends BaseTest { + + private static TimeZone defaultTimeZone = null; + + /* + * Need to set and use a custom TimeZone which does not + * observe daylight savings time for this test. + */ + @BeforeClass + public static void setUpClass() throws Exception { + defaultTimeZone = TimeZone.getDefault(); + TimeZone tzone = TimeZone.getTimeZone("GMT+01"); + assertFalse(tzone.observesDaylightTime()); + TimeZone.setDefault(tzone); + } + + /* + * Conservatively reset the default time zone after test. + */ + @AfterClass + public static void tearDownClass() throws Exception { + TimeZone.setDefault(defaultTimeZone); + } + + /* + * Validate an IllegalArgumentException is thrown for an invalid Timestamp + */ + @Test(dataProvider = "invalidTimestampValues", + expectedExceptions = IllegalArgumentException.class) + public void test(String ts) throws Exception { + Timestamp.valueOf(ts); + } + + /* + * Validate that two Timestamp are equal when the leading 0 in seconds is + * omitted + */ + @Test + public void test01() throws Exception { + String testTS = "2009-01-01 10:50:00"; + String ExpectedTS = "2009-01-01 10:50:0"; + Timestamp ts = Timestamp.valueOf(testTS); + Timestamp ts2 = Timestamp.valueOf(ExpectedTS); + assertEquals(ts, ts2, "Error ts1 != ts2"); + } + + /* + * Validate two Timestamps created from the same string are equal + */ + @Test + public void test02() throws Exception { + String testTS = "2009-01-01 10:50:0"; + Timestamp ts = Timestamp.valueOf(testTS); + Timestamp ts2 = Timestamp.valueOf(testTS); + assertEquals(ts, ts2, "Error ts1 != ts2"); + } + + /* + * Validate that two Timestamp values one with leading 0s for month and day + * equals same string without the leading 0s. + */ + @Test + public void test03() throws Exception { + String testTS = "2009-1-1 10:50:0"; + String ExpectedTS = "2009-01-01 10:50:0"; + Timestamp ts = Timestamp.valueOf(testTS); + Timestamp ts2 = Timestamp.valueOf(ExpectedTS); + assertEquals(ts, ts2, "Error ts1 != ts2"); + } + + /* + * Validate that two Timestamp values one with leading 0s for day omitted + * are equal + */ + @Test + public void test04() throws Exception { + String testTS = "2009-01-1 10:50:0"; + String ExpectedTS = "2009-01-01 10:50:0"; + Timestamp ts = Timestamp.valueOf(testTS); + Timestamp ts2 = Timestamp.valueOf(ExpectedTS); + assertEquals(ts, ts2, "Error ts1 != ts2"); + } + + /* + * Validate that two Timestamp values one with leading 0s for month omitted + * and both with leading 0s for seconds omitted are equal + */ + @Test + public void test05() throws Exception { + String testTS = "2009-1-01 10:50:0"; + String ExpectedTS = "2009-01-01 10:50:0"; + Timestamp ts = Timestamp.valueOf(testTS); + Timestamp ts2 = Timestamp.valueOf(ExpectedTS); + assertEquals(ts, ts2, "Error ts1 != ts2"); + } + + /* + * Validate that two Timestamp values one with leading 0s for month omitted + */ + @Test + public void test06() throws Exception { + String testTS = "2005-1-01 10:20:50.00"; + String ExpectedTS = "2005-01-01 10:20:50.00"; + Timestamp ts = Timestamp.valueOf(testTS); + Timestamp ts2 = Timestamp.valueOf(ExpectedTS); + assertEquals(ts, ts2, "Error ts1 != ts2"); + } + + /* + * Validate that two Timestamp values one created using valueOf and another + * via a constructor are equal + */ + @Test + public void test07() { + + Timestamp ts1 = Timestamp.valueOf("1996-12-13 14:15:25.001"); + Timestamp ts2 = new Timestamp(96, 11, 13, 14, 15, 25, 1000000); + assertTrue(ts1.equals(ts2), "Error ts1 != ts2"); + } + + /* + * Validate that two Timestamp values one created using valueOf and another + * via a constructor are equal + */ + @Test + public void test08() { + Timestamp ts1 = Timestamp.valueOf("1996-12-13 14:15:25.001"); + Timestamp ts2 = new Timestamp(ts1.getTime()); + assertTrue(ts1.equals(ts2), "Error ts1 != ts2"); + } + + /* + * Validate that two Timestamp values one created using valueOf and another + * via a constructor are equal + */ + @Test + public void test09() { + + Timestamp ts1 = Timestamp.valueOf("1996-12-13 14:15:25.0"); + Timestamp ts2 = new Timestamp(96, 11, 13, 14, 15, 25, 0); + assertTrue(ts1.equals(ts2), "Error ts1 != ts2"); + } + + /* + * Validate that a Timestamp cannot be equal to null + */ + @Test + public void test10() { + + Timestamp ts1 = Timestamp.valueOf("1961-08-30 14:15:25.745634"); + Timestamp ts2 = null; + assertFalse(ts1.equals(ts2), "Error ts1 == null"); + } + + /* + * Validate that a Timestamp is equal to another timestamp created with the + * using the same value but not equal to a Timestamp which is one day later + */ + @Test + public void test11() { + + Timestamp ts1 = Timestamp.valueOf("1996-12-10 12:26:19.12"); + Timestamp ts2 = Timestamp.valueOf("1996-12-10 12:26:19.12"); + Timestamp ts3 = Timestamp.valueOf("1996-12-11 12:24:19.12"); + assertTrue(ts1.equals(ts2) && ts2.equals(ts1), "Error ts1 != ts2"); + assertFalse(ts1.equals(ts3) && ts3.equals(ts1), "Error ts1 == ts3"); + + } + + /* + * Validate that a Timestamp is equal to itself + */ + @Test + public void test12() { + Timestamp ts1 = Timestamp.valueOf("1996-10-15 12:26:19.12"); + assertTrue(ts1.equals(ts1), "Error ts1 != ts1"); + } + + /* + * Validate that two Timestamps are equal when one is created from the + * toString() of the other + */ + @Test(dataProvider = "validTimestampValues") + public void test13(String ts, String expectedTS) { + Timestamp ts1 = Timestamp.valueOf(ts); + Timestamp ts2 = Timestamp.valueOf(ts1.toString()); + assertTrue(ts1.equals(ts2) && ts2.equals(ts1) + && ts1.toString().equals(expectedTS), "Error ts1 != ts2"); + } + + // Before Tests + /* + * Validate that Timestamp ts1 is before Timestamp ts2 + */ + @Test + public void test14() { + Timestamp ts1 = Timestamp.valueOf("1996-12-13 14:15:25.745634"); + Timestamp ts2 = Timestamp.valueOf("1996-12-13 15:15:25.645634"); + assertTrue(ts1.before(ts2), "Error ts1 not before ts2"); + } + + /* + * Validate that Timestamp ts1 is before Timestamp ts2 + */ + @Test + public void test15() { + Timestamp ts1 = Timestamp.valueOf("1961-08-30 14:15:25"); + Timestamp ts2 = Timestamp.valueOf("1999-12-13 15:15:25"); + assertTrue(ts1.before(ts2), "Error ts1 not before ts2"); + } + + /* + * Validate that Timestamp ts1 is before Timestamp ts2 + */ + @Test + public void test16() { + + Timestamp ts1 = Timestamp.valueOf("1999-12-13 14:15:25.745634"); + Timestamp ts2 = Timestamp.valueOf("1999-11-13 15:15:25.645634"); + assertFalse(ts1.before(ts2), "Error ts1 before ts2"); + } + + /* + * Validate that a NullPointerException is thrown if a null is passed to + * the before method + */ + @Test(expectedExceptions = NullPointerException.class) + public void test17() throws Exception { + Timestamp ts1 = Timestamp.valueOf("1996-12-13 14:15:25.745634"); + ts1.before(null); + } + + /* + * Validate a Timestamp cannot be before itself + */ + @Test + public void test18() { + Timestamp ts1 = Timestamp.valueOf("1999-11-10 12:26:19.3456543"); + assertFalse(ts1.before(ts1), "Error ts1 before ts1!"); + } + + /* + * Create 3 Timestamps and make sure the 1st is before the other two + * Timestamps which are each greater than the one before it + */ + @Test + public void test19() { + + Timestamp ts1 = new Timestamp(1234560000); + Timestamp ts2 = new Timestamp(1234567000); + Timestamp ts3 = new Timestamp(1234569000); + assertTrue(ts1.before(ts2) && ts2.before(ts3) && ts1.before(ts3)); + } + + /* + * Validate that Timestamp ts1 is not after Timestamp ts2 + */ + @Test + public void test20() { + Timestamp ts1 = Timestamp.valueOf("1999-12-13 14:15:25.745634"); + Timestamp ts2 = Timestamp.valueOf("1999-12-13 15:15:25.645634"); + assertFalse(ts1.after(ts2), "Error ts1 is after ts2"); + + } + + /* + * Validate that Timestamp ts1 is after Timestamp ts2 + */ + @Test + public void test21() { + Timestamp ts1 = Timestamp.valueOf("1996-12-13 14:15:25.745634"); + Timestamp ts2 = Timestamp.valueOf("1996-11-13 15:15:25.645634"); + assertTrue(ts1.after(ts2), "Error ts1 not after ts2"); + } + + /* + * Validate that a NullPointerException is thrown if a null is passed to the + * after method + */ + @Test(expectedExceptions = NullPointerException.class) + public void test22() throws Exception { + Timestamp ts1 = Timestamp.valueOf("1966-08-30 08:08:08"); + ts1.after(null); + } + + /* + * Validate that a Timestamp cannot be after itself + */ + @Test + public void test23() { + Timestamp ts1 = Timestamp.valueOf("1999-11-10 12:26:19.3456543"); + assertFalse(ts1.after(ts1), "Error ts1 is after itself"); + } + + /* + * Validate that a Timestamp after() works correctly with Timestamp created + * using milliseconds + */ + @Test + public void test24() { + + Timestamp ts1 = new Timestamp(1234568000); + Timestamp ts2 = new Timestamp(1234565000); + Timestamp ts3 = new Timestamp(1234562000); + assertTrue(ts1.after(ts2) && ts2.after(ts3) && ts1.after(ts3)); + } + + /* + * Validate compareTo returns 0 for Timestamps that are the same + */ + @Test + public void test25() { + Timestamp ts1 = Timestamp.valueOf("1966-08-30 08:08:08"); + Timestamp ts2 = new Timestamp(ts1.getTime()); + assertTrue(ts1.compareTo(ts2) == 0, "Error ts1 != ts2"); + } + + /* + * Validate compareTo returns -1 for when the 1st Timestamp is earlier than + * the 2nd Timestamp + */ + @Test + public void test26() { + Timestamp ts1 = Timestamp.valueOf("1966-08-30 08:08:08"); + Timestamp ts2 = new Timestamp(ts1.getTime() + 1000); + assertTrue(ts1.compareTo(ts2) == -1, "Error ts1 not before ts2"); + assertTrue(ts2.compareTo(ts1) == 1, "Error ts1 is not before ts2"); + } + + /* + * Validate compareTo returns 1 for when the 1st Timestamp is later than the + * 2nd Timestamp + */ + @Test + public void test27() { + Timestamp ts1 = Timestamp.valueOf("1966-08-30 08:08:08"); + Timestamp ts2 = new Timestamp(ts1.getTime() - 1000); + assertTrue(ts1.compareTo(ts2) == 1, "Error ts1 not after ts2"); + assertTrue(ts2.compareTo(ts1) == -1, "Error ts1 not after ts2"); + } + + /* + * Validate compareTo returns 0 for Timestamps that are the same + */ + @Test + public void test28() { + Timestamp ts1 = Timestamp.valueOf("1966-08-30 08:08:08"); + java.util.Date ts2 = new java.util.Date(ts1.getTime()); + assertTrue(ts1.compareTo(ts2) == 0, "Error ts1 != ts2"); + } + + /* + * Validate compareTo returns 0 for Timestamps that are the same + */ + @Test + public void test29() { + Timestamp ts1 = Timestamp.valueOf("1966-08-30 08:08:08"); + java.util.Date d = new java.util.Date(ts1.getTime()); + assertFalse(ts1.equals(d), "Error ts1 == d"); + } + + /* + * Validate compareTo returns 0 for Timestamps that are the same + */ + @Test + public void test30() { + Timestamp ts1 = Timestamp.valueOf("1966-08-30 08:08:08"); + java.util.Date d = new Timestamp(ts1.getTime()); + assertTrue(ts1.equals(d), "Error ts1 != d"); + } + + /* + * Validate equals returns false when a Date object is passed to equals + */ + @Test + public void test31() { + Timestamp ts1 = Timestamp.valueOf("1966-08-30 08:08:08"); + Date d = new Date(ts1.getTime()); + assertFalse(ts1.equals(d), "Error ts1 != d"); + } + + /* + * Validate equals returns false when a Date object is passed to equals + */ + @Test + public void test32() { + Timestamp ts1 = Timestamp.valueOf("1966-08-30 08:08:08"); + java.util.Date d = new Date(ts1.getTime()); + assertFalse(ts1.equals(d), "Error ts1 != d"); + } + + /* + * Validate equals returns false when a Time object is passed to equals + */ + @Test + public void test33() { + Timestamp ts1 = Timestamp.valueOf("1966-08-30 08:08:08"); + Time t1 = new Time(ts1.getTime()); + assertFalse(ts1.equals(t1), "Error ts1 == t1"); + } + + /* + * Validate equals returns false when a String object is passed to equals + */ + @Test + public void test34() { + Timestamp ts1 = Timestamp.valueOf("1966-08-30 08:08:08"); + assertFalse(ts1.equals("1966-08-30 08:08:08"), "Error ts1 == a String"); + } + + /* + * Validate getTime() returns the same value from 2 timeStamps created by + */ + @Test + public void test35() { + Timestamp ts1 = Timestamp.valueOf("1966-08-30 08:08:08"); + Timestamp ts2 = Timestamp.valueOf("1966-08-30 08:08:08"); + assertTrue(ts2.getTime() == ts1.getTime(), + "ts1.getTime() != ts2.getTime()"); + assertTrue(ts1.equals(ts2), "Error ts1 != ts2"); + } + + /* + * Validate getTime() returns the same value from 2 timeStamps when + * setTime() is used to specify the same value for both Timestamps + */ + @Test + public void test36() { + Timestamp ts1 = Timestamp.valueOf("1966-08-30 08:08:08"); + Timestamp ts2 = Timestamp.valueOf("1961-08-30 00:00:00"); + ts2.setTime(ts1.getTime()); + assertTrue(ts2.getTime() == ts1.getTime(), + "ts1.getTime() != ts2.getTime()"); + assertTrue(ts1.equals(ts2), "Error ts1 != ts2"); + } + + /* + * Validate an IllegalArgumentException is thrown for an invalid nanos value + */ + @Test(expectedExceptions = IllegalArgumentException.class) + public void test38() throws Exception { + Timestamp ts1 = Timestamp.valueOf("1961-08-30 00:00:00"); + ts1.setNanos(-1); + + } + + /* + * Validate an IllegalArgumentException is thrown for an invalid nanos value + */ + @Test(expectedExceptions = IllegalArgumentException.class) + public void test39() throws Exception { + int nanos = 999999999; + Timestamp ts1 = Timestamp.valueOf("1961-08-30 00:00:00"); + ts1.setNanos(nanos + 1); + } + + /* + * Validate you can set nanos to 999999999 + */ + @Test + public void test40() throws Exception { + int nanos = 999999999; + Timestamp ts1 = Timestamp.valueOf("1961-08-30 00:00:00"); + ts1.setNanos(nanos); + assertTrue(ts1.getNanos() == nanos, "Error Invalid Nanos value"); + } + + /* + * Validate you can set nanos to 0 + */ + @Test + public void test41() throws Exception { + int nanos = 0; + Timestamp ts1 = Timestamp.valueOf("1961-08-30 00:00:00"); + ts1.setNanos(nanos); + assertTrue(ts1.getNanos() == nanos, "Error Invalid Nanos value"); + } + + /* + * Validate that a Timestamp made from a LocalDateTime are equal + */ + @Test + public void test42() throws Exception { + Timestamp ts1 = Timestamp.valueOf("1961-08-30 00:00:00"); + LocalDateTime ldt = ts1.toLocalDateTime(); + Timestamp ts2 = Timestamp.valueOf(ldt); + assertTrue(ts1.equals(ts2), "Error ts1 != ts2"); + } + + /* + * Validate that a Timestamp LocalDateTime value, made from a LocalDateTime + * are equal + */ + @Test + public void test43() throws Exception { + LocalDateTime ldt = LocalDateTime.now(); + Timestamp ts2 = Timestamp.valueOf(ldt); + assertTrue(ldt.equals(ts2.toLocalDateTime()), + "Error LocalDateTime values are not equal"); + } + + /* + * Validate an NPE occurs when a null LocalDateTime is passed to valueOF + */ + @Test(expectedExceptions = NullPointerException.class) + public void test44() throws Exception { + LocalDateTime ldt = null; + Timestamp.valueOf(ldt); + } + + /* + * Validate that a Timestamp made from a Instant are equal + */ + @Test + public void test45() throws Exception { + Timestamp ts1 = Timestamp.valueOf("1961-08-30 00:00:00"); + Instant instant = ts1.toInstant(); + Timestamp ts2 = Timestamp.from(instant); + assertTrue(ts1.equals(ts2), "Error ts1 != ts2"); + } + + /* + * Validate that a Timestamp made from a Instant are equal + */ + @Test + public void test46() throws Exception { + Instant instant = Instant.now(); + Timestamp ts2 = Timestamp.from(instant); + assertTrue(instant.equals(ts2.toInstant()), + "Error Instant values do not match"); + } + + /* + * Validate an NPE occurs when a null instant is passed to from + */ + @Test(expectedExceptions = NullPointerException.class) + public void test47() throws Exception { + Instant instant = null; + Timestamp.from(instant); + } + + // Added SQE tests + /* + * Create a Timestamp and a 2nd Timestamp that is 1 month earlier and + * validate that it is not before or after the original Timestamp + */ + @Test + public void test48() { + Calendar cal = Calendar.getInstance(); + Timestamp ts1 = new Timestamp(System.currentTimeMillis()); + cal.setTimeInMillis(ts1.getTime()); + cal.add(Calendar.MONTH, -1); + cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DAY_OF_MONTH)); + Timestamp ts2 = new Timestamp(cal.getTimeInMillis()); + assertFalse(ts1.before(ts2) || ts2.after(ts1)); + } + + /* + * Create two Timestamps and validate that compareTo returns 1 to indicate + * the 1st Timestamp is greater than the 2nd Timestamp + */ + @Test + public void test49() { + Calendar cal = Calendar.getInstance(); + Timestamp ts1 = new Timestamp(System.currentTimeMillis()); + cal.setTimeInMillis(ts1.getTime()); + cal.add(Calendar.MONTH, -1); + cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DAY_OF_MONTH)); + Timestamp ts2 = new Timestamp(cal.getTimeInMillis()); + assertTrue(ts1.compareTo(ts2) == 1); + } + + /* + * Create two Timestamps and validate that the 1st Timestamp is not equal to + * the 2nd Timestamp but equal to itself + */ + @Test + public void test50() { + Calendar cal = Calendar.getInstance(); + Timestamp ts1 = new Timestamp(System.currentTimeMillis()); + cal.setTimeInMillis(ts1.getTime()); + cal.add(Calendar.MONTH, -1); + cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DAY_OF_MONTH)); + Timestamp ts2 = new Timestamp(cal.getTimeInMillis()); + assertTrue(!ts1.equals(ts2) && ts1.equals(ts1)); + } + + /* + * Validate that two Timestamps are equal when one is created from the + * toString() of the other + */ + @Test(dataProvider = "validateNanos") + public void test51(String ts, int nanos) { + Timestamp ts1 = Timestamp.valueOf(ts); + Timestamp ts2 = Timestamp.valueOf(ts1.toString()); + assertTrue(ts1.getNanos() == nanos && ts1.equals(ts2), + "Error with Nanos"); + } + + @Test(dataProvider = "validTimestampLongValues") + public void test52(long value, String ts) { + Timestamp ts1 = new Timestamp(value); + assertEquals(ts1.toString(), ts, "ts1.toString() != ts"); + } + + /* + * DataProvider used to provide Timestamps which are not valid and are used + * to validate that an IllegalArgumentException will be thrown from the + * valueOf method + */ + @DataProvider(name = "invalidTimestampValues") + private Object[][] invalidTimestampValues() { + return new Object[][]{ + {"2009-11-01-01 10:50:01"}, + {"aaaa-11-01-01 10:50"}, + {"aaaa-11-01 10:50"}, + {"1961--30 00:00:00"}, + {"--30 00:00:00"}, + {"-- 00:00:00"}, + {"1961-1- 00:00:00"}, + {"2009-11-01"}, + {"10:50:01"}, + {"1961-a-30 00:00:00"}, + {"1961-01-bb 00:00:00"}, + {"1961-08-30 00:00:00."}, + {"1961-08-30 :00:00"}, + {"1961-08-30 00::00"}, + {"1961-08-30 00:00:"}, + {"1961-08-30 ::"}, + {"1961-08-30 0a:00:00"}, + {"1961-08-30 00:bb:00"}, + {"1961-08-30 00:01:cc"}, + {"1961-08-30 00:00:00.01a"}, + {"1961-08-30 00:00:00.a"}, + {"1996-12-10 12:26:19.1234567890"}, + {null} + }; + } + + /* + * DataProvider used to provide Timestamps which are valid and are used + * to validate that an IllegalArgumentException will not be thrown from the + * valueOf method and the corect value from toString() is returned + */ + @DataProvider(name = "validTimestampValues") + private Object[][] validTimestampValues() { + return new Object[][]{ + {"1961-08-30 00:00:00", "1961-08-30 00:00:00.0"}, + {"1961-08-30 11:22:33", "1961-08-30 11:22:33.0"}, + {"1961-8-30 00:00:00", "1961-08-30 00:00:00.0"}, + {"1966-08-1 00:00:00", "1966-08-01 00:00:00.0"}, + {"1996-12-10 12:26:19.1", "1996-12-10 12:26:19.1"}, + {"1996-12-10 12:26:19.12", "1996-12-10 12:26:19.12"}, + {"1996-12-10 12:26:19.123", "1996-12-10 12:26:19.123"}, + {"1996-12-10 12:26:19.1234", "1996-12-10 12:26:19.1234"}, + {"1996-12-10 12:26:19.12345", "1996-12-10 12:26:19.12345"}, + {"1996-12-10 12:26:19.123456", "1996-12-10 12:26:19.123456"}, + {"1996-12-10 12:26:19.1234567", "1996-12-10 12:26:19.1234567"}, + {"1996-12-10 12:26:19.12345678", "1996-12-10 12:26:19.12345678"}, + {"1996-12-10 12:26:19.123456789", "1996-12-10 12:26:19.123456789"}, + {"1996-12-10 12:26:19.000000001", "1996-12-10 12:26:19.000000001"}, + {"1996-12-10 12:26:19.000000012", "1996-12-10 12:26:19.000000012"}, + {"1996-12-10 12:26:19.000000123", "1996-12-10 12:26:19.000000123"}, + {"1996-12-10 12:26:19.000001234", "1996-12-10 12:26:19.000001234"}, + {"1996-12-10 12:26:19.000012345", "1996-12-10 12:26:19.000012345"}, + {"1996-12-10 12:26:19.000123456", "1996-12-10 12:26:19.000123456"}, + {"1996-12-10 12:26:19.001234567", "1996-12-10 12:26:19.001234567"}, + {"1996-12-10 12:26:19.12345678", "1996-12-10 12:26:19.12345678"}, + {"1996-12-10 12:26:19.0", "1996-12-10 12:26:19.0"}, + {"1996-12-10 12:26:19.01230", "1996-12-10 12:26:19.0123"} + }; + } + + @DataProvider(name = "validTimestampLongValues") + private Object[][] validTimestampLongValues() { + return new Object[][]{ + {1L, "1970-01-01 01:00:00.001"}, + {-3600*1000L - 1, "1969-12-31 23:59:59.999"}, + {-(20000L*365*24*60*60*1000), "18018-08-28 01:00:00.0"}, + {Timestamp.valueOf("1961-08-30 11:22:33").getTime(), "1961-08-30 11:22:33.0"}, + {Timestamp.valueOf("1961-08-30 11:22:33.54321000").getTime(), "1961-08-30 11:22:33.543"}, // nanoprecision lost + {new Timestamp(114, 10, 10, 10, 10, 10, 100000000).getTime(), "2014-11-10 10:10:10.1"}, + {new Timestamp(0, 10, 10, 10, 10, 10, 100000).getTime(), "1900-11-10 10:10:10.0"}, // nanoprecision lost + {new Date(114, 10, 10).getTime(), "2014-11-10 00:00:00.0"}, + {new Date(0, 10, 10).getTime(), "1900-11-10 00:00:00.0"}, + {LocalDateTime.of(1960, 10, 10, 10, 10, 10, 50000).atZone(ZoneId.of("America/Los_Angeles")) + .toInstant().toEpochMilli(), "1960-10-10 19:10:10.0"}, + + // millisecond timestamps wraps around at year 1, so Long.MIN_VALUE looks similar + // Long.MAX_VALUE, while actually representing 292278994 BCE + {Long.MIN_VALUE, "292278994-08-17 08:12:55.192"}, + {Long.MAX_VALUE + 1, "292278994-08-17 08:12:55.192"}, + {Long.MAX_VALUE, "292278994-08-17 08:12:55.807"}, + {Long.MIN_VALUE - 1, "292278994-08-17 08:12:55.807"}, + + // wrap around point near 0001-01-01, test that we never get a negative year: + {-(1970L*365*24*60*60*1000), "0001-04-25 01:00:00.0"}, + {-(1970L*365*24*60*60*1000 + 115*24*60*60*1000L), "0001-12-31 01:00:00.0"}, + {-(1970L*365*24*60*60*1000 + 115*24*60*60*1000L - 23*60*60*1000L), "0001-01-01 00:00:00.0"}, + + {LocalDateTime.of(0, 1, 1, 10, 10, 10, 50000).atZone(ZoneId.of("America/Los_Angeles")) + .toInstant().toEpochMilli() - 2*24*60*60*1000L, "0001-01-01 19:03:08.0"}, // 1 BCE + {LocalDateTime.of(0, 1, 1, 10, 10, 10, 50000).atZone(ZoneId.of("America/Los_Angeles")) + .toInstant().toEpochMilli() - 3*24*60*60*1000L, "0002-12-31 19:03:08.0"} // 2 BCE + }; + } + + /* + * DataProvider used to provide Timestamp and Nanos values in order to + * validate that the correct Nanos value is generated from the specified + * Timestamp + */ + @DataProvider(name = "validateNanos") + private Object[][] validateNanos() { + return new Object[][]{ + {"1961-08-30 00:00:00", 0}, + {"1996-12-10 12:26:19.1", 100000000}, + {"1996-12-10 12:26:19.12", 120000000}, + {"1996-12-10 12:26:19.123", 123000000}, + {"1996-12-10 12:26:19.1234", 123400000}, + {"1996-12-10 12:26:19.12345", 123450000}, + {"1996-12-10 12:26:19.123456", 123456000}, + {"1996-12-10 12:26:19.1234567", 123456700}, + {"1996-12-10 12:26:19.12345678", 123456780}, + {"1996-12-10 12:26:19.123456789", 123456789}, + {"1996-12-10 12:26:19.000000001", 1}, + {"1996-12-10 12:26:19.000000012", 12}, + {"1996-12-10 12:26:19.000000123", 123}, + {"1996-12-10 12:26:19.000001234", 1234}, + {"1996-12-10 12:26:19.000012345", 12345}, + {"1996-12-10 12:26:19.000123456", 123456}, + {"1996-12-10 12:26:19.001234567", 1234567}, + {"1996-12-10 12:26:19.012345678", 12345678}, + {"1996-12-10 12:26:19.0", 0}, + {"1996-12-10 12:26:19.01230", 12300000} + }; + } +} diff --git a/test/java/sql/testng/util/BaseTest.java b/test/java/sql/testng/util/BaseTest.java new file mode 100644 index 000000000..6821940b7 --- /dev/null +++ b/test/java/sql/testng/util/BaseTest.java @@ -0,0 +1,126 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package util; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.security.Policy; +import java.sql.JDBCType; +import java.sql.SQLException; +import org.testng.annotations.AfterClass; +import org.testng.annotations.AfterMethod; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.DataProvider; + +public class BaseTest { + + protected final String reason = "reason"; + protected final String state = "SQLState"; + protected final String cause = "java.lang.Throwable: cause"; + protected final Throwable t = new Throwable("cause"); + protected final Throwable t1 = new Throwable("cause 1"); + protected final Throwable t2 = new Throwable("cause 2"); + protected final int errorCode = 21; + protected final String[] msgs = {"Exception 1", "cause 1", "Exception 2", + "Exception 3", "cause 2"}; + + @BeforeClass + public static void setUpClass() throws Exception { + } + + @AfterClass + public static void tearDownClass() throws Exception { + } + + @BeforeMethod + public void setUpMethod() throws Exception { + } + + @AfterMethod + public void tearDownMethod() throws Exception { + } + + /* + * Take some form of SQLException, serialize and deserialize it + */ + @SuppressWarnings("unchecked") + protected T + createSerializedException(T ex) + throws IOException, ClassNotFoundException { + return (T) serializeDeserializeObject(ex); + } + + /* + * Utility method to serialize and deserialize an object + */ + @SuppressWarnings("unchecked") + protected T serializeDeserializeObject(T o) + throws IOException, ClassNotFoundException { + T o1; + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + try (ObjectOutputStream oos = new ObjectOutputStream(baos)) { + oos.writeObject(o); + } + try (ObjectInputStream ois + = new ObjectInputStream(new ByteArrayInputStream(baos.toByteArray()))) { + o1 = (T) ois.readObject(); + } + return o1; + } + + /* + * Utility Method used to set the current Policy + */ + protected static void setPolicy(Policy p) { + Policy.setPolicy(p); + } + + /* + * DataProvider used to specify the value to set and check for + * methods using boolean values + */ + @DataProvider(name = "trueFalse") + protected Object[][] trueFalse() { + return new Object[][]{ + {true}, + {false} + }; + } + + /* + * DataProvider used to specify the standard JDBC Types + */ + @DataProvider(name = "jdbcTypes") + protected Object[][] jdbcTypes() { + Object[][] o = new Object[JDBCType.values().length][1]; + int pos = 0; + for (JDBCType c : JDBCType.values()) { + o[pos++][0] = c.getVendorTypeNumber(); + } + return o; + } +} diff --git a/test/java/sql/testng/util/DriverActionImpl.java b/test/java/sql/testng/util/DriverActionImpl.java new file mode 100644 index 000000000..4a286ad8f --- /dev/null +++ b/test/java/sql/testng/util/DriverActionImpl.java @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package util; + +import java.sql.DriverAction; + +/** + * Simple implementation of DriverAction which calls back into the Driver when + * release is called. + */ +class DriverActionImpl implements DriverAction { + + public DriverActionImpl(StubDriverDA d) { + driver = d; + } + + private final StubDriverDA driver; + + @Override + public void deregister() { + driver.release(); + } +} diff --git a/test/java/sql/testng/util/SerializedBatchUpdateException.java b/test/java/sql/testng/util/SerializedBatchUpdateException.java new file mode 100644 index 000000000..00efc5275 --- /dev/null +++ b/test/java/sql/testng/util/SerializedBatchUpdateException.java @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package util; + +public class SerializedBatchUpdateException { + /** + * Serialized BatchUpdateException from JDBC 4.0 with the following values + * reason = "This was the error msg" + * SQLState = "user defined sqlState" + * vendor Code = 99999 + * Update Counts = {1, 2, 21} + * cause = = "java.lang.Throwable: throw 1" + */ + public static byte[] DATA = { + (byte) 0xac, (byte) 0xed, (byte) 0x0, (byte) 0x5, (byte) 0x73, (byte) 0x72, (byte) 0x0, (byte) 0x1d, (byte) 0x6a, (byte) 0x61, (byte) 0x76, (byte) 0x61, (byte) 0x2e, (byte) 0x73, (byte) 0x71, (byte) 0x6c, (byte) 0x2e, (byte) 0x42, (byte) 0x61, (byte) 0x74, (byte) 0x63, (byte) 0x68, (byte) 0x55, (byte) 0x70, (byte) 0x64, (byte) 0x61, (byte) 0x74, (byte) 0x65, (byte) 0x45, (byte) 0x78, (byte) 0x63, (byte) 0x65, + (byte) 0x70, (byte) 0x74, (byte) 0x69, (byte) 0x6f, (byte) 0x6e, (byte) 0x52, (byte) 0xf4, (byte) 0x73, (byte) 0xc0, (byte) 0xc1, (byte) 0x8b, (byte) 0xe, (byte) 0x5d, (byte) 0x3, (byte) 0x0, (byte) 0x2, (byte) 0x5b, (byte) 0x0, (byte) 0x10, (byte) 0x6c, (byte) 0x6f, (byte) 0x6e, (byte) 0x67, (byte) 0x55, (byte) 0x70, (byte) 0x64, (byte) 0x61, (byte) 0x74, (byte) 0x65, (byte) 0x43, (byte) 0x6f, (byte) 0x75, + (byte) 0x6e, (byte) 0x74, (byte) 0x73, (byte) 0x74, (byte) 0x0, (byte) 0x2, (byte) 0x5b, (byte) 0x4a, (byte) 0x5b, (byte) 0x0, (byte) 0xc, (byte) 0x75, (byte) 0x70, (byte) 0x64, (byte) 0x61, (byte) 0x74, (byte) 0x65, (byte) 0x43, (byte) 0x6f, (byte) 0x75, (byte) 0x6e, (byte) 0x74, (byte) 0x73, (byte) 0x74, (byte) 0x0, (byte) 0x2, (byte) 0x5b, (byte) 0x49, (byte) 0x78, (byte) 0x72, (byte) 0x0, (byte) 0x15, + (byte) 0x6a, (byte) 0x61, (byte) 0x76, (byte) 0x61, (byte) 0x2e, (byte) 0x73, (byte) 0x71, (byte) 0x6c, (byte) 0x2e, (byte) 0x53, (byte) 0x51, (byte) 0x4c, (byte) 0x45, (byte) 0x78, (byte) 0x63, (byte) 0x65, (byte) 0x70, (byte) 0x74, (byte) 0x69, (byte) 0x6f, (byte) 0x6e, (byte) 0x1d, (byte) 0xa1, (byte) 0xe9, (byte) 0x30, (byte) 0xdb, (byte) 0x3e, (byte) 0x75, (byte) 0xdc, (byte) 0x2, (byte) 0x0, (byte) 0x3, + (byte) 0x49, (byte) 0x0, (byte) 0xa, (byte) 0x76, (byte) 0x65, (byte) 0x6e, (byte) 0x64, (byte) 0x6f, (byte) 0x72, (byte) 0x43, (byte) 0x6f, (byte) 0x64, (byte) 0x65, (byte) 0x4c, (byte) 0x0, (byte) 0x8, (byte) 0x53, (byte) 0x51, (byte) 0x4c, (byte) 0x53, (byte) 0x74, (byte) 0x61, (byte) 0x74, (byte) 0x65, (byte) 0x74, (byte) 0x0, (byte) 0x12, (byte) 0x4c, (byte) 0x6a, (byte) 0x61, (byte) 0x76, (byte) 0x61, + (byte) 0x2f, (byte) 0x6c, (byte) 0x61, (byte) 0x6e, (byte) 0x67, (byte) 0x2f, (byte) 0x53, (byte) 0x74, (byte) 0x72, (byte) 0x69, (byte) 0x6e, (byte) 0x67, (byte) 0x3b, (byte) 0x4c, (byte) 0x0, (byte) 0x4, (byte) 0x6e, (byte) 0x65, (byte) 0x78, (byte) 0x74, (byte) 0x74, (byte) 0x0, (byte) 0x17, (byte) 0x4c, (byte) 0x6a, (byte) 0x61, (byte) 0x76, (byte) 0x61, (byte) 0x2f, (byte) 0x73, (byte) 0x71, (byte) 0x6c, + (byte) 0x2f, (byte) 0x53, (byte) 0x51, (byte) 0x4c, (byte) 0x45, (byte) 0x78, (byte) 0x63, (byte) 0x65, (byte) 0x70, (byte) 0x74, (byte) 0x69, (byte) 0x6f, (byte) 0x6e, (byte) 0x3b, (byte) 0x78, (byte) 0x72, (byte) 0x0, (byte) 0x13, (byte) 0x6a, (byte) 0x61, (byte) 0x76, (byte) 0x61, (byte) 0x2e, (byte) 0x6c, (byte) 0x61, (byte) 0x6e, (byte) 0x67, (byte) 0x2e, (byte) 0x45, (byte) 0x78, (byte) 0x63, (byte) 0x65, + (byte) 0x70, (byte) 0x74, (byte) 0x69, (byte) 0x6f, (byte) 0x6e, (byte) 0xd0, (byte) 0xfd, (byte) 0x1f, (byte) 0x3e, (byte) 0x1a, (byte) 0x3b, (byte) 0x1c, (byte) 0xc4, (byte) 0x2, (byte) 0x0, (byte) 0x0, (byte) 0x78, (byte) 0x72, (byte) 0x0, (byte) 0x13, (byte) 0x6a, (byte) 0x61, (byte) 0x76, (byte) 0x61, (byte) 0x2e, (byte) 0x6c, (byte) 0x61, (byte) 0x6e, (byte) 0x67, (byte) 0x2e, (byte) 0x54, (byte) 0x68, + (byte) 0x72, (byte) 0x6f, (byte) 0x77, (byte) 0x61, (byte) 0x62, (byte) 0x6c, (byte) 0x65, (byte) 0xd5, (byte) 0xc6, (byte) 0x35, (byte) 0x27, (byte) 0x39, (byte) 0x77, (byte) 0xb8, (byte) 0xcb, (byte) 0x3, (byte) 0x0, (byte) 0x4, (byte) 0x4c, (byte) 0x0, (byte) 0x5, (byte) 0x63, (byte) 0x61, (byte) 0x75, (byte) 0x73, (byte) 0x65, (byte) 0x74, (byte) 0x0, (byte) 0x15, (byte) 0x4c, (byte) 0x6a, (byte) 0x61, + (byte) 0x76, (byte) 0x61, (byte) 0x2f, (byte) 0x6c, (byte) 0x61, (byte) 0x6e, (byte) 0x67, (byte) 0x2f, (byte) 0x54, (byte) 0x68, (byte) 0x72, (byte) 0x6f, (byte) 0x77, (byte) 0x61, (byte) 0x62, (byte) 0x6c, (byte) 0x65, (byte) 0x3b, (byte) 0x4c, (byte) 0x0, (byte) 0xd, (byte) 0x64, (byte) 0x65, (byte) 0x74, (byte) 0x61, (byte) 0x69, (byte) 0x6c, (byte) 0x4d, (byte) 0x65, (byte) 0x73, (byte) 0x73, (byte) 0x61, + (byte) 0x67, (byte) 0x65, (byte) 0x71, (byte) 0x0, (byte) 0x7e, (byte) 0x0, (byte) 0x4, (byte) 0x5b, (byte) 0x0, (byte) 0xa, (byte) 0x73, (byte) 0x74, (byte) 0x61, (byte) 0x63, (byte) 0x6b, (byte) 0x54, (byte) 0x72, (byte) 0x61, (byte) 0x63, (byte) 0x65, (byte) 0x74, (byte) 0x0, (byte) 0x1e, (byte) 0x5b, (byte) 0x4c, (byte) 0x6a, (byte) 0x61, (byte) 0x76, (byte) 0x61, (byte) 0x2f, (byte) 0x6c, (byte) 0x61, + (byte) 0x6e, (byte) 0x67, (byte) 0x2f, (byte) 0x53, (byte) 0x74, (byte) 0x61, (byte) 0x63, (byte) 0x6b, (byte) 0x54, (byte) 0x72, (byte) 0x61, (byte) 0x63, (byte) 0x65, (byte) 0x45, (byte) 0x6c, (byte) 0x65, (byte) 0x6d, (byte) 0x65, (byte) 0x6e, (byte) 0x74, (byte) 0x3b, (byte) 0x4c, (byte) 0x0, (byte) 0x14, (byte) 0x73, (byte) 0x75, (byte) 0x70, (byte) 0x70, (byte) 0x72, (byte) 0x65, (byte) 0x73, (byte) 0x73, + (byte) 0x65, (byte) 0x64, (byte) 0x45, (byte) 0x78, (byte) 0x63, (byte) 0x65, (byte) 0x70, (byte) 0x74, (byte) 0x69, (byte) 0x6f, (byte) 0x6e, (byte) 0x73, (byte) 0x74, (byte) 0x0, (byte) 0x10, (byte) 0x4c, (byte) 0x6a, (byte) 0x61, (byte) 0x76, (byte) 0x61, (byte) 0x2f, (byte) 0x75, (byte) 0x74, (byte) 0x69, (byte) 0x6c, (byte) 0x2f, (byte) 0x4c, (byte) 0x69, (byte) 0x73, (byte) 0x74, (byte) 0x3b, (byte) 0x78, + (byte) 0x70, (byte) 0x73, (byte) 0x71, (byte) 0x0, (byte) 0x7e, (byte) 0x0, (byte) 0x7, (byte) 0x71, (byte) 0x0, (byte) 0x7e, (byte) 0x0, (byte) 0xc, (byte) 0x74, (byte) 0x0, (byte) 0x7, (byte) 0x74, (byte) 0x68, (byte) 0x72, (byte) 0x6f, (byte) 0x77, (byte) 0x20, (byte) 0x31, (byte) 0x75, (byte) 0x72, (byte) 0x0, (byte) 0x1e, (byte) 0x5b, (byte) 0x4c, (byte) 0x6a, (byte) 0x61, (byte) 0x76, (byte) 0x61, + (byte) 0x2e, (byte) 0x6c, (byte) 0x61, (byte) 0x6e, (byte) 0x67, (byte) 0x2e, (byte) 0x53, (byte) 0x74, (byte) 0x61, (byte) 0x63, (byte) 0x6b, (byte) 0x54, (byte) 0x72, (byte) 0x61, (byte) 0x63, (byte) 0x65, (byte) 0x45, (byte) 0x6c, (byte) 0x65, (byte) 0x6d, (byte) 0x65, (byte) 0x6e, (byte) 0x74, (byte) 0x3b, (byte) 0x2, (byte) 0x46, (byte) 0x2a, (byte) 0x3c, (byte) 0x3c, (byte) 0xfd, (byte) 0x22, (byte) 0x39, + (byte) 0x2, (byte) 0x0, (byte) 0x0, (byte) 0x78, (byte) 0x70, (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x2, (byte) 0x73, (byte) 0x72, (byte) 0x0, (byte) 0x1b, (byte) 0x6a, (byte) 0x61, (byte) 0x76, (byte) 0x61, (byte) 0x2e, (byte) 0x6c, (byte) 0x61, (byte) 0x6e, (byte) 0x67, (byte) 0x2e, (byte) 0x53, (byte) 0x74, (byte) 0x61, (byte) 0x63, (byte) 0x6b, (byte) 0x54, (byte) 0x72, (byte) 0x61, (byte) 0x63, + (byte) 0x65, (byte) 0x45, (byte) 0x6c, (byte) 0x65, (byte) 0x6d, (byte) 0x65, (byte) 0x6e, (byte) 0x74, (byte) 0x61, (byte) 0x9, (byte) 0xc5, (byte) 0x9a, (byte) 0x26, (byte) 0x36, (byte) 0xdd, (byte) 0x85, (byte) 0x2, (byte) 0x0, (byte) 0x4, (byte) 0x49, (byte) 0x0, (byte) 0xa, (byte) 0x6c, (byte) 0x69, (byte) 0x6e, (byte) 0x65, (byte) 0x4e, (byte) 0x75, (byte) 0x6d, (byte) 0x62, (byte) 0x65, (byte) 0x72, + (byte) 0x4c, (byte) 0x0, (byte) 0xe, (byte) 0x64, (byte) 0x65, (byte) 0x63, (byte) 0x6c, (byte) 0x61, (byte) 0x72, (byte) 0x69, (byte) 0x6e, (byte) 0x67, (byte) 0x43, (byte) 0x6c, (byte) 0x61, (byte) 0x73, (byte) 0x73, (byte) 0x71, (byte) 0x0, (byte) 0x7e, (byte) 0x0, (byte) 0x4, (byte) 0x4c, (byte) 0x0, (byte) 0x8, (byte) 0x66, (byte) 0x69, (byte) 0x6c, (byte) 0x65, (byte) 0x4e, (byte) 0x61, (byte) 0x6d, + (byte) 0x65, (byte) 0x71, (byte) 0x0, (byte) 0x7e, (byte) 0x0, (byte) 0x4, (byte) 0x4c, (byte) 0x0, (byte) 0xa, (byte) 0x6d, (byte) 0x65, (byte) 0x74, (byte) 0x68, (byte) 0x6f, (byte) 0x64, (byte) 0x4e, (byte) 0x61, (byte) 0x6d, (byte) 0x65, (byte) 0x71, (byte) 0x0, (byte) 0x7e, (byte) 0x0, (byte) 0x4, (byte) 0x78, (byte) 0x70, (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x23, (byte) 0x74, (byte) 0x0, + (byte) 0x17, (byte) 0x43, (byte) 0x72, (byte) 0x65, (byte) 0x61, (byte) 0x74, (byte) 0x65, (byte) 0x42, (byte) 0x61, (byte) 0x74, (byte) 0x63, (byte) 0x68, (byte) 0x45, (byte) 0x78, (byte) 0x63, (byte) 0x65, (byte) 0x70, (byte) 0x74, (byte) 0x69, (byte) 0x6f, (byte) 0x6e, (byte) 0x53, (byte) 0x65, (byte) 0x72, (byte) 0x74, (byte) 0x0, (byte) 0x1c, (byte) 0x43, (byte) 0x72, (byte) 0x65, (byte) 0x61, (byte) 0x74, + (byte) 0x65, (byte) 0x42, (byte) 0x61, (byte) 0x74, (byte) 0x63, (byte) 0x68, (byte) 0x45, (byte) 0x78, (byte) 0x63, (byte) 0x65, (byte) 0x70, (byte) 0x74, (byte) 0x69, (byte) 0x6f, (byte) 0x6e, (byte) 0x53, (byte) 0x65, (byte) 0x72, (byte) 0x2e, (byte) 0x6a, (byte) 0x61, (byte) 0x76, (byte) 0x61, (byte) 0x74, (byte) 0x0, (byte) 0x9, (byte) 0x77, (byte) 0x72, (byte) 0x69, (byte) 0x74, (byte) 0x65, (byte) 0x54, + (byte) 0x65, (byte) 0x73, (byte) 0x74, (byte) 0x73, (byte) 0x71, (byte) 0x0, (byte) 0x7e, (byte) 0x0, (byte) 0x10, (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x1a, (byte) 0x71, (byte) 0x0, (byte) 0x7e, (byte) 0x0, (byte) 0x12, (byte) 0x71, (byte) 0x0, (byte) 0x7e, (byte) 0x0, (byte) 0x13, (byte) 0x74, (byte) 0x0, (byte) 0x4, (byte) 0x6d, (byte) 0x61, (byte) 0x69, (byte) 0x6e, (byte) 0x70, (byte) 0x78, + (byte) 0x74, (byte) 0x0, (byte) 0x16, (byte) 0x54, (byte) 0x68, (byte) 0x69, (byte) 0x73, (byte) 0x20, (byte) 0x77, (byte) 0x61, (byte) 0x73, (byte) 0x20, (byte) 0x74, (byte) 0x68, (byte) 0x65, (byte) 0x20, (byte) 0x65, (byte) 0x72, (byte) 0x72, (byte) 0x6f, (byte) 0x72, (byte) 0x20, (byte) 0x6d, (byte) 0x73, (byte) 0x67, (byte) 0x75, (byte) 0x71, (byte) 0x0, (byte) 0x7e, (byte) 0x0, (byte) 0xe, (byte) 0x0, + (byte) 0x0, (byte) 0x0, (byte) 0x2, (byte) 0x73, (byte) 0x71, (byte) 0x0, (byte) 0x7e, (byte) 0x0, (byte) 0x10, (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x28, (byte) 0x71, (byte) 0x0, (byte) 0x7e, (byte) 0x0, (byte) 0x12, (byte) 0x71, (byte) 0x0, (byte) 0x7e, (byte) 0x0, (byte) 0x13, (byte) 0x71, (byte) 0x0, (byte) 0x7e, (byte) 0x0, (byte) 0x14, (byte) 0x73, (byte) 0x71, (byte) 0x0, (byte) 0x7e, + (byte) 0x0, (byte) 0x10, (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x1a, (byte) 0x71, (byte) 0x0, (byte) 0x7e, (byte) 0x0, (byte) 0x12, (byte) 0x71, (byte) 0x0, (byte) 0x7e, (byte) 0x0, (byte) 0x13, (byte) 0x71, (byte) 0x0, (byte) 0x7e, (byte) 0x0, (byte) 0x16, (byte) 0x70, (byte) 0x78, (byte) 0x0, (byte) 0x1, (byte) 0x86, (byte) 0x9f, (byte) 0x74, (byte) 0x0, (byte) 0x15, (byte) 0x75, (byte) 0x73, + (byte) 0x65, (byte) 0x72, (byte) 0x20, (byte) 0x64, (byte) 0x65, (byte) 0x66, (byte) 0x69, (byte) 0x6e, (byte) 0x65, (byte) 0x64, (byte) 0x20, (byte) 0x73, (byte) 0x71, (byte) 0x6c, (byte) 0x53, (byte) 0x74, (byte) 0x61, (byte) 0x74, (byte) 0x65, (byte) 0x70, (byte) 0x75, (byte) 0x72, (byte) 0x0, (byte) 0x2, (byte) 0x5b, (byte) 0x4a, (byte) 0x78, (byte) 0x20, (byte) 0x4, (byte) 0xb5, (byte) 0x12, (byte) 0xb1, + (byte) 0x75, (byte) 0x93, (byte) 0x2, (byte) 0x0, (byte) 0x0, (byte) 0x78, (byte) 0x70, (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x3, (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x1, (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x2, (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x0, + (byte) 0x0, (byte) 0x0, (byte) 0x15, (byte) 0x75, (byte) 0x72, (byte) 0x0, (byte) 0x2, (byte) 0x5b, (byte) 0x49, (byte) 0x4d, (byte) 0xba, (byte) 0x60, (byte) 0x26, (byte) 0x76, (byte) 0xea, (byte) 0xb2, (byte) 0xa5, (byte) 0x2, (byte) 0x0, (byte) 0x0, (byte) 0x78, (byte) 0x70, (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x3, (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x1, (byte) 0x0, (byte) 0x0, + (byte) 0x0, (byte) 0x2, (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x15, (byte) 0x78 + }; +} diff --git a/test/java/sql/testng/util/StubConnection.java b/test/java/sql/testng/util/StubConnection.java new file mode 100644 index 000000000..88c44262f --- /dev/null +++ b/test/java/sql/testng/util/StubConnection.java @@ -0,0 +1,315 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package util; + +import java.sql.Array; +import java.sql.Blob; +import java.sql.CallableStatement; +import java.sql.Clob; +import java.sql.Connection; +import java.sql.DatabaseMetaData; +import java.sql.NClob; +import java.sql.PreparedStatement; +import java.sql.SQLClientInfoException; +import java.sql.SQLException; +import java.sql.SQLWarning; +import java.sql.SQLXML; +import java.sql.Savepoint; +import java.sql.Statement; +import java.sql.Struct; +import java.util.Map; +import java.util.Properties; +import java.util.concurrent.Executor; + +public class StubConnection implements Connection { + + @Override + public Statement createStatement() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public PreparedStatement prepareStatement(String sql) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public CallableStatement prepareCall(String sql) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String nativeSQL(String sql) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setAutoCommit(boolean autoCommit) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean getAutoCommit() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void commit() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void rollback() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void close() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean isClosed() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public DatabaseMetaData getMetaData() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setReadOnly(boolean readOnly) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean isReadOnly() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setCatalog(String catalog) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getCatalog() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setTransactionIsolation(int level) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getTransactionIsolation() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public SQLWarning getWarnings() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void clearWarnings() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Map> getTypeMap() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setTypeMap(Map> map) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setHoldability(int holdability) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getHoldability() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Savepoint setSavepoint() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Savepoint setSavepoint(String name) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void rollback(Savepoint savepoint) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void releaseSavepoint(Savepoint savepoint) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Clob createClob() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Blob createBlob() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public NClob createNClob() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public SQLXML createSQLXML() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean isValid(int timeout) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setClientInfo(String name, String value) throws SQLClientInfoException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setClientInfo(Properties properties) throws SQLClientInfoException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getClientInfo(String name) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Properties getClientInfo() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Array createArrayOf(String typeName, Object[] elements) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Struct createStruct(String typeName, Object[] attributes) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setSchema(String schema) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getSchema() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void abort(Executor executor) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNetworkTimeout(Executor executor, int milliseconds) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getNetworkTimeout() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public T unwrap(Class iface) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean isWrapperFor(Class iface) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } +} diff --git a/test/java/sql/testng/util/StubDriver.java b/test/java/sql/testng/util/StubDriver.java new file mode 100644 index 000000000..122530803 --- /dev/null +++ b/test/java/sql/testng/util/StubDriver.java @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package util; + +import java.sql.Connection; +import java.sql.Driver; +import java.sql.DriverPropertyInfo; +import java.sql.SQLException; +import java.sql.SQLFeatureNotSupportedException; +import java.util.Properties; +import java.util.logging.Logger; + +public class StubDriver implements Driver { + + public StubDriver() { + } + + @Override + public Connection connect(String url, Properties info) throws SQLException { + if (acceptsURL(url)) { + return new StubConnection(); + } + return null; + } + + @Override + public boolean acceptsURL(String url) throws SQLException { + return url.matches("^jdbc:tennis:.*"); + } + + @Override + public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getMajorVersion() { + return 1; + } + + @Override + public int getMinorVersion() { + return 0; + } + + @Override + public boolean jdbcCompliant() { + return true; + } + + @Override + public Logger getParentLogger() throws SQLFeatureNotSupportedException { + throw new UnsupportedOperationException("Not supported yet."); + } +} diff --git a/test/java/sql/testng/util/StubDriverDA.java b/test/java/sql/testng/util/StubDriverDA.java new file mode 100644 index 000000000..5b23f0846 --- /dev/null +++ b/test/java/sql/testng/util/StubDriverDA.java @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package util; + +import java.io.File; +import java.io.IOException; +import java.sql.DriverAction; +import java.sql.DriverManager; +import java.sql.SQLException; +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + * Simple java.sql.Driver stub class that registers the driver via a static + * block with a DriverAction Implementation + * @author ljanders + */ +public class StubDriverDA extends StubDriver { + + public static final String DriverActionCalled = "DriverActionCalled.txt"; + + static DriverAction da; + + static { + try { + DriverManager.registerDriver(new StubDriverDA(), da); + } catch (SQLException ex) { + Logger.getLogger(StubDriverDA.class.getName()).log(Level.SEVERE, null, ex); + } + } + + public StubDriverDA() { + da = new DriverActionImpl(this); + } + + @Override + public boolean acceptsURL(String url) throws SQLException { + return url.matches("^jdbc:luckydog:.*"); + } + + /** + * This method will write out a text file when called by the + * DriverActionImpl.release method when DriverManager.deregisterDriver + * is called. This is used by DriverManagerTests to validate that + * DriverAction.release was called + */ + protected void release() { + File file = new File(DriverActionCalled); + try { + file.createNewFile(); + } catch (IOException ex) { + throw new RuntimeException(ex); + } + } +} diff --git a/test/java/sql/testng/util/TestPolicy.java b/test/java/sql/testng/util/TestPolicy.java new file mode 100644 index 000000000..af21cc8fc --- /dev/null +++ b/test/java/sql/testng/util/TestPolicy.java @@ -0,0 +1,142 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package util; + +import java.io.FilePermission; +import java.security.AllPermission; +import java.security.CodeSource; +import java.security.Permission; +import java.security.PermissionCollection; +import java.security.Permissions; +import java.security.Policy; +import java.security.ProtectionDomain; +import java.security.SecurityPermission; +import java.sql.SQLPermission; +import java.util.Enumeration; +import java.util.PropertyPermission; +import java.util.StringJoiner; +import java.util.logging.LoggingPermission; + +/* + * Simple Policy class that supports the required Permissions to validate the + * JDBC concrete classes + */ +public class TestPolicy extends Policy { + + final PermissionCollection permissions = new Permissions(); + + /** + * Constructor which sets the minimum permissions allowing testNG to work + * with a SecurityManager + */ + public TestPolicy() { + setMinimalPermissions(); + } + + /* + * Constructor which determines which permissions are defined for this + * Policy used by the JDBC tests Possible values are: all (ALLPermissions), + * setLog (SQLPemission("setLog"), deregisterDriver + * (SQLPermission("deregisterDriver") (SQLPermission("deregisterDriver"), + * setSyncFactory(SQLPermission(setSyncFactory), and also + * LoggerPermission("control", null) when setting a Level + * + * @param policy Permissions to set + */ + public TestPolicy(String policy) { + + switch (policy) { + case "all": + permissions.add(new AllPermission()); + break; + case "setLog": + setMinimalPermissions(); + permissions.add(new SQLPermission("setLog")); + break; + case "deregisterDriver": + setMinimalPermissions(); + permissions.add(new SQLPermission("deregisterDriver")); + break; + case "setSyncFactory": + setMinimalPermissions(); + permissions.add(new SQLPermission("setSyncFactory")); + break; + case "setSyncFactoryLogger": + setMinimalPermissions(); + permissions.add(new SQLPermission("setSyncFactory")); + permissions.add(new LoggingPermission("control", null)); + break; + default: + setMinimalPermissions(); + } + } + + /* + * Defines the minimal permissions required by testNG when running these + * tests + */ + private void setMinimalPermissions() { + permissions.add(new SecurityPermission("getPolicy")); + permissions.add(new SecurityPermission("setPolicy")); + permissions.add(new RuntimePermission("getClassLoader")); + permissions.add(new RuntimePermission("setSecurityManager")); + permissions.add(new RuntimePermission("createSecurityManager")); + permissions.add(new PropertyPermission("testng.show.stack.frames", + "read")); + permissions.add(new PropertyPermission("line.separator", "read")); + permissions.add(new PropertyPermission("fileStringBuffer", "read")); + permissions.add(new PropertyPermission("dataproviderthreadcount", "read")); + permissions.add(new PropertyPermission("java.io.tmpdir", "read")); + permissions.add(new FilePermission("<>", + "read, write, delete")); + } + + /* + * Overloaded methods from the Policy class + */ + @Override + public String toString() { + StringJoiner sj = new StringJoiner("\n", "policy: ", ""); + Enumeration perms = permissions.elements(); + while (perms.hasMoreElements()) { + sj.add(perms.nextElement().toString()); + } + return sj.toString(); + + } + + @Override + public PermissionCollection getPermissions(ProtectionDomain domain) { + return permissions; + } + + @Override + public PermissionCollection getPermissions(CodeSource codesource) { + return permissions; + } + + @Override + public boolean implies(ProtectionDomain domain, Permission perm) { + return permissions.implies(perm); + } +} diff --git a/test/javax/sql/testng/TEST.properties b/test/javax/sql/testng/TEST.properties new file mode 100644 index 000000000..cb97c1605 --- /dev/null +++ b/test/javax/sql/testng/TEST.properties @@ -0,0 +1,7 @@ +# JDBC unit tests uses TestNG +TestNG.dirs= . +othervm.dirs= . +lib.dirs = /java/sql/testng +modules = java.sql.rowset/com.sun.rowset \ + java.sql.rowset/com.sun.rowset.internal \ + java.sql.rowset/com.sun.rowset.providers diff --git a/test/javax/sql/testng/jars/badFactory/META-INF/services/javax.sql.rowset.RowSetFactory b/test/javax/sql/testng/jars/badFactory/META-INF/services/javax.sql.rowset.RowSetFactory new file mode 100644 index 000000000..6cb88d5a3 --- /dev/null +++ b/test/javax/sql/testng/jars/badFactory/META-INF/services/javax.sql.rowset.RowSetFactory @@ -0,0 +1 @@ +invalid.RowSetFactoryImpl diff --git a/test/javax/sql/testng/jars/goodFactory/META-INF/services/javax.sql.rowset.RowSetFactory b/test/javax/sql/testng/jars/goodFactory/META-INF/services/javax.sql.rowset.RowSetFactory new file mode 100644 index 000000000..ac3a8187e --- /dev/null +++ b/test/javax/sql/testng/jars/goodFactory/META-INF/services/javax.sql.rowset.RowSetFactory @@ -0,0 +1 @@ +util.StubRowSetFactory diff --git a/test/javax/sql/testng/test/rowset/BaseRowSetTests.java b/test/javax/sql/testng/test/rowset/BaseRowSetTests.java new file mode 100644 index 000000000..95883556a --- /dev/null +++ b/test/javax/sql/testng/test/rowset/BaseRowSetTests.java @@ -0,0 +1,444 @@ +/* + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package test.rowset; + +import java.io.InputStream; +import java.io.Reader; +import java.io.StringBufferInputStream; +import java.io.StringReader; +import java.math.BigDecimal; +import java.sql.Array; +import java.sql.Blob; +import java.sql.Clob; +import java.sql.Date; +import java.sql.Ref; +import java.sql.SQLException; +import java.sql.Time; +import java.sql.Timestamp; +import java.sql.Types; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.util.Calendar; +import javax.sql.RowSet; +import javax.sql.rowset.serial.SerialArray; +import javax.sql.rowset.serial.SerialBlob; +import javax.sql.rowset.serial.SerialClob; +import javax.sql.rowset.serial.SerialRef; +import static org.testng.Assert.*; +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; +import util.StubArray; +import util.StubBaseRowSet; +import util.StubBlob; +import util.StubClob; +import util.StubRef; +import util.TestRowSetListener; + +public class BaseRowSetTests extends CommonRowSetTests { + + private StubBaseRowSet brs; + + @Override + protected RowSet newInstance() throws SQLException { + return new StubBaseRowSet(); + } + + /* + * Create a RowSetListener and validate that notifyCursorMoved is called + */ + @Test(dataProvider = "rowSetType") + public void baseRowSetTest0000(StubBaseRowSet rs) throws Exception { + TestRowSetListener rsl = new TestRowSetListener(); + rs.addRowSetListener(rsl); + rs.notifyCursorMoved(); + assertTrue(rsl.isNotified(TestRowSetListener.CURSOR_MOVED)); + } + + /* + * Create a RowSetListener and validate that notifyRowChanged is called + */ + @Test(dataProvider = "rowSetType") + public void baseRowSetTest0001(StubBaseRowSet rs) throws Exception { + TestRowSetListener rsl = new TestRowSetListener(); + rs.addRowSetListener(rsl); + rs.notifyRowChanged(); + assertTrue(rsl.isNotified(TestRowSetListener.ROW_CHANGED)); + } + + /* + * Create a RowSetListener and validate that notifyRowSetChanged is called + */ + @Test(dataProvider = "rowSetType") + public void baseRowSetTest0002(StubBaseRowSet rs) throws Exception { + TestRowSetListener rsl = new TestRowSetListener(); + rs.addRowSetListener(rsl); + rs.notifyRowSetChanged(); + assertTrue(rsl.isNotified(TestRowSetListener.ROWSET_CHANGED)); + } + + /* + * Create multiple RowSetListeners and validate that notifyRowSetChanged + * is called on all listeners + */ + @Test(dataProvider = "rowSetType") + public void baseRowSetTest0003(StubBaseRowSet rs) throws Exception { + TestRowSetListener rsl = new TestRowSetListener(); + TestRowSetListener rsl2 = new TestRowSetListener(); + rs.addRowSetListener(rsl); + rs.addRowSetListener(rsl2); + rs.notifyRowSetChanged(); + assertTrue(rsl.isNotified(TestRowSetListener.ROWSET_CHANGED)); + assertTrue(rsl2.isNotified(TestRowSetListener.ROWSET_CHANGED)); + } + + /* + * Create multiple RowSetListeners and validate that notifyRowChanged + * is called on all listeners + */ + @Test(dataProvider = "rowSetType") + public void baseRowSetTest0004(StubBaseRowSet rs) throws Exception { + TestRowSetListener rsl = new TestRowSetListener(); + TestRowSetListener rsl2 = new TestRowSetListener(); + rs.addRowSetListener(rsl); + rs.addRowSetListener(rsl2); + rs.notifyRowChanged(); + assertTrue(rsl.isNotified(TestRowSetListener.ROW_CHANGED)); + assertTrue(rsl2.isNotified(TestRowSetListener.ROW_CHANGED)); + } + + /* + * Create multiple RowSetListeners and validate that notifyCursorMoved + * is called on all listeners + */ + @Test(dataProvider = "rowSetType") + public void baseRowSetTest0005(StubBaseRowSet rs) throws Exception { + TestRowSetListener rsl = new TestRowSetListener(); + TestRowSetListener rsl2 = new TestRowSetListener(); + rs.addRowSetListener(rsl); + rs.addRowSetListener(rsl2); + rs.notifyCursorMoved(); + assertTrue(rsl.isNotified(TestRowSetListener.CURSOR_MOVED)); + assertTrue(rsl2.isNotified(TestRowSetListener.CURSOR_MOVED)); + } + + /* + * Create a RowSetListener and validate that notifyRowSetChanged, + * notifyRowChanged() and notifyCursorMoved are called + */ + @Test(dataProvider = "rowSetType") + public void baseRowSetTest0006(StubBaseRowSet rs) throws Exception { + TestRowSetListener rsl = new TestRowSetListener(); + rs.addRowSetListener(rsl); + rs.notifyRowSetChanged(); + rs.notifyRowChanged(); + rs.notifyCursorMoved(); + assertTrue(rsl.isNotified( + TestRowSetListener.CURSOR_MOVED | TestRowSetListener.ROWSET_CHANGED + | TestRowSetListener.ROW_CHANGED)); + } + + + /* + * Create multiple RowSetListeners and validate that notifyRowSetChanged, + * notifyRowChanged() and notifyCursorMoved are called on all listeners + */ + @Test(dataProvider = "rowSetType") + public void baseRowSetTest0007(StubBaseRowSet rs) throws Exception { + TestRowSetListener rsl = new TestRowSetListener(); + TestRowSetListener rsl2 = new TestRowSetListener(); + rs.addRowSetListener(rsl); + rs.addRowSetListener(rsl2); + rs.notifyRowSetChanged(); + rs.notifyRowChanged(); + rs.notifyCursorMoved(); + assertTrue(rsl.isNotified( + TestRowSetListener.CURSOR_MOVED | TestRowSetListener.ROWSET_CHANGED + | TestRowSetListener.ROW_CHANGED)); + assertTrue(rsl2.isNotified( + TestRowSetListener.CURSOR_MOVED | TestRowSetListener.ROWSET_CHANGED + | TestRowSetListener.ROW_CHANGED)); + } + + /* + * Create a RowSetListener and validate that notifyRowSetChanged is called, + * remove the listener, invoke notifyRowSetChanged again and verify the + * listner is not called + */ + @Test(dataProvider = "rowSetType") + public void baseRowSetTest0008(StubBaseRowSet rs) throws Exception { + TestRowSetListener rsl = new TestRowSetListener(); + rs.addRowSetListener(rsl); + rs.notifyRowSetChanged(); + assertTrue(rsl.isNotified(TestRowSetListener.ROWSET_CHANGED)); + // Clear the flag indicating the listener has been called + rsl.resetFlag(); + rs.removeRowSetListener(rsl); + rs.notifyRowSetChanged(); + assertFalse(rsl.isNotified(TestRowSetListener.ROWSET_CHANGED)); + } + + /* + * Set the base parameters and validate that the value set is + * the correct type and value + */ + @Test(dataProvider = "testBaseParameters") + public void baseRowSetTest0009(int pos, Object o) throws Exception { + assertTrue(getParam(pos, o).getClass().isInstance(o)); + assertTrue(o.equals(getParam(pos, o))); + } + + /* + * Set the complex parameters and validate that the value set is + * the correct type + */ + @Test(dataProvider = "testAdvancedParameters") + public void baseRowSetTest0010(int pos, Object o) throws Exception { + assertTrue(getParam(pos, o).getClass().isInstance(o)); + } + + /* + * Validate setNull specifying the supported type values + */ + @Test(dataProvider = "jdbcTypes") + public void baseRowSetTest0011(Integer type) throws Exception { + brs = new StubBaseRowSet(); + brs.setNull(1, type); + assertTrue(checkNullParam(1, type, null)); + } + + /* + * Validate setNull specifying the supported type values and that + * typeName is set internally + */ + @Test(dataProvider = "jdbcTypes") + public void baseRowSetTest0012(Integer type) throws Exception { + brs = new StubBaseRowSet(); + brs.setNull(1, type, "SUPERHERO"); + assertTrue(checkNullParam(1, type, "SUPERHERO")); + } + + /* + * Validate that setDate sets the specified Calendar internally + */ + @Test() + public void baseRowSetTest0013() throws Exception { + Calendar cal = Calendar.getInstance(); + brs = new StubBaseRowSet(); + brs.setDate(1, Date.valueOf(LocalDate.now()), cal); + assertTrue(checkCalendarParam(1, cal)); + } + + /* + * Validate that setTime sets the specified Calendar internally + */ + @Test() + public void baseRowSetTest0014() throws Exception { + Calendar cal = Calendar.getInstance(); + brs = new StubBaseRowSet(); + brs.setTime(1, Time.valueOf(LocalTime.now()), cal); + assertTrue(checkCalendarParam(1, cal)); + } + + /* + * Validate that setTimestamp sets the specified Calendar internally + */ + @Test() + public void baseRowSetTest0015() throws Exception { + Calendar cal = Calendar.getInstance(); + brs = new StubBaseRowSet(); + brs.setTimestamp(1, Timestamp.valueOf(LocalDateTime.now()), cal); + assertTrue(checkCalendarParam(1, cal)); + } + + /* + * Validate that initParams() initializes the parameters + */ + @Test(dataProvider = "rowSetType") + public void baseRowSetTest0016(StubBaseRowSet rs) throws Exception { + rs.setInt(1, 1); + rs.initParams(); + assertTrue(rs.getParams().length == 0); + } + + + /* + * DataProvider used to set parameters for basic types that are supported + */ + @DataProvider(name = "testBaseParameters") + private Object[][] testBaseParameters() throws SQLException { + Integer aInt = 1; + Long aLong = Long.MAX_VALUE; + Short aShort = Short.MIN_VALUE; + BigDecimal bd = BigDecimal.ONE; + Double aDouble = Double.MAX_VALUE; + Date aDate = Date.valueOf(LocalDate.now()); + Time aTime = Time.valueOf(LocalTime.now()); + Timestamp aTimeStamp = Timestamp.valueOf(LocalDateTime.now()); + Calendar cal = Calendar.getInstance(); + Boolean aBoolean = true; + Float aFloat = 1.5f; + Byte aByte = 1; + brs = new StubBaseRowSet(); + + brs.setInt(1, aInt); + brs.setString(2, query); + brs.setLong(3, aLong); + brs.setBoolean(4, aBoolean); + brs.setShort(5, aShort); + brs.setDouble(6, aDouble); + brs.setBigDecimal(7, bd); + brs.setFloat(8, aFloat); + brs.setByte(9, aByte); + brs.setDate(10, aDate); + brs.setTime(11, aTime); + brs.setTimestamp(12, aTimeStamp); + brs.setDate(13, aDate, cal); + brs.setTime(14, aTime, cal); + brs.setTimestamp(15, aTimeStamp); + brs.setObject(16, query); + brs.setObject(17, query, Types.CHAR); + brs.setObject(18, query, Types.CHAR, 0); + + return new Object[][]{ + {1, aInt}, + {2, query}, + {3, aLong}, + {4, aBoolean}, + {5, aShort}, + {6, aDouble}, + {7, bd}, + {8, aFloat}, + {9, aByte}, + {10, aDate}, + {11, aTime}, + {12, aTimeStamp}, + {13, aDate}, + {14, aTime}, + {15, aTimeStamp}, + {16, query}, + {17, query}, + {18, query} + + }; + } + + /* + * DataProvider used to set advanced parameters for types that are supported + */ + @DataProvider(name = "testAdvancedParameters") + private Object[][] testAdvancedParameters() throws SQLException { + + byte[] bytes = new byte[10]; + Ref aRef = new SerialRef(new StubRef("INTEGER", query)); + Array aArray = new SerialArray(new StubArray("INTEGER", new Object[1])); + Blob aBlob = new SerialBlob(new StubBlob()); + Clob aClob = new SerialClob(new StubClob()); + Reader rdr = new StringReader(query); + InputStream is = new StringBufferInputStream(query);; + brs = new StubBaseRowSet(); + brs.setBytes(1, bytes); + brs.setAsciiStream(2, is, query.length()); + brs.setRef(3, aRef); + brs.setArray(4, aArray); + brs.setBlob(5, aBlob); + brs.setClob(6, aClob); + brs.setBinaryStream(7, is, query.length()); + brs.setUnicodeStream(8, is, query.length()); + brs.setCharacterStream(9, rdr, query.length()); + + return new Object[][]{ + {1, bytes}, + {2, is}, + {3, aRef}, + {4, aArray}, + {5, aBlob}, + {6, aClob}, + {7, is}, + {8, is}, + {9, rdr} + }; + } + + /* + * Method that returns the specified parameter instance that was set via setXXX + * Note non-basic types are stored as an Object[] where the 1st element + * is the object instnace + */ + @SuppressWarnings("unchecked") + private T getParam(int pos, T o) throws SQLException { + Object[] params = brs.getParams(); + if (params[pos - 1] instanceof Object[]) { + Object[] param = (Object[]) params[pos - 1]; + return (T) param[0]; + } else { + return (T) params[pos - 1]; + } + } + + /* + * Utility method to validate parameters when the param is an Object[] + */ + private boolean checkParam(int pos, int type, Object val) throws SQLException { + boolean result = false; + Object[] params = brs.getParams(); + if (params[pos - 1] instanceof Object[]) { + Object[] param = (Object[]) params[pos - 1]; + + if (param[0] == null) { + // setNull was used + if (param.length == 2 && (Integer) param[1] == type) { + result = true; + } else { + if (param.length == 3 && (Integer) param[1] == type + && val.equals(param[2])) { + result = true; + } + } + + } else if (param[0] instanceof java.util.Date) { + // setDate/Time/Timestamp with a Calendar object + if (param[1] instanceof Calendar && val.equals(param[1])) { + result = true; + } + } + } + return result; + } + + /* + * Wrapper method for validating that a null was set and the appropriate + * type and typeName if applicable + */ + private boolean checkNullParam(int pos, int type, String typeName) throws SQLException { + return checkParam(pos, type, typeName); + } + + /* + * Wrapper method for validating that a Calander was set + */ + private boolean checkCalendarParam(int pos, Calendar cal) throws SQLException { + // 2nd param is ignored when instanceof java.util.Date + return checkParam(pos, Types.DATE, cal); + } +} diff --git a/test/javax/sql/testng/test/rowset/CommonRowSetTests.java b/test/javax/sql/testng/test/rowset/CommonRowSetTests.java new file mode 100644 index 000000000..89492aefe --- /dev/null +++ b/test/javax/sql/testng/test/rowset/CommonRowSetTests.java @@ -0,0 +1,1372 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package test.rowset; + +import java.io.InputStream; +import java.io.Reader; +import java.math.BigDecimal; +import java.sql.Connection; +import java.sql.Date; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.sql.RowId; +import java.sql.SQLException; +import java.sql.SQLFeatureNotSupportedException; +import java.sql.Time; +import java.sql.Timestamp; +import java.sql.Types; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.sql.RowSet; +import javax.sql.rowset.BaseRowSet; +import javax.sql.rowset.CachedRowSet; +import javax.sql.rowset.RowSetFactory; +import javax.sql.rowset.RowSetMetaDataImpl; +import javax.sql.rowset.RowSetProvider; +import org.testng.Assert; +import static org.testng.Assert.assertNull; +import static org.testng.Assert.assertTrue; +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; +import util.BaseTest; +import util.StubBlob; +import util.StubClob; +import util.StubNClob; +import util.StubSQLXML; + +public abstract class CommonRowSetTests extends BaseTest { + + protected final String stubProvider = "util.StubSyncProvider"; + protected final String query = "SELECT * FROM SUPERHEROS"; + private final String url = "jdbc:derby://localhost:1527/myDB"; + private final String dsName = "jdbc/myDB"; + private final String user = "Bruce Wayne"; + private final String password = "The Dark Knight"; + protected final String COFFEE_HOUSES_TABLE = "COFFEE_HOUSES"; + protected final String COFFEES_TABLE = "COFFEES"; + protected final int COFFEE_HOUSES_ROWS = 14; + protected final int COFFEES_ROWS = 5; + protected final Object[] COFFEES_PRIMARY_KEYS = {1, 2, 3, 4, 5}; + protected final Object[] COFFEE_HOUSES_PRIMARY_KEYS = { + 10023, 33002, 10040, 32001, 10042, 10024, 10039, 10041, + 33005, 33010, 10035, 10037, 10034, 32004 + }; + + /* + * COFFEES_HOUSES Table column names + */ + protected final String[] COFFEE_HOUSES_COLUMN_NAMES = { + "STORE_ID", "CITY", "COFFEE", "MERCH", "TOTAL" + }; + + /* + * COFFEES Table column names + */ + protected final String[] COFFEES_COLUMN_NAMES = { + "COF_ID", "COF_NAME", "SUP_ID", "PRICE", "SALES", "TOTAL" + }; + + protected RowSetFactory rsf; + + public CommonRowSetTests() { + try { + rsf = RowSetProvider.newFactory(); + } catch (SQLException ex) { + Assert.fail(ex.getMessage()); + } + } + + // Create an instance of the RowSet we are using + protected abstract T newInstance() throws SQLException; + + //DataProvider to use for common tests + + /* + * DataProvider used to specify the value to set and check for the + * methods for fetch direction + */ + @DataProvider(name = "rowSetFetchDirection") + protected Object[][] rowSetFetchDirection() throws Exception { + RowSet rs = newInstance(); + return new Object[][]{ + {rs, ResultSet.FETCH_FORWARD}, + {rs, ResultSet.FETCH_REVERSE}, + {rs, ResultSet.FETCH_UNKNOWN} + }; + } + + /* + * DataProvider used to specify the value to set and check for the + * methods for Cursor Scroll Type + */ + @DataProvider(name = "rowSetScrollTypes") + protected Object[][] rowSetScrollTypes() throws Exception { + RowSet rs = newInstance(); + + return new Object[][]{ + {rs, ResultSet.TYPE_FORWARD_ONLY}, + {rs, ResultSet.TYPE_SCROLL_INSENSITIVE}, + {rs, ResultSet.TYPE_SCROLL_SENSITIVE} + }; + } + + /* + * DataProvider used to specify the value to set and check for + * methods using transaction isolation types + */ + @DataProvider(name = "rowSetIsolationTypes") + protected Object[][] rowSetIsolationTypes() throws Exception { + RowSet rs = newInstance(); + + return new Object[][]{ + {rs, Connection.TRANSACTION_NONE}, + {rs, Connection.TRANSACTION_READ_COMMITTED}, + {rs, Connection.TRANSACTION_READ_UNCOMMITTED}, + {rs, Connection.TRANSACTION_REPEATABLE_READ}, + {rs, Connection.TRANSACTION_SERIALIZABLE} + }; + } + + /* + * DataProvider used to specify the value to set and check for the + * methods for Concurrency + */ + @DataProvider(name = "rowSetConcurrencyTypes") + protected Object[][] rowSetConcurrencyTypes() throws Exception { + RowSet rs = newInstance(); + return new Object[][]{ + {rs, ResultSet.CONCUR_READ_ONLY}, + {rs, ResultSet.CONCUR_UPDATABLE} + }; + } + + /* + * DataProvider used to specify the value to set and check for + * methods using boolean values + */ + @DataProvider(name = "rowSetTrueFalse") + protected Object[][] rowSetTrueFalse() throws Exception { + RowSet rs = newInstance(); + return new Object[][]{ + {rs, true}, + {rs, false} + }; + } + /* + * DataProvider used to specify the type of RowSet to use. We also must + * initialize the RowSet + */ + @DataProvider(name = "rowSetType") + protected Object[][] rowSetType() throws Exception { + + RowSet rs = newInstance(); + return new Object[][]{ + {rs} + }; + } + + /* + * Initializes a RowSet containing the COFFEE_HOUSES data + */ + protected T createCoffeeHousesRowSet() throws SQLException { + T rs = (T) newInstance(); + initCoffeeHousesMetaData((CachedRowSet) rs); + createCoffeeHouseRows(rs); + // Make sure you are not on the insertRow + rs.moveToCurrentRow(); + return rs; + } + + /* + * Initializes a RowSet containing the COFFEE_HOUSES data + */ + protected T createCoffeesRowSet() throws SQLException { + T rs = (T) newInstance(); + initCoffeesMetaData((CachedRowSet) rs); + createCoffeesRows(rs); + // Make sure you are not on the insertRow + rs.moveToCurrentRow(); + return rs; + } + + /* + * Initializes the COFFEE_HOUSES metadata + */ + private void initCoffeeHousesMetaData(CachedRowSet crs) throws SQLException { + RowSetMetaDataImpl rsmd = new RowSetMetaDataImpl(); + crs.setType(RowSet.TYPE_SCROLL_INSENSITIVE); + + /* + * CREATE TABLE COFFEE_HOUSES( + * STORE_ID Integer NOT NULL, + * CITY VARCHAR(32), + * COFFEE INTEGER NOT NULL, + * MERCH INTEGER NOT NULL, + * TOTAL INTEGER NOT NULL, + * PRIMARY KEY (STORE_ID)) + */ + rsmd.setColumnCount(COFFEE_HOUSES_COLUMN_NAMES.length); + for(int i = 1; i <= COFFEE_HOUSES_COLUMN_NAMES.length; i++){ + rsmd.setColumnName(i, COFFEE_HOUSES_COLUMN_NAMES[i-1]); + rsmd.setColumnLabel(i, rsmd.getColumnName(i)); + } + + rsmd.setColumnType(1, Types.INTEGER); + rsmd.setColumnType(2, Types.VARCHAR); + rsmd.setColumnType(3, Types.INTEGER); + rsmd.setColumnType(4, Types.INTEGER); + rsmd.setColumnType(5, Types.INTEGER); + crs.setMetaData(rsmd); + crs.setTableName(COFFEE_HOUSES_TABLE); + + } + + /* + * Add rows to COFFEE_HOUSES table + */ + protected void createCoffeeHouseRows(RowSet rs) throws SQLException { + + // insert into COFFEE_HOUSES values(10023, 'Mendocino', 3450, 2005, 5455) + rs.moveToInsertRow(); + rs.updateInt(1, 10023); + rs.updateString(2, "Mendocino"); + rs.updateInt(3, 3450); + rs.updateInt(4, 2005); + rs.updateInt(5, 5455); + rs.insertRow(); + // insert into COFFEE_HOUSES values(33002, 'Seattle', 4699, 3109, 7808) + rs.moveToInsertRow(); + rs.updateInt(1, 33002); + rs.updateString(2, "Seattle"); + rs.updateInt(3, 4699); + rs.updateInt(4, 3109); + rs.updateInt(5, 7808); + rs.insertRow(); + // insert into COFFEE_HOUSES values(10040, 'SF', 5386, 2841, 8227) + rs.moveToInsertRow(); + rs.updateInt(1, 10040); + rs.updateString(2, "SF"); + rs.updateInt(3, 5386); + rs.updateInt(4, 2841); + rs.updateInt(5, 8227); + rs.insertRow(); + // insert into COFFEE_HOUSES values(32001, 'Portland', 3147, 3579, 6726) + rs.moveToInsertRow(); + rs.updateInt(1, 32001); + rs.updateString(2, "Portland"); + rs.updateInt(3, 3147); + rs.updateInt(4, 3579); + rs.updateInt(5, 6726); + rs.insertRow(); + // insert into COFFEE_HOUSES values(10042, 'SF', 2863, 1874, 4710) + rs.moveToInsertRow(); + rs.updateInt(1, 10042); + rs.updateString(2, "SF"); + rs.updateInt(3, 2863); + rs.updateInt(4, 1874); + rs.updateInt(5, 4710); + rs.insertRow(); + // insert into COFFEE_HOUSES values(10024, 'Sacramento', 1987, 2341, 4328) + rs.moveToInsertRow(); + rs.updateInt(1, 10024); + rs.updateString(2, "Sacramento"); + rs.updateInt(3, 1987); + rs.updateInt(4, 2341); + rs.updateInt(5, 4328); + rs.insertRow(); + // insert into COFFEE_HOUSES values(10039, 'Carmel', 2691, 1121, 3812) + rs.moveToInsertRow(); + rs.updateInt(1, 10039); + rs.updateString(2, "Carmel"); + rs.updateInt(3, 2691); + rs.updateInt(4, 1121); + rs.updateInt(5, 3812); + rs.insertRow(); + // insert into COFFEE_HOUSES values(10041, 'LA', 1533, 1007, 2540) + rs.moveToInsertRow(); + rs.updateInt(1, 10041); + rs.updateString(2, "LA"); + rs.updateInt(3, 1533); + rs.updateInt(4, 1007); + rs.updateInt(5, 2540); + rs.insertRow(); + // insert into COFFEE_HOUSES values(33005, 'Olympia', 2733, 1550, 1550) + rs.moveToInsertRow(); + rs.updateInt(1, 33005); + rs.updateString(2, "Olympia"); + rs.updateInt(3, 2733); + rs.updateInt(4, 1550); + rs.updateInt(5, 1550); + rs.insertRow(); + // insert into COFFEE_HOUSES values(33010, 'Seattle', 3210, 2177, 5387) + rs.moveToInsertRow(); + rs.updateInt(1, 33010); + rs.updateString(2, "Seattle"); + rs.updateInt(3, 3210); + rs.updateInt(4, 2177); + rs.updateInt(5, 5387); + rs.insertRow(); + // insert into COFFEE_HOUSES values(10035, 'SF', 1922, 1056, 2978) + rs.moveToInsertRow(); + rs.updateInt(1, 10035); + rs.updateString(2, "SF"); + rs.updateInt(3, 1922); + rs.updateInt(4, 1056); + rs.updateInt(5, 2978); + rs.insertRow(); + // insert into COFFEE_HOUSES values(10037, 'LA', 2143, 1876, 4019) + rs.moveToInsertRow(); + rs.updateInt(1, 10037); + rs.updateString(2, "LA"); + rs.updateInt(3, 2143); + rs.updateInt(4, 1876); + rs.updateInt(5, 4019); + rs.insertRow(); + // insert into COFFEE_HOUSES values(10034, 'San_Jose', 1234, 1032, 2266) + rs.moveToInsertRow(); + rs.updateInt(1, 10034); + rs.updateString(2, "San Jose"); + rs.updateInt(3, 1234); + rs.updateInt(4, 1032); + rs.updateInt(5, 2266); + rs.insertRow(); + // insert into COFFEE_HOUSES values(32004, 'Eugene', 1356, 1112, 2468) + rs.moveToInsertRow(); + rs.updateInt(1, 32004); + rs.updateString(2, "Eugene"); + rs.updateInt(3, 1356); + rs.updateInt(4, 1112); + rs.updateInt(5, 2468); + rs.insertRow(); + rs.moveToCurrentRow(); + } + + /* + * Initializes the COFFEES metadata + */ + protected void initCoffeesMetaData(CachedRowSet crs) throws SQLException { + RowSetMetaDataImpl rsmd = new RowSetMetaDataImpl(); + crs.setType(RowSet.TYPE_SCROLL_INSENSITIVE); + + /* + * CREATE TABLE COFFEES ( + * COF_ID INTEGER NOT NULL, + * COF_NAME VARCHAR(32) NOT NULL, + * SUP_ID INTEGER NOT NULL, + * PRICE NUMBERIC(10,2 NOT NULL, + * SALES INTEGER NOT NULL, + * TOTAL INTEGER NOT NULL, + * PRIMARY KEY (COF_ID), + * FOREIGN KEY (SUP_ID) REFERENCES SUPPLIERS (SUP_ID) ) + */ + rsmd.setColumnCount(COFFEES_COLUMN_NAMES.length); + for(int i = 1; i <= COFFEES_COLUMN_NAMES.length; i++){ + rsmd.setColumnName(i, COFFEES_COLUMN_NAMES[i-1]); + rsmd.setColumnLabel(i, rsmd.getColumnName(i)); + } + + rsmd.setColumnType(1, Types.INTEGER); + rsmd.setColumnType(2, Types.VARCHAR); + rsmd.setColumnType(3, Types.INTEGER); + rsmd.setColumnType(4, Types.NUMERIC); + rsmd.setPrecision(4, 10); + rsmd.setScale(4, 2); + rsmd.setColumnType(5, Types.INTEGER); + rsmd.setColumnType(6, Types.INTEGER); + crs.setMetaData(rsmd); + crs.setTableName(COFFEES_TABLE); + + } + + /* + * Add rows to COFFEES table + */ + protected void createCoffeesRows(RowSet rs) throws SQLException { + + // insert into COFFEES values(1, 'Colombian', 101, 7.99, 0, 0) + rs.moveToInsertRow(); + rs.updateInt(1, 1); + rs.updateString(2, "Colombian"); + rs.updateInt(3, 101); + rs.updateBigDecimal(4, BigDecimal.valueOf(7.99)); + rs.updateInt(5, 0); + rs.updateInt(6, 0); + rs.insertRow(); + // insert into COFFEES values(2, 'French_Roast', 49, 8.99, 0, 0) + rs.moveToInsertRow(); + rs.updateInt(1, 2); + rs.updateString(2, "French_Roast"); + rs.updateInt(3, 49); + rs.updateBigDecimal(4, BigDecimal.valueOf(8.99)); + rs.updateInt(5, 0); + rs.updateInt(6, 0); + rs.insertRow(); + // insert into COFFEES values(3, 'Espresso', 150, 9.99, 0, 0) + rs.moveToInsertRow(); + rs.updateInt(1, 3); + rs.updateString(2, "Espresso"); + rs.updateInt(3, 150); + rs.updateBigDecimal(4, BigDecimal.valueOf(9.99)); + rs.updateInt(5, 0); + rs.updateInt(6, 0); + rs.insertRow(); + // insert into COFFEES values(4, 'Colombian_Decaf', 101, 8.99, 0, 0) + rs.moveToInsertRow(); + rs.updateInt(1, 4); + rs.updateString(2, "Colombian_Decaf"); + rs.updateInt(3, 101); + rs.updateBigDecimal(4, BigDecimal.valueOf(8.99)); + rs.updateInt(5, 0); + rs.updateInt(6, 0); + rs.insertRow(); + // insert into COFFEES values(5, 'French_Roast_Decaf', 049, 9.99, 0, 0) + rs.moveToInsertRow(); + rs.updateInt(1, 5); + rs.updateString(2, "French_Roast_Decaf"); + rs.updateInt(3, 49); + rs.updateBigDecimal(4, BigDecimal.valueOf(9.99)); + rs.updateInt(5, 0); + rs.updateInt(6, 0); + rs.insertRow(); + + } + + + /* + * Utility method to return the Primary Keys for a RowSet. The Primary + * keys are assumed to be in the first column of the RowSet + */ + protected Object[] getPrimaryKeys(ResultSet rs) throws SQLException { + List result = new ArrayList<>(); + if (rs == null) { + return null; + } + rs.beforeFirst(); + while (rs.next()) { + result.add(rs.getInt(1)); + } + return result.toArray(); + } + + /* + * Utility method to display the RowSet and will return the row count + * it found + */ + protected int displayResults(ResultSet rs) throws SQLException { + int rows = 0; + ResultSetMetaData rsmd = rs.getMetaData(); + int cols = rsmd.getColumnCount(); + if (rs != null) { + rs.beforeFirst(); + while (rs.next()) { + rows++; + + for (int i = 0; i < cols; i++) { + System.out.print(rs.getString(i + 1) + " "); + } + System.out.println(); + } + } + + return rows; + } + + + // Insert common tests here + + /* + * Validate that getCommand() returns null by default + */ + @Test(dataProvider = "rowSetType") + public void commonRowSetTest0000(RowSet rs) { + assertNull(rs.getCommand()); + } + + /* + * Validate that getCommand() returns command specified to setCommand + */ + @Test(dataProvider = "rowSetType") + public void commonRowSetTest0001(RowSet rs) throws Exception { + rs.setCommand(query); + assertTrue(rs.getCommand().equals(query)); + } + + + /* + * Validate that getCurrency() returns the correct default value + */ + @Test(dataProvider = "rowSetType") + public void commonRowSetTest0002(RowSet rs) throws Exception { + assertTrue(rs.getConcurrency() == ResultSet.CONCUR_UPDATABLE); + } + + /* + * Validate that getCurrency() returns the correct value + * after a call to setConcurrency()) + */ + @Test(dataProvider = "rowSetConcurrencyTypes") + public void commonRowSetTest0003(RowSet rs, int concurType) throws Exception { + rs.setConcurrency(concurType); + assertTrue(rs.getConcurrency() == concurType); + } + + /* + * Validate that getCurrency() throws a SQLException for an invalid value + */ + @Test(dataProvider = "rowSetType", expectedExceptions = SQLException.class) + public void commonRowSetTest0004(RowSet rs) throws Exception { + rs.setConcurrency(ResultSet.CLOSE_CURSORS_AT_COMMIT); + } + + /* + * Validate that getDataSourceName() returns null by default + */ + @Test(dataProvider = "rowSetType") + public void commonRowSetTest0005(RowSet rs) throws Exception { + assertTrue(rs.getDataSourceName() == null); + } + + /* + * Validate that getDataSourceName() returns the value specified + * by setDataSourceName() and getUrl() returns null + */ + @Test(dataProvider = "rowSetType") + public void commonRowSetTest0006(RowSet rs) throws Exception { + rs.setUrl(url); + rs.setDataSourceName(dsName); + assertTrue(rs.getDataSourceName().equals(dsName)); + assertNull(rs.getUrl()); + } + + /* + * Validate that setDataSourceName() throws a SQLException for an empty + * String specified for the data source name + */ + @Test(dataProvider = "rowSetType", expectedExceptions = SQLException.class) + public void commonRowSetTest0007(RowSet rs) throws Exception { + String dsname = ""; + rs.setDataSourceName(dsname); + } + + /* + * Validate that getEscapeProcessing() returns false by default + */ + @Test(dataProvider = "rowSetType") + public void commonRowSetTest0008(RowSet rs) throws Exception { + assertTrue(rs.getEscapeProcessing()); + } + + /* + * Validate that getEscapeProcessing() returns value set by + * setEscapeProcessing() + */ + @Test(dataProvider = "rowSetTrueFalse") + public void commonRowSetTest0009(RowSet rs, boolean val) throws Exception { + rs.setEscapeProcessing(val); + assertTrue(rs.getEscapeProcessing() == val); + } + + /* + * Validate that getFetchDirection() returns the correct default value + */ + @Test(dataProvider = "rowSetType") + public void commonRowSetTest0010(RowSet rs) throws Exception { + assertTrue(rs.getFetchDirection() == ResultSet.FETCH_FORWARD); + } + + /* + * Validate that getFetchDirection() returns the value set by + * setFetchDirection() + */ + @Test(dataProvider = "rowSetFetchDirection") + public void commonRowSetTest0011(RowSet rs, int direction) throws Exception { + rs.setFetchDirection(direction); + assertTrue(rs.getFetchDirection() == direction); + } + + /* + * Validate that setFetchSize() throws a SQLException for an invalid value + */ + @Test(dataProvider = "rowSetType", expectedExceptions = SQLException.class) + public void commonRowSetTest0013(RowSet rs) throws Exception { + rs.setFetchSize(-1); + } + + /* + * Validate that setFetchSize() throws a SQLException for a + * value greater than getMaxRows() + */ + @Test(dataProvider = "rowSetType", expectedExceptions = SQLException.class) + public void commonRowSetTest0014(RowSet rs) throws Exception { + rs.setMaxRows(5); + rs.setFetchSize(rs.getMaxRows() + 1); + } + + /* + * Validate that getFetchSize() returns the correct value after + * setFetchSize() has been called + */ + @Test(dataProvider = "rowSetType") + public void commonRowSetTest0015(RowSet rs) throws Exception { + int maxRows = 150; + rs.setFetchSize(0); + assertTrue(rs.getFetchSize() == 0); + rs.setFetchSize(100); + assertTrue(rs.getFetchSize() == 100); + rs.setMaxRows(maxRows); + rs.setFetchSize(maxRows); + assertTrue(rs.getFetchSize() == maxRows); + } + + /* + * Validate that setMaxFieldSize() throws a SQLException for an invalid value + */ + @Test(dataProvider = "rowSetType", expectedExceptions = SQLException.class) + public void commonRowSetTest0016(RowSet rs) throws Exception { + rs.setMaxFieldSize(-1); + } + + /* + * Validate that getMaxFieldSize() returns the value set by + * setMaxFieldSize() + */ + @Test(dataProvider = "rowSetType") + public void commonRowSetTest0017(RowSet rs) throws Exception { + rs.setMaxFieldSize(0); + assertTrue(rs.getMaxFieldSize() == 0); + rs.setMaxFieldSize(100); + assertTrue(rs.getMaxFieldSize() == 100); + rs.setMaxFieldSize(50); + assertTrue(rs.getMaxFieldSize() == 50); + } + + /* + * Validate that isReadOnly() returns value set by + * setReadOnly() + */ + @Test(dataProvider = "rowSetTrueFalse") + public void commonRowSetTest0018(RowSet rs, boolean val) throws Exception { + rs.setReadOnly(val); + assertTrue(rs.isReadOnly() == val); + } + + /* + * Validate that getTransactionIsolation() returns value set by + * setTransactionIsolation() + */ + @Test(dataProvider = "rowSetIsolationTypes") + public void commonRowSetTest0019(RowSet rs, int val) throws Exception { + rs.setTransactionIsolation(val); + assertTrue(rs.getTransactionIsolation() == val); + } + + /* + * Validate that getType() returns value set by setType() + */ + @Test(dataProvider = "rowSetScrollTypes") + public void commonRowSetTest0020(RowSet rs, int val) throws Exception { + rs.setType(val); + assertTrue(rs.getType() == val); + } + + /* + * Validate that getEscapeProcessing() returns value set by + * setEscapeProcessing() + */ + @Test(dataProvider = "rowSetTrueFalse") + public void commonRowSetTest0021(BaseRowSet rs, boolean val) throws Exception { + rs.setShowDeleted(val); + assertTrue(rs.getShowDeleted() == val); + } + + /* + * Validate that getTypeMap() returns same value set by + * setTypeMap() + */ + @Test(dataProvider = "rowSetType") + public void commonRowSetTest0022(RowSet rs) throws Exception { + Map> map = new HashMap<>(); + map.put("SUPERHERO", Class.forName("util.SuperHero")); + rs.setTypeMap(map); + assertTrue(rs.getTypeMap().equals(map)); + } + + /* + * Validate that getUsername() returns same value set by + * setUsername() + */ + @Test(dataProvider = "rowSetType") + public void commonRowSetTest0023(RowSet rs) throws Exception { + rs.setUsername(user); + assertTrue(rs.getUsername().equals(user)); + } + + /* + * Validate that getPassword() returns same password set by + * setPassword() + */ + @Test(dataProvider = "rowSetType") + public void commonRowSetTest0024(RowSet rs) throws Exception { + rs.setPassword(password); + assertTrue(rs.getPassword().equals(password)); + } + + /* + * Validate that getQueryTimeout() returns same value set by + * setQueryTimeout() and that 0 is a valid timeout value + */ + @Test(dataProvider = "rowSetType") + public void commonRowSetTest0025(RowSet rs) throws Exception { + int timeout = 0; + rs.setQueryTimeout(timeout); + assertTrue(rs.getQueryTimeout() == timeout); + } + + /* + * Validate that getQueryTimeout() returns same value set by + * setQueryTimeout() and that 0 is a valid timeout value + */ + @Test(dataProvider = "rowSetType") + public void commonRowSetTest0026(RowSet rs) throws Exception { + int timeout = 10000; + rs.setQueryTimeout(timeout); + assertTrue(rs.getQueryTimeout() == timeout); + } + + /* + * Validate that setQueryTimeout() throws a SQLException for a timeout + * value < 0 + */ + @Test(dataProvider = "rowSetType", expectedExceptions = SQLException.class) + public void commonRowSetTest0027(RowSet rs) throws Exception { + rs.setQueryTimeout(-1); + } + + + /* + * Validate addRowSetListener does not throw an Exception when null is + * passed as the parameter + */ + @Test(dataProvider = "rowSetType") + public void commonRowSetTest0028(RowSet rs) throws Exception { + rs.addRowSetListener(null); + } + + /* + * Validate removeRowSetListener does not throw an Exception when null is + * passed as the parameter + */ + @Test(dataProvider = "rowSetType") + public void commonRowSetTest0029(RowSet rs) throws Exception { + rs.removeRowSetListener(null); + } + + /* + * Set two parameters and then validate clearParameters() will clear them + */ + @Test(dataProvider = "rowSetType") + public void commonRowSetTest0030(BaseRowSet rs) throws Exception { + rs.setInt(1, 1); + rs.setString(2, query); + assertTrue(rs.getParams().length == 2); + rs.clearParameters(); + assertTrue(rs.getParams().length == 0); + } + + /* + * Validate that getURL() returns same value set by + * setURL() + */ + @Test(dataProvider = "rowSetType") + public void commonRowSetTest0031(RowSet rs) throws Exception { + rs.setUrl(url); + assertTrue(rs.getUrl().equals(url)); + } + + /* + * This method is currently not implemented in BaseRowSet and will + * throw a SQLFeatureNotSupportedException + */ + @Test(dataProvider = "rowSetType", + expectedExceptions = SQLFeatureNotSupportedException.class) + public void commonRowSetTest0100(RowSet rs) throws Exception { + InputStream is = null; + rs.setAsciiStream(1, is); + } + + /* + * This method is currently not implemented in BaseRowSet and will + * throw a SQLFeatureNotSupportedException + */ + @Test(dataProvider = "rowSetType", + expectedExceptions = SQLFeatureNotSupportedException.class) + public void commonRowSetTest0101(RowSet rs) throws Exception { + InputStream is = null; + rs.setAsciiStream("one", is); + } + + /* + * This method is currently not implemented in BaseRowSet and will + * throw a SQLFeatureNotSupportedException + */ + @Test(dataProvider = "rowSetType", + expectedExceptions = SQLFeatureNotSupportedException.class) + public void commonRowSetTest0102(RowSet rs) throws Exception { + InputStream is = null; + rs.setAsciiStream("one", is, query.length()); + } + + /* + * This method is currently not implemented in BaseRowSet and will + * throw a SQLFeatureNotSupportedException + */ + @Test(dataProvider = "rowSetType", + expectedExceptions = SQLFeatureNotSupportedException.class) + public void commonRowSetTest0103(RowSet rs) throws Exception { + InputStream is = null; + rs.setBinaryStream(1, is); + } + + /* + * This method is currently not implemented in BaseRowSet and will + * throw a SQLFeatureNotSupportedException + */ + @Test(dataProvider = "rowSetType", + expectedExceptions = SQLFeatureNotSupportedException.class) + public void commonRowSetTest0104(RowSet rs) throws Exception { + InputStream is = null; + rs.setBinaryStream("one", is); + } + + /* + * This method is currently not implemented in BaseRowSet and will + * throw a SQLFeatureNotSupportedException + */ + @Test(dataProvider = "rowSetType", + expectedExceptions = SQLFeatureNotSupportedException.class) + public void commonRowSetTest0105(RowSet rs) throws Exception { + InputStream is = null; + rs.setBinaryStream("one", is, query.length()); + } + + /* + * This method is currently not implemented in BaseRowSet and will + * throw a SQLFeatureNotSupportedException + */ + @Test(dataProvider = "rowSetType", + expectedExceptions = SQLFeatureNotSupportedException.class) + public void commonRowSetTest0106(RowSet rs) throws Exception { + rs.setBigDecimal("one", BigDecimal.ONE); + } + + /* + * This method is currently not implemented in BaseRowSet and will + * throw a SQLFeatureNotSupportedException + */ + @Test(dataProvider = "rowSetType", + expectedExceptions = SQLFeatureNotSupportedException.class) + public void commonRowSetTest0107(RowSet rs) throws Exception { + InputStream is = null; + rs.setBlob(1, is); + } + + /* + * This method is currently not implemented in BaseRowSet and will + * throw a SQLFeatureNotSupportedException + */ + @Test(dataProvider = "rowSetType", + expectedExceptions = SQLFeatureNotSupportedException.class) + public void commonRowSetTest0108(RowSet rs) throws Exception { + InputStream is = null; + rs.setBlob("one", is); + } + + /* + * This method is currently not implemented in BaseRowSet and will + * throw a SQLFeatureNotSupportedException + */ + @Test(dataProvider = "rowSetType", + expectedExceptions = SQLFeatureNotSupportedException.class) + public void commonRowSetTest0109(RowSet rs) throws Exception { + InputStream is = null; + rs.setBlob("one", is, query.length()); + } + + /* + * This method is currently not implemented in BaseRowSet and will + * throw a SQLFeatureNotSupportedException + */ + @Test(dataProvider = "rowSetType", + expectedExceptions = SQLFeatureNotSupportedException.class) + public void commonRowSetTest0110(RowSet rs) throws Exception { + rs.setBlob("one", new StubBlob()); + } + + /* + * This method is currently not implemented in BaseRowSet and will + * throw a SQLFeatureNotSupportedException + */ + @Test(dataProvider = "rowSetType", + expectedExceptions = SQLFeatureNotSupportedException.class) + public void commonRowSetTest0111(RowSet rs) throws Exception { + rs.setBoolean("one", true); + } + + /* + * This method is currently not implemented in BaseRowSet and will + * throw a SQLFeatureNotSupportedException + */ + @Test(dataProvider = "rowSetType", + expectedExceptions = SQLFeatureNotSupportedException.class) + public void commonRowSetTest0112(RowSet rs) throws Exception { + byte b = 1; + rs.setByte("one", b); + } + + /* + * This method is currently not implemented in BaseRowSet and will + * throw a SQLFeatureNotSupportedException + */ + @Test(dataProvider = "rowSetType", + expectedExceptions = SQLFeatureNotSupportedException.class) + public void commonRowSetTest0113(RowSet rs) throws Exception { + byte b = 1; + rs.setBytes("one", new byte[10]); + } + + /* + * This method is currently not implemented in BaseRowSet and will + * throw a SQLFeatureNotSupportedException + */ + @Test(dataProvider = "rowSetType", + expectedExceptions = SQLFeatureNotSupportedException.class) + public void commonRowSetTest0114(RowSet rs) throws Exception { + Reader rdr = null; + rs.setCharacterStream("one", rdr, query.length()); + } + + /* + * This method is currently not implemented in BaseRowSet and will + * throw a SQLFeatureNotSupportedException + */ + @Test(dataProvider = "rowSetType", + expectedExceptions = SQLFeatureNotSupportedException.class) + public void commonRowSetTest0115(RowSet rs) throws Exception { + Reader rdr = null; + rs.setCharacterStream("one", rdr); + } + + /* + * This method is currently not implemented in BaseRowSet and will + * throw a SQLFeatureNotSupportedException + */ + @Test(dataProvider = "rowSetType", + expectedExceptions = SQLFeatureNotSupportedException.class) + public void commonRowSetTest0116(RowSet rs) throws Exception { + Reader rdr = null; + rs.setCharacterStream(1, rdr); + } + + /* + * This method is currently not implemented in BaseRowSet and will + * throw a SQLFeatureNotSupportedException + */ + @Test(dataProvider = "rowSetType", + expectedExceptions = SQLFeatureNotSupportedException.class) + public void commonRowSetTest0117(RowSet rs) throws Exception { + Reader rdr = null; + rs.setClob(1, rdr); + } + + /* + * This method is currently not implemented in BaseRowSet and will + * throw a SQLFeatureNotSupportedException + */ + @Test(dataProvider = "rowSetType", + expectedExceptions = SQLFeatureNotSupportedException.class) + public void commonRowSetTest0118(RowSet rs) throws Exception { + Reader rdr = null; + rs.setClob("one", rdr); + } + + /* + * This method is currently not implemented in BaseRowSet and will + * throw a SQLFeatureNotSupportedException + */ + @Test(dataProvider = "rowSetType", + expectedExceptions = SQLFeatureNotSupportedException.class) + public void commonRowSetTest0119(RowSet rs) throws Exception { + Reader rdr = null; + rs.setClob("one", rdr, query.length()); + } + + /* + * This method is currently not implemented in BaseRowSet and will + * throw a SQLFeatureNotSupportedException + */ + @Test(dataProvider = "rowSetType", + expectedExceptions = SQLFeatureNotSupportedException.class) + public void commonRowSetTest0120(RowSet rs) throws Exception { + rs.setClob("one", new StubClob()); + } + + /* + * This method is currently not implemented in BaseRowSet and will + * throw a SQLFeatureNotSupportedException + */ + @Test(dataProvider = "rowSetType", + expectedExceptions = SQLFeatureNotSupportedException.class) + public void commonRowSetTest0121(RowSet rs) throws Exception { + rs.setDate("one", Date.valueOf(LocalDate.now())); + } + + /* + * This method is currently not implemented in BaseRowSet and will + * throw a SQLFeatureNotSupportedException + */ + @Test(dataProvider = "rowSetType", + expectedExceptions = SQLFeatureNotSupportedException.class) + public void commonRowSetTest0122(RowSet rs) throws Exception { + rs.setDate("one", Date.valueOf(LocalDate.now()), + Calendar.getInstance()); + } + + /* + * This method is currently not implemented in BaseRowSet and will + * throw a SQLFeatureNotSupportedException + */ + @Test(dataProvider = "rowSetType", + expectedExceptions = SQLFeatureNotSupportedException.class) + public void commonRowSetTest0123(RowSet rs) throws Exception { + rs.setTime("one", Time.valueOf(LocalTime.now())); + } + + /* + * This method is currently not implemented in BaseRowSet and will + * throw a SQLFeatureNotSupportedException + */ + @Test(dataProvider = "rowSetType", + expectedExceptions = SQLFeatureNotSupportedException.class) + public void commonRowSetTest0124(RowSet rs) throws Exception { + rs.setTime("one", Time.valueOf(LocalTime.now()), + Calendar.getInstance()); + } + + /* + * This method is currently not implemented in BaseRowSet and will + * throw a SQLFeatureNotSupportedException + */ + @Test(dataProvider = "rowSetType", + expectedExceptions = SQLFeatureNotSupportedException.class) + public void commonRowSetTest0125(RowSet rs) throws Exception { + rs.setTimestamp("one", Timestamp.valueOf(LocalDateTime.now())); + } + + /* + * This method is currently not implemented in BaseRowSet and will + * throw a SQLFeatureNotSupportedException + */ + @Test(dataProvider = "rowSetType", + expectedExceptions = SQLFeatureNotSupportedException.class) + public void commonRowSetTest0126(RowSet rs) throws Exception { + rs.setTimestamp("one", Timestamp.valueOf(LocalDateTime.now()), + Calendar.getInstance()); + } + + /* + * This method is currently not implemented in BaseRowSet and will + * throw a SQLFeatureNotSupportedException + */ + @Test(dataProvider = "rowSetType", + expectedExceptions = SQLFeatureNotSupportedException.class) + public void commonRowSetTest0127(RowSet rs) throws Exception { + rs.setDouble("one", 2.0d); + } + + /* + * This method is currently not implemented in BaseRowSet and will + * throw a SQLFeatureNotSupportedException + */ + @Test(dataProvider = "rowSetType", + expectedExceptions = SQLFeatureNotSupportedException.class) + public void commonRowSetTest0128(RowSet rs) throws Exception { + rs.setFloat("one", 2.0f); + } + + /* + * This method is currently not implemented in BaseRowSet and will + * throw a SQLFeatureNotSupportedException + */ + @Test(dataProvider = "rowSetType", + expectedExceptions = SQLFeatureNotSupportedException.class) + public void commonRowSetTest0129(RowSet rs) throws Exception { + rs.setInt("one", 21); + } + + /* + * This method is currently not implemented in BaseRowSet and will + * throw a SQLFeatureNotSupportedException + */ + @Test(dataProvider = "rowSetType", + expectedExceptions = SQLFeatureNotSupportedException.class) + public void commonRowSetTest0130(RowSet rs) throws Exception { + rs.setLong("one", 21l); + } + + /* + * This method is currently not implemented in BaseRowSet and will + * throw a SQLFeatureNotSupportedException + */ + @Test(dataProvider = "rowSetType", + expectedExceptions = SQLFeatureNotSupportedException.class) + public void commonRowSetTest0131(RowSet rs) throws Exception { + Reader rdr = null; + rs.setNCharacterStream("one", rdr, query.length()); + } + + /* + * This method is currently not implemented in BaseRowSet and will + * throw a SQLFeatureNotSupportedException + */ + @Test(dataProvider = "rowSetType", + expectedExceptions = SQLFeatureNotSupportedException.class) + public void commonRowSetTest0132(RowSet rs) throws Exception { + Reader rdr = null; + rs.setNCharacterStream("one", rdr); + } + + /* + * This method is currently not implemented in BaseRowSet and will + * throw a SQLFeatureNotSupportedException + */ + @Test(dataProvider = "rowSetType", + expectedExceptions = SQLFeatureNotSupportedException.class) + public void commonRowSetTest0133(RowSet rs) throws Exception { + Reader rdr = null; + rs.setNCharacterStream(1, rdr); + } + + /* + * This method is currently not implemented in BaseRowSet and will + * throw a SQLFeatureNotSupportedException + */ + @Test(dataProvider = "rowSetType", + expectedExceptions = SQLFeatureNotSupportedException.class) + public void commonRowSetTest0134(RowSet rs) throws Exception { + Reader rdr = null; + rs.setNCharacterStream(1, rdr, query.length()); + } + + /* + * This method is currently not implemented in BaseRowSet and will + * throw a SQLFeatureNotSupportedException + */ + @Test(dataProvider = "rowSetType", + expectedExceptions = SQLFeatureNotSupportedException.class) + public void commonRowSetTest0135(RowSet rs) throws Exception { + Reader rdr = null; + rs.setClob("one", rdr); + } + + /* + * This method is currently not implemented in BaseRowSet and will + * throw a SQLFeatureNotSupportedException + */ + @Test(dataProvider = "rowSetType", + expectedExceptions = SQLFeatureNotSupportedException.class) + public void commonRowSetTest0136(RowSet rs) throws Exception { + Reader rdr = null; + rs.setClob("one", rdr, query.length()); + } + + /* + * This method is currently not implemented in BaseRowSet and will + * throw a SQLFeatureNotSupportedException + */ + @Test(dataProvider = "rowSetType", + expectedExceptions = SQLFeatureNotSupportedException.class) + public void commonRowSetTest0137(RowSet rs) throws Exception { + rs.setNClob("one", new StubNClob()); + } + + /* + * This method is currently not implemented in BaseRowSet and will + * throw a SQLFeatureNotSupportedException + */ + @Test(dataProvider = "rowSetType", + expectedExceptions = SQLFeatureNotSupportedException.class) + public void commonRowSetTest0138(RowSet rs) throws Exception { + Reader rdr = null; + rs.setNClob(1, rdr); + } + + /* + * This method is currently not implemented in BaseRowSet and will + * throw a SQLFeatureNotSupportedException + */ + @Test(dataProvider = "rowSetType", + expectedExceptions = SQLFeatureNotSupportedException.class) + public void commonRowSetTest0139(RowSet rs) throws Exception { + Reader rdr = null; + rs.setNClob(1, rdr, query.length()); + } + + /* + * This method is currently not implemented in BaseRowSet and will + * throw a SQLFeatureNotSupportedException + */ + @Test(dataProvider = "rowSetType", + expectedExceptions = SQLFeatureNotSupportedException.class) + public void commonRowSetTest0140(RowSet rs) throws Exception { + rs.setNClob(1, new StubNClob()); + } + + /* + * This method is currently not implemented in BaseRowSet and will + * throw a SQLFeatureNotSupportedException + */ + @Test(dataProvider = "rowSetType", + expectedExceptions = SQLFeatureNotSupportedException.class) + public void commonRowSetTest0141(RowSet rs) throws Exception { + rs.setNString(1, query); + } + + /* + * This method is currently not implemented in BaseRowSet and will + * throw a SQLFeatureNotSupportedException + */ + @Test(dataProvider = "rowSetType", + expectedExceptions = SQLFeatureNotSupportedException.class) + public void commonRowSetTest0142(RowSet rs) throws Exception { + rs.setNull("one", Types.INTEGER); + } + + /* + * This method is currently not implemented in BaseRowSet and will + * throw a SQLFeatureNotSupportedException + */ + @Test(dataProvider = "rowSetType", + expectedExceptions = SQLFeatureNotSupportedException.class) + public void commonRowSetTest0143(RowSet rs) throws Exception { + rs.setNull("one", Types.INTEGER, "my.type"); + } + + /* + * This method is currently not implemented in BaseRowSet and will + * throw a SQLFeatureNotSupportedException + */ + @Test(dataProvider = "rowSetType", + expectedExceptions = SQLFeatureNotSupportedException.class) + public void commonRowSetTest0144(RowSet rs) throws Exception { + rs.setObject("one", query, Types.VARCHAR); + } + + /* + * This method is currently not implemented in BaseRowSet and will + * throw a SQLFeatureNotSupportedException + */ + @Test(dataProvider = "rowSetType", + expectedExceptions = SQLFeatureNotSupportedException.class) + public void commonRowSetTest0145(RowSet rs) throws Exception { + rs.setObject("one", query, Types.VARCHAR, 0); + } + + /* + * This method is currently not implemented in BaseRowSet and will + * throw a SQLFeatureNotSupportedException + */ + @Test(dataProvider = "rowSetType", + expectedExceptions = SQLFeatureNotSupportedException.class) + public void commonRowSetTest0146(RowSet rs) throws Exception { + rs.setObject("one", query); + } + + /* + * This method is currently not implemented in BaseRowSet and will + * throw a SQLFeatureNotSupportedException + */ + @Test(dataProvider = "rowSetType", + expectedExceptions = SQLFeatureNotSupportedException.class) + public void commonRowSetTest0147(RowSet rs) throws Exception { + RowId aRowid = null; + rs.setRowId("one", aRowid); + } + + /* + * This method is currently not implemented in BaseRowSet and will + * throw a SQLFeatureNotSupportedException + */ + @Test(dataProvider = "rowSetType", + expectedExceptions = SQLFeatureNotSupportedException.class) + public void commonRowSetTest0148(RowSet rs) throws Exception { + rs.setSQLXML("one", new StubSQLXML()); + } + + /* + * This method is currently not implemented in BaseRowSet and will + * throw a SQLFeatureNotSupportedException + */ + @Test(dataProvider = "rowSetType", + expectedExceptions = SQLFeatureNotSupportedException.class) + public void commonRowSetTest0149(RowSet rs) throws Exception { + rs.setSQLXML(1, new StubSQLXML()); + } + + /* + * This method is currently not implemented in BaseRowSet and will + * throw a SQLFeatureNotSupportedException + */ + @Test(dataProvider = "rowSetType", + expectedExceptions = SQLFeatureNotSupportedException.class) + public void commonRowSetTest0150(RowSet rs) throws Exception { + rs.setNString(1, query); + } + + /* + * This method is currently not implemented in BaseRowSet and will + * throw a SQLFeatureNotSupportedException + */ + @Test(dataProvider = "rowSetType", + expectedExceptions = SQLFeatureNotSupportedException.class) + public void commonRowSetTest0151(RowSet rs) throws Exception { + rs.setNString("one", query); + } + + /* + * This method is currently not implemented in BaseRowSet and will + * throw a SQLFeatureNotSupportedException + */ + @Test(dataProvider = "rowSetType", + expectedExceptions = SQLFeatureNotSupportedException.class) + public void commonRowSetTest0152(RowSet rs) throws Exception { + short val = 21; + rs.setShort("one", val); + } + +} diff --git a/test/javax/sql/testng/test/rowset/RowSetFactoryTests.java b/test/javax/sql/testng/test/rowset/RowSetFactoryTests.java new file mode 100644 index 000000000..72a4341c7 --- /dev/null +++ b/test/javax/sql/testng/test/rowset/RowSetFactoryTests.java @@ -0,0 +1,119 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package test.rowset; + +import java.sql.SQLException; +import javax.sql.rowset.RowSetFactory; +import javax.sql.rowset.RowSetProvider; +import static org.testng.Assert.*; +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; +import util.BaseTest; + +public class RowSetFactoryTests extends BaseTest { + + // RowSet implementations that we are testing for + private final String DEFAULT_CACHEDROWSET_CLASSNAME = "com.sun.rowset.CachedRowSetImpl"; + private final String DEFAULT_FILTEREDROWSET_CLASSNAME = "com.sun.rowset.FileteredRowSetImpl"; + private final String DEFAULT_JDBCROWSET_CLASSNAME = "com.sun.rowset.JdbcRowSetImpl"; + private final String DEFAULT_JOINROWSET_CLASSNAME = "com.sun.rowset.JoinRowSetImpl"; + private final String DEFAULT_WEBROWSET_CLASSNAME = "com.sun.rowset.WebRowSetImpl"; + private final String STUB_FACTORY_CLASSNAME = "util.StubRowSetFactory"; + private final String STUB_CACHEDROWSET_CLASSNAME = "util.StubCachedRowSetImpl"; + private final String STUB_FILTEREDROWSET_CLASSNAME = "util.StubFilteredRowSetImpl"; + private final String STUB_JDBCROWSET_CLASSNAME = "util.StubJdbcRowSetImpl"; + private final String STUB_JOINROWSET_CLASSNAME = "util.StubJoinRowSetImpl"; + private final String STUB_WEBROWSET_CLASSNAME = "util.StubWebRowSetImpl"; + + + /* + * Validate that the RowSetFactory returned by RowSetProvider.newFactory() + * returns the correct RowSet implementations + */ + @Test(dataProvider = "RowSetValues", enabled = true) + public void test(RowSetFactory rsf, String impl) throws SQLException { + validateRowSetImpl(rsf, impl); + } + + /* + * Utility Method to validate the RowsetFactory returns the correct + * RowSet implementation + */ + private void validateRowSetImpl(RowSetFactory rsf, String implName) + throws SQLException { + assertNotNull(rsf, "RowSetFactory should not be null"); + switch (implName) { + case DEFAULT_CACHEDROWSET_CLASSNAME: + assertTrue(rsf.createCachedRowSet() instanceof com.sun.rowset.CachedRowSetImpl); + break; + case DEFAULT_FILTEREDROWSET_CLASSNAME: + assertTrue(rsf.createFilteredRowSet() instanceof com.sun.rowset.FilteredRowSetImpl); + break; + case DEFAULT_JDBCROWSET_CLASSNAME: + assertTrue(rsf.createJdbcRowSet() instanceof com.sun.rowset.JdbcRowSetImpl); + break; + case DEFAULT_JOINROWSET_CLASSNAME: + assertTrue(rsf.createJoinRowSet() instanceof com.sun.rowset.JoinRowSetImpl); + break; + case DEFAULT_WEBROWSET_CLASSNAME: + assertTrue(rsf.createWebRowSet() instanceof com.sun.rowset.WebRowSetImpl); + break; + case STUB_CACHEDROWSET_CLASSNAME: + assertTrue(rsf.createCachedRowSet() instanceof util.StubCachedRowSetImpl); + break; + case STUB_FILTEREDROWSET_CLASSNAME: + assertTrue(rsf.createFilteredRowSet() instanceof util.StubFilteredRowSetImpl); + break; + case STUB_JDBCROWSET_CLASSNAME: + assertTrue(rsf.createJdbcRowSet() instanceof util.StubJdbcRowSetImpl); + break; + case STUB_WEBROWSET_CLASSNAME: + assertTrue(rsf.createWebRowSet() instanceof util.StubWebRowSetImpl); + break; + } + + } + + /* + * DataProvider used to provide the RowSetFactory and the RowSet + * implementation that should be returned + */ + @DataProvider(name = "RowSetValues") + private Object[][] RowSetValues() throws SQLException { + RowSetFactory rsf = RowSetProvider.newFactory(); + RowSetFactory rsf1 = RowSetProvider.newFactory(STUB_FACTORY_CLASSNAME, null); + return new Object[][]{ + {rsf, DEFAULT_CACHEDROWSET_CLASSNAME}, + {rsf, DEFAULT_FILTEREDROWSET_CLASSNAME}, + {rsf, DEFAULT_JDBCROWSET_CLASSNAME}, + {rsf, DEFAULT_JOINROWSET_CLASSNAME}, + {rsf, DEFAULT_WEBROWSET_CLASSNAME}, + {rsf1, STUB_CACHEDROWSET_CLASSNAME}, + {rsf1, STUB_FILTEREDROWSET_CLASSNAME}, + {rsf1, STUB_JDBCROWSET_CLASSNAME}, + {rsf1, STUB_JOINROWSET_CLASSNAME}, + {rsf1, STUB_WEBROWSET_CLASSNAME} + + }; + } +} diff --git a/test/javax/sql/testng/test/rowset/RowSetMetaDataTests.java b/test/javax/sql/testng/test/rowset/RowSetMetaDataTests.java new file mode 100644 index 000000000..8a944a8bb --- /dev/null +++ b/test/javax/sql/testng/test/rowset/RowSetMetaDataTests.java @@ -0,0 +1,555 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package test.rowset; + +import java.sql.ResultSetMetaData; +import java.sql.SQLException; +import java.sql.Types; +import javax.sql.RowSetMetaData; +import javax.sql.rowset.RowSetMetaDataImpl; +import static org.testng.Assert.*; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; +import util.BaseTest; + +public class RowSetMetaDataTests extends BaseTest { + + // Max columns used in the tests + private final int MAX_COLUMNS = 5; + // Instance to be used within the tests + private RowSetMetaDataImpl rsmd; + + @BeforeMethod + public void setUpMethod() throws Exception { + rsmd = new RowSetMetaDataImpl(); + rsmd.setColumnCount(MAX_COLUMNS); + } + + /* + * Validate a SQLException is thrown for an invalid column index + */ + @Test(dataProvider = "invalidColumnRanges", + expectedExceptions = SQLException.class) + public void test(Integer col) throws Exception { + rsmd.getCatalogName(col); + } + + /* + * Validate a SQLException is thrown for an invalid column index + */ + @Test(dataProvider = "invalidColumnRanges", + expectedExceptions = SQLException.class) + public void test01(Integer col) throws Exception { + rsmd.getColumnClassName(col); + } + + /* + * Validate a SQLException is thrown for an invalid column index + */ + @Test(dataProvider = "invalidColumnRanges", + expectedExceptions = SQLException.class) + public void test02(Integer col) throws Exception { + rsmd.getColumnDisplaySize(col); + } + + /* + * Validate a SQLException is thrown for an invalid column index + */ + @Test(dataProvider = "invalidColumnRanges", + expectedExceptions = SQLException.class) + public void test03(Integer col) throws Exception { + rsmd.getColumnLabel(col); + } + + /* + * Validate a SQLException is thrown for an invalid column index + */ + @Test(dataProvider = "invalidColumnRanges", + expectedExceptions = SQLException.class) + public void test04(Integer col) throws Exception { + rsmd.getColumnName(col); + } + + /* + * Validate a SQLException is thrown for an invalid column index + */ + @Test(dataProvider = "invalidColumnRanges", + expectedExceptions = SQLException.class) + public void test05(Integer col) throws Exception { + rsmd.getColumnType(col); + } + + /* + * Validate a SQLException is thrown for an invalid column index + */ + @Test(dataProvider = "invalidColumnRanges", + expectedExceptions = SQLException.class) + public void test06(Integer col) throws Exception { + rsmd.getColumnTypeName(col); + } + + /* + * Validate a SQLException is thrown for an invalid column index + */ + @Test(dataProvider = "invalidColumnRanges", + expectedExceptions = SQLException.class) + public void test07(Integer col) throws Exception { + rsmd.getPrecision(col); + } + + /* + * Validate a SQLException is thrown for an invalid column index + */ + @Test(dataProvider = "invalidColumnRanges", + expectedExceptions = SQLException.class) + public void test08(Integer col) throws Exception { + rsmd.getScale(col); + } + + /* + * Validate a SQLException is thrown for an invalid column index + */ + @Test(dataProvider = "invalidColumnRanges", + expectedExceptions = SQLException.class) + public void test09(Integer col) throws Exception { + rsmd.getSchemaName(col); + } + + /* + * Validate a SQLException is thrown for an invalid column index + */ + @Test(dataProvider = "invalidColumnRanges", + expectedExceptions = SQLException.class) + public void test10(Integer col) throws Exception { + rsmd.getTableName(col); + } + + /* + * Validate a SQLException is thrown for an invalid column index + */ + @Test(dataProvider = "invalidColumnRanges", + expectedExceptions = SQLException.class) + public void test11(Integer col) throws Exception { + rsmd.isAutoIncrement(col); + } + + /* + * Validate a SQLException is thrown for an invalid column index + */ + @Test(dataProvider = "invalidColumnRanges", + expectedExceptions = SQLException.class) + public void test12(Integer col) throws Exception { + rsmd.isCaseSensitive(col); + } + + /* + * Validate a SQLException is thrown for an invalid column index + */ + @Test(dataProvider = "invalidColumnRanges", + expectedExceptions = SQLException.class) + public void test13(Integer col) throws Exception { + rsmd.isCurrency(col); + } + + /* + * Validate a SQLException is thrown for an invalid column index + */ + @Test(dataProvider = "invalidColumnRanges", + expectedExceptions = SQLException.class) + public void test14(Integer col) throws Exception { + rsmd.isDefinitelyWritable(col); + } + + /* + * Validate a SQLException is thrown for an invalid column index + */ + @Test(dataProvider = "invalidColumnRanges", + expectedExceptions = SQLException.class) + public void test15(Integer col) throws Exception { + rsmd.isNullable(col); + } + + /* + * Validate a SQLException is thrown for an invalid column index + */ + @Test(dataProvider = "invalidColumnRanges", + expectedExceptions = SQLException.class) + public void test16(Integer col) throws Exception { + rsmd.isReadOnly(col); + } + + /* + * Validate a SQLException is thrown for an invalid column index + */ + @Test(dataProvider = "invalidColumnRanges", + expectedExceptions = SQLException.class) + public void test17(Integer col) throws Exception { + rsmd.isSearchable(col); + } + + /* + * Validate a SQLException is thrown for an invalid column index + */ + @Test(dataProvider = "invalidColumnRanges", + expectedExceptions = SQLException.class) + public void test18(Integer col) throws Exception { + rsmd.isSigned(col); + } + + /* + * Validate a SQLException is thrown for an invalid column index + */ + @Test(dataProvider = "invalidColumnRanges", + expectedExceptions = SQLException.class) + public void test19(Integer col) throws Exception { + rsmd.isWritable(col); + } + + /* + * Validate a SQLException is thrown for an invalid column index + */ + @Test(dataProvider = "invalidColumnRanges", + expectedExceptions = SQLException.class) + public void test20(Integer col) throws Exception { + rsmd.setAutoIncrement(col, true); + } + + /* + * Validate a SQLException is thrown for an invalid column index + */ + @Test(dataProvider = "invalidColumnRanges", + expectedExceptions = SQLException.class) + public void test21(Integer col) throws Exception { + rsmd.setCaseSensitive(col, true); + } + + /* + * Validate a SQLException is thrown for an invalid column index + */ + @Test(dataProvider = "invalidColumnRanges", + expectedExceptions = SQLException.class) + public void test22(Integer col) throws Exception { + rsmd.setCatalogName(col, null); + } + + /* + * Validate a SQLException is thrown for an invalid column index + */ + @Test(dataProvider = "invalidColumnRanges", + expectedExceptions = SQLException.class) + public void test23(Integer col) throws Exception { + rsmd.setColumnDisplaySize(col, 5); + } + + /* + * Validate a SQLException is thrown for an invalid column index + */ + @Test(dataProvider = "invalidColumnRanges", + expectedExceptions = SQLException.class) + public void test24(Integer col) throws Exception { + rsmd.setColumnLabel(col, "label"); + } + + /* + * Validate a SQLException is thrown for an invalid column index + */ + @Test(dataProvider = "invalidColumnRanges", + expectedExceptions = SQLException.class) + public void test25(Integer col) throws Exception { + rsmd.setColumnName(col, "F1"); + } + + /* + * Validate a SQLException is thrown for an invalid column index + */ + @Test(dataProvider = "invalidColumnRanges", + expectedExceptions = SQLException.class) + public void test26(Integer col) throws Exception { + rsmd.setColumnType(col, Types.CHAR); + } + + /* + * Validate a SQLException is thrown for an invalid column index + */ + @Test(dataProvider = "invalidColumnRanges", + expectedExceptions = SQLException.class) + public void test27(Integer col) throws Exception { + rsmd.setColumnTypeName(col, "F1"); + } + + /* + * Validate a SQLException is thrown for an invalid column index + */ + @Test(dataProvider = "invalidColumnRanges", + expectedExceptions = SQLException.class) + public void test28(Integer col) throws Exception { + rsmd.setCurrency(col, true); + } + + /* + * Validate a SQLException is thrown for an invalid column index + */ + @Test(dataProvider = "invalidColumnRanges", + expectedExceptions = SQLException.class) + public void test29(Integer col) throws Exception { + rsmd.setNullable(col, ResultSetMetaData.columnNoNulls); + } + + /* + * Validate a SQLException is thrown for an invalid column index + */ + @Test(dataProvider = "invalidColumnRanges", + expectedExceptions = SQLException.class) + public void test30(Integer col) throws Exception { + rsmd.setPrecision(col, 2); + } + + /* + * Validate a SQLException is thrown for an invalid column index + */ + @Test(dataProvider = "invalidColumnRanges", + expectedExceptions = SQLException.class) + public void test31(Integer col) throws Exception { + rsmd.setScale(col, 2); + } + + /* + * Validate a SQLException is thrown for an invalid column index + */ + @Test(dataProvider = "invalidColumnRanges", + expectedExceptions = SQLException.class) + public void test32(Integer col) throws Exception { + rsmd.setSchemaName(col, "Gotham"); + } + + /* + * Validate a SQLException is thrown for an invalid column index + */ + @Test(dataProvider = "invalidColumnRanges", + expectedExceptions = SQLException.class) + public void test33(Integer col) throws Exception { + rsmd.setSearchable(col, false); + } + + /* + * Validate a SQLException is thrown for an invalid column index + */ + @Test(dataProvider = "invalidColumnRanges", + expectedExceptions = SQLException.class) + public void test34(Integer col) throws Exception { + rsmd.setSigned(col, false); + } + + /* + * Validate a SQLException is thrown for an invalid column index + */ + @Test(dataProvider = "invalidColumnRanges", + expectedExceptions = SQLException.class) + public void test35(Integer col) throws Exception { + rsmd.setTableName(col, "SUPERHEROS"); + } + + /* + * Validate that the correct class name is returned for the column + * Note: Once setColumnClassName is added to RowSetMetaData, this + * method will need to change. + */ + @Test(dataProvider = "columnClassNames") + public void test36(Integer type, String name) throws Exception { + rsmd.setColumnType(1, type); + assertTrue(rsmd.getColumnClassName(1).equals(name)); + } + + /* + * Validate that all of the methods are accessible and the correct value + * is returned for each column + */ + @Test(dataProvider = "columnRanges") + public void test37(Integer col) throws Exception { + rsmd.setAutoIncrement(col, true); + assertTrue(rsmd.isAutoIncrement(col)); + rsmd.setCaseSensitive(col, true); + assertTrue(rsmd.isCaseSensitive(col)); + rsmd.setCatalogName(col, "Gotham"); + assertTrue(rsmd.getCatalogName(col).equals("Gotham")); + rsmd.setColumnDisplaySize(col, 20); + assertTrue(rsmd.getColumnDisplaySize(col) == 20); + rsmd.setColumnLabel(col, "F1"); + assertTrue(rsmd.getColumnLabel(col).equals("F1")); + rsmd.setColumnName(col, "F1"); + assertTrue(rsmd.getColumnName(col).equals("F1")); + rsmd.setColumnType(col, Types.INTEGER); + assertTrue(rsmd.getColumnType(col) == Types.INTEGER); + assertTrue(rsmd.getColumnClassName(col).equals(Integer.class.getName())); + rsmd.setColumnTypeName(col, "INTEGER"); + assertTrue(rsmd.getColumnTypeName(col).equals("INTEGER")); + rsmd.setCurrency(col, true); + assertTrue(rsmd.isCurrency(col)); + rsmd.setNullable(col, ResultSetMetaData.columnNoNulls); + assertTrue(rsmd.isNullable(col) == ResultSetMetaData.columnNoNulls); + rsmd.setPrecision(col, 2); + assertTrue(rsmd.getPrecision(col) == 2); + rsmd.setScale(col, 2); + assertTrue(rsmd.getScale(col) == 2); + rsmd.setSchemaName(col, "GOTHAM"); + assertTrue(rsmd.getSchemaName(col).equals("GOTHAM")); + rsmd.setSearchable(col, false); + assertFalse(rsmd.isSearchable(col)); + rsmd.setSigned(col, false); + assertFalse(rsmd.isSigned(col)); + rsmd.setTableName(col, "SUPERHEROS"); + assertTrue(rsmd.getTableName(col).equals("SUPERHEROS")); + rsmd.isReadOnly(col); + rsmd.isDefinitelyWritable(col); + rsmd.isWritable(col); + + } + + /* + * Validate that the proper values are accepted by setNullable + */ + @Test(dataProvider = "validSetNullableValues") + public void test38(Integer val) throws Exception { + rsmd.setNullable(1, val); + } + + /* + * Validate that the correct type is returned for the column + */ + @Test(dataProvider = "jdbcTypes") + public void test39(Integer type) throws Exception { + rsmd.setColumnType(1, type); + assertTrue(type == rsmd.getColumnType(1)); + } + + /* + * Validate that the correct value is returned from the isXXX methods + */ + @Test(dataProvider = "trueFalse") + public void test40(Boolean b) throws Exception { + rsmd.setAutoIncrement(1, b); + rsmd.setCaseSensitive(1, b); + rsmd.setCurrency(1, b); + rsmd.setSearchable(1, b); + rsmd.setSigned(1, b); + assertTrue(rsmd.isAutoIncrement(1) == b); + assertTrue(rsmd.isCaseSensitive(1) == b); + assertTrue(rsmd.isCurrency(1) == b); + assertTrue(rsmd.isSearchable(1) == b); + assertTrue(rsmd.isSigned(1) == b); + } + + /* + * Validate isWrapperFor and unwrap work correctly + */ + @SuppressWarnings("unchecked") + @Test + public void test99() throws Exception { + RowSetMetaData rsmd1 = rsmd; + ResultSetMetaData rsmd2 = rsmd; + Class clzz = rsmd.getClass(); + assertTrue(rsmd1.isWrapperFor(clzz)); + assertTrue(rsmd2.isWrapperFor(clzz)); + RowSetMetaDataImpl rsmdi = (RowSetMetaDataImpl) rsmd2.unwrap(clzz); + + // False should be returned + assertFalse(rsmd1.isWrapperFor(this.getClass())); + assertFalse(rsmd2.isWrapperFor(this.getClass())); + } + + /* + * DataProvider used to provide Date which are not valid and are used + * to validate that an IllegalArgumentException will be thrown from the + * valueOf method + */ + @DataProvider(name = "validSetNullableValues") + private Object[][] validSetNullableValues() { + return new Object[][]{ + {ResultSetMetaData.columnNoNulls}, + {ResultSetMetaData.columnNullable}, + {ResultSetMetaData.columnNullableUnknown} + }; + } + + /* + * DataProvider used to provide column indexes that are out of range so that + * SQLException is thrown + */ + @DataProvider(name = "invalidColumnRanges") + private Object[][] invalidColumnRanges() { + return new Object[][]{ + {-1}, + {0}, + {MAX_COLUMNS + 1} + }; + } + + /* + * DataProvider used to provide the valid column ranges for the + * RowSetMetaDataImpl object + */ + @DataProvider(name = "columnRanges") + private Object[][] columnRanges() { + Object[][] o = new Object[MAX_COLUMNS][1]; + for (int i = 1; i <= MAX_COLUMNS; i++) { + o[i - 1][0] = i; + } + return o; + } + + /* + * DataProvider used to specify the value to set via setColumnType and + * the expected value to be returned from getColumnClassName + */ + @DataProvider(name = "columnClassNames") + private Object[][] columnClassNames() { + return new Object[][]{ + {Types.CHAR, "java.lang.String"}, + {Types.NCHAR, "java.lang.String"}, + {Types.VARCHAR, "java.lang.String"}, + {Types.NVARCHAR, "java.lang.String"}, + {Types.LONGVARCHAR, "java.lang.String"}, + {Types.LONGNVARCHAR, "java.lang.String"}, + {Types.NUMERIC, "java.math.BigDecimal"}, + {Types.DECIMAL, "java.math.BigDecimal"}, + {Types.BIT, "java.lang.Boolean"}, + {Types.TINYINT, "java.lang.Byte"}, + {Types.SMALLINT, "java.lang.Short"}, + {Types.INTEGER, "java.lang.Integer"}, + {Types.FLOAT, "java.lang.Double"}, + {Types.DOUBLE, "java.lang.Double"}, + {Types.BINARY, "byte[]"}, + {Types.VARBINARY, "byte[]"}, + {Types.LONGVARBINARY, "byte[]"}, + {Types.DATE, "java.sql.Date"}, + {Types.TIME, "java.sql.Time"}, + {Types.TIMESTAMP, "java.sql.Timestamp"}, + {Types.CLOB, "java.sql.Clob"}, + {Types.BLOB, "java.sql.Blob"} + + }; + + } + +} diff --git a/test/javax/sql/testng/test/rowset/RowSetProviderTests.java b/test/javax/sql/testng/test/rowset/RowSetProviderTests.java new file mode 100644 index 000000000..47a5cdb1e --- /dev/null +++ b/test/javax/sql/testng/test/rowset/RowSetProviderTests.java @@ -0,0 +1,189 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package test.rowset; + +import com.sun.rowset.RowSetFactoryImpl; +import java.io.File; +import java.net.URL; +import java.net.URLClassLoader; +import java.sql.SQLException; +import javax.sql.rowset.RowSetFactory; +import javax.sql.rowset.RowSetProvider; +import static org.testng.Assert.*; +import org.testng.annotations.AfterClass; +import org.testng.annotations.AfterMethod; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; +import util.BaseTest; +import util.StubRowSetFactory; + +public class RowSetProviderTests extends BaseTest { + + // Default RowSetFactory Implementation + private final String DEFFAULT_FACTORY_CLASSNAME = "com.sun.rowset.RowSetFactoryImpl"; + // Stub RowSetFactory Implementation + private final String STUB_FACTORY_CLASSNAME = "util.StubRowSetFactory"; + // Indicator that the factory implementation does not need to be checked + private final String NO_VALADATE_IMPL = ""; + // Original System property value for javax.sql.rowset.RowSetFactory + private static String origFactoryProperty; + // Original ClassLoader + private static ClassLoader cl; + // Path to the location of the jar files used by the ServiceLoader API + private static String jarPath; + + /* + * Save off the original property value for javax.sql.rowset.RowSetFactory, + * original classloader and define the path to the jars directory + */ + @BeforeClass + public static void setUpClass() throws Exception { + origFactoryProperty = System.getProperty("javax.sql.rowset.RowSetFactory"); + cl = Thread.currentThread().getContextClassLoader(); + jarPath = System.getProperty("test.src", ".") + File.separatorChar + + "jars" + File.separatorChar; + } + + /* + * Install the original javax.sql.rowset.RowSetFactory property value + */ + @AfterClass + public static void tearDownClass() throws Exception { + if (origFactoryProperty != null) { + System.setProperty("javax.sql.rowset.RowSetFactory", + origFactoryProperty); + } + } + + /* + * Clear the javax.sql.rowset.RowSetFactory property value and + * reset the classloader to its original value + */ + @AfterMethod + public void tearDownMethod() throws Exception { + System.clearProperty("javax.sql.rowset.RowSetFactory"); + Thread.currentThread().setContextClassLoader(cl); + } + + /* + * Validate that the correct RowSetFactory is returned by newFactory(). + */ + @Test(dataProvider = "RowSetFactoryValues") + public void test(RowSetFactory rsf, String impl) throws SQLException { + validateProvider(rsf, impl); + } + + /* + * Validate that the default RowSetFactory is returned by newFactory() + * when specified by the javax.sql.rowset.RowSetFactory property. + */ + @Test + public void test01() throws SQLException { + System.setProperty("javax.sql.rowset.RowSetFactory", + DEFFAULT_FACTORY_CLASSNAME); + validateProvider(RowSetProvider.newFactory(), DEFFAULT_FACTORY_CLASSNAME); + } + + /* + * Validate that the correct RowSetFactory is returned by newFactory() + * when specified by the javax.sql.rowset.RowSetFactory property. + */ + @Test(enabled = true) + public void test02() throws SQLException { + System.setProperty("javax.sql.rowset.RowSetFactory", STUB_FACTORY_CLASSNAME); + validateProvider(RowSetProvider.newFactory(), STUB_FACTORY_CLASSNAME); + } + + /* + * Validate that a SQLException is thrown by newFactory() + * when specified RowSetFactory specified by the + * javax.sql.rowset.RowSetFactory property is not valid. + */ + @Test(expectedExceptions = SQLException.class) + public void test03() throws SQLException { + System.setProperty("javax.sql.rowset.RowSetFactory", + "invalid.RowSetFactoryImpl"); + RowSetFactory rsf = RowSetProvider.newFactory(); + } + + /* + * Validate that the correct RowSetFactory is returned by newFactory() + * when specified by the ServiceLoader API. + */ + @Test + public void test04() throws Exception { + File f = new File(jarPath + "goodFactory"); + URLClassLoader loader = new URLClassLoader(new URL[]{ + new URL(f.toURI().toString())}, getClass().getClassLoader()); + Thread.currentThread().setContextClassLoader(loader); + validateProvider(RowSetProvider.newFactory(), STUB_FACTORY_CLASSNAME); + } + + /* + * Validate that a SQLException is thrown by newFactory() if the default + * RowSetFactory specified by the ServiceLoader API is not valid + */ + @Test(expectedExceptions = SQLException.class) + public void test05() throws Exception { + File f = new File(jarPath + "badFactory"); + URLClassLoader loader = new URLClassLoader(new URL[]{ + new URL(f.toURI().toString())}, getClass().getClassLoader()); + Thread.currentThread().setContextClassLoader(loader); + RowSetProvider.newFactory(); + } + + /* + * Utility Method to validate that the RowsetFactory returned from + * RowSetProvider.newFactory() is correct + */ + private void validateProvider(RowSetFactory rsf, String implName) { + assertNotNull(rsf, "RowSetFactory should not be null"); + switch (implName) { + case DEFFAULT_FACTORY_CLASSNAME: + assertTrue(rsf instanceof RowSetFactoryImpl); + break; + case STUB_FACTORY_CLASSNAME: + assertTrue(rsf instanceof StubRowSetFactory); + break; + default: + } + } + + /* + * DataProvider used to provide a RowSetFactory and the expected + * RowSetFactory implementation that should be returned + */ + @DataProvider(name = "RowSetFactoryValues") + private Object[][] RowSetFactoryValues() throws SQLException { + RowSetFactory rsf = RowSetProvider.newFactory(); + RowSetFactory rsf1 = RowSetProvider.newFactory(STUB_FACTORY_CLASSNAME, null); + RowSetFactory rsf2 = RowSetProvider.newFactory(DEFFAULT_FACTORY_CLASSNAME, null); + return new Object[][]{ + {rsf, NO_VALADATE_IMPL}, + {rsf, DEFFAULT_FACTORY_CLASSNAME}, + {rsf1, STUB_FACTORY_CLASSNAME}, + {rsf2, DEFFAULT_FACTORY_CLASSNAME} + }; + } +} diff --git a/test/javax/sql/testng/test/rowset/RowSetWarningTests.java b/test/javax/sql/testng/test/rowset/RowSetWarningTests.java new file mode 100644 index 000000000..41b52c4ef --- /dev/null +++ b/test/javax/sql/testng/test/rowset/RowSetWarningTests.java @@ -0,0 +1,238 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package test.rowset; + +import java.sql.SQLException; +import javax.sql.rowset.RowSetWarning; +import static org.testng.Assert.*; +import org.testng.annotations.Test; +import util.BaseTest; + +public class RowSetWarningTests extends BaseTest { + + private final String[] warnings = {"Warning 1", "cause 1", "Warning 2", + "Warning 3", "cause 2"}; + + /* + * Create RowSetWarning and setting all objects to null + */ + @Test + public void test() { + RowSetWarning e = new RowSetWarning(null, null, errorCode); + assertTrue(e.getMessage() == null && e.getSQLState() == null + && e.getCause() == null && e.getErrorCode() == errorCode); + } + + /* + * Create RowSetWarning with no-arg constructor + */ + @Test + public void test01() { + RowSetWarning ex = new RowSetWarning(); + assertTrue(ex.getMessage() == null + && ex.getSQLState() == null + && ex.getCause() == null + && ex.getErrorCode() == 0); + } + + /* + * Create RowSetWarning with message + */ + @Test + public void test02() { + RowSetWarning ex = new RowSetWarning(reason); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState() == null + && ex.getCause() == null + && ex.getErrorCode() == 0); + } + + /* + * Create RowSetWarning with message, and SQLState + */ + @Test + public void test03() { + + RowSetWarning ex = new RowSetWarning(reason, state); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState().equals(state) + && ex.getCause() == null + && ex.getErrorCode() == 0); + } + + /* + * Create RowSetWarning with message, SQLState, and error code + */ + @Test + public void test04() { + RowSetWarning ex = new RowSetWarning(reason, state, errorCode); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState().equals(state) + && ex.getCause() == null + && ex.getErrorCode() == errorCode); + } + + /* + * Serialize a RowSetWarning and make sure you can read it back properly + */ + @Test + public void test05() throws Exception { + RowSetWarning e = new RowSetWarning(reason, state, errorCode); + e.initCause(t); + RowSetWarning ex1 = createSerializedException(e); + assertTrue(reason.equals(ex1.getMessage()) + && ex1.getSQLState().equals(state) + && cause.equals(ex1.getCause().toString()) + && ex1.getErrorCode() == errorCode); + } + + /* + * Validate that the ordering of the returned Exceptions is correct using + * for-each loop + */ + @Test + public void test06() { + RowSetWarning ex = new RowSetWarning("Exception 1"); + ex.initCause(t1); + RowSetWarning ex1 = new RowSetWarning("Exception 2"); + RowSetWarning ex2 = new RowSetWarning("Exception 3"); + ex2.initCause(t2); + ex.setNextException(ex1); + ex.setNextException(ex2); + int num = 0; + for (Throwable e : ex) { + assertTrue(msgs[num++].equals(e.getMessage())); + } + } + + /* + * Validate that the ordering of the returned Exceptions is correct using + * traditional while loop + */ + @Test + public void test07() { + RowSetWarning ex = new RowSetWarning("Exception 1"); + ex.initCause(t1); + RowSetWarning ex1 = new RowSetWarning("Exception 2"); + RowSetWarning ex2 = new RowSetWarning("Exception 3"); + ex2.initCause(t2); + ex.setNextException(ex1); + ex.setNextException(ex2); + int num = 0; + SQLException sqe = ex; + while (sqe != null) { + assertTrue(msgs[num++].equals(sqe.getMessage())); + Throwable c = sqe.getCause(); + while (c != null) { + assertTrue(msgs[num++].equals(c.getMessage())); + c = c.getCause(); + } + sqe = sqe.getNextException(); + } + } + + /* + * Validate that the ordering of the returned RowSetWarning is correct using + * for-each loop + */ + @Test + public void test08() { + RowSetWarning ex = new RowSetWarning("Warning 1"); + ex.initCause(t1); + RowSetWarning ex1 = new RowSetWarning("Warning 2"); + RowSetWarning ex2 = new RowSetWarning("Warning 3"); + ex2.initCause(t2); + ex.setNextWarning(ex1); + ex.setNextWarning(ex2); + int num = 0; + for (Throwable e : ex) { + assertTrue(warnings[num++].equals(e.getMessage())); + } + } + + /** + * Validate that the ordering of the returned RowSetWarning is correct using + * traditional while loop + */ + @Test + public void test09() { + RowSetWarning ex = new RowSetWarning("Warning 1"); + ex.initCause(t1); + RowSetWarning ex1 = new RowSetWarning("Warning 2"); + RowSetWarning ex2 = new RowSetWarning("Warning 3"); + ex2.initCause(t2); + ex.setNextWarning(ex1); + ex.setNextWarning(ex2); + int num = 0; + RowSetWarning sqe = ex; + while (sqe != null) { + assertTrue(warnings[num++].equals(sqe.getMessage())); + Throwable c = sqe.getCause(); + while (c != null) { + assertTrue(msgs[num++].equals(c.getMessage())); + c = c.getCause(); + } + sqe = sqe.getNextWarning(); + } + } + + /* + * Serialize a RowSetWarning and make sure you can read it back properly + */ + @Test + public void test10() throws Exception { + RowSetWarning e = new RowSetWarning(reason, state, errorCode); + RowSetWarning ex1 = createSerializedException(e); + assertTrue(reason.equals(ex1.getMessage()) + && ex1.getSQLState().equals(state) + && ex1.getCause() == null + && ex1.getErrorCode() == errorCode); + } + + /* + * Serialize a RowSetWarning and make sure you can read it back properly. + * Validate that the ordering of the returned RowSetWarning is correct using + * traditional while loop + */ + @Test + public void test11() throws Exception { + RowSetWarning ex = new RowSetWarning("Warning 1"); + ex.initCause(t1); + RowSetWarning ex1 = new RowSetWarning("Warning 2"); + RowSetWarning ex2 = new RowSetWarning("Warning 3"); + ex2.initCause(t2); + ex.setNextWarning(ex1); + ex.setNextWarning(ex2); + int num = 0; + RowSetWarning sqe = createSerializedException(ex); + while (sqe != null) { + assertTrue(warnings[num++].equals(sqe.getMessage())); + Throwable c = sqe.getCause(); + while (c != null) { + assertTrue(msgs[num++].equals(c.getMessage())); + c = c.getCause(); + } + sqe = sqe.getNextWarning(); + } + } +} diff --git a/test/javax/sql/testng/test/rowset/cachedrowset/CachedRowSetTests.java b/test/javax/sql/testng/test/rowset/cachedrowset/CachedRowSetTests.java new file mode 100644 index 000000000..1155a8891 --- /dev/null +++ b/test/javax/sql/testng/test/rowset/cachedrowset/CachedRowSetTests.java @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package test.rowset.cachedrowset; + +import java.sql.SQLException; +import javax.sql.rowset.CachedRowSet; + +public class CachedRowSetTests extends CommonCachedRowSetTests { + + @Override + protected CachedRowSet newInstance() throws SQLException { + return rsf.createCachedRowSet(); + } + +} diff --git a/test/javax/sql/testng/test/rowset/cachedrowset/CommonCachedRowSetTests.java b/test/javax/sql/testng/test/rowset/cachedrowset/CommonCachedRowSetTests.java new file mode 100644 index 000000000..7b04443e2 --- /dev/null +++ b/test/javax/sql/testng/test/rowset/cachedrowset/CommonCachedRowSetTests.java @@ -0,0 +1,1612 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package test.rowset.cachedrowset; + +import java.math.BigDecimal; +import java.sql.Array; +import java.sql.Date; +import java.sql.JDBCType; +import java.sql.Ref; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.sql.SQLException; +import java.sql.Time; +import java.sql.Timestamp; +import java.sql.Types; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.util.Collection; +import javax.sql.RowSet; +import javax.sql.rowset.CachedRowSet; +import javax.sql.rowset.RowSetMetaDataImpl; +import javax.sql.rowset.serial.SerialRef; +import javax.sql.rowset.spi.SyncFactory; +import javax.sql.rowset.spi.SyncProvider; +import javax.sql.rowset.spi.SyncProviderException; +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertFalse; +import static org.testng.Assert.assertNull; +import static org.testng.Assert.assertTrue; +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; +import test.rowset.CommonRowSetTests; +import util.StubArray; +import util.StubRef; +import util.StubSyncProvider; +import util.TestRowSetListener; + +public abstract class CommonCachedRowSetTests extends CommonRowSetTests { + + /* + * DATATYPES Table column names + */ + private final String[] DATATYPES_COLUMN_NAMES = {"AINTEGER", "ACHAR", + "AVARCHAR", "ALONG", "ABOOLEAN", "ASHORT", "ADOUBLE", "ABIGDECIMAL", + "AREAL", "ABYTE", "ADATE", "ATIME", "ATIMESTAMP", "ABYTES", "ARRAY", + "AREF", "AFLOAT"}; + + /* + * Initializes a RowSet containing the DATAYPES data + */ + protected T createDataTypesRowSet() throws SQLException { + T rs = (T) newInstance(); + initDataTypesMetaData((CachedRowSet) rs); + createDataTypesRows(rs); + // Make sure you are not on the insertRow + rs.moveToCurrentRow(); + return rs; + } + + //DataProviders to use for common tests + + /* + * DataProvider that uses a RowSet with the COFFEE_HOUSES Table + */ + @DataProvider(name = "rowsetUsingCoffeeHouses") + protected Object[][] rowsetUsingCoffeeHouses() throws Exception { + RowSet rs = createCoffeeHousesRowSet(); + return new Object[][]{ + {rs} + }; + } + + /* + * DataProvider that uses a RowSet with the COFFEES Table + */ + @DataProvider(name = "rowsetUsingCoffees") + protected Object[][] rowsetUsingCoffees() throws Exception { + RowSet rs = createCoffeesRowSet(); + return new Object[][]{ + {rs} + }; + } + + /* + * DataProvider that uses a RowSet with the DATAYPES Table and + * used to validate the various supported data types + */ + @DataProvider(name = "rowsetUsingDataTypes") + protected Object[][] rowsetUsingDataTypes() throws Exception { + + CachedRowSet rs = createDataTypesRowSet(); + return new Object[][]{ + {rs, JDBCType.INTEGER}, + {rs, JDBCType.CHAR}, + {rs, JDBCType.VARCHAR}, + {rs, JDBCType.BIGINT}, + {rs, JDBCType.BOOLEAN}, + {rs, JDBCType.SMALLINT}, + {rs, JDBCType.DOUBLE}, + {rs, JDBCType.DECIMAL}, + {rs, JDBCType.REAL}, + {rs, JDBCType.TINYINT}, + {rs, JDBCType.DATE}, + {rs, JDBCType.TIME}, + {rs, JDBCType.TIMESTAMP}, + {rs, JDBCType.VARBINARY}, + {rs, JDBCType.ARRAY}, + {rs, JDBCType.REF}, + {rs, JDBCType.FLOAT} + }; + } + + /* + * Initializes the DATAYPES table metadata + */ + protected void initDataTypesMetaData(CachedRowSet crs) throws SQLException { + RowSetMetaDataImpl rsmd = new RowSetMetaDataImpl(); + crs.setType(RowSet.TYPE_SCROLL_INSENSITIVE); + + rsmd.setColumnCount(DATATYPES_COLUMN_NAMES.length); + + for (int i = 1; i <= DATATYPES_COLUMN_NAMES.length; i++) { + rsmd.setColumnName(i, DATATYPES_COLUMN_NAMES[i - 1]); + rsmd.setColumnLabel(i, rsmd.getColumnName(i)); + } + + rsmd.setColumnType(1, Types.INTEGER); + rsmd.setColumnType(2, Types.CHAR); + rsmd.setColumnType(3, Types.VARCHAR); + rsmd.setColumnType(4, Types.BIGINT); + rsmd.setColumnType(5, Types.BOOLEAN); + rsmd.setColumnType(6, Types.SMALLINT); + rsmd.setColumnType(7, Types.DOUBLE); + rsmd.setColumnType(8, Types.DECIMAL); + rsmd.setColumnType(9, Types.REAL); + rsmd.setColumnType(10, Types.TINYINT); + rsmd.setColumnType(11, Types.DATE); + rsmd.setColumnType(12, Types.TIME); + rsmd.setColumnType(13, Types.TIMESTAMP); + rsmd.setColumnType(14, Types.VARBINARY); + rsmd.setColumnType(15, Types.ARRAY); + rsmd.setColumnType(16, Types.REF); + rsmd.setColumnType(17, Types.FLOAT); + crs.setMetaData(rsmd); + + } + + /* + * Add rows to DATAYPES table + */ + protected void createDataTypesRows(RowSet crs) throws SQLException { + + Integer aInteger = 100; + String aChar = "Oswald Cobblepot"; + Long aLong = Long.MAX_VALUE; + Short aShort = Short.MAX_VALUE; + Double aDouble = Double.MAX_VALUE; + BigDecimal aBigDecimal = BigDecimal.ONE; + Boolean aBoolean = false; + Float aFloat = Float.MAX_VALUE; + Byte aByte = Byte.MAX_VALUE; + Date aDate = Date.valueOf(LocalDate.now()); + Time aTime = Time.valueOf(LocalTime.now()); + Timestamp aTimeStamp = Timestamp.valueOf(LocalDateTime.now()); + Array aArray = new StubArray("INTEGER", new Object[1]); + Ref aRef = new SerialRef(new StubRef("INTEGER", query)); + byte[] bytes = new byte[10]; + crs.moveToInsertRow(); + crs.updateInt(1, aInteger); + crs.updateString(2, aChar); + crs.updateString(3, aChar); + crs.updateLong(4, aLong); + crs.updateBoolean(5, aBoolean); + crs.updateShort(6, aShort); + crs.updateDouble(7, aDouble); + crs.updateBigDecimal(8, aBigDecimal); + crs.updateFloat(9, aFloat); + crs.updateByte(10, aByte); + crs.updateDate(11, aDate); + crs.updateTime(12, aTime); + crs.updateTimestamp(13, aTimeStamp); + crs.updateBytes(14, bytes); + crs.updateArray(15, aArray); + crs.updateRef(16, aRef); + crs.updateDouble(17, aDouble); + crs.insertRow(); + crs.moveToCurrentRow(); + + } + + /* + * Dermine if a Row exists in a ResultSet by its primary key + * If the parameter deleteRow is true, delete the row and validate + * the RowSet indicates it is deleted + */ + protected boolean findRowByPrimaryKey(RowSet rs, int id, int idPos, + boolean deleteRow) throws Exception { + boolean foundRow = false; + rs.beforeFirst(); + while (rs.next()) { + if (rs.getInt(idPos) == id) { + foundRow = true; + if (deleteRow) { + rs.deleteRow(); + // validate row is marked as deleted + assertTrue(rs.rowDeleted()); + } + break; + } + } + return foundRow; + } + + /* + * Wrapper method to find if a row exists within a RowSet by its primary key + */ + protected boolean findRowByPrimaryKey(RowSet rs, int id, int idPos) throws Exception { + return findRowByPrimaryKey(rs, id, idPos, false); + } + + /* + * Wrapper method to find if a row exists within a RowSet by its primary key + * and delete it + */ + protected boolean deleteRowByPrimaryKey(RowSet rs, int id, int idPos) throws Exception { + return findRowByPrimaryKey(rs, id, idPos, true); + } + + /* + * Utility method that compares two ResultSetMetaDataImpls for containing + * the same values + */ + private void compareMetaData(ResultSetMetaData rsmd, + ResultSetMetaData rsmd1) throws SQLException { + + assertEquals(rsmd1.getColumnCount(), rsmd.getColumnCount()); + int cols = rsmd.getColumnCount(); + for (int i = 1; i <= cols; i++) { + assertTrue(rsmd1.getCatalogName(i).equals(rsmd.getCatalogName(i))); + assertTrue(rsmd1.getColumnClassName(i).equals(rsmd.getColumnClassName(i))); + assertTrue(rsmd1.getColumnDisplaySize(i) == rsmd.getColumnDisplaySize(i)); + assertTrue(rsmd1.getColumnLabel(i).equals(rsmd.getColumnLabel(i))); + assertTrue(rsmd1.getColumnName(i).equals(rsmd.getColumnName(i))); + assertTrue(rsmd1.getColumnType(i) == rsmd.getColumnType(i)); + assertTrue(rsmd1.getPrecision(i) == rsmd.getPrecision(i)); + assertTrue(rsmd1.getScale(i) == rsmd.getScale(i)); + assertTrue(rsmd1.getSchemaName(i).equals(rsmd.getSchemaName(i))); + assertTrue(rsmd1.getTableName(i).equals(rsmd.getTableName(i))); + assertTrue(rsmd1.isAutoIncrement(i) == rsmd.isAutoIncrement(i)); + assertTrue(rsmd1.isCaseSensitive(i) == rsmd.isCaseSensitive(i)); + assertTrue(rsmd1.isCurrency(i) == rsmd.isCurrency(i)); + assertTrue(rsmd1.isDefinitelyWritable(i) == rsmd.isDefinitelyWritable(i)); + assertTrue(rsmd1.isNullable(i) == rsmd.isNullable(i)); + assertTrue(rsmd1.isReadOnly(i) == rsmd.isReadOnly(i)); + assertTrue(rsmd1.isSearchable(i) == rsmd.isSearchable(i)); + assertTrue(rsmd1.isSigned(i) == rsmd.isSigned(i)); + assertTrue(rsmd1.isWritable(i) == rsmd.isWritable(i)); + + } + } + + /* + * Utility method to compare two rowsets + */ + private void compareRowSets(CachedRowSet crs, CachedRowSet crs1) throws Exception { + + int rows = crs.size(); + assertTrue(rows == crs1.size()); + + ResultSetMetaData rsmd = crs.getMetaData(); + + compareMetaData(rsmd, crs1.getMetaData()); + int cols = rsmd.getColumnCount(); + + for (int row = 1; row <= rows; row++) { + crs.absolute((row)); + crs1.absolute(row); + for (int col = 1; col <= cols; col++) { + compareColumnValue(JDBCType.valueOf(rsmd.getColumnType(col)), + crs, crs1, col); + } + } + + } + + /* + * Utility method to compare two columns + */ + private void compareColumnValue(JDBCType type, ResultSet rs, ResultSet rs1, + int col) throws SQLException { + + switch (type) { + case INTEGER: + assertTrue(rs.getInt(col) == rs1.getInt(col)); + break; + case CHAR: + case VARCHAR: + assertTrue(rs.getString(col).equals(rs1.getString(col))); + break; + case BIGINT: + assertTrue(rs.getLong(col) == rs1.getLong(col)); + break; + case BOOLEAN: + assertTrue(rs.getBoolean(col) == rs1.getBoolean(col)); + break; + case SMALLINT: + assertTrue(rs.getShort(col) == rs1.getShort(col)); + break; + case DOUBLE: + case FLOAT: + assertTrue(rs.getDouble(col) == rs1.getDouble(col)); + break; + case DECIMAL: + assertTrue(rs.getBigDecimal(col).equals(rs1.getBigDecimal(col))); + break; + case REAL: + assertTrue(rs.getFloat(col) == rs1.getFloat(col)); + break; + case TINYINT: + assertTrue(rs.getByte(col) == rs1.getByte(col)); + break; + case DATE: + assertTrue(rs.getDate(col).equals(rs1.getDate(col))); + break; + case TIME: + assertTrue(rs.getTime(col).equals(rs1.getTime(col))); + break; + case TIMESTAMP: + assertTrue(rs.getTimestamp(col).equals(rs1.getTimestamp(col))); + break; + } + } + + /* + * Validate SyncProviderException is thrown when acceptChanges is called + * but there is not a way to make a connection to the datasource + */ + @Test(dataProvider = "rowSetType", expectedExceptions = SyncProviderException.class) + public void commonCachedRowSetTest0000(CachedRowSet rs) throws Exception { + rs.acceptChanges(); + rs.close(); + } + + /* + * Validate SyncProviderException is thrown when acceptChanges is called + * when null is passed as the datasource + */ + @Test(dataProvider = "rowSetType", expectedExceptions = SyncProviderException.class) + public void commonCachedRowSetTest0001(CachedRowSet rs) throws Exception { + rs.acceptChanges(null); + rs.close(); + } + + /* + * Validate that that RIOPtimsticProvider is the default SyncProvider + */ + @Test(dataProvider = "rowSetType") + public void commonCachedRowSetTest0002(CachedRowSet rs) throws SQLException { + SyncProvider sp = rs.getSyncProvider(); + assertTrue(sp instanceof com.sun.rowset.providers.RIOptimisticProvider); + rs.close(); + } + + /* + * Validate that you can specify a SyncProvider + */ + @Test(dataProvider = "rowSetType") + public void commonCachedRowSetTest0003(CachedRowSet rs) throws SQLException { + + // Register a provider and make sure it is avaiable + SyncFactory.registerProvider(stubProvider); + rs.setSyncProvider(stubProvider); + SyncProvider sp = rs.getSyncProvider(); + assertTrue(sp instanceof StubSyncProvider); + SyncFactory.unregisterProvider(stubProvider); + rs.close(); + } + + /* + * Create a RowSetListener and validate that notifyRowSetChanged is called + */ + @Test(dataProvider = "rowSetType") + public void commonCachedRowSetTest0004(CachedRowSet rs) throws Exception { + TestRowSetListener rsl = new TestRowSetListener(); + rs.addRowSetListener(rsl); + rs.release(); + assertTrue(rsl.isNotified(TestRowSetListener.ROWSET_CHANGED)); + rs.close(); + } + + /* + * Create a RowSetListener and validate that notifyRowSetChanged is called + */ + @Test(dataProvider = "rowSetType") + public void commonCachedRowSetTest0005(CachedRowSet rs) throws Exception { + TestRowSetListener rsl = new TestRowSetListener(); + rs.addRowSetListener(rsl); + rs.restoreOriginal(); + assertTrue(rsl.isNotified(TestRowSetListener.ROWSET_CHANGED)); + rs.close(); + } + + /* + * Create a RowSetListener and validate that notifyRowChanged is called + */ + @Test(dataProvider = "rowsetUsingCoffeeHouses") + public void commonCachedRowSetTest0006(RowSet rs) throws Exception { + TestRowSetListener rsl = new TestRowSetListener(); + rs.addRowSetListener(rsl); + rs.moveToInsertRow(); + rs.updateInt(1, 10024); + rs.updateString(2, "Sacramento"); + rs.updateInt(3, 1987); + rs.updateInt(4, 2341); + rs.updateInt(5, 4328); + rs.insertRow(); + assertTrue(rsl.isNotified(TestRowSetListener.ROW_CHANGED)); + rs.close(); + } + + /* + * Create a multiple RowSetListeners and validate that notifyRowChanged, + * notifiyMoved is called on all listners + */ + @Test(dataProvider = "rowsetUsingCoffeeHouses") + public void commonCachedRowSetTest0007(RowSet rs) throws Exception { + TestRowSetListener rsl = new TestRowSetListener(); + TestRowSetListener rsl2 = new TestRowSetListener(); + rs.addRowSetListener(rsl); + rs.addRowSetListener(rsl2); + rs.first(); + rs.updateInt(1, 1961); + rs.updateString(2, "Pittsburgh"); + rs.updateInt(3, 1987); + rs.updateInt(4, 2341); + rs.updateInt(5, 6689); + rs.updateRow(); + assertTrue(rsl.isNotified(TestRowSetListener.CURSOR_MOVED + | TestRowSetListener.ROW_CHANGED)); + assertTrue(rsl2.isNotified(TestRowSetListener.CURSOR_MOVED + | TestRowSetListener.ROW_CHANGED)); + rs.close(); + } + + /* + * Create a RowSetListener and validate that notifyRowChanged and + * notifyCursorMoved are called + */ + @Test(dataProvider = "rowsetUsingCoffeeHouses") + public void commonCachedRowSetTest0008(CachedRowSet rs) throws Exception { + TestRowSetListener rsl = new TestRowSetListener(); + rs.addRowSetListener(rsl); + + rs.first(); + assertTrue(rsl.isNotified(TestRowSetListener.CURSOR_MOVED)); + rs.deleteRow(); + assertTrue( + rsl.isNotified(TestRowSetListener.ROW_CHANGED | TestRowSetListener.CURSOR_MOVED)); + rsl.resetFlag(); + rs.setShowDeleted(true); + rs.undoDelete(); + assertTrue(rsl.isNotified(TestRowSetListener.ROW_CHANGED)); + rs.close(); + } + + /* + * Create a RowSetListener and validate that notifyCursorMoved is called + */ + @Test(dataProvider = "rowSetType") + public void commonCachedRowSetTest0009(RowSet rs) throws Exception { + TestRowSetListener rsl = new TestRowSetListener(); + rs.addRowSetListener(rsl); + rs.beforeFirst(); + assertTrue(rsl.isNotified(TestRowSetListener.CURSOR_MOVED)); + rs.close(); + } + + /* + * Validate that getTableName() returns the proper values + */ + @Test(dataProvider = "rowSetType") + public void commonCachedRowSetTest0010(CachedRowSet rs) throws Exception { + assertNull(rs.getTableName()); + rs.setTableName(COFFEE_HOUSES_TABLE); + assertTrue(rs.getTableName().equals(COFFEE_HOUSES_TABLE)); + rs.close(); + } + + /* + * Validate that getKeyColumns() returns the proper values + */ + @Test(dataProvider = "rowSetType") + public void commonCachedRowSetTest0011(CachedRowSet rs) throws Exception { + int[] pkeys = {1, 3}; + assertNull(rs.getKeyColumns()); + rs.setKeyColumns(pkeys); + assertEquals(rs.getKeyColumns(), pkeys); + rs.close(); + } + + /* + * Validate that setMatchColumn throws a SQLException if the column + * index specified is out of range + */ + @Test(dataProvider = "rowsetUsingCoffeeHouses", + expectedExceptions = SQLException.class) + public void commonCachedRowSetTest0012(CachedRowSet rs) throws Exception { + rs.setMatchColumn(-1); + rs.close(); + } + + /* + * Validate that setMatchColumn throws a SQLException if the column + * index specified is out of range + */ + @Test(dataProvider = "rowsetUsingCoffeeHouses", + expectedExceptions = SQLException.class) + public void commonCachedRowSetTest0013(CachedRowSet rs) throws Exception { + int[] cols = {1, -1}; + rs.setMatchColumn(cols); + rs.close(); + } + + /* + * Validate that setMatchColumn throws a SQLException if the column + * index specified is out of range + */ + @Test(dataProvider = "rowsetUsingCoffeeHouses", + expectedExceptions = SQLException.class) + public void commonCachedRowSetTest0014(CachedRowSet rs) throws Exception { + rs.setMatchColumn((String) null); + rs.close(); + } + + /* + * Validate that setMatchColumn throws a SQLException if the column + * index specified is out of range + */ + @Test(dataProvider = "rowsetUsingCoffeeHouses", + expectedExceptions = SQLException.class) + public void commonCachedRowSetTest0015(CachedRowSet rs) throws Exception { + String[] cols = {"ID", null}; + rs.setMatchColumn(cols); + } + + /* + * Validate that getMatchColumn returns the same value specified by + * setMatchColumn + */ + @Test(dataProvider = "rowsetUsingCoffeeHouses", enabled = false) + public void commonCachedRowSetTest0016(CachedRowSet rs) throws Exception { + int[] expectedCols = {1}; + String[] expectedColNames = {"ID"}; + rs.setMatchColumn(1); + int[] actualCols = rs.getMatchColumnIndexes(); + String[] actualColNames = rs.getMatchColumnNames(); + for (int i = 0; i < actualCols.length; i++) { + System.out.println(actualCols[i]); + } + assertEquals(actualCols, expectedCols); + assertEquals(actualColNames, expectedColNames); + rs.close(); + } + + /* + * Validate that getMatchColumn returns the same value specified by + * setMatchColumn + */ + @Test(dataProvider = "rowsetUsingCoffeeHouses", enabled = false) + public void commonCachedRowSetTest0017(CachedRowSet rs) throws Exception { + int[] expectedCols = {1}; + String[] expectedColNames = {"ID"}; + rs.setMatchColumn(expectedColNames[0]); + int[] actualCols = rs.getMatchColumnIndexes(); + String[] actualColNames = rs.getMatchColumnNames(); + assertEquals(actualCols, expectedCols); + assertEquals(actualColNames, expectedColNames); + rs.close(); + } + + /* + * Validate that getMatchColumn returns the same valid value specified by + * setMatchColumn + */ + @Test(dataProvider = "rowsetUsingCoffeeHouses", enabled = false) + public void commonCachedRowSetTest0018(CachedRowSet rs) throws Exception { + int[] expectedCols = {1, 3}; + String[] expectedColNames = {"COF_ID", "SUP_ID"}; + rs.setMatchColumn(expectedCols); + int[] actualCols = rs.getMatchColumnIndexes(); + String[] actualColNames = rs.getMatchColumnNames(); + assertEquals(actualCols, expectedCols); + assertEquals(actualColNames, expectedColNames); + assertEquals(actualCols, expectedCols); + rs.close(); + } + + /* + * Validate that getMatchColumn returns the same valid value specified by + * setMatchColumn + */ + @Test(dataProvider = "rowsetUsingCoffeeHouses", enabled = false) + public void commonCachedRowSetTest0019(CachedRowSet rs) throws Exception { + int[] expectedCols = {1, 3}; + String[] expectedColNames = {"COF_ID", "SUP_ID"}; + rs.setMatchColumn(expectedColNames); + int[] actualCols = rs.getMatchColumnIndexes(); + String[] actualColNames = rs.getMatchColumnNames(); + assertEquals(actualCols, expectedCols); + assertEquals(actualColNames, expectedColNames); + rs.close(); + } + + /* + * Validate that getMatchColumnIndexes throws a SQLException if + * unsetMatchColumn has been called + */ + @Test(dataProvider = "rowsetUsingCoffeeHouses", + expectedExceptions = SQLException.class) + public void commonCachedRowSetTest0020(CachedRowSet rs) throws Exception { + rs.setMatchColumn(1); + int[] actualCols = rs.getMatchColumnIndexes(); + assertTrue(actualCols != null); + rs.unsetMatchColumn(1); + actualCols = rs.getMatchColumnIndexes(); + rs.close(); + } + + /* + * Validate that getMatchColumnNames throws a SQLException if + * unsetMatchColumn has been called + */ + @Test(dataProvider = "rowsetUsingCoffeeHouses", + expectedExceptions = SQLException.class) + public void commonCachedRowSetTest0021(CachedRowSet rs) throws Exception { + String matchColumn = "ID"; + rs.setMatchColumn(matchColumn); + String[] actualColNames = rs.getMatchColumnNames(); + assertTrue(actualColNames != null); + rs.unsetMatchColumn(matchColumn); + actualColNames = rs.getMatchColumnNames(); + rs.close(); + } + + /* + * Validate that getMatchColumnIndexes throws a SQLException if + * unsetMatchColumn has been called + */ + @Test(dataProvider = "rowsetUsingCoffeeHouses", + expectedExceptions = SQLException.class) + public void commonCachedRowSetTest0022(CachedRowSet rs) throws Exception { + int[] expectedCols = {1, 3}; + rs.setMatchColumn(expectedCols); + int[] actualCols = rs.getMatchColumnIndexes(); + assertTrue(actualCols != null); + rs.unsetMatchColumn(expectedCols); + actualCols = rs.getMatchColumnIndexes(); + rs.close(); + } + + /* + * Validate that getMatchColumnNames throws a SQLException if + * unsetMatchColumn has been called + */ + @Test(dataProvider = "rowsetUsingCoffeeHouses", + expectedExceptions = SQLException.class) + public void commonCachedRowSetTest0023(CachedRowSet rs) throws Exception { + String[] expectedColNames = {"COF_ID", "SUP_ID"}; + rs.setMatchColumn(expectedColNames); + String[] actualColNames = rs.getMatchColumnNames(); + assertTrue(actualColNames != null); + rs.unsetMatchColumn(expectedColNames); + actualColNames = rs.getMatchColumnNames(); + rs.close(); + } + + /* + * Validate size() returns the correct number of rows + */ + @Test(dataProvider = "rowsetUsingCoffeeHouses") + public void commonCachedRowSetTest0024(CachedRowSet rs) throws Exception { + assertTrue(rs.size() == COFFEE_HOUSES_ROWS); + rs.close(); + } + + /* + * Validate that the correct rows are returned comparing the primary + * keys + */ + @Test(dataProvider = "rowsetUsingCoffeeHouses") + public void commonCachedRowSetTest0025(RowSet rs) throws SQLException { + assertEquals(getPrimaryKeys(rs), COFFEE_HOUSES_PRIMARY_KEYS); + rs.close(); + } + + /* + * Delete a row within the RowSet using its primary key + * Validate the visibility of the row depending on the value of + * setShowdelete + */ + @Test(dataProvider = "rowsetUsingCoffeeHouses") + public void commonCachedRowSetTest0026(CachedRowSet rs) throws Exception { + Object[] afterDelete = { + 10023, 33002, 10040, 32001, 10042, 10024, 10039, 10041, + 33005, 33010, 10037, 10034, 32004 + }; + int rowToDelete = 10035; + // All rows should be found + assertEquals(getPrimaryKeys(rs), COFFEE_HOUSES_PRIMARY_KEYS); + // Delete the row + assertTrue(deleteRowByPrimaryKey(rs, rowToDelete, 1)); + // With setShowDeleted(false) which is the default, + // the deleted row should not be visible + assertFalse(findRowByPrimaryKey(rs, rowToDelete, 1)); + assertEquals(getPrimaryKeys(rs), afterDelete); + assertTrue(rs.size() == COFFEE_HOUSES_ROWS); + // With setShowDeleted(true), the deleted row should be visible + rs.setShowDeleted(true); + assertTrue(findRowByPrimaryKey(rs, rowToDelete, 1)); + rs.close(); + } + + /* + * Validate that there is no page size by default + */ + @Test(dataProvider = "rowSetType") + public void commonCachedRowSetTest0027(CachedRowSet rs) throws Exception { + assertTrue(rs.getPageSize() == 0); + rs.close(); + } + + /* + * Validate the value you set via setPageSize is returned by getPageSize + * then reset to having no limit + */ + @Test(dataProvider = "rowSetType") + public void commonCachedRowSetTest0028(CachedRowSet rs) throws Exception { + int rows = 100; + rs.setPageSize(rows); + assertTrue(rows == rs.getPageSize()); + rs.setPageSize(0); + assertTrue(rs.getPageSize() == 0); + rs.close(); + } + + /* + * Validate SQLException is thrown when an invalid value is specified + * for setPageSize + */ + @Test(dataProvider = "rowSetType", expectedExceptions = SQLException.class) + public void commonCachedRowSetTest0029(CachedRowSet rs) throws Exception { + rs.setPageSize(-1); + rs.close(); + } + + /* + * Validate SQLException is thrown when nextPage is called without a + * call to populate or execute + */ + @Test(dataProvider = "rowSetType", expectedExceptions = SQLException.class) + public void commonCachedRowSetTest0030(CachedRowSet rs) throws Exception { + rs.nextPage(); + rs.close(); + } + + /* + * Validate SQLException is thrown when previousPage is called without a + * call to populate or execute + */ + @Test(dataProvider = "rowSetType", expectedExceptions = SQLException.class) + public void commonCachedRowSetTest0031(CachedRowSet rs) throws Exception { + rs.previousPage(); + rs.close(); + } + + + /* + * Validate SQLException is thrown when execute is called + * but there is not a way to make a connection to the datasource + */ + @Test(dataProvider = "rowSetType", expectedExceptions = SQLException.class) + public void commonCachedRowSetTest0032(CachedRowSet rs) throws Exception { + rs.execute(null); + rs.close(); + } + + /* + * Validate SQLException is thrown when execute is called + * but there is not a way to make a connection to the datasource + */ + @Test(dataProvider = "rowSetType", expectedExceptions = SQLException.class) + public void commonCachedRowSetTest0033(CachedRowSet rs) throws Exception { + rs.execute(); + rs.close(); + } + + /* + * Validate that toCollection() returns the proper values + */ + @Test(dataProvider = "rowsetUsingCoffeeHouses") + public void commonCachedRowSetTest0034(CachedRowSet rs) throws Exception { + Object[] cities = {"Mendocino", "Seattle", "SF", "Portland", "SF", + "Sacramento", "Carmel", "LA", "Olympia", "Seattle", "SF", + "LA", "San Jose", "Eugene"}; + rs.beforeFirst(); + assertEquals(rs.toCollection(2).toArray(), cities); + assertEquals(rs.toCollection("CITY").toArray(), cities); + rs.close(); + } + + /* + * Validate that toCollection() returns the proper values + */ + @Test(dataProvider = "rowsetUsingCoffeeHouses") + public void commonCachedRowSetTest0035(CachedRowSet rs) throws Exception { + Collection col = rs.toCollection(); + assertTrue(rs.size() == col.size()); + assertTrue(rs.toCollection().containsAll(col) + && col.containsAll(rs.toCollection())); + try ( // Validate that False is returned when compared to a different RowSet; + CachedRowSet crs1 = createCoffeesRowSet()) { + assertFalse(crs1.toCollection().containsAll(col) + && col.containsAll(crs1.toCollection())); + } + rs.close(); + + } + + /* + * Validate that createCopy() returns the proper values + */ + @Test(dataProvider = "rowsetUsingCoffeeHouses") + public void commonCachedRowSetTest0036(CachedRowSet rs) throws Exception { + try (CachedRowSet crs1 = rs.createCopy()) { + compareRowSets(rs, crs1); + } + rs.close(); + } + + /* + * Validate that createCopySchema() returns the proper values + */ + @Test(dataProvider = "rowsetUsingCoffeeHouses") + public void commonCachedRowSetTest0037(CachedRowSet rs) throws Exception { + try (CachedRowSet crs1 = rs.createCopySchema()) { + assertTrue(crs1.size() == 0); + compareMetaData(crs1.getMetaData(), rs.getMetaData()); + } + rs.close(); + } + + /* + * Validate that createCopyNoConstraints() returns the proper values + * and getMatchColumnIndexes should throw a SQLException. This test + * specifies setMatchColumn(int) + */ + @Test(dataProvider = "rowsetUsingCoffeeHouses") + public void commonCachedRowSetTest0038(CachedRowSet rs) throws Exception { + rs.setMatchColumn(1); + try (CachedRowSet crs1 = rs.createCopyNoConstraints()) { + assertTrue(crs1.size() == COFFEE_HOUSES_ROWS); + compareRowSets(rs, crs1); + boolean recievedSQE = false; + try { + int[] indexes = crs1.getMatchColumnIndexes(); + } catch (SQLException e) { + recievedSQE = true; + } + assertTrue(recievedSQE); + recievedSQE = false; + try { + String[] colNames = crs1.getMatchColumnNames(); + } catch (SQLException e) { + recievedSQE = true; + } + assertTrue(recievedSQE); + } + rs.close(); + } + + /* + * Validate that createCopyNoConstraints() returns the proper values + * and getMatchColumnIndexes should throw a SQLException. This test + * specifies setMatchColumn(String) + */ + @Test(dataProvider = "rowsetUsingCoffeeHouses") + public void commonCachedRowSetTest0039(CachedRowSet rs) throws Exception { + rs.setMatchColumn("ID"); + try (CachedRowSet crs1 = rs.createCopyNoConstraints()) { + assertTrue(crs1.size() == COFFEE_HOUSES_ROWS); + compareRowSets(rs, crs1); + boolean recievedSQE = false; + try { + int[] indexes = crs1.getMatchColumnIndexes(); + } catch (SQLException e) { + recievedSQE = true; + } + assertTrue(recievedSQE); + recievedSQE = false; + try { + String[] colNames = crs1.getMatchColumnNames(); + } catch (SQLException e) { + recievedSQE = true; + } + assertTrue(recievedSQE); + } + rs.close(); + } + + /* + * Validate that columnUpdated works with the various datatypes specifying + * the column index + */ + @Test(dataProvider = "rowsetUsingDataTypes") + public void commonCachedRowSetTest0040(CachedRowSet rs, JDBCType type) throws Exception { + rs.beforeFirst(); + assertTrue(rs.next()); + switch (type) { + case INTEGER: + assertFalse(rs.columnUpdated(1)); + rs.updateInt(1, Integer.MIN_VALUE); + assertTrue(rs.columnUpdated(1)); + break; + case CHAR: + assertFalse(rs.columnUpdated(2)); + rs.updateString(2, "foo"); + assertTrue(rs.columnUpdated(2)); + break; + case VARCHAR: + assertFalse(rs.columnUpdated(3)); + rs.updateString(3, "foo"); + assertTrue(rs.columnUpdated(3)); + break; + case BIGINT: + assertFalse(rs.columnUpdated(4)); + rs.updateLong(4, Long.MIN_VALUE); + assertTrue(rs.columnUpdated(4)); + break; + case BOOLEAN: + assertFalse(rs.columnUpdated(5)); + rs.updateBoolean(5, false); + assertTrue(rs.columnUpdated(5)); + break; + case SMALLINT: + assertFalse(rs.columnUpdated(6)); + rs.updateShort(6, Short.MIN_VALUE); + assertTrue(rs.columnUpdated(6)); + break; + case DOUBLE: + assertFalse(rs.columnUpdated(7)); + rs.updateDouble(7, Double.MIN_VALUE); + assertTrue(rs.columnUpdated(7)); + break; + case DECIMAL: + assertFalse(rs.columnUpdated(8)); + rs.updateBigDecimal(8, BigDecimal.TEN); + assertTrue(rs.columnUpdated(8)); + break; + case REAL: + assertFalse(rs.columnUpdated(9)); + rs.updateFloat(9, Float.MIN_VALUE); + assertTrue(rs.columnUpdated(9)); + break; + case TINYINT: + assertFalse(rs.columnUpdated(10)); + rs.updateByte(10, Byte.MIN_VALUE); + assertTrue(rs.columnUpdated(10)); + break; + case DATE: + assertFalse(rs.columnUpdated(11)); + rs.updateDate(11, Date.valueOf(LocalDate.now())); + assertTrue(rs.columnUpdated(11)); + break; + case TIME: + assertFalse(rs.columnUpdated(12)); + rs.updateTime(12, Time.valueOf(LocalTime.now())); + assertTrue(rs.columnUpdated(12)); + break; + case TIMESTAMP: + assertFalse(rs.columnUpdated(13)); + rs.updateTimestamp(13, Timestamp.valueOf(LocalDateTime.now())); + assertTrue(rs.columnUpdated(13)); + break; + case VARBINARY: + assertFalse(rs.columnUpdated(14)); + rs.updateBytes(14, new byte[1]); + assertTrue(rs.columnUpdated(14)); + break; + case ARRAY: + assertFalse(rs.columnUpdated(15)); + rs.updateArray(15, new StubArray("VARCHAR", new Object[10])); + assertTrue(rs.columnUpdated(15)); + break; + case REF: + assertFalse(rs.columnUpdated(16)); + rs.updateRef(16, new StubRef("INTEGER", query)); + assertTrue(rs.columnUpdated(16)); + break; + case FLOAT: + assertFalse(rs.columnUpdated(17)); + rs.updateDouble(17, Double.MIN_NORMAL); + assertTrue(rs.columnUpdated(17)); + } + + } + + /* + * Validate that columnUpdated works with the various datatypes specifying + * the column name + */ + @Test(dataProvider = "rowsetUsingDataTypes") + public void commonCachedRowSetTest0041(CachedRowSet rs, JDBCType type) throws Exception { + rs.beforeFirst(); + assertTrue(rs.next()); + switch (type) { + case INTEGER: + assertFalse(rs.columnUpdated(DATATYPES_COLUMN_NAMES[0])); + rs.updateInt(DATATYPES_COLUMN_NAMES[0], Integer.MIN_VALUE); + assertTrue(rs.columnUpdated(DATATYPES_COLUMN_NAMES[0])); + break; + case CHAR: + assertFalse(rs.columnUpdated(DATATYPES_COLUMN_NAMES[1])); + rs.updateString(DATATYPES_COLUMN_NAMES[1], "foo"); + assertTrue(rs.columnUpdated(DATATYPES_COLUMN_NAMES[1])); + break; + case VARCHAR: + assertFalse(rs.columnUpdated(DATATYPES_COLUMN_NAMES[2])); + rs.updateString(DATATYPES_COLUMN_NAMES[2], "foo"); + assertTrue(rs.columnUpdated(DATATYPES_COLUMN_NAMES[2])); + break; + case BIGINT: + assertFalse(rs.columnUpdated(DATATYPES_COLUMN_NAMES[3])); + rs.updateLong(DATATYPES_COLUMN_NAMES[3], Long.MIN_VALUE); + assertTrue(rs.columnUpdated(DATATYPES_COLUMN_NAMES[3])); + break; + case BOOLEAN: + assertFalse(rs.columnUpdated(DATATYPES_COLUMN_NAMES[4])); + rs.updateBoolean(DATATYPES_COLUMN_NAMES[4], false); + assertTrue(rs.columnUpdated(DATATYPES_COLUMN_NAMES[4])); + break; + case SMALLINT: + assertFalse(rs.columnUpdated(DATATYPES_COLUMN_NAMES[5])); + rs.updateShort(DATATYPES_COLUMN_NAMES[5], Short.MIN_VALUE); + assertTrue(rs.columnUpdated(DATATYPES_COLUMN_NAMES[5])); + break; + case DOUBLE: + assertFalse(rs.columnUpdated(DATATYPES_COLUMN_NAMES[6])); + rs.updateDouble(DATATYPES_COLUMN_NAMES[6], Double.MIN_VALUE); + assertTrue(rs.columnUpdated(DATATYPES_COLUMN_NAMES[6])); + break; + case DECIMAL: + assertFalse(rs.columnUpdated(DATATYPES_COLUMN_NAMES[7])); + rs.updateBigDecimal(DATATYPES_COLUMN_NAMES[7], BigDecimal.TEN); + assertTrue(rs.columnUpdated(DATATYPES_COLUMN_NAMES[7])); + break; + case REAL: + assertFalse(rs.columnUpdated(DATATYPES_COLUMN_NAMES[8])); + rs.updateFloat(DATATYPES_COLUMN_NAMES[8], Float.MIN_VALUE); + assertTrue(rs.columnUpdated(DATATYPES_COLUMN_NAMES[8])); + break; + case TINYINT: + assertFalse(rs.columnUpdated(DATATYPES_COLUMN_NAMES[9])); + rs.updateByte(DATATYPES_COLUMN_NAMES[9], Byte.MIN_VALUE); + assertTrue(rs.columnUpdated(DATATYPES_COLUMN_NAMES[9])); + break; + case DATE: + assertFalse(rs.columnUpdated(DATATYPES_COLUMN_NAMES[10])); + rs.updateDate(DATATYPES_COLUMN_NAMES[10], Date.valueOf(LocalDate.now())); + assertTrue(rs.columnUpdated(DATATYPES_COLUMN_NAMES[10])); + break; + case TIME: + assertFalse(rs.columnUpdated(DATATYPES_COLUMN_NAMES[11])); + rs.updateTime(DATATYPES_COLUMN_NAMES[11], Time.valueOf(LocalTime.now())); + assertTrue(rs.columnUpdated(DATATYPES_COLUMN_NAMES[11])); + break; + case TIMESTAMP: + assertFalse(rs.columnUpdated(DATATYPES_COLUMN_NAMES[12])); + rs.updateTimestamp(DATATYPES_COLUMN_NAMES[12], Timestamp.valueOf(LocalDateTime.now())); + assertTrue(rs.columnUpdated(DATATYPES_COLUMN_NAMES[12])); + break; + case VARBINARY: + assertFalse(rs.columnUpdated(DATATYPES_COLUMN_NAMES[13])); + rs.updateBytes(DATATYPES_COLUMN_NAMES[13], new byte[1]); + assertTrue(rs.columnUpdated(DATATYPES_COLUMN_NAMES[13])); + break; + case ARRAY: + assertFalse(rs.columnUpdated(DATATYPES_COLUMN_NAMES[14])); + rs.updateArray(DATATYPES_COLUMN_NAMES[14], new StubArray("VARCHAR", new Object[10])); + assertTrue(rs.columnUpdated(DATATYPES_COLUMN_NAMES[14])); + break; + case REF: + assertFalse(rs.columnUpdated(DATATYPES_COLUMN_NAMES[15])); + rs.updateRef(DATATYPES_COLUMN_NAMES[15], new StubRef("INTEGER", query)); + assertTrue(rs.columnUpdated(DATATYPES_COLUMN_NAMES[15])); + break; + case FLOAT: + assertFalse(rs.columnUpdated(DATATYPES_COLUMN_NAMES[16])); + rs.updateDouble(DATATYPES_COLUMN_NAMES[16], Double.MIN_NORMAL); + assertTrue(rs.columnUpdated(DATATYPES_COLUMN_NAMES[16])); + break; + } + + } + + /* + * Validate isBeforeFirst(), isFirst() and first() return the correct + * results + */ + @Test(dataProvider = "rowsetUsingCoffeeHouses") + public void commonCachedRowSetTest0042(RowSet rs) throws Exception { + assertFalse(rs.isBeforeFirst()); + assertFalse(rs.isFirst()); + rs.beforeFirst(); + assertTrue(rs.isBeforeFirst()); + assertFalse(rs.isFirst()); + rs.next(); + assertFalse(rs.isBeforeFirst()); + assertTrue(rs.isFirst()); + rs.next(); + assertFalse(rs.isBeforeFirst()); + assertFalse(rs.isFirst()); + rs.first(); + assertFalse(rs.isBeforeFirst()); + assertTrue(rs.isFirst()); + rs.close(); + } + + /* + * Validate isAfterLast(), isLast() and last() return the correct + * results + */ + @Test(dataProvider = "rowsetUsingCoffeeHouses") + public void commonCachedRowSetTest0043(RowSet rs) throws Exception { + assertFalse(rs.isAfterLast()); + assertFalse(rs.isLast()); + rs.afterLast(); + assertTrue(rs.isAfterLast()); + assertFalse(rs.isLast()); + rs.previous(); + assertFalse(rs.isAfterLast()); + assertTrue(rs.isLast()); + rs.previous(); + assertFalse(rs.isAfterLast()); + assertFalse(rs.isLast()); + rs.last(); + assertFalse(rs.isAfterLast()); + assertTrue(rs.isLast()); + rs.close(); + } + + /* + * Validate a SQLException is thrown when undoDelete is called on the + * insertRow + */ + @Test(dataProvider = "rowsetUsingCoffeeHouses", + expectedExceptions = SQLException.class) + public void commonCachedRowSetTest0044(CachedRowSet rs) throws Exception { + rs.insertRow(); + rs.undoDelete(); + rs.close(); + } + + /* + * Validate a SQLException is thrown when undoDelete is called when + * cursor is before the first row + */ + @Test(dataProvider = "rowsetUsingCoffeeHouses", + expectedExceptions = SQLException.class) + public void commonCachedRowSetTest0045(CachedRowSet rs) throws Exception { + rs.setShowDeleted(true); + rs.beforeFirst(); + rs.undoDelete(); + rs.close(); + } + + /* + * Validate a SQLException is thrown when undoDelete is called when + * cursor is after the last row + */ + @Test(dataProvider = "rowsetUsingCoffeeHouses", + expectedExceptions = SQLException.class) + public void commonCachedRowSetTest0046(CachedRowSet rs) throws Exception { + rs.setShowDeleted(true); + rs.afterLast(); + rs.undoDelete(); + rs.close(); + } + + /* + * Validate a SQLException is thrown when undoUpdate is called on the + * insertRow + */ + @Test(dataProvider = "rowsetUsingCoffeeHouses", + expectedExceptions = SQLException.class) + public void commonCachedRowSetTest0047(CachedRowSet rs) throws Exception { + rs.insertRow(); + rs.undoUpdate(); + rs.close(); + } + + /* + * Validate a SQLException is thrown when undoUpdate is called when + * cursor is before the first row + */ + @Test(dataProvider = "rowsetUsingCoffeeHouses", + expectedExceptions = SQLException.class) + public void commonCachedRowSetTest0048(CachedRowSet rs) throws Exception { + rs.setShowDeleted(true); + rs.beforeFirst(); + rs.undoUpdate(); + rs.close(); + } + + /* + * Validate a SQLException is thrown when undoUpdate is called when + * cursor is after the last row + */ + @Test(dataProvider = "rowsetUsingCoffeeHouses", + expectedExceptions = SQLException.class) + public void commonCachedRowSetTest0049(CachedRowSet rs) throws Exception { + rs.setShowDeleted(true); + rs.afterLast(); + rs.undoUpdate(); + rs.close(); + } + + /* + * Validate a SQLException is thrown when undoInsert is called on the + * insertRow + */ + @Test(dataProvider = "rowsetUsingCoffeeHouses", + expectedExceptions = SQLException.class) + public void commonCachedRowSetTest0050(CachedRowSet rs) throws Exception { + rs.insertRow(); + rs.undoInsert(); + rs.close(); + } + + /* + * Validate a SQLException is thrown when undoInsert is called when + * cursor is before the first row + */ + @Test(dataProvider = "rowsetUsingCoffeeHouses", + expectedExceptions = SQLException.class) + public void commonCachedRowSetTest0051(CachedRowSet rs) throws Exception { + rs.setShowDeleted(true); + rs.beforeFirst(); + rs.undoInsert(); + rs.close(); + } + + /* + * Validate a SQLException is thrown when undoInsert is called when + * cursor is after the last row + */ + @Test(dataProvider = "rowsetUsingCoffeeHouses", + expectedExceptions = SQLException.class) + public void commonCachedRowSetTest0052(CachedRowSet rs) throws Exception { + rs.setShowDeleted(true); + rs.afterLast(); + rs.undoInsert(); + rs.close(); + } + + /* + * Insert a row, then call undoInsert to roll back the insert and validate + * the row is not there + */ + @Test(dataProvider = "rowsetUsingCoffeeHouses") + public void commonCachedRowSetTest0053(CachedRowSet rs) throws Exception { + int rowToInsert = 1961; + assertTrue(rs.size() == COFFEE_HOUSES_ROWS); + // Add new row + rs.moveToInsertRow(); + rs.updateInt(1, rowToInsert); + rs.updateString(2, "GOTHAM"); + rs.updateInt(3, 3450); + rs.updateInt(4, 2005); + rs.updateInt(5, 5455); + rs.insertRow(); + rs.moveToCurrentRow(); + // check that the number of rows has increased + assertTrue(rs.size() == COFFEE_HOUSES_ROWS + 1); + assertTrue(findRowByPrimaryKey(rs, rowToInsert, 1)); + rs.undoInsert(); + // Check to make sure the row is no longer there + assertTrue(rs.size() == COFFEE_HOUSES_ROWS); + assertFalse(findRowByPrimaryKey(rs, rowToInsert, 1)); + rs.close(); + } + + /* + * Insert a row, delete the row and then call undoDelete to make sure it + * is comes back + */ + @Test(dataProvider = "rowsetUsingCoffeeHouses") + public void commonCachedRowSetTest0054(CachedRowSet rs) throws Exception { + int rowToDelete = 1961; + assertTrue(rs.size() == COFFEE_HOUSES_ROWS); + // Add new row + rs.moveToInsertRow(); + rs.updateInt(1, rowToDelete); + rs.updateString(2, "GOTHAM"); + rs.updateInt(3, 3450); + rs.updateInt(4, 2005); + rs.updateInt(5, 5455); + rs.insertRow(); + rs.moveToCurrentRow(); + // check that the number of rows has increased + assertTrue(rs.size() == COFFEE_HOUSES_ROWS + 1); + assertTrue(findRowByPrimaryKey(rs, rowToDelete, 1)); + rs.absolute(COFFEE_HOUSES_ROWS + 1); + rs.deleteRow(); + // Check to make sure the row is no longer there + //assertTrue(rs.size() == COFFEE_HOUSES_ROWS); + assertFalse(findRowByPrimaryKey(rs, rowToDelete, 1)); + rs.setShowDeleted(true); + rs.absolute(COFFEE_HOUSES_ROWS + 1); + rs.undoDelete(); + // check that the row is back + assertTrue(rs.size() == COFFEE_HOUSES_ROWS + 1); + assertTrue(findRowByPrimaryKey(rs, rowToDelete, 1)); + rs.close(); + } + + /* + * Insert a row, modify a field and then call undoUpdate to revert the + * insert + */ + @Test(dataProvider = "rowsetUsingCoffeeHouses") + public void commonCachedRowSetTest0055(CachedRowSet rs) throws Exception { + int rowToInsert = 1961; + assertTrue(rs.size() == COFFEE_HOUSES_ROWS); + // Add new row + rs.moveToInsertRow(); + rs.updateInt(1, rowToInsert); + rs.updateString(2, "GOTHAM"); + rs.updateInt(3, 3450); + rs.updateInt(4, 2005); + rs.updateInt(5, 5455); + rs.insertRow(); + rs.moveToCurrentRow(); + // check that the number of rows has increased + assertTrue(rs.size() == COFFEE_HOUSES_ROWS + 1); + assertTrue(findRowByPrimaryKey(rs, rowToInsert, 1)); + rs.absolute(COFFEE_HOUSES_ROWS + 1); + // Save off the original column values + String f2 = rs.getString(2); + int f3 = rs.getInt(3); + rs.updateString(2, "SMALLVILLE"); + rs.updateInt(3, 500); + // Validate the columns have been updated + assertTrue(rs.columnUpdated(2)); + assertTrue(rs.columnUpdated(3)); + // Undo the update and validate it has taken place + rs.absolute(COFFEE_HOUSES_ROWS + 1); + rs.undoUpdate(); + assertTrue(rs.size() == COFFEE_HOUSES_ROWS); + assertFalse(findRowByPrimaryKey(rs, rowToInsert, 1)); + rs.close(); + } + + /* + * Validate getOriginal returns a ResultSet which is a copy of the original + * RowSet + */ + @Test(dataProvider = "rowsetUsingCoffees") + public void commonCachedRowSetTest0056(CachedRowSet rs) throws Exception { + String coffee = "Hazelnut"; + int sales = 100; + int id = 200; + Object[] updatedPkeys = {1, id, 3, 4, 5}; + // Change the coffee name and sales total for row 2 and save the + // previous values + rs.absolute(2); + int origId = rs.getInt(1); + String origCoffee = rs.getString(2); + int origSales = rs.getInt(5); + rs.updateInt(1, id); + rs.updateString(2, coffee); + rs.updateInt(5, sales); + // MetaData should match + try ( // Get the original original RowSet and validate that the changes + // are only made to the current, not the original + ResultSet rs1 = rs.getOriginal()) { + // MetaData should match + compareMetaData(rs.getMetaData(), rs1.getMetaData()); + assertTrue(rs1.isBeforeFirst()); + assertTrue(rs1.getConcurrency() == ResultSet.CONCUR_UPDATABLE); + assertTrue(rs1.getType() == ResultSet.TYPE_SCROLL_INSENSITIVE); + rs1.absolute(2); + // Check original rowset is not changed + assertTrue(rs1.getInt(1) == origId); + assertTrue(rs1.getString(2).equals(origCoffee)); + assertTrue(rs1.getInt(5) == origSales); + assertEquals(getPrimaryKeys(rs1), COFFEES_PRIMARY_KEYS); + // Check current rowset + assertTrue(rs.getInt(1) == id); + assertTrue(rs.getString(2).equals(coffee)); + assertTrue(rs.getInt(5) == sales); + assertEquals(getPrimaryKeys(rs), updatedPkeys); + } + rs.close(); + } + + /* + * Validate getOriginalRow returns a ResultSet which is a copy of the + * original row that was modified + */ + @Test(dataProvider = "rowsetUsingCoffees") + public void commonCachedRowSetTest0057(CachedRowSet rs) throws Exception { + String coffee = "Hazelnut"; + int sales = 100; + int id = 200; + Object[] updatedPkeys = {1, id, 3, 4, 5}; + // Change the coffee name and sales total for row 2 and save the + // previous values + rs.absolute(2); + int origId = rs.getInt(1); + String origCoffee = rs.getString(2); + int origSales = rs.getInt(5); + rs.updateInt(1, id); + rs.updateString(2, coffee); + rs.updateInt(5, sales); + // MetaData should match + try ( // Get the original original row and validate that the changes + // are only made to the current, not the original + ResultSet rs1 = rs.getOriginalRow()) { + // MetaData should match + compareMetaData(rs.getMetaData(), rs1.getMetaData()); + assertTrue(rs1.isBeforeFirst()); + assertTrue(rs1.getConcurrency() == ResultSet.CONCUR_UPDATABLE); + assertTrue(rs1.getType() == ResultSet.TYPE_SCROLL_INSENSITIVE); + rs1.next(); + assertTrue(rs1.isFirst() && rs1.isLast()); + assertTrue(rs1.getRow() == 1); + // Check original row is not changed + assertTrue(rs1.getInt(1) == origId); + assertTrue(rs1.getString(2).equals(origCoffee)); + assertTrue(rs1.getInt(5) == origSales); + // Check current row + assertTrue(rs.getInt(1) == id); + assertTrue(rs.getString(2).equals(coffee)); + assertTrue(rs.getInt(5) == sales); + assertEquals(getPrimaryKeys(rs), updatedPkeys); + } + rs.close(); + } + + /* + * Validate that restoreOrginal will restore the RowSet to its + * state prior to the insert of a row + */ + @Test(dataProvider = "rowsetUsingCoffeeHouses") + public void commonCachedRowSetTest0058(CachedRowSet rs) throws Exception { + int rowToInsert = 1961; + assertTrue(rs.size() == COFFEE_HOUSES_ROWS); + try ( // Add new row + CachedRowSet crs1 = rsf.createCachedRowSet()) { + rs.beforeFirst(); + crs1.populate(rs); + TestRowSetListener rsl = new TestRowSetListener(); + crs1.addRowSetListener(rsl); + crs1.moveToInsertRow(); + crs1.updateInt(1, rowToInsert); + crs1.updateString(2, "GOTHAM"); + crs1.updateInt(3, 3450); + crs1.updateInt(4, 2005); + crs1.updateInt(5, 5455); + crs1.insertRow(); + assertTrue(rsl.isNotified(TestRowSetListener.ROW_CHANGED)); + crs1.moveToCurrentRow(); + assertTrue(findRowByPrimaryKey(crs1, rowToInsert, 1)); + // Restore back to our original state and the + // previously inserted row should not be there + rsl.resetFlag(); + crs1.restoreOriginal(); + assertTrue(rsl.isNotified(TestRowSetListener.ROWSET_CHANGED)); + assertTrue(crs1.isBeforeFirst()); + crs1.last(); + assertFalse(crs1.rowInserted()); + assertFalse(findRowByPrimaryKey(crs1, rowToInsert, 1)); + } + rs.close(); + } + + /* + * Validate that restoreOrginal will restore the RowSet to its + * state prior to deleting a row + */ + @Test(dataProvider = "rowsetUsingCoffees", enabled = true) + public void commonCachedRowSetTest0059(CachedRowSet rs) throws Exception { + int rowToDelete = 2; + try (CachedRowSet crs1 = rsf.createCachedRowSet()) { + rs.beforeFirst(); + crs1.populate(rs); + TestRowSetListener rsl = new TestRowSetListener(); + crs1.addRowSetListener(rsl); + // Delete a row, the PK is also the absolute position as a List + // backs the RowSet + crs1.absolute(rowToDelete); + crs1.deleteRow(); + assertTrue(crs1.rowDeleted()); + assertFalse(findRowByPrimaryKey(crs1, rowToDelete, 1)); + // Restore back to our original state and the + // previously deleted row should be there + rsl.resetFlag(); + crs1.restoreOriginal(); + assertTrue(rsl.isNotified(TestRowSetListener.ROWSET_CHANGED)); + assertTrue(crs1.isBeforeFirst()); + crs1.absolute(rowToDelete); + assertFalse(crs1.rowDeleted()); + assertTrue(findRowByPrimaryKey(crs1, rowToDelete, 1)); + } + rs.close(); + } + + /* + * Validate that restoreOrginal will restore the RowSet to its + * state prior to updating a row + */ + @Test(dataProvider = "rowsetUsingCoffees", enabled = true) + public void commonCachedRowSetTest0060(CachedRowSet rs) throws Exception { + int rowToUpdate = 2; + String coffee = "Hazelnut"; + try (CachedRowSet crs1 = rsf.createCachedRowSet()) { + rs.beforeFirst(); + crs1.populate(rs); + TestRowSetListener rsl = new TestRowSetListener(); + crs1.addRowSetListener(rsl); + // Delete a row, the PK is also the absolute position as a List + // backs the RowSet + crs1.absolute(rowToUpdate); + String origCoffee = crs1.getString(2); + crs1.updateString(2, coffee); + assertTrue(crs1.columnUpdated(2)); + crs1.updateRow(); + assertTrue(crs1.rowUpdated()); + assertFalse(origCoffee.equals(crs1.getString(2))); + // Restore back to our original state and the + // previous value for the column within the row should be there + rsl.resetFlag(); + crs1.restoreOriginal(); + assertTrue(rsl.isNotified(TestRowSetListener.ROWSET_CHANGED)); + assertTrue(crs1.isBeforeFirst()); + // absolute() is failing for some reason so need to look at this later + crs1.next(); + crs1.next(); + assertFalse(crs1.columnUpdated(2)); + assertFalse(crs1.rowUpdated()); + assertTrue(origCoffee.equals(crs1.getString(2))); + } + rs.close(); + } + + /* + * Initialize a RowSet via the populate method. Validate it matches + * the original ResultSet + */ + @Test(dataProvider = "rowsetUsingCoffeeHouses") + public void commonCachedRowSetTest0061(CachedRowSet rs) throws Exception { + try (CachedRowSet crs1 = rsf.createCachedRowSet()) { + rs.beforeFirst(); + crs1.populate(rs); + compareRowSets(rs, crs1); + } + rs.close(); + } + + /* + * Initialize a RowSet via the populate method specifying a starting row. + * Validate it matches the original ResultSet starting for the specofied + * offset + */ + @Test(dataProvider = "rowsetUsingCoffeeHouses") + public void commonCachedRowSetTest0062(CachedRowSet rs) throws Exception { + Object[] expectedRows = { + 32001, 10042, 10024, 10039, 10041, 33005, 33010, 10035, 10037, + 10034, 32004 + }; + int startingRow = 4; + try (CachedRowSet crs1 = rsf.createCachedRowSet()) { + rs.beforeFirst(); + crs1.populate(rs, startingRow); + assertEquals(crs1.size(), COFFEE_HOUSES_ROWS - startingRow + 1); + assertEquals(getPrimaryKeys(crs1), expectedRows); + } + rs.close(); + } + +} diff --git a/test/javax/sql/testng/test/rowset/filteredrowset/CityFilter.java b/test/javax/sql/testng/test/rowset/filteredrowset/CityFilter.java new file mode 100644 index 000000000..2188c4eed --- /dev/null +++ b/test/javax/sql/testng/test/rowset/filteredrowset/CityFilter.java @@ -0,0 +1,100 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package test.rowset.filteredrowset; + +import java.sql.SQLException; +import javax.sql.RowSet; +import javax.sql.rowset.Predicate; + +/* + * Simple implementation of Predicate which is used to filter rows based + * on a City. + */ +public class CityFilter implements Predicate { + + private final String[] cities; + private String colName = null; + private int colNumber = -1; + + public CityFilter(String[] cities, String colName) { + this.cities = cities; + this.colName = colName; + } + + public CityFilter(String[] cities, int colNumber) { + this.cities = cities; + this.colNumber = colNumber; + } + + public boolean evaluate(Object value, String colName) { + + if (colName.equalsIgnoreCase(this.colName)) { + for (String city : cities) { + if (city.equalsIgnoreCase((String) value)) { + return true; + } + } + } + return false; + } + + public boolean evaluate(Object value, int colNumber) { + + if (colNumber == this.colNumber) { + for (String city : this.cities) { + if (city.equalsIgnoreCase((String) value)) { + return true; + } + } + } + return false; + } + + public boolean evaluate(RowSet rs) { + + boolean result = false; + + if (rs == null) { + return false; + } + + try { + for (String city : cities) { + + String val = ""; + if (colNumber > 0) { + val = (String) rs.getObject(colNumber); + } else if (colName != null) { + val = (String) rs.getObject(colName); + } + + if (val.equalsIgnoreCase(city)) { + return true; + } + } + } catch (SQLException e) { + result = false; + } + return result; + } +} diff --git a/test/javax/sql/testng/test/rowset/filteredrowset/FilteredRowSetTests.java b/test/javax/sql/testng/test/rowset/filteredrowset/FilteredRowSetTests.java new file mode 100644 index 000000000..263a79a68 --- /dev/null +++ b/test/javax/sql/testng/test/rowset/filteredrowset/FilteredRowSetTests.java @@ -0,0 +1,140 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package test.rowset.filteredrowset; + +import java.sql.SQLException; +import javax.sql.RowSet; +import javax.sql.rowset.FilteredRowSet; +import javax.sql.rowset.Predicate; +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertNull; +import static org.testng.Assert.assertTrue; +import org.testng.annotations.AfterMethod; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; +import test.rowset.webrowset.CommonWebRowSetTests; + +public class FilteredRowSetTests extends CommonWebRowSetTests { + + private FilteredRowSet frs; + + @BeforeMethod + public void setUpMethod() throws Exception { + frs = createCoffeeHousesRowSet(); + } + + @AfterMethod + public void tearDownMethod() throws Exception { + frs.close(); + } + + protected FilteredRowSet newInstance() throws SQLException { + return rsf.createFilteredRowSet(); + } + + /* + * Validate getFilter returns null if setFilter has not been called + */ + @Test + public void FilteredRowSetTest0000() throws SQLException { + assertNull(frs.getFilter()); + } + + /* + * Call setFilter to set a Predicate and validate that getFilter + * returns the correct Predicate + */ + @Test + public void FilteredRowSetTest0001() throws SQLException { + Predicate p = new PrimaryKeyFilter(0, 100030, 1); + frs.setFilter(p); + assertTrue(frs.getFilter().equals(p)); + frs.setFilter(null); + assertNull(frs.getFilter()); + } + + /* + * Validate that the correct rows are returned when a Predicate using + * a column index is used + */ + @Test + public void FilteredRowSetTest0002() throws SQLException { + Object[] expectedKeys = { + 10023, 10040, 10042, 10024, 10039, 10041, 10035, 10037, 10034 + }; + frs.setFilter(new PrimaryKeyFilter(10000, 10999, 1)); + assertEquals(getPrimaryKeys(frs), expectedKeys); + } + + /* + * Validate that the correct rows are returned when a Predicate using + * a column Label is used + */ + @Test + public void FilteredRowSetTest0003() throws SQLException { + Object[] expectedKeys = { + 10023, 10040, 10042, 10024, 10039, 10041, 10035, 10037, 10034 + }; + frs.setFilter(new PrimaryKeyFilter(10000, 10999, "STORE_ID")); + assertEquals(getPrimaryKeys(frs), expectedKeys); + + } + + /* + * Validate that the correct rows are returned when a Predicate using + * a column index is used + */ + @Test + public void FilteredRowSetTest0004() throws SQLException { + Object[] expectedKeys = { + 10040, 10042, 10041, 10035, 10037 + }; + String[] cityArray = {"SF", "LA"}; + frs.setFilter(new CityFilter(cityArray, 2)); + assertEquals(getPrimaryKeys(frs), expectedKeys); + } + + /* + * Validate that the correct rows are returned when a Predicate using + * a column Label is used + */ + @Test + public void FilteredRowSetTest0005() throws SQLException { + Object[] expectedKeys = { + 10040, 10042, 10041, 10035, 10037 + }; + String[] cityArray = {"SF", "LA"}; + frs.setFilter(new CityFilter(cityArray, "CITY")); + assertEquals(getPrimaryKeys(frs), expectedKeys); + } + + + // Tests that are common but need to be disabled due to an implementation bug + + + @Test(dataProvider = "rowSetType", enabled = false) + public void commonCachedRowSetTest0043(RowSet rs) throws Exception { + // Need to fix bug in FilteredRowSets + } + +} diff --git a/test/javax/sql/testng/test/rowset/filteredrowset/PrimaryKeyFilter.java b/test/javax/sql/testng/test/rowset/filteredrowset/PrimaryKeyFilter.java new file mode 100644 index 000000000..2a7483140 --- /dev/null +++ b/test/javax/sql/testng/test/rowset/filteredrowset/PrimaryKeyFilter.java @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package test.rowset.filteredrowset; + +import javax.sql.RowSet; +import javax.sql.rowset.Predicate; + +/* + * Simple implementation of Predicate which is used to filter rows based + * on the Primary Key. + */ +public class PrimaryKeyFilter implements Predicate { + + private final int lo; + private final int hi; + private String colName = null; + private int colNumber = -1; + + public PrimaryKeyFilter(int lo, int hi, int colNumber) { + this.lo = lo; + this.hi = hi; + this.colNumber = colNumber; + } + + public PrimaryKeyFilter(int lo, int hi, String colName) { + this.lo = lo; + this.hi = hi; + this.colName = colName; + } + + public boolean evaluate(Object value, String columnName) { + + boolean result = false; + if (columnName.equalsIgnoreCase(this.colName)) { + int columnValue = ((Integer) value); + result = (columnValue >= this.lo) && (columnValue <= this.hi); + } + return result; + } + + public boolean evaluate(Object value, int columnNumber) { + + boolean result = false; + if (this.colNumber == columnNumber) { + int columnValue = (Integer) value; + result = (columnValue >= this.lo) && (columnValue <= this.hi); + } + return result; + } + + public boolean evaluate(RowSet rs) { + + boolean result = false; + try { + int columnValue = -1; + + if (this.colNumber > 0) { + columnValue = rs.getInt(this.colNumber); + } else if (this.colName != null) { + columnValue = rs.getInt(this.colName); + } + if ((columnValue >= this.lo) && (columnValue <= this.hi)) { + result = true; + } + + } catch (Exception e) { + System.out.println("Error:" + e.getMessage()); + result = false; + } + return result; + } + +} diff --git a/test/javax/sql/testng/test/rowset/joinrowset/JoinRowSetTests.java b/test/javax/sql/testng/test/rowset/joinrowset/JoinRowSetTests.java new file mode 100644 index 000000000..b84453e9a --- /dev/null +++ b/test/javax/sql/testng/test/rowset/joinrowset/JoinRowSetTests.java @@ -0,0 +1,324 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package test.rowset.joinrowset; + +import java.sql.SQLException; +import java.sql.Types; +import java.util.ArrayList; +import java.util.List; +import javax.sql.RowSet; +import javax.sql.rowset.CachedRowSet; +import javax.sql.rowset.JoinRowSet; +import javax.sql.rowset.RowSetMetaDataImpl; +import javax.sql.rowset.WebRowSet; +import static org.testng.Assert.assertEquals; +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; +import test.rowset.webrowset.CommonWebRowSetTests; + +public class JoinRowSetTests extends CommonWebRowSetTests { + + private final String SUPPLIERS_TABLE = "SUPPLIERS"; + // Expected COF_IDs to be found + private final Object[] EXPECTED = {4, 1}; + // SUPPLIERS Primary Key to use to validate the joins + private final int SUP_ID = 101; + // Join Column between the SUPPLIERS and COFFEES table + private final String JOIN_COLNAME = "SUP_ID"; + // Column index in COFFEES table which contains SUP_ID + private final int COFFEES_JOIN_COLUMN_INDEX = 3; + // Column index in SUPPLIERS table which contains SUP_ID + private final int SUPPLIERS_JOIN_COLUMN_INDEX = 1; + + @Override + protected JoinRowSet newInstance() throws SQLException { + return rsf.createJoinRowSet(); + } + + /* + * Initializes the SUPPLIERS metadata + */ + private void initSuppliersMetaData(CachedRowSet crs) throws SQLException { + RowSetMetaDataImpl rsmd = new RowSetMetaDataImpl(); + + /* + * CREATE TABLE SUPPLIERS ( + * SUP_ID INTEGER NOT NULL, + * SUP_NAME VARCHAR(32) NOT NULL, + * STREET VARCHAR(32) NOT NULL, + * CITY VARCHAR(32) NOT NULL, + * STATE CHAR(2) NOT NULL, + * ZIP CHAR(5) NOT NULL, + * PRIMARY KEY (SUP_ID)) + */ + rsmd.setColumnCount(6); + rsmd.setColumnName(1, "SUP_ID"); + rsmd.setColumnName(2, "SUP_NAME"); + rsmd.setColumnName(3, "STREET"); + rsmd.setColumnName(4, "CITY"); + rsmd.setColumnName(5, "STATE"); + rsmd.setColumnName(6, "ZIP"); + + rsmd.setColumnType(1, Types.INTEGER); + rsmd.setColumnType(2, Types.VARCHAR); + rsmd.setColumnType(3, Types.VARCHAR); + rsmd.setColumnType(4, Types.VARCHAR); + rsmd.setColumnType(5, Types.CHAR); + rsmd.setColumnType(6, Types.CHAR); + crs.setMetaData(rsmd); + crs.setTableName(SUPPLIERS_TABLE); + } + + /* + * Add rows to SUPPLIERS table + */ + protected void createSuppiersRows(RowSet rs) throws SQLException { + + // insert into SUPPLIERS values(49, 'Superior Coffee', '1 Party Place', + // 'Mendocino', 'CA', '95460') + rs.moveToInsertRow(); + rs.updateInt(1, 49); + rs.updateString(2, "Superior Coffee"); + rs.updateString(3, "1 Party Place"); + rs.updateString(4, "Mendocino"); + rs.updateString(5, "CA"); + rs.updateString(6, "95460"); + rs.insertRow(); + + // insert into SUPPLIERS values(101, 'Acme, Inc.', '99 Market Street', + // 'Groundsville', 'CA', '95199') + rs.moveToInsertRow(); + rs.updateInt(1, 101); + rs.updateString(2, "Acme, Inc."); + rs.updateString(3, "99 Market Street"); + rs.updateString(4, "Groundsville"); + rs.updateString(5, "CA"); + rs.updateString(6, "95199"); + rs.insertRow(); + // insert into SUPPLIERS values(150, 'The High Ground', + // '100 Coffee Lane', 'Meadows', 'CA', '93966') + rs.moveToInsertRow(); + rs.updateInt(1, 150); + rs.updateString(2, "The High Ground"); + rs.updateString(3, "100 Coffee Lane"); + rs.updateString(4, "Meadows"); + rs.updateString(5, "CA"); + rs.updateString(6, "93966"); + rs.insertRow(); + // insert into SUPPLIERS values(456," 'Restaurant Supplies, Inc.', + // '200 Magnolia Street', 'Meadows', 'CA', '93966') + rs.moveToInsertRow(); + rs.updateInt(1, 456); + rs.updateString(2, "Restaurant Supplies, Inc."); + rs.updateString(3, "200 Magnolia Stree"); + rs.updateString(4, "Meadows"); + rs.updateString(5, "CA"); + rs.updateString(6, "93966"); + rs.insertRow(); + // insert into SUPPLIERS values(927, 'Professional Kitchen', + // '300 Daisy Avenue', 'Groundsville'," 'CA', '95199') + rs.moveToInsertRow(); + rs.updateInt(1, 927); + rs.updateString(2, "Professional Kitchen"); + rs.updateString(3, "300 Daisy Avenue"); + rs.updateString(4, "Groundsville"); + rs.updateString(5, "CA"); + rs.updateString(6, "95199"); + rs.insertRow(); + } + + /* + * DataProvider used to set parameters for basic types that are supported + */ + @DataProvider(name = "createCachedRowSetsToUse") + private Object[][] createCachedRowSetsToUse() throws SQLException { + CachedRowSet crs = rsf.createCachedRowSet(); + initCoffeesMetaData(crs); + createCoffeesRows(crs); + // Make sure you are not on the insertRow + crs.moveToCurrentRow(); + CachedRowSet crs1 = rsf.createCachedRowSet(); + initSuppliersMetaData(crs1); + createSuppiersRows(crs1); + // Make sure you are not on the insertRow + crs1.moveToCurrentRow(); + return new Object[][]{ + {crs, crs1} + }; + } + + /* + * Validate that the correct coffees are returned for SUP_ID + */ + private void validateResults(final JoinRowSet jrs) throws SQLException { + List results = new ArrayList<>(); + jrs.beforeFirst(); + while (jrs.next()) { + if (jrs.getInt(JOIN_COLNAME) == SUP_ID) { + results.add(jrs.getInt("COF_ID")); + } + } + assertEquals(results.toArray(), EXPECTED); + } + + /* + * Join two CachedRowSets specifying a column name to join against + */ + @Test(dataProvider = "createCachedRowSetsToUse") + public void joinRowSetTests0000(CachedRowSet crs, CachedRowSet crs1) + throws Exception { + + try (JoinRowSet jrs = newInstance()) { + jrs.addRowSet(crs, JOIN_COLNAME); + jrs.addRowSet(crs1, JOIN_COLNAME); + validateResults(jrs); + crs.close(); + crs1.close(); + } + } + + /* + * Join two CachedRowSets specifying a column index to join against + */ + @Test(dataProvider = "createCachedRowSetsToUse") + public void joinRowSetTests0001(CachedRowSet crs, CachedRowSet crs1) + throws Exception { + + try (JoinRowSet jrs = newInstance()) { + jrs.addRowSet(crs, COFFEES_JOIN_COLUMN_INDEX); + jrs.addRowSet(crs1, SUPPLIERS_JOIN_COLUMN_INDEX); + validateResults(jrs); + crs.close(); + crs1.close(); + } + } + + /* + * Join two CachedRowSets specifying a column name to join against + */ + @Test(dataProvider = "createCachedRowSetsToUse") + public void joinRowSetTests0002(CachedRowSet crs, CachedRowSet crs1) + throws Exception { + + try (JoinRowSet jrs = newInstance()) { + RowSet[] rowsets = {crs, crs1}; + String[] joinCols = {JOIN_COLNAME, JOIN_COLNAME}; + jrs.addRowSet(rowsets, joinCols); + validateResults(jrs); + crs.close(); + crs1.close(); + } + } + + /* + * Join two CachedRowSets specifying a column index to join against + */ + @Test(dataProvider = "createCachedRowSetsToUse") + public void joinRowSetTests0003(CachedRowSet crs, CachedRowSet crs1) + throws Exception { + + try (JoinRowSet jrs = newInstance()) { + RowSet[] rowsets = {crs, crs1}; + int[] joinCols = {COFFEES_JOIN_COLUMN_INDEX, + SUPPLIERS_JOIN_COLUMN_INDEX}; + jrs.addRowSet(rowsets, joinCols); + validateResults(jrs); + crs.close(); + crs1.close(); + } + } + + /* + * Join two CachedRowSets specifying a column name to join against + */ + @Test(dataProvider = "createCachedRowSetsToUse") + public void joinRowSetTests0005(CachedRowSet crs, CachedRowSet crs1) + throws Exception { + + try (JoinRowSet jrs = newInstance()) { + crs.setMatchColumn(JOIN_COLNAME); + crs1.setMatchColumn(JOIN_COLNAME); + jrs.addRowSet(crs); + jrs.addRowSet(crs1); + validateResults(jrs); + crs.close(); + crs1.close(); + } + } + + /* + * Join two CachedRowSets specifying a column index to join against + */ + @Test(dataProvider = "createCachedRowSetsToUse") + public void joinRowSetTests0006(CachedRowSet crs, CachedRowSet crs1) + throws Exception { + + try (JoinRowSet jrs = newInstance()) { + crs.setMatchColumn(COFFEES_JOIN_COLUMN_INDEX); + crs1.setMatchColumn(SUPPLIERS_JOIN_COLUMN_INDEX); + + jrs.addRowSet(crs); + jrs.addRowSet(crs1); + validateResults(jrs); + crs.close(); + crs1.close(); + } + } + + // Disabled tests due to bugs in JoinRowSet + @Test(dataProvider = "rowSetType", enabled = false) + public void commonCachedRowSetTest0004(CachedRowSet rs) throws Exception { + } + + @Test(dataProvider = "rowSetType", enabled = false) + public void commonCachedRowSetTest0005(CachedRowSet rs) throws Exception { + } + + @Test(dataProvider = "rowSetType", enabled = false) + public void commonCachedRowSetTest0008(CachedRowSet rs) throws Exception { + } + + @Test(dataProvider = "rowSetType", enabled = false) + public void commonCachedRowSetTest0026(CachedRowSet rs) throws Exception { + } + + @Test(dataProvider = "rowSetType", enabled = false) + public void commonCachedRowSetTest0027(CachedRowSet rs) throws Exception { + } + + @Test(dataProvider = "rowSetType", enabled = false) + public void commonCachedRowSetTest0053(CachedRowSet rs) throws Exception { + } + + @Test(dataProvider = "rowSetType", enabled = false) + public void commonCachedRowSetTest0054(CachedRowSet rs) throws Exception { + } + + @Test(dataProvider = "rowSetType", enabled = false) + public void commonCachedRowSetTest0055(CachedRowSet rs) throws Exception { + } + + @Test(dataProvider = "rowSetType") + public void WebRowSetTest0009(WebRowSet wrs1) throws Exception { + } +} diff --git a/test/javax/sql/testng/test/rowset/serial/SQLInputImplTests.java b/test/javax/sql/testng/test/rowset/serial/SQLInputImplTests.java new file mode 100644 index 000000000..a6756a13a --- /dev/null +++ b/test/javax/sql/testng/test/rowset/serial/SQLInputImplTests.java @@ -0,0 +1,211 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package test.rowset.serial; + +import java.net.URL; +import java.sql.Array; +import java.sql.Blob; +import java.sql.Clob; +import java.sql.Ref; +import java.sql.SQLException; +import java.sql.Struct; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import javax.sql.rowset.serial.SQLInputImpl; +import static org.testng.Assert.*; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; +import util.BaseTest; +import util.StubArray; +import util.StubBlob; +import util.StubClob; +import util.StubRef; +import util.StubStruct; +import util.SuperHero; +import util.TestSQLDataImpl; + +public class SQLInputImplTests extends BaseTest { + + // Copy of the array of data type values + private Object[] typeValues; + private TestSQLDataImpl impl; + private Map> map ; + private SuperHero hero; + private final String sqlType = "SUPERHERO"; + + @BeforeMethod + @Override + public void setUpMethod() throws Exception { + map = new HashMap<>(); + impl = new TestSQLDataImpl("TestSQLData"); + typeValues = Arrays.copyOf(TestSQLDataImpl.attributes, + TestSQLDataImpl.attributes.length); + hero = new SuperHero(sqlType, "Bruce", "Wayne", + 1939, "Batman"); + } + + /* + * Validate that a SQLException is thrown if the attribute value is + * null + */ + @Test(expectedExceptions = SQLException.class) + public void test() throws Exception { + SQLInputImpl x = new SQLInputImpl(null, map); + } + + /* + * Validate that a SQLException is thrown if the map value is + * null + */ + @Test(expectedExceptions = SQLException.class) + public void test02() throws Exception { + SQLInputImpl x = new SQLInputImpl(typeValues, null); + } + + /* + * Read in the various datatypes via readSQL (which will exercise the + * various readXXX methods and validate that results are as expected + */ + @Test() + public void test03() throws Exception { + impl.readSQL(new SQLInputImpl(typeValues, map), "misc"); + assertTrue(Arrays.equals(impl.toArray(), typeValues)); + // Null out a field and make sure the arrays do not match + typeValues[2] = null; + assertFalse(Arrays.equals(impl.toArray(), typeValues)); + } + + /* + * Validate that wasNull indicates if a null was read in + */ + @Test() + public void test04() throws Exception { + Object[] values = {"Hello", null, 1}; + SQLInputImpl sqli = new SQLInputImpl(values, map); + String s = sqli.readString(); + assertFalse(sqli.wasNull()); + s = sqli.readString(); + assertTrue(sqli.wasNull()); + int i = sqli.readInt(); + assertFalse(sqli.wasNull()); + } + + /* + * Validate that readObject returns the correct value + */ + @Test() + public void test05() throws Exception { + Object[] values = {hero}; + SQLInputImpl sqli = new SQLInputImpl(values, map); + Object o = sqli.readObject(); + assertTrue(hero.equals(o)); + + } + + /* + * Validate a Array can be read + */ + @Test(enabled = true) + public void test06() throws Exception { + Object[] coffees = new Object[]{"Espresso", "Colombian", "French Roast", + "Cappuccino"}; + Array a = new StubArray("VARCHAR", coffees); + Object[] values = {a}; + SQLInputImpl sqli = new SQLInputImpl(values, map); + Array a2 = sqli.readArray(); + assertTrue(Arrays.equals((Object[]) a2.getArray(), (Object[]) a.getArray())); + assertTrue(a.getBaseTypeName().equals(a2.getBaseTypeName())); + } + + /* + * Validate a Blob can be read + */ + @Test(enabled = true) + public void test07() throws Exception { + Blob b = new StubBlob(); + Object[] values = {b}; + SQLInputImpl sqli = new SQLInputImpl(values, map); + Blob b2 = sqli.readBlob(); + assertTrue(Arrays.equals( + b.getBytes(1, (int) b.length()), + b2.getBytes(1, (int) b2.length()))); + } + + /* + * Validate a Clob can be read + */ + @Test(enabled = true) + public void test08() throws Exception { + Clob c = new StubClob(); + Object[] values = {c}; + SQLInputImpl sqli = new SQLInputImpl(values, map); + Clob c2 = sqli.readClob(); + assertTrue(c.getSubString(1, + (int) c.length()).equals(c2.getSubString(1, (int) c2.length()))); + } + + /* + * Validate a Ref can be read + */ + @Test(enabled = true) + public void test09() throws Exception { + Ref ref = new StubRef(sqlType, hero); + Object[] values = {ref}; + SQLInputImpl sqli = new SQLInputImpl(values, map); + Ref ref2 = sqli.readRef(); + assertTrue(ref.getObject().equals(ref2.getObject())); + assertTrue(ref.getBaseTypeName().equals(ref2.getBaseTypeName())); + } + + /* + * Validate a URL can be read + */ + @Test(enabled = true) + public void test10() throws Exception { + URL u = new URL("http://www.oracle.com/");; + Object[] values = {u}; + SQLInputImpl sqli = new SQLInputImpl(values, map); + URL u2 = sqli.readURL(); + assertTrue(u2.equals(u)); + assertTrue(u2.sameFile(u)); + } + + /* + * Validate that readObject returns the correct value when a Struct is + * next on the stream + */ + @Test() + public void test11() throws Exception { + Object[] attributes = new Object[]{"Bruce", "Wayne", 1939, + "Batman"}; + map.put(sqlType, Class.forName("util.SuperHero")); + Struct struct = new StubStruct(sqlType, attributes); + Object[] values = {struct}; + SQLInputImpl sqli = new SQLInputImpl(values, map); + Object o = sqli.readObject(); + + assertTrue(hero.equals(o)); + + } +} diff --git a/test/javax/sql/testng/test/rowset/serial/SQLOutputImplTests.java b/test/javax/sql/testng/test/rowset/serial/SQLOutputImplTests.java new file mode 100644 index 000000000..00f62df6f --- /dev/null +++ b/test/javax/sql/testng/test/rowset/serial/SQLOutputImplTests.java @@ -0,0 +1,199 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package test.rowset.serial; + +import java.net.URL; +import java.sql.Array; +import java.sql.Blob; +import java.sql.Clob; +import java.sql.Ref; +import java.sql.SQLException; +import java.sql.Struct; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import java.util.Vector; +import javax.sql.rowset.serial.SQLInputImpl; +import javax.sql.rowset.serial.SQLOutputImpl; +import javax.sql.rowset.serial.SerialArray; +import javax.sql.rowset.serial.SerialBlob; +import javax.sql.rowset.serial.SerialClob; +import javax.sql.rowset.serial.SerialDatalink; +import javax.sql.rowset.serial.SerialRef; +import javax.sql.rowset.serial.SerialStruct; +import static org.testng.Assert.*; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; +import util.BaseTest; +import util.StubArray; +import util.StubBlob; +import util.StubClob; +import util.StubRef; +import util.StubStruct; +import util.SuperHero; +import util.TestSQLDataImpl; + +public class SQLOutputImplTests extends BaseTest { + + // Copy of the array of data type values + private Object[] typeValues; + private TestSQLDataImpl impl; + private Map> map = new HashMap<>(); + private Vector results; + private final String sqlType = "SUPERHERO"; + private SuperHero hero; + private SQLOutputImpl outImpl; + + @BeforeMethod + @Override + public void setUpMethod() throws Exception { + results = new Vector(); + impl = new TestSQLDataImpl("TestSQLData"); + typeValues = Arrays.copyOf(TestSQLDataImpl.attributes, + TestSQLDataImpl.attributes.length); + hero = new SuperHero(sqlType, "Bruce", "Wayne", 1939, "Batman"); + outImpl = new SQLOutputImpl(results, map); + } + + /* + * Validate that a SQLException is thrown if the attribute value is + * null + */ + @Test(expectedExceptions = SQLException.class) + public void test() throws Exception { + SQLOutputImpl x = new SQLOutputImpl(null, map); + } + + /* + * Validate that a SQLException is thrown if the map value is + * null + */ + @Test(expectedExceptions = SQLException.class) + public void test02() throws Exception { + SQLOutputImpl x = new SQLOutputImpl(results, null); + } + + /* + * Read in the various datatypes via readSQL (which will exercise the + * various readXXX methods and validate that results are as expected + */ + @Test() + public void test03() throws Exception { + impl.readSQL(new SQLInputImpl(typeValues, map), "misc"); + impl.writeSQL(outImpl); + assertTrue(Arrays.equals(results.toArray(), typeValues)); + // Null out a field and make sure the arrays do not match + typeValues[2] = null; + assertFalse(Arrays.equals(results.toArray(), typeValues)); + } + + /* + * Validate a Array can be written and returned + */ + @Test(enabled = true) + public void test04() throws Exception { + Object[] coffees = new Object[]{"Espresso", "Colombian", "French Roast", + "Cappuccino"}; + Array a = new StubArray("VARCHAR", coffees); + outImpl.writeArray(a); + SerialArray sa = (SerialArray) results.get(0); + assertTrue(Arrays.equals(coffees, (Object[]) sa.getArray())); + assertTrue(a.getBaseTypeName().equals(sa.getBaseTypeName())); + } + + /* + * Validate a Blob can be written and returned + */ + @Test(enabled = true) + public void test05() throws Exception { + Blob b = new StubBlob(); + outImpl.writeBlob(b); + SerialBlob sb = (SerialBlob) results.get(0); + assertTrue(Arrays.equals( + b.getBytes(1, (int) b.length()), + sb.getBytes(1, (int) sb.length()))); + } + + /* + * Validate a Clob can be written and returned + */ + @Test(enabled = true) + public void test06() throws Exception { + Clob c = new StubClob(); + outImpl.writeClob(c); + SerialClob sc = (SerialClob) results.get(0); + assertTrue(c.getSubString(1, + (int) c.length()).equals(sc.getSubString(1, (int) sc.length()))); + } + + /* + * Validate a Ref can be written and returned + */ + @Test(enabled = true) + public void test07() throws Exception { + Ref ref = new StubRef(sqlType, hero); + outImpl.writeRef(ref); + SerialRef sr = (SerialRef) results.get(0); + assertTrue(hero.equals(sr.getObject())); + } + + /* + * Validate a Struct can be written and returned + */ + @Test(enabled = true) + public void test08() throws Exception { + Object[] attributes = new Object[]{"Bruce", "Wayne", 1939, + "Batman"}; + Struct s = new StubStruct(sqlType, attributes); + outImpl.writeStruct(s); + SerialStruct ss = (SerialStruct) results.get(0); + assertTrue(Arrays.equals(attributes, (Object[]) ss.getAttributes())); + assertTrue(sqlType.equals(ss.getSQLTypeName())); + } + + /* + * Validate a DataLink can be written and returned + */ + @Test(enabled = true) + public void test09() throws Exception { + URL u = new URL("http://www.oracle.com/"); + outImpl.writeURL(u); + SerialDatalink sdl = (SerialDatalink) results.get(0); + URL u2 = sdl.getDatalink(); + assertTrue(u2.equals(u)); + assertTrue(u2.sameFile(u)); + } + + /* + * Validate an Object implementing SQLData can be written and returned + */ + @Test(enabled = true) + public void test10() throws Exception { + Object[] attributes = new Object[]{"Bruce", "Wayne", 1939, + "Batman"}; + outImpl.writeObject(hero); + SerialStruct ss = (SerialStruct) results.get(0); + assertTrue(Arrays.equals(attributes, (Object[]) ss.getAttributes())); + assertTrue(sqlType.equals(ss.getSQLTypeName())); + } +} diff --git a/test/javax/sql/testng/test/rowset/serial/SerialArrayTests.java b/test/javax/sql/testng/test/rowset/serial/SerialArrayTests.java new file mode 100644 index 000000000..077ce43da --- /dev/null +++ b/test/javax/sql/testng/test/rowset/serial/SerialArrayTests.java @@ -0,0 +1,236 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package test.rowset.serial; + +import java.sql.Array; +import java.sql.SQLException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import javax.sql.rowset.serial.SerialArray; +import javax.sql.rowset.serial.SerialException; +import static org.testng.Assert.*; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; +import util.BaseTest; +import util.StubArray; + +public class SerialArrayTests extends BaseTest { + + private Object[] coffees; + private final String sqlType = "VARCHAR"; + private Array a; + private Map> map; + + @BeforeMethod + public void setUpMethod() throws Exception { + coffees = new Object[]{"Espresso", "Colombian", "French Roast", + "Cappuccino"}; + a = new StubArray(sqlType, coffees); + map = new HashMap<>(); + } + + /* + * Validate a SerialArray can be created from an Array + */ + @Test + public void test01() throws Exception { + SerialArray sa = new SerialArray(a); + } + + /* + * Validate a SQLException is thrown if the map is null + */ + @Test(expectedExceptions = SQLException.class) + public void test02() throws Exception { + SerialArray sa = new SerialArray(a, null); + } + + /* + * Validate a SerialException is thrown when getResultSet() is called + */ + @Test(expectedExceptions = SerialException.class) + public void test03() throws Exception { + SerialArray sa = new SerialArray(a); + sa.getResultSet(); + } + + /* + * Validate a SerialException is thrown when getResultSet() is called + */ + @Test(expectedExceptions = SerialException.class) + public void test04() throws Exception { + SerialArray sa = new SerialArray(a); + sa.getResultSet(null); + } + + /* + * Validate a SerialException is thrown when getResultSet() is called + */ + @Test(expectedExceptions = SerialException.class) + public void test05() throws Exception { + SerialArray sa = new SerialArray(a); + sa.getResultSet(1, 1); + } + + /* + * Validate a SerialException is thrown when getResultSet() is called + */ + @Test(expectedExceptions = SerialException.class) + public void test06() throws Exception { + SerialArray sa = new SerialArray(a); + sa.getResultSet(1, 1, null); + } + + /* + * Validate a SerialException is thrown when getArray() is invoked after + * free() is called + */ + @Test(expectedExceptions = SerialException.class) + public void test07() throws Exception { + SerialArray sa = new SerialArray(a); + sa.free(); + sa.getArray(); + } + + /* + * Validate a SerialException is thrown when getArray() is invoked after + * free() is called + */ + @Test(expectedExceptions = SerialException.class) + public void test08() throws Exception { + SerialArray sa = new SerialArray(a); + sa.free(); + sa.getArray(map); + } + + /* + * Validate a SerialException is thrown when getArray() is invoked after + * free() is called + */ + @Test(expectedExceptions = SerialException.class) + public void test09() throws Exception { + SerialArray sa = new SerialArray(a); + sa.free(); + sa.getArray(1, 1, map); + } + + /* + * Validate a SerialException is thrown when getArray() is invoked after + * free() is called + */ + @Test(expectedExceptions = SerialException.class) + public void test10() throws Exception { + SerialArray sa = new SerialArray(a); + sa.free(); + sa.getArray(1, 1); + } + + /* + * Validate a SerialException is thrown when getBaseType() is invoked after + * free() is called + */ + @Test(expectedExceptions = SerialException.class) + public void test11() throws Exception { + SerialArray sa = new SerialArray(a); + sa.free(); + sa.getBaseType(); + } + + /* + * Validate a SerialException is thrown when getBaseTypeName() is invoked after + * free() is called + */ + @Test(expectedExceptions = SerialException.class) + public void test12() throws Exception { + SerialArray sa = new SerialArray(a); + sa.free(); + sa.getBaseTypeName(); + } + + /* + * Validate getArray() returns the same Object[] used to create the + * SerialArray + */ + @Test + public void test13() throws Exception { + SerialArray sa = new SerialArray(a); + Object[] o = (Object[]) sa.getArray(); + assertTrue(Arrays.equals(o, coffees)); + } + + /* + * Validate getArray() returns the same Object[] used to create the + * SerialArray + */ + @Test + public void test14() throws Exception { + SerialArray sa = new SerialArray(a); + Object[] o = (Object[]) sa.getArray(map); + assertTrue(Arrays.equals(o, coffees)); + } + + /* + * Validate getArray() returns the same Object[] used to create the + * SerialArray + */ + @Test + public void test15() throws Exception { + SerialArray sa = new SerialArray(a); + Object[] o = (Object[]) sa.getArray(1, 2); + assertTrue(Arrays.equals(o, Arrays.copyOfRange(coffees, 1, 3))); + } + + /* + * Validate getArray() returns the same Object[] used to create the + * SerialArray + */ + @Test + public void test16() throws Exception { + SerialArray sa = new SerialArray(a); + Object[] o = (Object[]) sa.getArray(1, 2, map); + assertTrue(Arrays.equals(o, Arrays.copyOfRange(coffees, 1, 3))); + } + + /* + * clone() a SerialArray and check that it is equal to the + * object it was cloned from + */ + @Test + public void test17() throws Exception { + SerialArray sa = new SerialArray(a); + SerialArray sa1 = (SerialArray) sa.clone(); + assertTrue(sa.equals(sa1)); + } + + /* + * Validate that a SerialArray that is serialized & deserialized is equal to + * itself + */ + @Test + public void test18() throws Exception { + SerialArray sa = new SerialArray(a); + SerialArray sa1 = serializeDeserializeObject(sa);; + assertTrue(sa.equals(sa1)); + } +} diff --git a/test/javax/sql/testng/test/rowset/serial/SerialBlobTests.java b/test/javax/sql/testng/test/rowset/serial/SerialBlobTests.java new file mode 100644 index 000000000..e080b1ca1 --- /dev/null +++ b/test/javax/sql/testng/test/rowset/serial/SerialBlobTests.java @@ -0,0 +1,399 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package test.rowset.serial; + +import java.io.InputStream; +import java.io.OutputStream; +import java.util.Arrays; +import javax.sql.rowset.serial.SerialBlob; +import javax.sql.rowset.serial.SerialException; +import static org.testng.Assert.*; +import org.testng.annotations.Test; +import util.BaseTest; +import util.StubBlob; + +public class SerialBlobTests extends BaseTest { + + // byte[] used to populate SerialBlob + private byte[] bytes = new byte[]{1, 2, 3, 4, 5}; + + /* + * Validate calling free() does not throw an Exception + */ + @Test + public void test() throws Exception { + SerialBlob sb = new SerialBlob(new StubBlob()); + sb.free(); + } + + /* + * Validate calling getBinaryStream() after calling free() throws an + * SerialException + */ + @Test(expectedExceptions = SerialException.class) + public void test01() throws Exception { + SerialBlob sb = new SerialBlob(new StubBlob()); + sb.free(); + sb.getBinaryStream(); + } + + /* + * Validate calling getBinaryStream() after calling free() throws an + * SerialException + */ + @Test(expectedExceptions = SerialException.class) + public void test02() throws Exception { + SerialBlob sb = new SerialBlob(new StubBlob()); + sb.free(); + sb.getBinaryStream(1, 5); + } + + /* + * Validate calling getBytes() after calling free() throws an + * SerialException + */ + @Test(expectedExceptions = SerialException.class) + public void test03() throws Exception { + SerialBlob sb = new SerialBlob(new StubBlob()); + sb.free(); + sb.getBytes(1, 1); + } + + /* + * Validate calling getLength() after calling free() throws an + * SerialException + */ + @Test(expectedExceptions = SerialException.class) + public void test04() throws Exception { + SerialBlob sb = new SerialBlob(new StubBlob()); + sb.free(); + sb.length(); + } + + /* + * Validate calling position() after calling free() throws an + * SerialException + */ + @Test(expectedExceptions = SerialException.class) + public void test05() throws Exception { + SerialBlob sb = new SerialBlob(new StubBlob()); + sb.free(); + sb.position(new byte[5], 1); + } + + /* + * Validate calling position() after calling free() throws an + * SerialException + */ + @Test(expectedExceptions = SerialException.class) + public void test06() throws Exception { + SerialBlob sb = new SerialBlob(new StubBlob()); + sb.free(); + sb.position(new StubBlob(), 1); + } + + /* + * Validate calling free() after calling setBinaryStream() throws an + * SerialException + */ + @Test(expectedExceptions = SerialException.class) + public void test07() throws Exception { + SerialBlob sb = new SerialBlob(new StubBlob()); + sb.free(); + sb.setBinaryStream(5); + } + + /* + * Validate calling free() after calling setBytes() throws an + * SerialException + */ + @Test(expectedExceptions = SerialException.class) + public void test08() throws Exception { + SerialBlob sb = new SerialBlob(new StubBlob()); + sb.free(); + sb.setBytes(1, new byte[5]); + } + + /* + * Validate calling setBytes() after calling free() throws an + * SerialException + */ + @Test(expectedExceptions = SerialException.class) + public void test09() throws Exception { + SerialBlob sb = new SerialBlob(new StubBlob()); + sb.free(); + sb.setBytes(1, new byte[10], 0, 5); + } + + /* + * Validate calling truncate() after calling free() throws an + * SerialException + */ + @Test(expectedExceptions = SerialException.class) + public void test10() throws Exception { + SerialBlob sb = new SerialBlob(new StubBlob()); + sb.free(); + sb.truncate(1); + } + + /* + * Validate getBinaryStream returns the correct bytes + */ + @Test + public void test11() throws Exception { + byte[] expected = new byte[]{1, 2, 3}; + SerialBlob sb = new SerialBlob(bytes); + InputStream is = sb.getBinaryStream(1, 3); + for (byte b : expected) { + byte val = (byte) is.read(); + assertTrue(b == val, val + " does not match " + b); + } + } + + /* + * Validate a SerialException is thrown if pos < 0 for getBinaryStream + */ + @Test(expectedExceptions = SerialException.class) + public void test12() throws Exception { + SerialBlob sb = new SerialBlob(bytes); + InputStream is = sb.getBinaryStream(-1, 3); + } + + /* + * Validate a SerialException is thrown if pos = 0 for getBinaryStream + */ + @Test(expectedExceptions = SerialException.class) + public void test13() throws Exception { + SerialBlob sb = new SerialBlob(bytes); + InputStream is = sb.getBinaryStream(0, 3); + } + + /* + * Validate a SerialException is thrown if len > the length of the stream + * for getBinaryStream + */ + @Test(expectedExceptions = SerialException.class) + public void test14() throws Exception { + SerialBlob sb = new SerialBlob(bytes); + InputStream is = sb.getBinaryStream(0, 3); + } + + /* + * Validate a SerialException is thrown if length < 1 + */ + @Test(expectedExceptions = SerialException.class) + public void test15() throws Exception { + SerialBlob sb = new SerialBlob(bytes); + InputStream is = sb.getBinaryStream(1, 0); + } + + /* + * Validate a SerialException is thrown if length > byte array length + */ + @Test(expectedExceptions = SerialException.class) + public void test16() throws Exception { + SerialBlob sb = new SerialBlob(bytes); + InputStream is = sb.getBinaryStream(1, 6); + } + + /* + * Validate a SerialException is thrown if pos > byte array length + */ + @Test(expectedExceptions = SerialException.class) + public void test17() throws Exception { + SerialBlob sb = new SerialBlob(bytes); + InputStream is = sb.getBinaryStream(bytes.length + 2, 6); + } + + /* + * Validate that a cloned SerializedBlob bytes match the original + */ + @Test + public void test18() throws Exception { + SerialBlob sb = new SerialBlob(bytes); + SerialBlob sb2 = (SerialBlob) sb.clone(); + assertTrue( + Arrays.equals(sb.getBytes(1, (int) sb.length()), + sb2.getBytes(1, (int) sb2.length())), + "arrays do not match "); + } + + /* + * Test clone after free has been called that the clone is not accessible + */ + @Test(expectedExceptions = SerialException.class) + public void test19() throws Exception { + SerialBlob sb = new SerialBlob(bytes); + sb.free(); + SerialBlob sb2 = (SerialBlob) sb.clone(); + InputStream is = sb2.getBinaryStream(1, 3); + } + + /* + * Validate that a SerialBlob that is serialized & deserialized is equal to + * itself + */ + @Test + public void test20() throws Exception { + SerialBlob sb = new SerialBlob(bytes); + SerialBlob sb2 = serializeDeserializeObject(sb); + assertTrue(sb.equals(sb2), "SerialBlob not equal"); + } + + /* + * Validate a SerialException is thrown if byte[] is used to + * create the SeriablBlob and setBinaryStream is called + */ + @Test(expectedExceptions = SerialException.class) + public void test21() throws Exception { + SerialBlob sb = new SerialBlob(bytes); + sb.setBinaryStream(3); + } + + /* + * Validate that setBytes will properly write a set of bytes to the + * specified location in the SerialBlob and the correct count is returned + * for bytes written + */ + @Test + public void test22() throws Exception { + byte[] diff = new byte[]{7, 8, 9}; + byte[] expected = new byte[]{1, 7, 8, 9, 5}; + SerialBlob sb = new SerialBlob(bytes); + int written = sb.setBytes(2, diff); + assertEquals(written, diff.length); + assertTrue( + Arrays.equals(sb.getBytes(1, (int) sb.length()), + expected), + "arrays do not match "); + } + + /* + * Validate that setBytes will properly write a set of bytes to the + * specified location in the SerialBlob and the correct count is returned + * for bytes written + */ + @Test + public void test23() throws Exception { + int bytesToWrite = 3; + byte[] diff = new byte[]{7, 8, 9, 0}; + byte[] expected = new byte[]{1, 8, 9, 0, 5}; + SerialBlob sb = new SerialBlob(bytes); + int written = sb.setBytes(2, diff, 1, bytesToWrite); + assertEquals(written, bytesToWrite); + assertTrue( + Arrays.equals(sb.getBytes(1, (int) sb.length()), + expected), + "arrays do not match "); + } + + /* + * Validate that truncate reduces the length of the SerlizedBlob to the + * specified value + */ + @Test + public void test24() throws Exception { + SerialBlob sb = new SerialBlob(bytes); + sb.truncate(0); + assertTrue(sb.length() == 0); + sb = new SerialBlob(bytes); + sb.truncate(3); + assertTrue(sb.length() == 3); + } + + /* + * Validate getBinaryStream returns the correct bytes + */ + @Test + public void test25() throws Exception { + byte[] expected = bytes; + SerialBlob sb = new SerialBlob(bytes); + InputStream is = sb.getBinaryStream(); + for (byte b : expected) { + byte val = (byte) is.read(); + assertTrue(b == val, val + " does not match " + b); + } + } + + /* + * Validate setBinaryStream returns an OutputStream when passed a Blob + */ + @Test + public void test26() throws Exception { + SerialBlob sb = new SerialBlob(new StubBlob()); + OutputStream os = sb.setBinaryStream(0); + assertTrue(os != null); + } + + /* + * Validate that position returns the correct starting location for a + * pattern in the SerialBlob + */ + @Test + public void test27() throws Exception { + long expectedPos = 3; // starting offset is 1 vs 0 + byte[] pattern = new byte[]{3, 4}; + SerialBlob sb = new SerialBlob(bytes); + long pos = sb.position(pattern, 1); + assertEquals(pos, expectedPos); + } + + /* + * Validate that position returns the correct starting location for a + * pattern in the SerialBlob + */ + @Test + public void test28() throws Exception { + long expectedPos = 3; // starting offset is 1 vs 0 + byte[] pattern = new byte[]{3, 4, 5}; + SerialBlob sb = new SerialBlob(bytes); + long pos = sb.position(pattern, 2); + assertEquals(pos, expectedPos); + } + + /* + * Validate that position returns the correct starting location for a + * pattern in the SerialBlob + */ + @Test + public void test29() throws Exception { + long expectedPos = 2; // starting offset is 1 vs 0 + byte[] pattern = new byte[]{4, 6}; + SerialBlob sb = new SerialBlob(new StubBlob()); + long pos = sb.position(pattern, 1); + assertEquals(pos, expectedPos); + } + + /* + * Validate that position returns the correct starting location for a + * pattern in the SerialBlob + */ + @Test + public void test30() throws Exception { + long expectedPos = 3; // starting offset is 1 vs 0 + byte[] pattern = new byte[]{6, 8}; + SerialBlob sb = new SerialBlob(new StubBlob()); + long pos = sb.position(pattern, 2); + assertEquals(pos, expectedPos); + } +} diff --git a/test/javax/sql/testng/test/rowset/serial/SerialClobTests.java b/test/javax/sql/testng/test/rowset/serial/SerialClobTests.java new file mode 100644 index 000000000..72f42674d --- /dev/null +++ b/test/javax/sql/testng/test/rowset/serial/SerialClobTests.java @@ -0,0 +1,499 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package test.rowset.serial; + +import java.io.InputStream; +import java.io.OutputStream; +import java.io.Reader; +import java.io.Writer; +import javax.sql.rowset.serial.SerialClob; +import javax.sql.rowset.serial.SerialException; +import static org.testng.Assert.*; +import org.testng.annotations.Test; +import util.BaseTest; +import util.StubClob; + +public class SerialClobTests extends BaseTest { + + // char[] used to populate SerialClob + private final char[] chars; + + public SerialClobTests() { + this.chars = new char[]{'h', 'e', 'l', 'l', 'o', ' ', 'w', + 'o', 'r', 'l', 'd'}; + } + + /* + * Validate calling free() does not throw an Exception + */ + @Test + public void test() throws Exception { + SerialClob sc = new SerialClob(new StubClob()); + sc.free(); + } + + /* + * Validate calling getCharacterStream() after calling free() throws an + * SerialException + */ + @Test(expectedExceptions = SerialException.class) + public void test01() throws Exception { + SerialClob sc = new SerialClob(new StubClob()); + sc.free(); + sc.getCharacterStream(); + } + + /* + * Validate calling getCharacterStream() after calling free() throws an + * SerialException + */ + @Test(expectedExceptions = SerialException.class) + public void test02() throws Exception { + SerialClob sc = new SerialClob(chars); + sc.free(); + sc.getCharacterStream(); + } + + /* + * Validate calling getCharacterStream() after calling free() throws an + * SerialException + */ + @Test(expectedExceptions = SerialException.class) + public void test03() throws Exception { + SerialClob sc = new SerialClob(new StubClob()); + sc.free(); + sc.getCharacterStream(1, 5); + } + + /* + * Validate calling getSubString() after calling free() throws an + * SerialException + */ + @Test(expectedExceptions = SerialException.class) + public void test04() throws Exception { + SerialClob sc = new SerialClob(new StubClob()); + sc.free(); + sc.getSubString(1, 1); + } + + /* + * Validate calling truncate() after calling free() throws an + * SerialException + */ + @Test(expectedExceptions = SerialException.class) + public void test05() throws Exception { + SerialClob sc = new SerialClob(new StubClob()); + sc.free(); + sc.truncate(1); + } + + /* + * Validate calling getAsciiStream() after calling free() throws an + * SerialException + */ + @Test(expectedExceptions = SerialException.class) + public void test06() throws Exception { + SerialClob sc = new SerialClob(new StubClob()); + sc.free(); + sc.getAsciiStream(); + } + + /* + * Validate calling length() after calling free() throws an SerialException + */ + @Test(expectedExceptions = SerialException.class) + public void test07() throws Exception { + SerialClob sc = new SerialClob(new StubClob()); + sc.free(); + sc.length(); + } + + /* + * Validate calling position() after calling free() throws an + * SerialException + */ + @Test(expectedExceptions = SerialException.class) + public void test08() throws Exception { + SerialClob sc = new SerialClob(new StubClob()); + sc.free(); + sc.position("hello", 1); + } + + /* + * Validate calling position() after calling free() throws an + * SerialException + */ + @Test(expectedExceptions = SerialException.class) + public void test09() throws Exception { + SerialClob sc = new SerialClob(new StubClob()); + sc.free(); + sc.position(new StubClob(), 1); + } + + /* + * Validate calling setAsciiStream() after calling free() throws an + * SerialException + */ + @Test(expectedExceptions = SerialException.class) + public void test10() throws Exception { + SerialClob sc = new SerialClob(new StubClob()); + sc.free(); + sc.setAsciiStream(5); + } + + /* + * Validate calling setCharacterStream() after calling free() throws an + * SerialException + */ + @Test(expectedExceptions = SerialException.class) + public void test11() throws Exception { + SerialClob sc = new SerialClob(new StubClob()); + sc.free(); + sc.setCharacterStream(5); + } + + /* + * Validate calling setString() after calling free() throws an + * SerialException + */ + @Test(expectedExceptions = SerialException.class) + public void test12() throws Exception { + SerialClob sc = new SerialClob(new StubClob()); + sc.free(); + sc.setString(1, "hello"); + } + + /* + * Validate calling setString() after calling free() throws an + * SerialException + */ + @Test(expectedExceptions = SerialException.class) + public void test13() throws Exception { + SerialClob sc = new SerialClob(new StubClob()); + sc.free(); + sc.setString(1, "hello", 0, 5); + } + + /* + * Test that SerialException is thrown if pos < 0 on a call to + * getCharacterStream + */ + @Test(expectedExceptions = SerialException.class) + public void test14() throws Exception { + SerialClob sc = new SerialClob(chars); + sc.getCharacterStream(-1, 5); + } + + /* + * Test that SerialException is thrown if pos = 0 on a call to + * getCharacterStream + */ + @Test(expectedExceptions = SerialException.class) + public void test15() throws Exception { + SerialClob sc = new SerialClob(chars); + sc.getCharacterStream(0, 5); + } + + /* + * Test that SerialException is thrown if pos = 0 on a call to + * getCharacterStream + */ + @Test(expectedExceptions = SerialException.class) + public void test16() throws Exception { + SerialClob sc = new SerialClob(chars); + sc.getCharacterStream(1, 100); + } + + /* + * Test that SerialException is thrown if length = 0 on a call to + * getCharacterStream + */ + @Test(expectedExceptions = SerialException.class) + public void test17() throws Exception { + SerialClob sc = new SerialClob(chars); + sc.getCharacterStream(1, 0); + } + + /* + * Test that SerialException is thrown if pos > length on a call to + * getCharacterStream + */ + @Test(expectedExceptions = SerialException.class) + public void test18() throws Exception { + SerialClob sc = new SerialClob(chars); + sc.getCharacterStream(100, 5); + } + + /* + * Clone a SerialClob and check that it is equal to itself + */ + @Test + public void test19() throws Exception { + SerialClob sc = new SerialClob(chars); + SerialClob sc1 = (SerialClob) sc.clone(); + assertTrue(sc.equals(sc1), "SerialClobs not equal"); + } + + /* + * Validate that a getAsciiStream() returns an InputStream when a Clob is + * used to create the SerialClob + */ + @Test + public void test20() throws Exception { + SerialClob sc = new SerialClob(new StubClob()); + InputStream is = sc.getAsciiStream(); + assertTrue(is != null); + } + + /* + * Validate that a getCharacterStream() returns an Reader when a Clob is + * used to create the SerialClob + */ + @Test + public void test21() throws Exception { + SerialClob sc = new SerialClob(new StubClob()); + Reader is = sc.getCharacterStream(); + assertTrue(is != null); + } + + /* + * Validate that a getCharacterStream() returns an Reader when a char[] is + * used to create the SerialClob + */ + @Test + public void test22() throws Exception { + SerialClob sc = new SerialClob(chars); + Reader is = sc.getCharacterStream(); + assertTrue(is != null); + } + + /* + * Validate that a getSubString() returns the correct value when a char[] is + * used to create the SerialClob + */ + @Test + public void test23() throws Exception { + SerialClob sc = new SerialClob(chars); + String expected = "world"; + assertEquals(expected, sc.getSubString(7, 5)); + } + + /* + * Validate that a getSubString() returns the correct value when a Clob is + * used to create the SerialClob + */ + @Test + public void test24() throws Exception { + SerialClob sc = new SerialClob(new StubClob()); + String expected = "test string"; + assertEquals(expected, sc.getSubString(5, 11)); + } + + /* + * Validate that position() returns the correct value when a Clob is used to + * create the SerialClob + */ + @Test + public void test25() throws Exception { + long expectedPos = 5; + SerialClob sc = new SerialClob(new StubClob()); + String expected = "test string"; + long pos = sc.position(expected, 1); + assertEquals(expectedPos, pos); + } + + /* + * Validate that position returned is -1 when an the search string is not + * part of the SerialClob + */ + @Test + public void test26() throws Exception { + long expectedPos = -1; + SerialClob sc = new SerialClob(chars); + String expected = "test string"; + long pos = sc.position(expected, 1); + assertEquals(expectedPos, pos); + } + + /* + * Validate that position() returned is -1 when an the search string is not + * part of the SerialClob + */ + @Test + public void test27() throws Exception { + long expectedPos = -1; + SerialClob sc = new SerialClob(new StubClob()); + String expected = "I am Batman"; + long pos = sc.position(expected, 2); + assertEquals(expectedPos, pos); + } + + /* + * Validate that position() returns the correct value when a char[] is used + * to create the SerialClob + */ + @Test + public void test28() throws Exception { + long expectedPos = 2; + SerialClob sc = new SerialClob(chars); + String expected = "ello"; + long pos = sc.position(expected, 1); + assertEquals(expectedPos, pos); + } + + /* + * Validate that position() returns the correct value when a SerialClob is + * used for the search argument + */ + @Test + public void test29() throws Exception { + long expectedPos = 21; + String expected = "Batman"; + String buf = "I am Joker, not the Batman, hahaha"; + SerialClob sc = new SerialClob(expected.toCharArray()); + SerialClob sc1 = new SerialClob(buf.toCharArray()); + long pos = sc1.position(sc, 1); + assertEquals(expectedPos, pos); + } + + /* + * Validate that position() returns the correct value when a SerialClob is + * used for the search argument + */ + @Test + public void test30() throws Exception { + long expectedPos = 17; + String expected = "012"; + SerialClob sc = new SerialClob(expected.toCharArray()); + SerialClob sc1 = new SerialClob(new StubClob()); + long pos = sc1.position(sc, 1); + assertEquals(expectedPos, pos); + } + + /* + * Check that setString() updates the appropriate characters in the + * SerialClob + */ + @Test + public void test31() throws Exception { + String val = "Hello, I am Bruce Wayne"; + String val1 = "the Batman!"; + String expected = "Hello, I am the Batman!"; + SerialClob sc = new SerialClob(val.toCharArray()); + int written = sc.setString(13, val1); + assertEquals(val1.length(), written); + assertTrue(expected.equals(sc.getSubString(1, (int) sc.length()))); + } + + /* + * Check that setString() updates the appropriate characters in the + * SerialClob + */ + @Test(enabled = false) + public void test32() throws Exception { + int expectedWritten = 9; + String val = "Hi, I am Catwoman!!!!!!"; + String val1 = "Hahaha the Joker, who are you?!"; + String expected = "Hi, I am the Joker!"; + SerialClob sc = new SerialClob(val.toCharArray()); + int written = sc.setString(10, val1, 8, expectedWritten+1); + assertEquals(written, expectedWritten); + + } + + /* + * Check that setCharacterStream() returns a non-null Writer for an + * SerialClob created from a Clob + */ + @Test + public void test33() throws Exception { + SerialClob sc = new SerialClob(new StubClob()); + Writer w = sc.setCharacterStream(1); + assertTrue(w != null); + } + + /* + * Check that setAsciiStream() returns a non-null OutputStream for an SerialClob + * created from a Clob + */ + @Test + public void test34() throws Exception { + SerialClob sc = new SerialClob(new StubClob()); + OutputStream os = sc.setAsciiStream(1); + assertTrue(os != null); + } + + /* + * Check that truncate() truncates the length of the SerialClob to the + * specified size + */ + @Test + public void test35() throws Exception { + SerialClob sc = new SerialClob(new StubClob()); + sc.truncate(0); + assertTrue(sc.length() == 0); + sc = new SerialClob(chars); + sc.truncate(5); + assertTrue(sc.length() == 5); + } + + /* + * Check that getCharacterStream() returns a Reader and that the char[] that + * was specified to create the SerialClob can be returned via the Reader + */ + @Test + public void test36() throws Exception { + SerialClob sc = new SerialClob(chars); + Reader r = sc.getCharacterStream(); + for (char c : chars) { + char val = (char) r.read(); + assertTrue(c == val, val + " does not match " + c); + } + } + + /* + * Check that getCharacterStream() returns a Reader and that the char[] that + * was specified to create the SerialClob can be returned via the Reader + */ + @Test(enabled = false) + public void test37() throws Exception { + SerialClob sc = new SerialClob(chars); + String expected = "ello w"; + Reader r = sc.getCharacterStream(2, 6); + for (char c : expected.toCharArray()) { + char val = (char) r.read(); + assertTrue(c == val, val + " does not match " + c); + } + } + + /* + * Validate that a SerialClob that is serialized & deserialized is equal to + * itself + */ + @Test + public void test38() throws Exception { + SerialClob sc = new SerialClob(chars); + SerialClob sc2 = serializeDeserializeObject(sc); + assertTrue(sc.equals(sc2), "SerialClobs not equal"); + } +} diff --git a/test/javax/sql/testng/test/rowset/serial/SerialDataLinkTests.java b/test/javax/sql/testng/test/rowset/serial/SerialDataLinkTests.java new file mode 100644 index 000000000..8e86d4a8f --- /dev/null +++ b/test/javax/sql/testng/test/rowset/serial/SerialDataLinkTests.java @@ -0,0 +1,110 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package test.rowset.serial; + +import java.net.URL; +import javax.sql.rowset.serial.SerialDatalink; +import javax.sql.rowset.serial.SerialException; +import static org.testng.Assert.*; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; +import util.BaseTest; + +public class SerialDataLinkTests extends BaseTest { + + private URL u; + private URL u1; + private SerialDatalink dl; + + @BeforeMethod + public void setUpMethod() throws Exception { + u = new URL("http://www.oracle.com/"); + u1 = new URL("http://www.usatoday.com/"); + dl = new SerialDatalink(u); + } + + /* + * Validate that a SerialException is thrown if the URL is null + */ + @Test(expectedExceptions = SerialException.class) + public void test() throws Exception { + SerialDatalink dl1 = new SerialDatalink(null); + } + + /* + * Validate that getDatalink() returns the same URL used to create the + * SerialDatalink object + */ + @Test + public void test01() throws Exception { + URL u2 = dl.getDatalink(); + assertTrue(u2.equals(u)); + assertTrue(u2.sameFile(u)); + } + + /* + * Validate that URL returned from getDatalink() differs from a URL that was + * not used to create the SerialDatalink + */ + @Test + public void test02() throws Exception { + URL u2 = dl.getDatalink(); + assertFalse(u2.equals(u1)); + assertFalse(u2.sameFile(u1)); + } + + /* + * Create a clone of a SerialDatalink and validate that it is equal to the + * SerialDatalink it was cloned from + */ + @Test + public void test03() throws Exception { + SerialDatalink dl2 = (SerialDatalink) dl.clone(); + assertTrue(dl.equals(dl2)); + SerialDatalink dl3 = new SerialDatalink(u1); + assertFalse(dl2.equals(dl3)); + } + + /* + * Validate that a SerialDatalink that is serialized & deserialized is + * equal to itself + */ + @Test + public void test04() throws Exception { + SerialDatalink dl2 = serializeDeserializeObject(dl); + SerialDatalink dl3 = new SerialDatalink(u); + assertTrue(dl.equals(dl2)); + assertTrue(dl3.equals(dl2)); + } + + /** + * Validate that a SerialDatalink that is serialized & deserialized is not equal + * to to a SerialDatalink created using a different URL + */ + @Test + public void test05() throws Exception { + SerialDatalink dl2 = serializeDeserializeObject(dl); + SerialDatalink d3 = new SerialDatalink(u1); + assertFalse(d3.equals(dl2)); + } +} diff --git a/test/javax/sql/testng/test/rowset/serial/SerialExceptionTests.java b/test/javax/sql/testng/test/rowset/serial/SerialExceptionTests.java new file mode 100644 index 000000000..ff963ae7b --- /dev/null +++ b/test/javax/sql/testng/test/rowset/serial/SerialExceptionTests.java @@ -0,0 +1,113 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package test.rowset.serial; + +import java.sql.SQLException; +import javax.sql.rowset.serial.SerialException; +import static org.testng.Assert.*; +import org.testng.annotations.Test; +import util.BaseTest; + +public class SerialExceptionTests extends BaseTest { + + /* + * Create SerialException with no-arg constructor + */ + @Test + public void test01() { + SerialException ex = new SerialException(); + assertTrue(ex.getMessage() == null + && ex.getSQLState() == null + && ex.getCause() == null + && ex.getErrorCode() == 0); + } + + /* + * Create SerialException with message + */ + @Test + public void test02() { + SerialException ex = new SerialException(reason); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState() == null + && ex.getCause() == null + && ex.getErrorCode() == 0); + } + + /* + * Validate that the ordering of the returned Exceptions is correct using + * for-each loop + */ + @Test + public void test03() { + SerialException ex = new SerialException("Exception 1"); + ex.initCause(t1); + SerialException ex1 = new SerialException("Exception 2"); + SerialException ex2 = new SerialException("Exception 3"); + ex2.initCause(t2); + ex.setNextException(ex1); + ex.setNextException(ex2); + int num = 0; + for (Throwable e : ex) { + assertTrue(msgs[num++].equals(e.getMessage())); + } + } + + /* + * Validate that the ordering of the returned Exceptions is correct using + * traditional while loop + */ + @Test + public void test04() { + SQLException ex = new SerialException("Exception 1"); + ex.initCause(t1); + SerialException ex1 = new SerialException("Exception 2"); + SerialException ex2 = new SerialException("Exception 3"); + ex2.initCause(t2); + ex.setNextException(ex1); + ex.setNextException(ex2); + int num = 0; + while (ex != null) { + assertTrue(msgs[num++].equals(ex.getMessage())); + Throwable c = ex.getCause(); + while (c != null) { + assertTrue(msgs[num++].equals(c.getMessage())); + c = c.getCause(); + } + ex = ex.getNextException(); + } + } + + /* + * Serialize a SerialException and make sure you can read it back properly + */ + @Test + public void test05() throws Exception { + SerialException e = new SerialException(reason); + SerialException ex1 = createSerializedException(e); + assertTrue(ex1.getMessage().equals(reason) + && ex1.getSQLState() == null + && ex1.getCause() == null + && ex1.getErrorCode() == 0);; + } +} diff --git a/test/javax/sql/testng/test/rowset/serial/SerialJavaObjectTests.java b/test/javax/sql/testng/test/rowset/serial/SerialJavaObjectTests.java new file mode 100644 index 000000000..cc2d18429 --- /dev/null +++ b/test/javax/sql/testng/test/rowset/serial/SerialJavaObjectTests.java @@ -0,0 +1,100 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package test.rowset.serial; + +import java.lang.reflect.Field; +import java.util.Arrays; +import javax.sql.rowset.RowSetMetaDataImpl; +import javax.sql.rowset.serial.SerialException; +import javax.sql.rowset.serial.SerialJavaObject; +import static org.testng.Assert.*; +import org.testng.annotations.Test; +import util.BaseTest; + +public class SerialJavaObjectTests extends BaseTest { + + /* + * Validate that an NPE is thrown when null is specified to create + * the SerialJavaObject + */ + @Test(expectedExceptions = NullPointerException.class) + public void test() throws Exception { + SerialJavaObject sjo = new SerialJavaObject(null); + } + + /* + * Validate that an SerialExcepion is thrown when the object specified + * contains public static fields + */ + @Test(expectedExceptions = SerialException.class, enabled = false) + public void test01() throws Exception { + SerialJavaObject sjo = new SerialJavaObject(new RowSetMetaDataImpl()); + } + + /* + * Validate that an getFields()s returns the same Field[] for the object + * used to create the SerialJavaObject + */ + @Test + public void test02() throws Exception { + SerialException e = new SerialException(); + SerialJavaObject sjo = new SerialJavaObject(e); + Field[] f = e.getClass().getFields(); + assertTrue(Arrays.equals(f, sjo.getFields())); + assertFalse(Arrays.equals("hello".getClass().getFields(), + sjo.getFields())); + } + + /* + * clone() a SerialJavaObject and check that it is equal to the + * object it was cloned from + */ + @Test + public void test03() throws Exception { + SerialJavaObject sjo = new SerialJavaObject("Hello"); + SerialJavaObject sjo2 = (SerialJavaObject) sjo.clone(); + assertTrue(sjo.equals(sjo2)); + } + + /** + * Validate that a SerialJavaObject that is serialized & deserialized is + * equal to itself + */ + @Test + public void test04() throws Exception { + SerialJavaObject sjo = new SerialJavaObject("Hello"); + SerialJavaObject sjo2 = serializeDeserializeObject(sjo); + assertTrue(sjo.equals(sjo2)); + } + + /* + * Validate that a getObject() returns an object used to create the + * SerialJavaObject + */ + @Test + public void test05() throws Exception { + String s = "Hello world"; + SerialJavaObject sjo = new SerialJavaObject(s); + assertTrue(s.equals(sjo.getObject())); + } +} diff --git a/test/javax/sql/testng/test/rowset/serial/SerialRefTests.java b/test/javax/sql/testng/test/rowset/serial/SerialRefTests.java new file mode 100644 index 000000000..8f23de70a --- /dev/null +++ b/test/javax/sql/testng/test/rowset/serial/SerialRefTests.java @@ -0,0 +1,131 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package test.rowset.serial; + +import java.sql.Ref; +import java.sql.SQLException; +import java.util.HashMap; +import java.util.Map; +import javax.sql.rowset.serial.SerialRef; +import static org.testng.Assert.*; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; +import util.BaseTest; +import util.StubRef; +import util.SuperHero; + +public class SerialRefTests extends BaseTest { + + private static Map> map = new HashMap<>(); + private Ref ref; + private final String sqlType = "SUPERHERO"; + private SuperHero hero; + + @BeforeMethod + public void setUpMethod() throws Exception { + map.put(sqlType, Class.forName("util.SuperHero")); + hero = new SuperHero(sqlType, "Bruce", "Wayne", 1939, "Batman"); + ref = new StubRef(sqlType, hero); + } + + /* + * Validate that a SQLException() is thrown if the Ref is null + */ + @Test(expectedExceptions = SQLException.class) + public void test01() throws Exception { + SerialRef sr = new SerialRef(null); + } + + /* + * Validate that a SQLException() is thrown if the typeName is null in the + * Ref used to create the SerialRef + */ + @Test(expectedExceptions = SQLException.class) + public void test02() throws Exception { + SerialRef sr = new SerialRef(new StubRef(null, hero)); + } + + /* + * Validate that getBaseTypeName() returns the same SQLType specified + * to create the Ref + */ + @Test + public void test03() throws Exception { + SerialRef sr = new SerialRef(ref); + assertEquals(sr.getBaseTypeName(), sqlType); + } + + /* + * Validate that getObject() returns the same object used to create the Ref + */ + @Test + public void test04() throws Exception { + SerialRef sr = new SerialRef(ref); + assertTrue(hero.equals(sr.getObject())); + } + + /* + * Validate that getObject() returns the same object used to create the Ref + */ + @Test(enabled = false) + public void test05() throws Exception { + SerialRef sr = new SerialRef(ref); + assertTrue(hero.equals(sr.getObject(map))); + } + + /* + * Validate that setObject() can be used to change the value of the object + * pointed to by the SerialRef + */ + @Test + public void test06() throws Exception { + SerialRef sr = new SerialRef(ref); + assertTrue(hero.equals(sr.getObject())); + SuperHero h = new SuperHero(sqlType, "Dick", "Grayson", 1940, "Robin"); + sr.setObject(h); + assertFalse(hero.equals(sr.getObject())); + } + + /* + * clone() a SerialRef and check that it is equal to the + * object it was cloned from + */ + @Test + public void test09() throws Exception { + SerialRef sr = new SerialRef(ref); + SerialRef sr1 = (SerialRef) sr.clone(); + assertTrue(sr.equals(sr1)); + } + + /** + * Validate that a SerialRef that is serialized & deserialized is equal to + * itself for the Object & baseTypeName + */ + @Test + public void test10() throws Exception { + SerialRef sr = new SerialRef(ref); + SerialRef sr1 = serializeDeserializeObject(sr); + assertTrue(sr1.getObject().equals(sr.getObject()) + && sr1.getBaseTypeName().equals(sr.getBaseTypeName())); + } +} diff --git a/test/javax/sql/testng/test/rowset/serial/SerialStructTests.java b/test/javax/sql/testng/test/rowset/serial/SerialStructTests.java new file mode 100644 index 000000000..84a0ff2aa --- /dev/null +++ b/test/javax/sql/testng/test/rowset/serial/SerialStructTests.java @@ -0,0 +1,140 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package test.rowset.serial; + +import java.sql.Struct; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import javax.sql.rowset.serial.SerialStruct; +import static org.testng.Assert.*; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; +import util.BaseTest; +import util.StubStruct; +import util.SuperHero; + +public class SerialStructTests extends BaseTest { + + private static Map> map = new HashMap<>(); + private Object[] attributes; + private Struct struct; + private final String sqlType = "SUPERHERO"; + private SuperHero hero; + + @BeforeMethod + public void setUpMethod() throws Exception { + attributes = new Object[]{"Bruce", "Wayne", 1939, + "Batman"}; + map.put(sqlType, Class.forName("util.SuperHero")); + struct = new StubStruct(sqlType, attributes); + hero = new SuperHero(sqlType, "Bruce", "Wayne", 1939, "Batman"); + } + + /* + * Validate that getSQLTypeName() returns the same SQLType specified by + * the Struct used to create the object + */ + @Test + public void test01() throws Exception { + SerialStruct ss = new SerialStruct(struct, map); + assertEquals(ss.getSQLTypeName(), sqlType); + } + + /* + * Validate that getSQLTypeName() returns the same SQLType specified by + * the Struct used to create the object + */ + @Test + public void test02() throws Exception { + SerialStruct ss = new SerialStruct(hero, map); + assertEquals(ss.getSQLTypeName(), sqlType); + } + + /* + * Validate that getAttributes() returns the same attributes specified by + * the Struct used to create the object + */ + @Test + public void test03() throws Exception { + SerialStruct ss = new SerialStruct(struct, map); + assertTrue(Arrays.equals(attributes, + ss.getAttributes())); + } + + /* + * Validate that getAttributes() returns the same attributes specified by + * the Struct used to create the object + */ + @Test + public void test04() throws Exception { + SerialStruct ss = new SerialStruct(hero, map); + assertTrue(Arrays.equals(attributes, + ss.getAttributes())); + } + + /* + * Validate that getAttributes() returns the + same attributes specified by + * the Struct used to create the object + */ + @Test + public void test05() throws Exception { + SerialStruct ss = new SerialStruct(struct, map); + assertTrue(Arrays.equals(attributes, + ss.getAttributes(map))); + } + + /* + * Validate that getAttributes() returns the same attributes specified by + * the Struct used to create the object + */ + @Test + public void test06() throws Exception { + SerialStruct ss = new SerialStruct(hero, map); + assertTrue(Arrays.equals(attributes, + ss.getAttributes(map))); + } + + /* + * clone() a SerialStruct and check that it is equal to the + * object it was cloned from + */ + @Test + public void test07() throws Exception { + SerialStruct ss = new SerialStruct(struct, map); + SerialStruct ss1 = (SerialStruct) ss.clone(); + assertTrue(ss.equals(ss1)); + } + + /** + * Validate that a SerialStruct that is serialized & deserialized is equal + * to itself + */ + @Test + public void test08() throws Exception { + SerialStruct ss = new SerialStruct(struct, map); + SerialStruct ss1 = serializeDeserializeObject(ss);; + assertTrue(ss.equals(ss1)); + } +} diff --git a/test/javax/sql/testng/test/rowset/spi/SyncFactoryExceptionTests.java b/test/javax/sql/testng/test/rowset/spi/SyncFactoryExceptionTests.java new file mode 100644 index 000000000..e93a6109e --- /dev/null +++ b/test/javax/sql/testng/test/rowset/spi/SyncFactoryExceptionTests.java @@ -0,0 +1,113 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package test.rowset.spi; + +import java.sql.SQLException; +import javax.sql.rowset.spi.SyncFactoryException; +import static org.testng.Assert.*; +import org.testng.annotations.Test; +import util.BaseTest; + +public class SyncFactoryExceptionTests extends BaseTest { + + /* + * Create SyncFactoryException with no-arg constructor + */ + @Test + public void test01() { + SyncFactoryException ex = new SyncFactoryException(); + assertTrue(ex.getMessage() == null + && ex.getSQLState() == null + && ex.getCause() == null + && ex.getErrorCode() == 0); + } + + /* + * Create SyncFactoryException with message + */ + @Test + public void test02() { + SyncFactoryException ex = new SyncFactoryException(reason); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState() == null + && ex.getCause() == null + && ex.getErrorCode() == 0); + } + + /* + * Validate that the ordering of the returned Exceptions is correct using + * for-each loop + */ + @Test + public void test03() { + SyncFactoryException ex = new SyncFactoryException("Exception 1"); + ex.initCause(t1); + SyncFactoryException ex1 = new SyncFactoryException("Exception 2"); + SyncFactoryException ex2 = new SyncFactoryException("Exception 3"); + ex2.initCause(t2); + ex.setNextException(ex1); + ex.setNextException(ex2); + int num = 0; + for (Throwable e : ex) { + assertTrue(msgs[num++].equals(e.getMessage())); + } + } + + /* + * Validate that the ordering of the returned Exceptions is correct using + * traditional while loop + */ + @Test + public void test04() { + SQLException ex = new SyncFactoryException("Exception 1"); + ex.initCause(t1); + SyncFactoryException ex1 = new SyncFactoryException("Exception 2"); + SyncFactoryException ex2 = new SyncFactoryException("Exception 3"); + ex2.initCause(t2); + ex.setNextException(ex1); + ex.setNextException(ex2); + int num = 0; + while (ex != null) { + assertTrue(msgs[num++].equals(ex.getMessage())); + Throwable c = ex.getCause(); + while (c != null) { + assertTrue(msgs[num++].equals(c.getMessage())); + c = c.getCause(); + } + ex = ex.getNextException(); + } + } + + /* + * Serialize a SyncFactoryException and make sure you can read it back properly + */ + @Test + public void test05() throws Exception { + SyncFactoryException e = new SyncFactoryException(reason); + SyncFactoryException ex1 = createSerializedException(e); + assertTrue(ex1.getMessage().equals(reason) + && ex1.getSQLState() == null + && ex1.getCause() == null + && ex1.getErrorCode() == 0); + } +} diff --git a/test/javax/sql/testng/test/rowset/spi/SyncFactoryPermissionsTests.java b/test/javax/sql/testng/test/rowset/spi/SyncFactoryPermissionsTests.java new file mode 100644 index 000000000..970d678f8 --- /dev/null +++ b/test/javax/sql/testng/test/rowset/spi/SyncFactoryPermissionsTests.java @@ -0,0 +1,179 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package test.rowset.spi; + +import java.security.AccessControlException; +import java.security.Policy; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.naming.Context; +import javax.sql.rowset.spi.SyncFactory; +import javax.sql.rowset.spi.SyncFactoryException; +import org.testng.annotations.AfterClass; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; +import util.BaseTest; +import util.StubContext; +import util.TestPolicy; + +public class SyncFactoryPermissionsTests extends BaseTest { + + Context ctx; + private static Policy policy; + private static SecurityManager sm; + private final Logger alogger = Logger.getLogger(this.getClass().getName()); + + /* + * Install a SeeurityManager along with a base Policy to allow testNG to run + */ + @BeforeClass + public static void setUpClass() throws Exception { + setPolicy(new TestPolicy()); + System.setSecurityManager(new SecurityManager()); + } + + /* + * Install the original Policy and SecurityManager + */ + @AfterClass + public static void tearDownClass() throws Exception { + System.setSecurityManager(sm); + setPolicy(policy); + } + + /* + * Initialize a Context to be used in our tests. + * Save off the original Policy and SecurityManager + */ + public SyncFactoryPermissionsTests() { + policy = Policy.getPolicy(); + sm = System.getSecurityManager(); + ctx = new StubContext(); + } + + /* + * Validate that AccessControlException is thrown if + * SQLPermission("setSyncFactory") has not been granted + */ + @Test(expectedExceptions = AccessControlException.class) + public void test() throws Exception { + setPolicy(new TestPolicy()); + SyncFactory.setJNDIContext(ctx); + } + + /* + * Validate that a SyncFactoryException is thrown if the Logger is null + */ + @Test(expectedExceptions = SyncFactoryException.class) + public void test00() throws SyncFactoryException { + Logger l = SyncFactory.getLogger(); + } + + /* + * Validate that setJNDIContext succeeds if SQLPermission("setSyncFactory") + * has been granted + */ + @Test + public void test01() throws Exception { + setPolicy(new TestPolicy("setSyncFactory")); + SyncFactory.setJNDIContext(ctx); + } + + /* + * Validate that setJNDIContext succeeds if AllPermissions has been granted + */ + @Test + public void test02() throws Exception { + setPolicy(new TestPolicy("all")); + SyncFactory.setJNDIContext(ctx); + } + + /* + * Validate that AccessControlException is thrown if + * SQLPermission("setSyncFactory") has not been granted + */ + @Test(expectedExceptions = AccessControlException.class) + public void test03() throws Exception { + setPolicy(new TestPolicy()); + SyncFactory.setLogger(alogger); + } + + /* + * Validate that setLogger succeeds if SQLPermission("setSyncFactory") + * has been granted + */ + @Test + public void test04() throws Exception { + setPolicy(new TestPolicy("setSyncFactory")); + SyncFactory.setLogger(alogger); + } + + /* + * Validate that setLogger succeeds if AllPermissions has been granted + */ + @Test + public void test05() throws Exception { + setPolicy(new TestPolicy("all")); + SyncFactory.setLogger(alogger); + } + + /* + * Validate that AccessControlException is thrown if + * SQLPermission("setSyncFactory") has not been granted + */ + @Test(expectedExceptions = AccessControlException.class) + public void test06() throws Exception { + setPolicy(new TestPolicy()); + SyncFactory.setLogger(alogger, Level.INFO); + } + + /* + * Validate that AccessControlException is thrown if + * SQLPermission("setSyncFactory") and LoggingPermission("control", null) + * have not been granted + */ + @Test(expectedExceptions = AccessControlException.class) + public void test07() throws Exception { + setPolicy(new TestPolicy("setSyncFactory")); + SyncFactory.setLogger(alogger, Level.INFO); + } + + /* + * Validate that setLogger succeeds if SQLPermission("setSyncFactory") + * has been granted + */ + @Test + public void test08() throws Exception { + setPolicy(new TestPolicy("setSyncFactoryLogger")); + SyncFactory.setLogger(alogger, Level.INFO); + } + + /* + * Validate that setLogger succeeds if AllPermissions has been granted + */ + @Test + public void test09() throws Exception { + setPolicy(new TestPolicy("all")); + SyncFactory.setLogger(alogger, Level.INFO); + } +} diff --git a/test/javax/sql/testng/test/rowset/spi/SyncFactoryTests.java b/test/javax/sql/testng/test/rowset/spi/SyncFactoryTests.java new file mode 100644 index 000000000..415488abb --- /dev/null +++ b/test/javax/sql/testng/test/rowset/spi/SyncFactoryTests.java @@ -0,0 +1,220 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package test.rowset.spi; + +import com.sun.rowset.providers.RIOptimisticProvider; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Enumeration; +import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.naming.Context; +import javax.sql.rowset.spi.SyncFactory; +import javax.sql.rowset.spi.SyncFactoryException; +import javax.sql.rowset.spi.SyncProvider; +import static org.testng.Assert.*; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; +import util.PropertyStubProvider; +import util.StubSyncProvider; +import util.StubContext; + +//com.sun.jndi.ldap.LdapCtxFactory +public class SyncFactoryTests { + private static String origFactory; + + private final String stubProvider = "util.StubSyncProvider"; + private final String propertyStubProvider = "util.PropertyStubProvider"; + private final Logger alogger = Logger.getLogger(this.getClass().getName()); + // Initial providers including those set via a property + List initialProviders; + // All providers including those specifically registered + List allProviders; + private Context ctx= null; + + public SyncFactoryTests() { + + // Add a provider via a property + System.setProperty("rowset.provider.classname", propertyStubProvider); + initialProviders = Arrays.asList( + "com.sun.rowset.providers.RIOptimisticProvider", + "com.sun.rowset.providers.RIXMLProvider", + propertyStubProvider); + allProviders = new ArrayList<>(); + allProviders.addAll(initialProviders); + allProviders.add(stubProvider); + ctx = new StubContext(); + } + + @BeforeMethod + public void setUpMethod() throws Exception { + // Make sure the provider provider that is registered is removed + // before each run + SyncFactory.unregisterProvider(stubProvider); + } + + /* + * Validate a non-null factory is returned + */ + @Test + public void test() throws SyncFactoryException { + SyncFactory syncFactory = SyncFactory.getSyncFactory(); + assertTrue(syncFactory != null); + } + + /* + * Check that the correct SyncProvider is returned for the specified + * providerID for the provider registered via a property + */ + @Test + public void test00() throws SyncFactoryException { + SyncProvider p = SyncFactory.getInstance(propertyStubProvider); + assertTrue(p instanceof PropertyStubProvider); + } + + /* + * Check that the correct SyncProvider is returned for the specified + * providerID + */ + @Test + public void test01() throws SyncFactoryException { + SyncFactory.registerProvider(stubProvider); + SyncProvider p = SyncFactory.getInstance(stubProvider); + assertTrue(p instanceof StubSyncProvider); + } + + /* + * Check that the Default SyncProvider is returned if an empty String is + * passed or if an invalid providerID is specified + */ + @Test + public void test02() throws SyncFactoryException { + SyncProvider p = SyncFactory.getInstance(""); + assertTrue(p instanceof RIOptimisticProvider); + // Attempt to get an invalid provider and get the default provider + p = SyncFactory.getInstance("util.InvalidSyncProvider"); + assertTrue(p instanceof RIOptimisticProvider); + } + + /* + * Validate that a SyncFactoryException is thrown if the ProviderID is null + */ + @Test(expectedExceptions = SyncFactoryException.class) + public void test03() throws SyncFactoryException { + SyncProvider p = SyncFactory.getInstance(null); + } + + /* + * Validate that a SyncFactoryException is thrown if the Logger is null + */ + @Test(expectedExceptions = SyncFactoryException.class,enabled=true) + public void test04() throws SyncFactoryException { + Logger l = SyncFactory.getLogger(); + } + + /* + * Validate that the correct logger is returned by getLogger + */ + @Test + public void test05() throws SyncFactoryException { + SyncFactory.setLogger(alogger); + Logger l = SyncFactory.getLogger(); + assertTrue(l.equals(alogger)); + } + + /* + * Validate that the correct logger is returned by getLogger + */ + @Test + public void test06() throws SyncFactoryException { + SyncFactory.setLogger(alogger, Level.INFO); + Logger l = SyncFactory.getLogger(); + assertTrue(l.equals(alogger)); + } + + /* + * Validate that a driver that is registered is returned by + * getRegisteredProviders and if it is unregistered, that it is + * not returned by getRegisteredProviders + */ + @Test + public void test07() throws SyncFactoryException { + + // Validate that only the default providers and any specified via + // a System property are available + validateProviders(initialProviders); + + // Register a provider and make sure it is avaiable + SyncFactory.registerProvider(stubProvider); + validateProviders(allProviders); + + // Check that if a provider is unregistered, it does not show as + // registered + SyncFactory.unregisterProvider(stubProvider); + validateProviders(initialProviders); + } + + /* + * Validate that setJNDIContext throws a SyncFactoryException if the + * context is null + */ + @Test(expectedExceptions = SyncFactoryException.class, enabled=true) + public void test08() throws Exception { + SyncFactory.setJNDIContext(null); + } + + /* + * Validate that setJNDIContext succeeds + */ + @Test(enabled=true) + public void test09() throws Exception { + SyncFactory.setJNDIContext(ctx); + } + + /* + * Utility method to validate the expected providers are regsitered + */ + private void validateProviders(List expectedProviders) + throws SyncFactoryException { + List results = new ArrayList<>(); + Enumeration providers = SyncFactory.getRegisteredProviders(); + + while (providers.hasMoreElements()) { + SyncProvider p = providers.nextElement(); + results.add(p.getProviderID()); + } + assertTrue(expectedProviders.containsAll(results) + && results.size() == expectedProviders.size()); + } + + /* + * Utility method to dump out SyncProvider info for a registered provider + */ + private void showImpl(SyncProvider impl) { + System.out.println("Provider implementation:" + + "\nVendor: " + impl.getVendor() + + "\nVersion: " + impl.getVersion() + + "\nProviderID: " + impl.getProviderID()); + } +} diff --git a/test/javax/sql/testng/test/rowset/spi/SyncProviderExceptionTests.java b/test/javax/sql/testng/test/rowset/spi/SyncProviderExceptionTests.java new file mode 100644 index 000000000..0b576b43f --- /dev/null +++ b/test/javax/sql/testng/test/rowset/spi/SyncProviderExceptionTests.java @@ -0,0 +1,187 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package test.rowset.spi; + +import com.sun.rowset.internal.SyncResolverImpl; +import java.sql.SQLException; +import javax.sql.rowset.spi.SyncProviderException; +import static org.testng.Assert.*; +import org.testng.annotations.AfterClass; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; +import util.BaseTest; +import util.StubSyncResolver; + +public class SyncProviderExceptionTests extends BaseTest { + @BeforeClass + public static void setUpClass() throws Exception { + System.out.println(System.getProperty("java.naming.factory.initial")); + } + + @AfterClass + public static void tearDownClass() throws Exception { + } + /* + * Create SyncProviderException with no-arg constructor + */ + @Test + public void test() { + SyncProviderException ex = new SyncProviderException(); + assertTrue(ex.getMessage() == null + && ex.getSQLState() == null + && ex.getCause() == null + && ex.getErrorCode() == 0 + && ex.getSyncResolver() instanceof SyncResolverImpl); + } + + /* + * Create SyncProviderException with no-arg constructor and + * call setSyncResolver to indicate the SyncResolver to use + */ + @Test + public void test01() { + SyncProviderException ex = new SyncProviderException(); + ex.setSyncResolver(new StubSyncResolver()); + assertTrue(ex.getMessage() == null + && ex.getSQLState() == null + && ex.getCause() == null + && ex.getErrorCode() == 0 + && ex.getSyncResolver() instanceof StubSyncResolver); + } + + /* + * Create SyncProviderException with message + */ + @Test + public void test02() { + SyncProviderException ex = new SyncProviderException(reason); + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState() == null + && ex.getCause() == null + && ex.getErrorCode() == 0 + && ex.getSyncResolver() instanceof SyncResolverImpl); + } + + /* + * Create SyncProviderException with message and + * call setSyncResolver to indicate the SyncResolver to use + */ + @Test + public void test03() { + SyncProviderException ex = new SyncProviderException(reason); + ex.setSyncResolver(new StubSyncResolver()); + + assertTrue(ex.getMessage().equals(reason) + && ex.getSQLState() == null + && ex.getCause() == null + && ex.getErrorCode() == 0 + && ex.getSyncResolver() instanceof StubSyncResolver); + } + + /* + * Create SyncProviderException with and specify the SyncResolver to use + */ + @Test + public void test04() { + SyncProviderException ex = new SyncProviderException(new StubSyncResolver()); + assertTrue(ex.getMessage() == null + && ex.getSQLState() == null + && ex.getCause() == null + && ex.getErrorCode() == 0 + && ex.getSyncResolver() instanceof StubSyncResolver); + } + + /* + * Validate that the ordering of the returned Exceptions is correct using + * for-each loop + */ + @Test + public void test05() { + SyncProviderException ex = new SyncProviderException("Exception 1"); + ex.initCause(t1); + SyncProviderException ex1 = new SyncProviderException("Exception 2"); + SyncProviderException ex2 = new SyncProviderException("Exception 3"); + ex2.initCause(t2); + ex.setNextException(ex1); + ex.setNextException(ex2); + int num = 0; + for (Throwable e : ex) { + assertTrue(msgs[num++].equals(e.getMessage())); + } + } + + /* + * Validate that the ordering of the returned Exceptions is correct using + * traditional while loop + */ + @Test + public void test06() { + SQLException ex = new SyncProviderException("Exception 1"); + ex.initCause(t1); + SyncProviderException ex1 = new SyncProviderException("Exception 2"); + SyncProviderException ex2 = new SyncProviderException("Exception 3"); + ex2.initCause(t2); + ex.setNextException(ex1); + ex.setNextException(ex2); + int num = 0; + while (ex != null) { + assertTrue(msgs[num++].equals(ex.getMessage())); + Throwable c = ex.getCause(); + while (c != null) { + assertTrue(msgs[num++].equals(c.getMessage())); + c = c.getCause(); + } + ex = ex.getNextException(); + } + } + + /* + * Serialize a SyncProviderException and make sure you can read it back properly + */ + @Test + public void test07() throws Exception { + SyncProviderException e = new SyncProviderException(reason); + SyncProviderException ex1 = createSerializedException(e); + assertTrue(ex1.getMessage().equals(reason) + && ex1.getSQLState() == null + && ex1.getCause() == null + && ex1.getErrorCode() == 0 + && ex1.getSyncResolver() instanceof SyncResolverImpl, ex1.getSyncResolver().getClass().getName()); + } + + /* + * Serialize a SyncProviderException and make sure you can read it back properly + */ + @Test + public void test08() throws Exception { + SyncProviderException e = new SyncProviderException(reason); + e.setSyncResolver(new StubSyncResolver()); + + SyncProviderException ex1 = createSerializedException(e); + assertTrue(ex1.getMessage().equals(reason) + && ex1.getSQLState() == null + && ex1.getCause() == null + && ex1.getErrorCode() == 0 + && ex1.getSyncResolver() instanceof StubSyncResolver); + } +} diff --git a/test/javax/sql/testng/test/rowset/webrowset/CommonWebRowSetTests.java b/test/javax/sql/testng/test/rowset/webrowset/CommonWebRowSetTests.java new file mode 100644 index 000000000..ce0801e0f --- /dev/null +++ b/test/javax/sql/testng/test/rowset/webrowset/CommonWebRowSetTests.java @@ -0,0 +1,400 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package test.rowset.webrowset; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileReader; +import java.io.InputStreamReader; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.io.OutputStreamWriter; +import java.math.BigDecimal; +import java.sql.ResultSet; +import java.util.Arrays; +import javax.sql.rowset.WebRowSet; +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertEqualsNoOrder; +import static org.testng.Assert.assertFalse; +import static org.testng.Assert.assertTrue; +import org.testng.annotations.Test; +import test.rowset.cachedrowset.CommonCachedRowSetTests; + +public abstract class CommonWebRowSetTests extends CommonCachedRowSetTests { + + protected final String XMLFILEPATH = System.getProperty("test.src", ".") + + File.separatorChar + "xml" + File.separatorChar; + protected final String COFFEE_ROWS_XML = XMLFILEPATH + "COFFEE_ROWS.xml"; + protected final String DELETED_COFFEE_ROWS_XML + = XMLFILEPATH + "DELETED_COFFEE_ROWS.xml"; + protected final String MODFIED_DELETED_COFFEE_ROWS_XML + = XMLFILEPATH + "MODFIED_DELETED_COFFEE_ROWS.xml"; + protected final String UPDATED_COFFEE_ROWS_XML + = XMLFILEPATH + "UPDATED_COFFEE_ROWS.xml"; + protected final String INSERTED_COFFEE_ROWS_XML + = XMLFILEPATH + "INSERTED_COFFEE_ROWS.xml"; + protected final String UPDATED_INSERTED_COFFEE_ROWS_XML + = XMLFILEPATH + "UPDATED_INSERTED_COFFEE_ROWS.xml"; + + + /* + * Utility method to write a WebRowSet XML file via an OutputStream + */ + protected ByteArrayOutputStream writeWebRowSetWithOutputStream(WebRowSet rs) throws Exception { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + try (ObjectOutputStream oos = new ObjectOutputStream(baos)) { + rs.writeXml(oos); + } + return baos; + } + + /* + * Utility method to write a WebRowSet XML file via an OutputStream + * and populating the WebRowSet via a ResultSet + */ + protected ByteArrayOutputStream writeWebRowSetWithOutputStream(ResultSet rs) throws Exception { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + try (ObjectOutputStream oos = new ObjectOutputStream(baos)) { + WebRowSet wrs = rsf.createWebRowSet(); + wrs.writeXml(rs, oos); + } + return baos; + } + + + /* + * Utility method to popoulate a WebRowSet via a InputStream + */ + protected WebRowSet readWebRowSetWithOInputStream(ByteArrayOutputStream baos) throws Exception { + WebRowSet wrs1 = rsf.createWebRowSet(); + try (ObjectInputStream ois + = new ObjectInputStream(new ByteArrayInputStream(baos.toByteArray()))) { + wrs1.readXml(ois); + } + return wrs1; + } + + /* + * Utility method to write a WebRowSet XML file via an Writer + */ + protected ByteArrayOutputStream writeWebRowSetWithOutputStreamWithWriter(WebRowSet rs) throws Exception { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + OutputStreamWriter osw = new OutputStreamWriter(baos); + rs.writeXml(osw); + return baos; + } + + /* + * Utility method to write a WebRowSet XML file via an Writer and populating + * the WebRowSet via a ResultSet + */ + protected ByteArrayOutputStream writeWebRowSetWithOutputStreamWithWriter(ResultSet rs) throws Exception { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + OutputStreamWriter osw = new OutputStreamWriter(baos); + WebRowSet wrs = rsf.createWebRowSet(); + wrs.writeXml(rs, osw); + return baos; + } + + /* + * Utility method to popoulate a WebRowSet via a Readar + */ + protected WebRowSet readWebRowSetWithOInputStreamWithReader(ByteArrayOutputStream baos) throws Exception { + WebRowSet wrs1 = rsf.createWebRowSet(); + InputStreamReader isr = new InputStreamReader(new ByteArrayInputStream(baos.toByteArray())); + wrs1.readXml(isr); + return wrs1; + } + + /* + * Validate the expected Rows are contained within the RowSet + */ + @Test(dataProvider = "rowsetUsingCoffees") + public void WebRowSetTest0000(WebRowSet wrs) throws Exception { + assertEquals(getPrimaryKeys(wrs), COFFEES_PRIMARY_KEYS); + assertEquals(wrs.size(), COFFEES_ROWS); + wrs.close(); + } + + /* + * Validate the expected Rows are contained within the RowSet + * populated by readXML(Reader) + */ + @Test(dataProvider = "rowSetType") + public void WebRowSetTest0001(WebRowSet wrs1) throws Exception { + + try (FileReader fr = new FileReader(COFFEE_ROWS_XML)) { + wrs1.readXml(fr); + } + assertEquals(getPrimaryKeys(wrs1), COFFEES_PRIMARY_KEYS); + assertEquals(wrs1.size(), COFFEES_ROWS); + wrs1.close(); + + } + + /* + * Validate the expected Rows are contained within the RowSet + * populated by readXML(InputStream) + */ + @Test(dataProvider = "rowSetType") + public void WebRowSetTest0002(WebRowSet wrs1) throws Exception { + try (FileInputStream fis = new FileInputStream(COFFEE_ROWS_XML)) { + wrs1.readXml(fis); + } + assertEquals(getPrimaryKeys(wrs1), COFFEES_PRIMARY_KEYS); + assertEquals(wrs1.size(), COFFEES_ROWS); + wrs1.close(); + } + + /* + * Write a WebRowSet via writeXML(OutputStream), read it + * back via readXML(InputStream) and validate the primary keys + * are the same + */ + @Test(dataProvider = "rowsetUsingCoffees") + public void WebRowSetTest0003(WebRowSet wrs) throws Exception { + ByteArrayOutputStream baos = writeWebRowSetWithOutputStream(wrs); + try (WebRowSet wrs1 = readWebRowSetWithOInputStream(baos)) { + assertEquals(getPrimaryKeys(wrs1), COFFEES_PRIMARY_KEYS); + assertEquals(wrs1.size(), COFFEES_ROWS); + } + } + + /* + * Write a ResultSet via writeXML(OutputStream), read it + * back via readXML(InputStream) and validate the primary keys + * are the same + */ + @Test(dataProvider = "rowsetUsingCoffees") + public void WebRowSetTest0004(WebRowSet wrs) throws Exception { + ResultSet rs = wrs; + rs.beforeFirst(); + ByteArrayOutputStream baos = writeWebRowSetWithOutputStream(rs); + try (WebRowSet wrs1 = readWebRowSetWithOInputStream(baos)) { + assertEquals(getPrimaryKeys(wrs1), COFFEES_PRIMARY_KEYS); + assertEquals(wrs1.size(), COFFEES_ROWS); + } + } + + /* + * Write a WebRowSet via writeXML(Writer), read it + * back via readXML(Reader) and validate the primary keys + * are the same + */ + @Test(dataProvider = "rowsetUsingCoffees") + public void WebRowSetTest0005(WebRowSet wrs) throws Exception { + ByteArrayOutputStream baos = writeWebRowSetWithOutputStreamWithWriter(wrs); + try (WebRowSet wrs1 = readWebRowSetWithOInputStreamWithReader(baos)) { + assertEquals(getPrimaryKeys(wrs1), COFFEES_PRIMARY_KEYS); + assertEquals(wrs1.size(), COFFEES_ROWS); + } + } + + /* + * Write a WebRowSet via writeXML(Writer), read it + * back via readXML(Reader) and validate the primary keys + * are the same + */ + @Test(dataProvider = "rowsetUsingCoffees") + public void WebRowSetTest0006(WebRowSet wrs) throws Exception { + ResultSet rs = wrs; + rs.beforeFirst(); + ByteArrayOutputStream baos = writeWebRowSetWithOutputStreamWithWriter(rs); + try (WebRowSet wrs1 = readWebRowSetWithOInputStreamWithReader(baos)) { + assertEquals(getPrimaryKeys(wrs1), COFFEES_PRIMARY_KEYS); + assertEquals(wrs1.size(), COFFEES_ROWS); + } + } + + /* + * Validate the expected Rows are contained within the RowSet + * after deleting the specified rows + */ + @Test(dataProvider = "rowsetUsingCoffees", enabled = false) + public void WebRowSetTest0007(WebRowSet wrs) throws Exception { + assertEquals(getPrimaryKeys(wrs), COFFEES_PRIMARY_KEYS); + int[] rowsToDelete = {2, 4}; + assertEquals(getPrimaryKeys(wrs), COFFEES_PRIMARY_KEYS); + for (int row : rowsToDelete) { + assertTrue(deleteRowByPrimaryKey(wrs, row, 1)); + } + + FileInputStream fis = new FileInputStream(MODFIED_DELETED_COFFEE_ROWS_XML); + try (WebRowSet wrs1 = rsf.createWebRowSet()) { + wrs1.readXml(fis); + // With setShowDeleted(false) which is the default, + // the deleted row should not be visible + for (int row : rowsToDelete) { + assertTrue(findRowByPrimaryKey(wrs1, row, 1)); + } + assertTrue(wrs.size() == COFFEES_ROWS); + // With setShowDeleted(true), the deleted row should be visible + for (int row : rowsToDelete) { + assertTrue(findRowByPrimaryKey(wrs, row, 1)); + } + } + } + + /* + * Validate the expected Rows are contained within the RowSet + * that was populated by reading an xml file with all rows + * marked as a currentRow + */ + @Test(dataProvider = "rowSetType") + public void WebRowSetTest0008(WebRowSet wrs1) throws Exception { + FileInputStream fis = new FileInputStream(COFFEE_ROWS_XML); + wrs1.readXml(fis); + assertTrue(wrs1.size() == COFFEES_ROWS); + assertEquals(getPrimaryKeys(wrs1), COFFEES_PRIMARY_KEYS); + // Validate that the rows are not marked as deleted, inserted or updated + wrs1.beforeFirst(); + while (wrs1.next()) { + assertFalse(wrs1.rowDeleted()); + assertFalse(wrs1.rowInserted()); + assertFalse(wrs1.rowUpdated()); + } + wrs1.close(); + } + + /* + * Read an XML file to populate a WebRowSet and validate that the rows + * that are marked as deleted are marked as such in the WebRowSet + * Also validate that they are or are not visible based on the + * setShowDeleted value + */ + @Test(dataProvider = "rowSetType") + public void WebRowSetTest0009(WebRowSet wrs1) throws Exception { + int[] rowsToDelete = {2, 4}; + Object[] expectedRows = {1, 3, 5}; + FileInputStream fis = new FileInputStream(DELETED_COFFEE_ROWS_XML); + wrs1.readXml(fis); + assertTrue(wrs1.size() == COFFEES_ROWS); + assertEquals(getPrimaryKeys(wrs1), expectedRows); + // With setShowDeleted(false) which is the default, + // the deleted row should not be visible + for (int row : rowsToDelete) { + assertFalse(findRowByPrimaryKey(wrs1, row, 1)); + } + // With setShowDeleted(true), the deleted row should be visible + wrs1.setShowDeleted(true); + for (int row : rowsToDelete) { + assertTrue(findRowByPrimaryKey(wrs1, row, 1)); + } + assertEquals(getPrimaryKeys(wrs1), COFFEES_PRIMARY_KEYS); + wrs1.close(); + + } + + /* + * Validate that the correct row in the WebRowSet that had been created + * from an xml file is marked as updated and contains the correct values + */ + @Test(dataProvider = "rowSetType") + public void WebRowSetTest0010(WebRowSet wrs1) throws Exception { + FileInputStream fis = new FileInputStream(UPDATED_COFFEE_ROWS_XML); + wrs1.readXml(fis); + assertTrue(wrs1.size() == COFFEES_ROWS); + assertEquals(getPrimaryKeys(wrs1), COFFEES_PRIMARY_KEYS); + wrs1.beforeFirst(); + while (wrs1.next()) { + if (wrs1.getInt(1) == 3) { + assertTrue(wrs1.rowUpdated()); + assertTrue(wrs1.getInt(5) == 21 && wrs1.getInt(6) == 69); + assertFalse(wrs1.rowDeleted()); + assertFalse(wrs1.rowInserted()); + } else { + assertFalse(wrs1.rowUpdated()); + assertFalse(wrs1.rowDeleted()); + assertFalse(wrs1.rowInserted()); + } + } + wrs1.close(); + } + + /* + * Validate the correct row is marked as inserted in a WebRowSet + * that is read from an xml file + */ + @Test(dataProvider = "rowSetType") + public void WebRowSetTest0011(WebRowSet wrs1) throws Exception { + int expectedSize = COFFEES_ROWS + 2; + int addedRowPK = 15; + int addedRowPK2 = 20; + Object[] expected = Arrays.copyOf(COFFEES_PRIMARY_KEYS, expectedSize); + expected[expectedSize - 2] = addedRowPK; + expected[expectedSize - 1] = addedRowPK2; + FileInputStream fis = new FileInputStream(INSERTED_COFFEE_ROWS_XML); + wrs1.readXml(fis); + assertTrue(wrs1.size() == expectedSize); + assertEqualsNoOrder(getPrimaryKeys(wrs1), expected); + wrs1.beforeFirst(); + while (wrs1.next()) { + if (wrs1.getInt(1) == 15 || wrs1.getInt(1) == 20) { + assertTrue(wrs1.rowInserted()); + assertFalse(wrs1.rowDeleted()); + assertFalse(wrs1.rowUpdated()); + } else { + assertFalse(wrs1.rowInserted()); + assertFalse(wrs1.rowDeleted()); + assertFalse(wrs1.rowUpdated()); + } + } + wrs1.close(); + } + + /* + * Read an xml file which contains a row that was inserted and updated + */ + @Test(dataProvider = "rowSetType") + public void WebRowSetTest0012(WebRowSet wrs1) throws Exception { + int expectedSize = COFFEES_ROWS + 1; + int addedRowPK = 100; + Object[] expected = Arrays.copyOf(COFFEES_PRIMARY_KEYS, expectedSize); + expected[expectedSize - 1] = addedRowPK; + FileInputStream fis = new FileInputStream(UPDATED_INSERTED_COFFEE_ROWS_XML); + wrs1.readXml(fis); + assertTrue(wrs1.size() == expectedSize); + assertEquals(getPrimaryKeys(wrs1), expected); + wrs1.beforeFirst(); + while (wrs1.next()) { + if (wrs1.getInt(1) == addedRowPK) { + // Row that was inserted and updated + assertTrue(wrs1.rowUpdated()); + assertTrue( + wrs1.getBigDecimal(4).equals(BigDecimal.valueOf(12.99)) + && wrs1.getInt(6) == 125); + assertFalse(wrs1.rowDeleted()); + assertTrue(wrs1.rowInserted()); + } else { + // Remaining rows should only be inserted + assertFalse(wrs1.rowUpdated()); + assertFalse(wrs1.rowDeleted()); + assertTrue(wrs1.rowInserted()); + } + } + wrs1.close(); + } + +} diff --git a/test/javax/sql/testng/test/rowset/webrowset/WebRowSetTests.java b/test/javax/sql/testng/test/rowset/webrowset/WebRowSetTests.java new file mode 100644 index 000000000..5f2890e0b --- /dev/null +++ b/test/javax/sql/testng/test/rowset/webrowset/WebRowSetTests.java @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package test.rowset.webrowset; + +import java.sql.SQLException; +import javax.sql.rowset.WebRowSet; + +public class WebRowSetTests extends CommonWebRowSetTests { + + @Override + protected WebRowSet newInstance() throws SQLException { + return rsf.createWebRowSet(); + } + +} diff --git a/test/javax/sql/testng/util/PropertyStubProvider.java b/test/javax/sql/testng/util/PropertyStubProvider.java new file mode 100644 index 000000000..d397cc1c7 --- /dev/null +++ b/test/javax/sql/testng/util/PropertyStubProvider.java @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package util; + +public class PropertyStubProvider extends StubSyncProvider { + +} diff --git a/test/javax/sql/testng/util/StubArray.java b/test/javax/sql/testng/util/StubArray.java new file mode 100644 index 000000000..1d2ef0e5b --- /dev/null +++ b/test/javax/sql/testng/util/StubArray.java @@ -0,0 +1,99 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package util; + +import java.sql.Array; +import java.sql.JDBCType; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Arrays; +import java.util.Map; + +public class StubArray implements Array { + + private String typeName; + Object[] elements; + + public StubArray(String name, Object[] values) { + typeName = name; + elements = Arrays.copyOf(values, values.length); + + } + + @Override + public String getBaseTypeName() throws SQLException { + return typeName; + } + + @Override + public int getBaseType() throws SQLException { + return JDBCType.valueOf(typeName).getVendorTypeNumber(); + } + + @Override + public Object getArray() throws SQLException { + return Arrays.copyOf(elements, elements.length); + } + + @Override + public Object getArray(Map> map) throws SQLException { + return getArray(); + } + + @Override + public Object getArray(long index, int count) throws SQLException { + return getArray(); + } + + @Override + public Object getArray(long index, int count, Map> map) throws SQLException { + return getArray(); + } + + @Override + public ResultSet getResultSet() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public ResultSet getResultSet(Map> map) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public ResultSet getResultSet(long index, int count) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public ResultSet getResultSet(long index, int count, Map> map) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void free() throws SQLException { + elements = null; + typeName = null; + } + +} diff --git a/test/javax/sql/testng/util/StubBaseRowSet.java b/test/javax/sql/testng/util/StubBaseRowSet.java new file mode 100644 index 000000000..e003b522e --- /dev/null +++ b/test/javax/sql/testng/util/StubBaseRowSet.java @@ -0,0 +1,1001 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package util; + +import java.io.InputStream; +import java.io.Reader; +import java.math.BigDecimal; +import java.sql.Array; +import java.sql.Blob; +import java.sql.Clob; +import java.sql.Date; +import java.sql.NClob; +import java.sql.Ref; +import java.sql.ResultSetMetaData; +import java.sql.RowId; +import java.sql.SQLException; +import java.sql.SQLWarning; +import java.sql.SQLXML; +import java.sql.Statement; +import java.sql.Time; +import java.sql.Timestamp; +import java.util.Calendar; +import java.util.Map; +import javax.sql.RowSet; +import javax.sql.rowset.BaseRowSet; + +public class StubBaseRowSet extends BaseRowSet implements RowSet { + + public StubBaseRowSet() { + super(); + // Must call initParams() as part of initialization + super.initParams(); + } + + public void notifyCursorMoved() throws SQLException { + super.notifyCursorMoved(); + } + + public void notifyRowChanged() throws SQLException { + super.notifyRowChanged(); + } + + public void notifyRowSetChanged() throws SQLException { + super.notifyRowSetChanged(); + } + + public void initParams() { + super.initParams(); + } + + // Methods required by RowSet interace, not used + @Override + public void execute() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean next() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void close() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean wasNull() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getString(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean getBoolean(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public byte getByte(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public short getShort(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getInt(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public long getLong(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public float getFloat(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public double getDouble(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public byte[] getBytes(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Date getDate(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Time getTime(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Timestamp getTimestamp(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public InputStream getAsciiStream(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public InputStream getUnicodeStream(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public InputStream getBinaryStream(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getString(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean getBoolean(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public byte getByte(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public short getShort(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getInt(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public long getLong(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public float getFloat(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public double getDouble(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public BigDecimal getBigDecimal(String columnLabel, int scale) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public byte[] getBytes(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Date getDate(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Time getTime(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Timestamp getTimestamp(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public InputStream getAsciiStream(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public InputStream getUnicodeStream(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public InputStream getBinaryStream(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public SQLWarning getWarnings() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void clearWarnings() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getCursorName() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public ResultSetMetaData getMetaData() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Object getObject(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Object getObject(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int findColumn(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Reader getCharacterStream(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Reader getCharacterStream(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public BigDecimal getBigDecimal(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public BigDecimal getBigDecimal(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean isBeforeFirst() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean isAfterLast() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean isFirst() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean isLast() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void beforeFirst() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void afterLast() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean first() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean last() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getRow() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean absolute(int row) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean relative(int rows) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean previous() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean rowUpdated() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean rowInserted() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean rowDeleted() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNull(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBoolean(int columnIndex, boolean x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateByte(int columnIndex, byte x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateShort(int columnIndex, short x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateInt(int columnIndex, int x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateLong(int columnIndex, long x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateFloat(int columnIndex, float x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateDouble(int columnIndex, double x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBigDecimal(int columnIndex, BigDecimal x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateString(int columnIndex, String x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBytes(int columnIndex, byte[] x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateDate(int columnIndex, Date x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateTime(int columnIndex, Time x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateTimestamp(int columnIndex, Timestamp x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateAsciiStream(int columnIndex, InputStream x, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBinaryStream(int columnIndex, InputStream x, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateCharacterStream(int columnIndex, Reader x, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateObject(int columnIndex, Object x, int scaleOrLength) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateObject(int columnIndex, Object x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNull(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBoolean(String columnLabel, boolean x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateByte(String columnLabel, byte x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateShort(String columnLabel, short x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateInt(String columnLabel, int x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateLong(String columnLabel, long x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateFloat(String columnLabel, float x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateDouble(String columnLabel, double x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBigDecimal(String columnLabel, BigDecimal x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateString(String columnLabel, String x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBytes(String columnLabel, byte[] x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateDate(String columnLabel, Date x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateTime(String columnLabel, Time x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateTimestamp(String columnLabel, Timestamp x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateAsciiStream(String columnLabel, InputStream x, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBinaryStream(String columnLabel, InputStream x, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateCharacterStream(String columnLabel, Reader reader, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateObject(String columnLabel, Object x, int scaleOrLength) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateObject(String columnLabel, Object x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void insertRow() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateRow() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void deleteRow() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void refreshRow() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void cancelRowUpdates() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void moveToInsertRow() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void moveToCurrentRow() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Statement getStatement() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Object getObject(int columnIndex, Map> map) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Ref getRef(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Blob getBlob(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Clob getClob(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Array getArray(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Object getObject(String columnLabel, Map> map) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Ref getRef(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Blob getBlob(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Clob getClob(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Array getArray(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Date getDate(int columnIndex, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Date getDate(String columnLabel, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Time getTime(int columnIndex, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Time getTime(String columnLabel, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Timestamp getTimestamp(int columnIndex, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Timestamp getTimestamp(String columnLabel, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public java.net.URL getURL(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public java.net.URL getURL(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateRef(int columnIndex, Ref x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateRef(String columnLabel, Ref x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBlob(int columnIndex, Blob x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBlob(String columnLabel, Blob x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateClob(int columnIndex, Clob x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateClob(String columnLabel, Clob x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateArray(int columnIndex, Array x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateArray(String columnLabel, Array x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public RowId getRowId(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public RowId getRowId(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateRowId(int columnIndex, RowId x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateRowId(String columnLabel, RowId x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getHoldability() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean isClosed() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNString(int columnIndex, String nString) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNString(String columnLabel, String nString) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNClob(int columnIndex, NClob nClob) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNClob(String columnLabel, NClob nClob) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public NClob getNClob(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public NClob getNClob(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public SQLXML getSQLXML(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public SQLXML getSQLXML(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateSQLXML(int columnIndex, SQLXML xmlObject) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateSQLXML(String columnLabel, SQLXML xmlObject) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getNString(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getNString(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Reader getNCharacterStream(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Reader getNCharacterStream(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNCharacterStream(int columnIndex, Reader x, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNCharacterStream(String columnLabel, Reader reader, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateAsciiStream(int columnIndex, InputStream x, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBinaryStream(int columnIndex, InputStream x, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateCharacterStream(int columnIndex, Reader x, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateAsciiStream(String columnLabel, InputStream x, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBinaryStream(String columnLabel, InputStream x, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateCharacterStream(String columnLabel, Reader reader, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBlob(int columnIndex, InputStream inputStream, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBlob(String columnLabel, InputStream inputStream, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateClob(int columnIndex, Reader reader, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateClob(String columnLabel, Reader reader, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNClob(int columnIndex, Reader reader, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNClob(String columnLabel, Reader reader, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNCharacterStream(int columnIndex, Reader x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNCharacterStream(String columnLabel, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateAsciiStream(int columnIndex, InputStream x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBinaryStream(int columnIndex, InputStream x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateCharacterStream(int columnIndex, Reader x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateAsciiStream(String columnLabel, InputStream x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBinaryStream(String columnLabel, InputStream x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateCharacterStream(String columnLabel, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBlob(int columnIndex, InputStream inputStream) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBlob(String columnLabel, InputStream inputStream) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateClob(int columnIndex, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateClob(String columnLabel, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNClob(int columnIndex, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNClob(String columnLabel, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public T getObject(int columnIndex, Class type) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public T getObject(String columnLabel, Class type) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public T unwrap(Class iface) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean isWrapperFor(Class iface) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } +} diff --git a/test/javax/sql/testng/util/StubBlob.java b/test/javax/sql/testng/util/StubBlob.java new file mode 100644 index 000000000..727e8a926 --- /dev/null +++ b/test/javax/sql/testng/util/StubBlob.java @@ -0,0 +1,100 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package util; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.ObjectOutputStream; +import java.io.OutputStream; +import java.sql.Blob; +import java.sql.SQLException; +import java.util.Arrays; +import java.util.logging.Level; +import java.util.logging.Logger; + +public class StubBlob implements Blob { + + private byte[] bytes; + + public StubBlob() { + bytes = new byte[]{2, 4, 6, 8}; + } + + public long length() throws SQLException { + return bytes.length; + } + + public byte[] getBytes(long pos, int length) + throws SQLException { + return Arrays.copyOfRange(bytes, (int) pos - 1, length); + } + + public InputStream getBinaryStream() + throws SQLException { + return null; + } + + public long position(byte[] pattern, long start) + throws SQLException { + return 0; + } + + public long position(Blob pattern, long start) + throws SQLException { + return 0; + } + + public int setBytes(long pos, byte[] bytes) + throws SQLException { + return 0; + } + + public int setBytes(long pos, byte[] bytes, int offset, int len) + throws SQLException { + return 0; + } + + public OutputStream setBinaryStream(long pos) + throws SQLException { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + ObjectOutputStream oos = null; + try { + oos = new ObjectOutputStream(baos); + } catch (IOException ex) { + Logger.getLogger(StubBlob.class.getName()).log(Level.SEVERE, null, ex); + } + return oos; + } + + public void truncate(long len) + throws SQLException { + } + + public void free() throws SQLException { + } + + public InputStream getBinaryStream(long pos, long length) throws SQLException { + return null; + } +} diff --git a/test/javax/sql/testng/util/StubCachedRowSetImpl.java b/test/javax/sql/testng/util/StubCachedRowSetImpl.java new file mode 100644 index 000000000..9000deb1b --- /dev/null +++ b/test/javax/sql/testng/util/StubCachedRowSetImpl.java @@ -0,0 +1,1848 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package util; + +import java.io.InputStream; +import java.io.Reader; +import java.math.BigDecimal; +import java.net.URL; +import java.sql.Array; +import java.sql.Blob; +import java.sql.Clob; +import java.sql.Connection; +import java.sql.Date; +import java.sql.NClob; +import java.sql.Ref; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.sql.RowId; +import java.sql.SQLException; +import java.sql.SQLWarning; +import java.sql.SQLXML; +import java.sql.Savepoint; +import java.sql.Statement; +import java.sql.Time; +import java.sql.Timestamp; +import java.util.Calendar; +import java.util.Collection; +import java.util.Map; +import javax.sql.RowSet; +import javax.sql.RowSetEvent; +import javax.sql.RowSetListener; +import javax.sql.RowSetMetaData; +import javax.sql.rowset.CachedRowSet; +import javax.sql.rowset.RowSetWarning; +import javax.sql.rowset.spi.SyncProvider; +import javax.sql.rowset.spi.SyncProviderException; + +public class StubCachedRowSetImpl implements CachedRowSet { + + public StubCachedRowSetImpl() { + } + + @Override + public void populate(ResultSet data) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void execute(Connection conn) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void acceptChanges() throws SyncProviderException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void acceptChanges(Connection con) throws SyncProviderException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void restoreOriginal() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void release() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void undoDelete() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void undoInsert() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void undoUpdate() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean columnUpdated(int idx) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean columnUpdated(String columnName) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Collection toCollection() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Collection toCollection(int column) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Collection toCollection(String column) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public SyncProvider getSyncProvider() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setSyncProvider(String provider) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int size() { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setMetaData(RowSetMetaData md) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public ResultSet getOriginal() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public ResultSet getOriginalRow() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setOriginalRow() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getTableName() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setTableName(String tabName) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int[] getKeyColumns() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setKeyColumns(int[] keys) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public RowSet createShared() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public CachedRowSet createCopy() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public CachedRowSet createCopySchema() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public CachedRowSet createCopyNoConstraints() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public RowSetWarning getRowSetWarnings() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean getShowDeleted() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setShowDeleted(boolean b) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void commit() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void rollback() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void rollback(Savepoint s) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void rowSetPopulated(RowSetEvent event, int numRows) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void populate(ResultSet rs, int startRow) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setPageSize(int size) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getPageSize() { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean nextPage() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean previousPage() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getUrl() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setUrl(String url) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getDataSourceName() { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setDataSourceName(String name) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getUsername() { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setUsername(String name) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getPassword() { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setPassword(String password) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getTransactionIsolation() { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setTransactionIsolation(int level) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Map> getTypeMap() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setTypeMap(Map> map) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getCommand() { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setCommand(String cmd) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean isReadOnly() { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setReadOnly(boolean value) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getMaxFieldSize() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setMaxFieldSize(int max) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getMaxRows() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setMaxRows(int max) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean getEscapeProcessing() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setEscapeProcessing(boolean enable) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getQueryTimeout() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setQueryTimeout(int seconds) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setType(int type) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setConcurrency(int concurrency) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNull(int parameterIndex, int sqlType) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNull(String parameterName, int sqlType) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNull(int paramIndex, int sqlType, String typeName) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNull(String parameterName, int sqlType, String typeName) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBoolean(int parameterIndex, boolean x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBoolean(String parameterName, boolean x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setByte(int parameterIndex, byte x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setByte(String parameterName, byte x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setShort(int parameterIndex, short x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setShort(String parameterName, short x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setInt(int parameterIndex, int x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setInt(String parameterName, int x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setLong(int parameterIndex, long x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setLong(String parameterName, long x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setFloat(int parameterIndex, float x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setFloat(String parameterName, float x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setDouble(int parameterIndex, double x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setDouble(String parameterName, double x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBigDecimal(String parameterName, BigDecimal x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setString(int parameterIndex, String x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setString(String parameterName, String x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBytes(int parameterIndex, byte[] x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBytes(String parameterName, byte[] x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setDate(int parameterIndex, Date x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setTime(int parameterIndex, Time x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setTimestamp(int parameterIndex, Timestamp x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setTimestamp(String parameterName, Timestamp x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setAsciiStream(int parameterIndex, InputStream x, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setAsciiStream(String parameterName, InputStream x, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBinaryStream(int parameterIndex, InputStream x, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBinaryStream(String parameterName, InputStream x, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setCharacterStream(int parameterIndex, Reader reader, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setCharacterStream(String parameterName, Reader reader, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setAsciiStream(int parameterIndex, InputStream x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setAsciiStream(String parameterName, InputStream x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBinaryStream(int parameterIndex, InputStream x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBinaryStream(String parameterName, InputStream x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setCharacterStream(int parameterIndex, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setCharacterStream(String parameterName, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNCharacterStream(int parameterIndex, Reader value) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setObject(int parameterIndex, Object x, int targetSqlType, int scaleOrLength) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setObject(String parameterName, Object x, int targetSqlType, int scale) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setObject(int parameterIndex, Object x, int targetSqlType) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setObject(String parameterName, Object x, int targetSqlType) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setObject(String parameterName, Object x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setObject(int parameterIndex, Object x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setRef(int i, Ref x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBlob(int i, Blob x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBlob(int parameterIndex, InputStream inputStream, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBlob(int parameterIndex, InputStream inputStream) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBlob(String parameterName, InputStream inputStream, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBlob(String parameterName, Blob x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBlob(String parameterName, InputStream inputStream) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setClob(int i, Clob x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setClob(int parameterIndex, Reader reader, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setClob(int parameterIndex, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setClob(String parameterName, Reader reader, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setClob(String parameterName, Clob x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setClob(String parameterName, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setArray(int i, Array x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setDate(int parameterIndex, Date x, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setDate(String parameterName, Date x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setDate(String parameterName, Date x, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setTime(int parameterIndex, Time x, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setTime(String parameterName, Time x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setTime(String parameterName, Time x, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setTimestamp(int parameterIndex, Timestamp x, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setTimestamp(String parameterName, Timestamp x, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void clearParameters() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void execute() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void addRowSetListener(RowSetListener listener) { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void removeRowSetListener(RowSetListener listener) { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setSQLXML(String parameterName, SQLXML xmlObject) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setRowId(int parameterIndex, RowId x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setRowId(String parameterName, RowId x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNString(int parameterIndex, String value) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNString(String parameterName, String value) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNCharacterStream(int parameterIndex, Reader value, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNCharacterStream(String parameterName, Reader value, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNCharacterStream(String parameterName, Reader value) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNClob(String parameterName, NClob value) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNClob(String parameterName, Reader reader, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNClob(String parameterName, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNClob(int parameterIndex, Reader reader, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNClob(int parameterIndex, NClob value) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNClob(int parameterIndex, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setURL(int parameterIndex, URL x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean next() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void close() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean wasNull() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getString(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean getBoolean(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public byte getByte(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public short getShort(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getInt(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public long getLong(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public float getFloat(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public double getDouble(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public byte[] getBytes(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Date getDate(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Time getTime(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Timestamp getTimestamp(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public InputStream getAsciiStream(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public InputStream getUnicodeStream(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public InputStream getBinaryStream(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getString(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean getBoolean(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public byte getByte(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public short getShort(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getInt(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public long getLong(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public float getFloat(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public double getDouble(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public BigDecimal getBigDecimal(String columnLabel, int scale) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public byte[] getBytes(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Date getDate(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Time getTime(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Timestamp getTimestamp(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public InputStream getAsciiStream(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public InputStream getUnicodeStream(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public InputStream getBinaryStream(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public SQLWarning getWarnings() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void clearWarnings() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getCursorName() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public ResultSetMetaData getMetaData() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Object getObject(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Object getObject(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int findColumn(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Reader getCharacterStream(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Reader getCharacterStream(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public BigDecimal getBigDecimal(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public BigDecimal getBigDecimal(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean isBeforeFirst() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean isAfterLast() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean isFirst() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean isLast() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void beforeFirst() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void afterLast() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean first() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean last() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getRow() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean absolute(int row) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean relative(int rows) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean previous() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setFetchDirection(int direction) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getFetchDirection() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setFetchSize(int rows) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getFetchSize() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getType() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getConcurrency() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean rowUpdated() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean rowInserted() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean rowDeleted() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNull(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBoolean(int columnIndex, boolean x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateByte(int columnIndex, byte x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateShort(int columnIndex, short x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateInt(int columnIndex, int x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateLong(int columnIndex, long x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateFloat(int columnIndex, float x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateDouble(int columnIndex, double x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBigDecimal(int columnIndex, BigDecimal x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateString(int columnIndex, String x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBytes(int columnIndex, byte[] x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateDate(int columnIndex, Date x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateTime(int columnIndex, Time x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateTimestamp(int columnIndex, Timestamp x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateAsciiStream(int columnIndex, InputStream x, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBinaryStream(int columnIndex, InputStream x, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateCharacterStream(int columnIndex, Reader x, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateObject(int columnIndex, Object x, int scaleOrLength) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateObject(int columnIndex, Object x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNull(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBoolean(String columnLabel, boolean x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateByte(String columnLabel, byte x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateShort(String columnLabel, short x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateInt(String columnLabel, int x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateLong(String columnLabel, long x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateFloat(String columnLabel, float x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateDouble(String columnLabel, double x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBigDecimal(String columnLabel, BigDecimal x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateString(String columnLabel, String x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBytes(String columnLabel, byte[] x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateDate(String columnLabel, Date x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateTime(String columnLabel, Time x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateTimestamp(String columnLabel, Timestamp x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateAsciiStream(String columnLabel, InputStream x, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBinaryStream(String columnLabel, InputStream x, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateCharacterStream(String columnLabel, Reader reader, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateObject(String columnLabel, Object x, int scaleOrLength) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateObject(String columnLabel, Object x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void insertRow() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateRow() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void deleteRow() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void refreshRow() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void cancelRowUpdates() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void moveToInsertRow() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void moveToCurrentRow() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Statement getStatement() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Object getObject(int columnIndex, Map> map) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Ref getRef(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Blob getBlob(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Clob getClob(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Array getArray(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Object getObject(String columnLabel, Map> map) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Ref getRef(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Blob getBlob(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Clob getClob(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Array getArray(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Date getDate(int columnIndex, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Date getDate(String columnLabel, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Time getTime(int columnIndex, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Time getTime(String columnLabel, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Timestamp getTimestamp(int columnIndex, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Timestamp getTimestamp(String columnLabel, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public URL getURL(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public URL getURL(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateRef(int columnIndex, Ref x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateRef(String columnLabel, Ref x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBlob(int columnIndex, Blob x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBlob(String columnLabel, Blob x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateClob(int columnIndex, Clob x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateClob(String columnLabel, Clob x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateArray(int columnIndex, Array x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateArray(String columnLabel, Array x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public RowId getRowId(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public RowId getRowId(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateRowId(int columnIndex, RowId x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateRowId(String columnLabel, RowId x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getHoldability() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean isClosed() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNString(int columnIndex, String nString) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNString(String columnLabel, String nString) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNClob(int columnIndex, NClob nClob) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNClob(String columnLabel, NClob nClob) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public NClob getNClob(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public NClob getNClob(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public SQLXML getSQLXML(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public SQLXML getSQLXML(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateSQLXML(int columnIndex, SQLXML xmlObject) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateSQLXML(String columnLabel, SQLXML xmlObject) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getNString(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getNString(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Reader getNCharacterStream(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Reader getNCharacterStream(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNCharacterStream(int columnIndex, Reader x, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNCharacterStream(String columnLabel, Reader reader, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateAsciiStream(int columnIndex, InputStream x, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBinaryStream(int columnIndex, InputStream x, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateCharacterStream(int columnIndex, Reader x, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateAsciiStream(String columnLabel, InputStream x, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBinaryStream(String columnLabel, InputStream x, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateCharacterStream(String columnLabel, Reader reader, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBlob(int columnIndex, InputStream inputStream, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBlob(String columnLabel, InputStream inputStream, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateClob(int columnIndex, Reader reader, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateClob(String columnLabel, Reader reader, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNClob(int columnIndex, Reader reader, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNClob(String columnLabel, Reader reader, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNCharacterStream(int columnIndex, Reader x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNCharacterStream(String columnLabel, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateAsciiStream(int columnIndex, InputStream x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBinaryStream(int columnIndex, InputStream x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateCharacterStream(int columnIndex, Reader x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateAsciiStream(String columnLabel, InputStream x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBinaryStream(String columnLabel, InputStream x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateCharacterStream(String columnLabel, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBlob(int columnIndex, InputStream inputStream) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBlob(String columnLabel, InputStream inputStream) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateClob(int columnIndex, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateClob(String columnLabel, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNClob(int columnIndex, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNClob(String columnLabel, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public T getObject(int columnIndex, Class type) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public T getObject(String columnLabel, Class type) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public T unwrap(Class iface) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean isWrapperFor(Class iface) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setMatchColumn(int columnIdx) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setMatchColumn(int[] columnIdxes) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setMatchColumn(String columnName) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setMatchColumn(String[] columnNames) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int[] getMatchColumnIndexes() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String[] getMatchColumnNames() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void unsetMatchColumn(int columnIdx) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void unsetMatchColumn(int[] columnIdxes) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void unsetMatchColumn(String columnName) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void unsetMatchColumn(String[] columnName) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + +} diff --git a/test/javax/sql/testng/util/StubClob.java b/test/javax/sql/testng/util/StubClob.java new file mode 100644 index 000000000..cb1e0c0a6 --- /dev/null +++ b/test/javax/sql/testng/util/StubClob.java @@ -0,0 +1,113 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package util; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.ObjectOutputStream; +import java.io.OutputStream; +import java.io.Reader; +import java.io.StringReader; +import java.io.StringWriter; +import java.io.Writer; +import java.sql.Clob; +import java.sql.SQLException; +import java.util.logging.Level; +import java.util.logging.Logger; + +public class StubClob implements Clob { + + public String buf = "The test string 0123456789"; + + @Override + public String getSubString(long pos, int length) throws SQLException { + return buf; + } + + @Override + public long length() throws SQLException { + return buf.length(); + } + + @Override + public Reader getCharacterStream() throws SQLException { + return new StringReader(buf); + } + + @Override + public InputStream getAsciiStream() throws SQLException { + return new java.io.StringBufferInputStream(buf); + } + + @Override + public int setString(long pos, String str) throws SQLException { + return str.length(); + } + + @Override + public int setString(long pos, String str, int offset, int len) throws SQLException { + return len; + } + + @Override + public long position(String searchstr, long start) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public long position(Clob searchstr, long start) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public OutputStream setAsciiStream(long pos) throws SQLException { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + ObjectOutputStream oos = null; + try { + oos = new ObjectOutputStream(baos); + } catch (IOException ex) { + Logger.getLogger(StubBlob.class.getName()).log(Level.SEVERE, null, ex); + } + return oos; + } + + @Override + public Writer setCharacterStream(long pos) throws SQLException { + return new StringWriter(); + } + + @Override + public void truncate(long len) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void free() throws SQLException { + } + + @Override + public Reader getCharacterStream(long pos, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } +} diff --git a/test/javax/sql/testng/util/StubContext.java b/test/javax/sql/testng/util/StubContext.java new file mode 100644 index 000000000..af03534d9 --- /dev/null +++ b/test/javax/sql/testng/util/StubContext.java @@ -0,0 +1,220 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package util; + +import java.util.Hashtable; +import javax.naming.Binding; +import javax.naming.Context; +import javax.naming.Name; +import javax.naming.NameClassPair; +import javax.naming.NameParser; +import javax.naming.NamingEnumeration; +import javax.naming.NamingException; + +@SuppressWarnings("unchecked") +public class StubContext implements Context { + + @Override + public Object lookup(Name name) throws NamingException { + return null; + } + + @Override + public Object lookup(String name) throws NamingException { + return null; + } + + @Override + public void bind(Name name, Object obj) throws NamingException { + + } + + @Override + public void bind(String name, Object obj) throws NamingException { + + } + + @Override + public void rebind(Name name, Object obj) throws NamingException { + + } + + @Override + public void rebind(String name, Object obj) throws NamingException { + + } + + @Override + public void unbind(Name name) throws NamingException { + + } + + @Override + public void unbind(String name) throws NamingException { + + } + + @Override + public void rename(Name oldName, Name newName) throws NamingException { + + } + + @Override + public void rename(String oldName, String newName) throws NamingException { + + } + + @Override + public NamingEnumeration list(Name name) throws NamingException { + return new NamingEnumerationStub(); + } + + @Override + public NamingEnumeration list(String name) throws NamingException { + return new NamingEnumerationStub(); + } + + @Override + public NamingEnumeration listBindings(Name name) throws NamingException { + return new NamingEnumerationStub(); + } + + @Override + public NamingEnumeration listBindings(String name) throws NamingException { + return new NamingEnumerationStub(); + } + + @Override + public void destroySubcontext(Name name) throws NamingException { + + } + + @Override + public void destroySubcontext(String name) throws NamingException { + + } + + @Override + public Context createSubcontext(Name name) throws NamingException { + return null; + } + + @Override + public Context createSubcontext(String name) throws NamingException { + return null; + } + + @Override + public Object lookupLink(Name name) throws NamingException { + return null; + } + + @Override + public Object lookupLink(String name) throws NamingException { + return null; + } + + @Override + public NameParser getNameParser(Name name) throws NamingException { + return new NameParserStub(); + } + + @Override + public NameParser getNameParser(String name) throws NamingException { + return new NameParserStub(); + } + + @Override + public Name composeName(Name name, Name prefix) throws NamingException { + return null; + } + + @Override + public String composeName(String name, String prefix) throws NamingException { + return null; + } + + @Override + public Object addToEnvironment(String propName, Object propVal) throws NamingException { + return null; + } + + @Override + public Object removeFromEnvironment(String propName) throws NamingException { + return null; + } + + @Override + public Hashtable getEnvironment() throws NamingException { + return new Hashtable(); + } + + @Override + public void close() throws NamingException { + + } + + @Override + public String getNameInNamespace() throws NamingException { + return null; + } + + class NamingEnumerationStub implements NamingEnumeration { + + @Override + public Object next() throws NamingException { + return null; + } + + @Override + public boolean hasMore() throws NamingException { + return false; + } + + @Override + public void close() throws NamingException { + + } + + @Override + public boolean hasMoreElements() { + return false; + } + + @Override + public Object nextElement() { + return null; + } + + } + + class NameParserStub implements NameParser { + + @Override + public Name parse(String name) throws NamingException { + return null; + } + + } + +} diff --git a/test/javax/sql/testng/util/StubFilteredRowSetImpl.java b/test/javax/sql/testng/util/StubFilteredRowSetImpl.java new file mode 100644 index 000000000..8fcbfa4c0 --- /dev/null +++ b/test/javax/sql/testng/util/StubFilteredRowSetImpl.java @@ -0,0 +1,1892 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package util; + +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.Reader; +import java.io.Writer; +import java.math.BigDecimal; +import java.net.URL; +import java.sql.Array; +import java.sql.Blob; +import java.sql.Clob; +import java.sql.Connection; +import java.sql.Date; +import java.sql.NClob; +import java.sql.Ref; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.sql.RowId; +import java.sql.SQLException; +import java.sql.SQLWarning; +import java.sql.SQLXML; +import java.sql.Savepoint; +import java.sql.Statement; +import java.sql.Time; +import java.sql.Timestamp; +import java.util.Calendar; +import java.util.Collection; +import java.util.Map; +import javax.sql.RowSet; +import javax.sql.RowSetEvent; +import javax.sql.RowSetListener; +import javax.sql.RowSetMetaData; +import javax.sql.rowset.CachedRowSet; +import javax.sql.rowset.FilteredRowSet; +import javax.sql.rowset.Predicate; +import javax.sql.rowset.RowSetWarning; +import javax.sql.rowset.spi.SyncProvider; +import javax.sql.rowset.spi.SyncProviderException; + +public class StubFilteredRowSetImpl implements FilteredRowSet { + + public StubFilteredRowSetImpl() { + } + + @Override + public void setFilter(Predicate p) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Predicate getFilter() { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void readXml(Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void readXml(InputStream iStream) throws SQLException, IOException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void writeXml(ResultSet rs, Writer writer) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void writeXml(ResultSet rs, OutputStream oStream) throws SQLException, IOException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void writeXml(Writer writer) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void writeXml(OutputStream oStream) throws SQLException, IOException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void populate(ResultSet data) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void execute(Connection conn) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void acceptChanges() throws SyncProviderException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void acceptChanges(Connection con) throws SyncProviderException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void restoreOriginal() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void release() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void undoDelete() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void undoInsert() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void undoUpdate() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean columnUpdated(int idx) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean columnUpdated(String columnName) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Collection toCollection() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Collection toCollection(int column) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Collection toCollection(String column) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public SyncProvider getSyncProvider() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setSyncProvider(String provider) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int size() { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setMetaData(RowSetMetaData md) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public ResultSet getOriginal() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public ResultSet getOriginalRow() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setOriginalRow() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getTableName() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setTableName(String tabName) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int[] getKeyColumns() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setKeyColumns(int[] keys) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public RowSet createShared() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public CachedRowSet createCopy() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public CachedRowSet createCopySchema() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public CachedRowSet createCopyNoConstraints() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public RowSetWarning getRowSetWarnings() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean getShowDeleted() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setShowDeleted(boolean b) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void commit() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void rollback() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void rollback(Savepoint s) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void rowSetPopulated(RowSetEvent event, int numRows) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void populate(ResultSet rs, int startRow) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setPageSize(int size) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getPageSize() { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean nextPage() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean previousPage() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getUrl() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setUrl(String url) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getDataSourceName() { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setDataSourceName(String name) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getUsername() { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setUsername(String name) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getPassword() { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setPassword(String password) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getTransactionIsolation() { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setTransactionIsolation(int level) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Map> getTypeMap() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setTypeMap(Map> map) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getCommand() { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setCommand(String cmd) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean isReadOnly() { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setReadOnly(boolean value) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getMaxFieldSize() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setMaxFieldSize(int max) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getMaxRows() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setMaxRows(int max) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean getEscapeProcessing() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setEscapeProcessing(boolean enable) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getQueryTimeout() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setQueryTimeout(int seconds) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setType(int type) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setConcurrency(int concurrency) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNull(int parameterIndex, int sqlType) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNull(String parameterName, int sqlType) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNull(int paramIndex, int sqlType, String typeName) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNull(String parameterName, int sqlType, String typeName) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBoolean(int parameterIndex, boolean x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBoolean(String parameterName, boolean x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setByte(int parameterIndex, byte x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setByte(String parameterName, byte x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setShort(int parameterIndex, short x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setShort(String parameterName, short x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setInt(int parameterIndex, int x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setInt(String parameterName, int x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setLong(int parameterIndex, long x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setLong(String parameterName, long x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setFloat(int parameterIndex, float x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setFloat(String parameterName, float x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setDouble(int parameterIndex, double x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setDouble(String parameterName, double x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBigDecimal(String parameterName, BigDecimal x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setString(int parameterIndex, String x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setString(String parameterName, String x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBytes(int parameterIndex, byte[] x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBytes(String parameterName, byte[] x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setDate(int parameterIndex, Date x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setTime(int parameterIndex, Time x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setTimestamp(int parameterIndex, Timestamp x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setTimestamp(String parameterName, Timestamp x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setAsciiStream(int parameterIndex, InputStream x, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setAsciiStream(String parameterName, InputStream x, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBinaryStream(int parameterIndex, InputStream x, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBinaryStream(String parameterName, InputStream x, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setCharacterStream(int parameterIndex, Reader reader, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setCharacterStream(String parameterName, Reader reader, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setAsciiStream(int parameterIndex, InputStream x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setAsciiStream(String parameterName, InputStream x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBinaryStream(int parameterIndex, InputStream x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBinaryStream(String parameterName, InputStream x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setCharacterStream(int parameterIndex, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setCharacterStream(String parameterName, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNCharacterStream(int parameterIndex, Reader value) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setObject(int parameterIndex, Object x, int targetSqlType, int scaleOrLength) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setObject(String parameterName, Object x, int targetSqlType, int scale) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setObject(int parameterIndex, Object x, int targetSqlType) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setObject(String parameterName, Object x, int targetSqlType) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setObject(String parameterName, Object x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setObject(int parameterIndex, Object x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setRef(int i, Ref x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBlob(int i, Blob x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBlob(int parameterIndex, InputStream inputStream, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBlob(int parameterIndex, InputStream inputStream) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBlob(String parameterName, InputStream inputStream, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBlob(String parameterName, Blob x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBlob(String parameterName, InputStream inputStream) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setClob(int i, Clob x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setClob(int parameterIndex, Reader reader, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setClob(int parameterIndex, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setClob(String parameterName, Reader reader, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setClob(String parameterName, Clob x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setClob(String parameterName, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setArray(int i, Array x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setDate(int parameterIndex, Date x, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setDate(String parameterName, Date x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setDate(String parameterName, Date x, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setTime(int parameterIndex, Time x, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setTime(String parameterName, Time x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setTime(String parameterName, Time x, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setTimestamp(int parameterIndex, Timestamp x, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setTimestamp(String parameterName, Timestamp x, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void clearParameters() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void execute() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void addRowSetListener(RowSetListener listener) { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void removeRowSetListener(RowSetListener listener) { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setSQLXML(String parameterName, SQLXML xmlObject) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setRowId(int parameterIndex, RowId x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setRowId(String parameterName, RowId x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNString(int parameterIndex, String value) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNString(String parameterName, String value) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNCharacterStream(int parameterIndex, Reader value, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNCharacterStream(String parameterName, Reader value, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNCharacterStream(String parameterName, Reader value) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNClob(String parameterName, NClob value) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNClob(String parameterName, Reader reader, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNClob(String parameterName, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNClob(int parameterIndex, Reader reader, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNClob(int parameterIndex, NClob value) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNClob(int parameterIndex, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setURL(int parameterIndex, URL x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean next() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void close() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean wasNull() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getString(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean getBoolean(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public byte getByte(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public short getShort(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getInt(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public long getLong(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public float getFloat(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public double getDouble(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public byte[] getBytes(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Date getDate(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Time getTime(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Timestamp getTimestamp(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public InputStream getAsciiStream(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public InputStream getUnicodeStream(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public InputStream getBinaryStream(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getString(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean getBoolean(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public byte getByte(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public short getShort(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getInt(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public long getLong(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public float getFloat(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public double getDouble(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public BigDecimal getBigDecimal(String columnLabel, int scale) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public byte[] getBytes(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Date getDate(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Time getTime(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Timestamp getTimestamp(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public InputStream getAsciiStream(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public InputStream getUnicodeStream(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public InputStream getBinaryStream(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public SQLWarning getWarnings() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void clearWarnings() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getCursorName() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public ResultSetMetaData getMetaData() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Object getObject(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Object getObject(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int findColumn(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Reader getCharacterStream(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Reader getCharacterStream(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public BigDecimal getBigDecimal(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public BigDecimal getBigDecimal(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean isBeforeFirst() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean isAfterLast() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean isFirst() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean isLast() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void beforeFirst() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void afterLast() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean first() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean last() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getRow() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean absolute(int row) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean relative(int rows) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean previous() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setFetchDirection(int direction) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getFetchDirection() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setFetchSize(int rows) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getFetchSize() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getType() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getConcurrency() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean rowUpdated() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean rowInserted() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean rowDeleted() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNull(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBoolean(int columnIndex, boolean x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateByte(int columnIndex, byte x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateShort(int columnIndex, short x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateInt(int columnIndex, int x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateLong(int columnIndex, long x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateFloat(int columnIndex, float x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateDouble(int columnIndex, double x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBigDecimal(int columnIndex, BigDecimal x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateString(int columnIndex, String x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBytes(int columnIndex, byte[] x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateDate(int columnIndex, Date x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateTime(int columnIndex, Time x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateTimestamp(int columnIndex, Timestamp x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateAsciiStream(int columnIndex, InputStream x, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBinaryStream(int columnIndex, InputStream x, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateCharacterStream(int columnIndex, Reader x, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateObject(int columnIndex, Object x, int scaleOrLength) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateObject(int columnIndex, Object x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNull(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBoolean(String columnLabel, boolean x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateByte(String columnLabel, byte x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateShort(String columnLabel, short x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateInt(String columnLabel, int x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateLong(String columnLabel, long x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateFloat(String columnLabel, float x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateDouble(String columnLabel, double x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBigDecimal(String columnLabel, BigDecimal x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateString(String columnLabel, String x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBytes(String columnLabel, byte[] x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateDate(String columnLabel, Date x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateTime(String columnLabel, Time x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateTimestamp(String columnLabel, Timestamp x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateAsciiStream(String columnLabel, InputStream x, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBinaryStream(String columnLabel, InputStream x, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateCharacterStream(String columnLabel, Reader reader, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateObject(String columnLabel, Object x, int scaleOrLength) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateObject(String columnLabel, Object x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void insertRow() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateRow() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void deleteRow() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void refreshRow() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void cancelRowUpdates() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void moveToInsertRow() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void moveToCurrentRow() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Statement getStatement() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Object getObject(int columnIndex, Map> map) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Ref getRef(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Blob getBlob(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Clob getClob(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Array getArray(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Object getObject(String columnLabel, Map> map) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Ref getRef(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Blob getBlob(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Clob getClob(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Array getArray(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Date getDate(int columnIndex, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Date getDate(String columnLabel, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Time getTime(int columnIndex, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Time getTime(String columnLabel, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Timestamp getTimestamp(int columnIndex, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Timestamp getTimestamp(String columnLabel, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public URL getURL(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public URL getURL(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateRef(int columnIndex, Ref x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateRef(String columnLabel, Ref x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBlob(int columnIndex, Blob x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBlob(String columnLabel, Blob x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateClob(int columnIndex, Clob x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateClob(String columnLabel, Clob x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateArray(int columnIndex, Array x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateArray(String columnLabel, Array x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public RowId getRowId(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public RowId getRowId(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateRowId(int columnIndex, RowId x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateRowId(String columnLabel, RowId x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getHoldability() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean isClosed() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNString(int columnIndex, String nString) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNString(String columnLabel, String nString) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNClob(int columnIndex, NClob nClob) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNClob(String columnLabel, NClob nClob) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public NClob getNClob(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public NClob getNClob(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public SQLXML getSQLXML(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public SQLXML getSQLXML(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateSQLXML(int columnIndex, SQLXML xmlObject) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateSQLXML(String columnLabel, SQLXML xmlObject) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getNString(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getNString(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Reader getNCharacterStream(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Reader getNCharacterStream(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNCharacterStream(int columnIndex, Reader x, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNCharacterStream(String columnLabel, Reader reader, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateAsciiStream(int columnIndex, InputStream x, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBinaryStream(int columnIndex, InputStream x, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateCharacterStream(int columnIndex, Reader x, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateAsciiStream(String columnLabel, InputStream x, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBinaryStream(String columnLabel, InputStream x, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateCharacterStream(String columnLabel, Reader reader, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBlob(int columnIndex, InputStream inputStream, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBlob(String columnLabel, InputStream inputStream, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateClob(int columnIndex, Reader reader, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateClob(String columnLabel, Reader reader, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNClob(int columnIndex, Reader reader, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNClob(String columnLabel, Reader reader, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNCharacterStream(int columnIndex, Reader x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNCharacterStream(String columnLabel, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateAsciiStream(int columnIndex, InputStream x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBinaryStream(int columnIndex, InputStream x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateCharacterStream(int columnIndex, Reader x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateAsciiStream(String columnLabel, InputStream x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBinaryStream(String columnLabel, InputStream x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateCharacterStream(String columnLabel, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBlob(int columnIndex, InputStream inputStream) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBlob(String columnLabel, InputStream inputStream) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateClob(int columnIndex, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateClob(String columnLabel, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNClob(int columnIndex, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNClob(String columnLabel, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public T getObject(int columnIndex, Class type) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public T getObject(String columnLabel, Class type) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public T unwrap(Class iface) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean isWrapperFor(Class iface) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setMatchColumn(int columnIdx) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setMatchColumn(int[] columnIdxes) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setMatchColumn(String columnName) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setMatchColumn(String[] columnNames) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int[] getMatchColumnIndexes() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String[] getMatchColumnNames() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void unsetMatchColumn(int columnIdx) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void unsetMatchColumn(int[] columnIdxes) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void unsetMatchColumn(String columnName) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void unsetMatchColumn(String[] columnName) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } +} diff --git a/test/javax/sql/testng/util/StubJdbcRowSetImpl.java b/test/javax/sql/testng/util/StubJdbcRowSetImpl.java new file mode 100644 index 000000000..ec59eb6c5 --- /dev/null +++ b/test/javax/sql/testng/util/StubJdbcRowSetImpl.java @@ -0,0 +1,1672 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package util; + +import java.io.InputStream; +import java.io.Reader; +import java.math.BigDecimal; +import java.net.URL; +import java.sql.Array; +import java.sql.Blob; +import java.sql.Clob; +import java.sql.Date; +import java.sql.NClob; +import java.sql.Ref; +import java.sql.ResultSetMetaData; +import java.sql.RowId; +import java.sql.SQLException; +import java.sql.SQLWarning; +import java.sql.SQLXML; +import java.sql.Savepoint; +import java.sql.Statement; +import java.sql.Time; +import java.sql.Timestamp; +import java.util.Calendar; +import java.util.Map; +import javax.sql.RowSetListener; +import javax.sql.rowset.JdbcRowSet; +import javax.sql.rowset.RowSetWarning; + +public class StubJdbcRowSetImpl implements JdbcRowSet { + + @Override + public boolean getShowDeleted() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setShowDeleted(boolean b) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public RowSetWarning getRowSetWarnings() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void commit() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean getAutoCommit() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setAutoCommit(boolean autoCommit) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void rollback() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void rollback(Savepoint s) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getUrl() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setUrl(String url) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getDataSourceName() { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setDataSourceName(String name) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getUsername() { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setUsername(String name) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getPassword() { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setPassword(String password) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getTransactionIsolation() { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setTransactionIsolation(int level) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Map> getTypeMap() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setTypeMap(Map> map) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getCommand() { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setCommand(String cmd) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean isReadOnly() { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setReadOnly(boolean value) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getMaxFieldSize() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setMaxFieldSize(int max) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getMaxRows() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setMaxRows(int max) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean getEscapeProcessing() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setEscapeProcessing(boolean enable) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getQueryTimeout() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setQueryTimeout(int seconds) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setType(int type) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setConcurrency(int concurrency) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNull(int parameterIndex, int sqlType) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNull(String parameterName, int sqlType) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNull(int paramIndex, int sqlType, String typeName) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNull(String parameterName, int sqlType, String typeName) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBoolean(int parameterIndex, boolean x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBoolean(String parameterName, boolean x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setByte(int parameterIndex, byte x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setByte(String parameterName, byte x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setShort(int parameterIndex, short x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setShort(String parameterName, short x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setInt(int parameterIndex, int x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setInt(String parameterName, int x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setLong(int parameterIndex, long x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setLong(String parameterName, long x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setFloat(int parameterIndex, float x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setFloat(String parameterName, float x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setDouble(int parameterIndex, double x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setDouble(String parameterName, double x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBigDecimal(String parameterName, BigDecimal x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setString(int parameterIndex, String x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setString(String parameterName, String x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBytes(int parameterIndex, byte[] x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBytes(String parameterName, byte[] x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setDate(int parameterIndex, Date x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setTime(int parameterIndex, Time x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setTimestamp(int parameterIndex, Timestamp x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setTimestamp(String parameterName, Timestamp x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setAsciiStream(int parameterIndex, InputStream x, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setAsciiStream(String parameterName, InputStream x, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBinaryStream(int parameterIndex, InputStream x, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBinaryStream(String parameterName, InputStream x, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setCharacterStream(int parameterIndex, Reader reader, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setCharacterStream(String parameterName, Reader reader, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setAsciiStream(int parameterIndex, InputStream x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setAsciiStream(String parameterName, InputStream x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBinaryStream(int parameterIndex, InputStream x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBinaryStream(String parameterName, InputStream x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setCharacterStream(int parameterIndex, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setCharacterStream(String parameterName, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNCharacterStream(int parameterIndex, Reader value) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setObject(int parameterIndex, Object x, int targetSqlType, int scaleOrLength) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setObject(String parameterName, Object x, int targetSqlType, int scale) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setObject(int parameterIndex, Object x, int targetSqlType) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setObject(String parameterName, Object x, int targetSqlType) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setObject(String parameterName, Object x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setObject(int parameterIndex, Object x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setRef(int i, Ref x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBlob(int i, Blob x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBlob(int parameterIndex, InputStream inputStream, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBlob(int parameterIndex, InputStream inputStream) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBlob(String parameterName, InputStream inputStream, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBlob(String parameterName, Blob x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBlob(String parameterName, InputStream inputStream) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setClob(int i, Clob x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setClob(int parameterIndex, Reader reader, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setClob(int parameterIndex, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setClob(String parameterName, Reader reader, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setClob(String parameterName, Clob x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setClob(String parameterName, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setArray(int i, Array x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setDate(int parameterIndex, Date x, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setDate(String parameterName, Date x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setDate(String parameterName, Date x, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setTime(int parameterIndex, Time x, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setTime(String parameterName, Time x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setTime(String parameterName, Time x, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setTimestamp(int parameterIndex, Timestamp x, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setTimestamp(String parameterName, Timestamp x, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void clearParameters() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void execute() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void addRowSetListener(RowSetListener listener) { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void removeRowSetListener(RowSetListener listener) { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setSQLXML(String parameterName, SQLXML xmlObject) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setRowId(int parameterIndex, RowId x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setRowId(String parameterName, RowId x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNString(int parameterIndex, String value) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNString(String parameterName, String value) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNCharacterStream(int parameterIndex, Reader value, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNCharacterStream(String parameterName, Reader value, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNCharacterStream(String parameterName, Reader value) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNClob(String parameterName, NClob value) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNClob(String parameterName, Reader reader, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNClob(String parameterName, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNClob(int parameterIndex, Reader reader, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNClob(int parameterIndex, NClob value) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNClob(int parameterIndex, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setURL(int parameterIndex, URL x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean next() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void close() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean wasNull() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getString(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean getBoolean(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public byte getByte(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public short getShort(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getInt(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public long getLong(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public float getFloat(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public double getDouble(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public byte[] getBytes(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Date getDate(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Time getTime(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Timestamp getTimestamp(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public InputStream getAsciiStream(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public InputStream getUnicodeStream(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public InputStream getBinaryStream(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getString(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean getBoolean(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public byte getByte(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public short getShort(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getInt(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public long getLong(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public float getFloat(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public double getDouble(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public BigDecimal getBigDecimal(String columnLabel, int scale) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public byte[] getBytes(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Date getDate(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Time getTime(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Timestamp getTimestamp(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public InputStream getAsciiStream(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public InputStream getUnicodeStream(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public InputStream getBinaryStream(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public SQLWarning getWarnings() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void clearWarnings() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getCursorName() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public ResultSetMetaData getMetaData() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Object getObject(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Object getObject(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int findColumn(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Reader getCharacterStream(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Reader getCharacterStream(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public BigDecimal getBigDecimal(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public BigDecimal getBigDecimal(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean isBeforeFirst() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean isAfterLast() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean isFirst() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean isLast() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void beforeFirst() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void afterLast() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean first() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean last() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getRow() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean absolute(int row) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean relative(int rows) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean previous() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setFetchDirection(int direction) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getFetchDirection() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setFetchSize(int rows) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getFetchSize() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getType() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getConcurrency() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean rowUpdated() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean rowInserted() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean rowDeleted() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNull(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBoolean(int columnIndex, boolean x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateByte(int columnIndex, byte x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateShort(int columnIndex, short x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateInt(int columnIndex, int x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateLong(int columnIndex, long x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateFloat(int columnIndex, float x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateDouble(int columnIndex, double x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBigDecimal(int columnIndex, BigDecimal x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateString(int columnIndex, String x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBytes(int columnIndex, byte[] x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateDate(int columnIndex, Date x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateTime(int columnIndex, Time x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateTimestamp(int columnIndex, Timestamp x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateAsciiStream(int columnIndex, InputStream x, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBinaryStream(int columnIndex, InputStream x, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateCharacterStream(int columnIndex, Reader x, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateObject(int columnIndex, Object x, int scaleOrLength) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateObject(int columnIndex, Object x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNull(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBoolean(String columnLabel, boolean x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateByte(String columnLabel, byte x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateShort(String columnLabel, short x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateInt(String columnLabel, int x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateLong(String columnLabel, long x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateFloat(String columnLabel, float x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateDouble(String columnLabel, double x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBigDecimal(String columnLabel, BigDecimal x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateString(String columnLabel, String x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBytes(String columnLabel, byte[] x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateDate(String columnLabel, Date x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateTime(String columnLabel, Time x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateTimestamp(String columnLabel, Timestamp x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateAsciiStream(String columnLabel, InputStream x, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBinaryStream(String columnLabel, InputStream x, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateCharacterStream(String columnLabel, Reader reader, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateObject(String columnLabel, Object x, int scaleOrLength) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateObject(String columnLabel, Object x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void insertRow() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateRow() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void deleteRow() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void refreshRow() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void cancelRowUpdates() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void moveToInsertRow() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void moveToCurrentRow() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Statement getStatement() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Object getObject(int columnIndex, Map> map) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Ref getRef(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Blob getBlob(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Clob getClob(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Array getArray(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Object getObject(String columnLabel, Map> map) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Ref getRef(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Blob getBlob(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Clob getClob(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Array getArray(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Date getDate(int columnIndex, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Date getDate(String columnLabel, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Time getTime(int columnIndex, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Time getTime(String columnLabel, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Timestamp getTimestamp(int columnIndex, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Timestamp getTimestamp(String columnLabel, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public URL getURL(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public URL getURL(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateRef(int columnIndex, Ref x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateRef(String columnLabel, Ref x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBlob(int columnIndex, Blob x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBlob(String columnLabel, Blob x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateClob(int columnIndex, Clob x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateClob(String columnLabel, Clob x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateArray(int columnIndex, Array x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateArray(String columnLabel, Array x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public RowId getRowId(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public RowId getRowId(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateRowId(int columnIndex, RowId x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateRowId(String columnLabel, RowId x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getHoldability() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean isClosed() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNString(int columnIndex, String nString) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNString(String columnLabel, String nString) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNClob(int columnIndex, NClob nClob) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNClob(String columnLabel, NClob nClob) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public NClob getNClob(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public NClob getNClob(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public SQLXML getSQLXML(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public SQLXML getSQLXML(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateSQLXML(int columnIndex, SQLXML xmlObject) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateSQLXML(String columnLabel, SQLXML xmlObject) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getNString(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getNString(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Reader getNCharacterStream(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Reader getNCharacterStream(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNCharacterStream(int columnIndex, Reader x, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNCharacterStream(String columnLabel, Reader reader, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateAsciiStream(int columnIndex, InputStream x, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBinaryStream(int columnIndex, InputStream x, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateCharacterStream(int columnIndex, Reader x, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateAsciiStream(String columnLabel, InputStream x, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBinaryStream(String columnLabel, InputStream x, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateCharacterStream(String columnLabel, Reader reader, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBlob(int columnIndex, InputStream inputStream, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBlob(String columnLabel, InputStream inputStream, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateClob(int columnIndex, Reader reader, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateClob(String columnLabel, Reader reader, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNClob(int columnIndex, Reader reader, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNClob(String columnLabel, Reader reader, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNCharacterStream(int columnIndex, Reader x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNCharacterStream(String columnLabel, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateAsciiStream(int columnIndex, InputStream x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBinaryStream(int columnIndex, InputStream x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateCharacterStream(int columnIndex, Reader x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateAsciiStream(String columnLabel, InputStream x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBinaryStream(String columnLabel, InputStream x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateCharacterStream(String columnLabel, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBlob(int columnIndex, InputStream inputStream) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBlob(String columnLabel, InputStream inputStream) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateClob(int columnIndex, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateClob(String columnLabel, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNClob(int columnIndex, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNClob(String columnLabel, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public T getObject(int columnIndex, Class type) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public T getObject(String columnLabel, Class type) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public T unwrap(Class iface) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean isWrapperFor(Class iface) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setMatchColumn(int columnIdx) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setMatchColumn(int[] columnIdxes) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setMatchColumn(String columnName) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setMatchColumn(String[] columnNames) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int[] getMatchColumnIndexes() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String[] getMatchColumnNames() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void unsetMatchColumn(int columnIdx) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void unsetMatchColumn(int[] columnIdxes) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void unsetMatchColumn(String columnName) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void unsetMatchColumn(String[] columnName) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + +} diff --git a/test/javax/sql/testng/util/StubJoinRowSetImpl.java b/test/javax/sql/testng/util/StubJoinRowSetImpl.java new file mode 100644 index 000000000..c7ece7cd5 --- /dev/null +++ b/test/javax/sql/testng/util/StubJoinRowSetImpl.java @@ -0,0 +1,1962 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package util; + +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.Reader; +import java.io.Writer; +import java.math.BigDecimal; +import java.net.URL; +import java.sql.Array; +import java.sql.Blob; +import java.sql.Clob; +import java.sql.Connection; +import java.sql.Date; +import java.sql.NClob; +import java.sql.Ref; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.sql.RowId; +import java.sql.SQLException; +import java.sql.SQLWarning; +import java.sql.SQLXML; +import java.sql.Savepoint; +import java.sql.Statement; +import java.sql.Time; +import java.sql.Timestamp; +import java.util.Calendar; +import java.util.Collection; +import java.util.Map; +import javax.sql.RowSet; +import javax.sql.RowSetEvent; +import javax.sql.RowSetListener; +import javax.sql.RowSetMetaData; +import javax.sql.rowset.CachedRowSet; +import javax.sql.rowset.JoinRowSet; +import javax.sql.rowset.Joinable; +import javax.sql.rowset.RowSetWarning; +import javax.sql.rowset.spi.SyncProvider; +import javax.sql.rowset.spi.SyncProviderException; + +class StubJoinRowSetImpl implements JoinRowSet { + + public StubJoinRowSetImpl() { + } + + @Override + public void addRowSet(Joinable rowset) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void addRowSet(RowSet rowset, int columnIdx) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void addRowSet(RowSet rowset, String columnName) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void addRowSet(RowSet[] rowset, int[] columnIdx) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void addRowSet(RowSet[] rowset, String[] columnName) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Collection getRowSets() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String[] getRowSetNames() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public CachedRowSet toCachedRowSet() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean supportsCrossJoin() { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean supportsInnerJoin() { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean supportsLeftOuterJoin() { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean supportsRightOuterJoin() { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean supportsFullJoin() { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setJoinType(int joinType) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getWhereClause() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getJoinType() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void readXml(Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void readXml(InputStream iStream) throws SQLException, IOException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void writeXml(ResultSet rs, Writer writer) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void writeXml(ResultSet rs, OutputStream oStream) throws SQLException, IOException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void writeXml(Writer writer) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void writeXml(OutputStream oStream) throws SQLException, IOException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void populate(ResultSet data) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void execute(Connection conn) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void acceptChanges() throws SyncProviderException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void acceptChanges(Connection con) throws SyncProviderException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void restoreOriginal() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void release() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void undoDelete() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void undoInsert() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void undoUpdate() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean columnUpdated(int idx) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean columnUpdated(String columnName) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Collection toCollection() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Collection toCollection(int column) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Collection toCollection(String column) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public SyncProvider getSyncProvider() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setSyncProvider(String provider) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int size() { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setMetaData(RowSetMetaData md) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public ResultSet getOriginal() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public ResultSet getOriginalRow() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setOriginalRow() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getTableName() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setTableName(String tabName) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int[] getKeyColumns() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setKeyColumns(int[] keys) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public RowSet createShared() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public CachedRowSet createCopy() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public CachedRowSet createCopySchema() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public CachedRowSet createCopyNoConstraints() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public RowSetWarning getRowSetWarnings() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean getShowDeleted() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setShowDeleted(boolean b) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void commit() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void rollback() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void rollback(Savepoint s) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void rowSetPopulated(RowSetEvent event, int numRows) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void populate(ResultSet rs, int startRow) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setPageSize(int size) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getPageSize() { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean nextPage() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean previousPage() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getUrl() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setUrl(String url) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getDataSourceName() { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setDataSourceName(String name) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getUsername() { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setUsername(String name) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getPassword() { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setPassword(String password) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getTransactionIsolation() { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setTransactionIsolation(int level) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Map> getTypeMap() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setTypeMap(Map> map) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getCommand() { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setCommand(String cmd) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean isReadOnly() { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setReadOnly(boolean value) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getMaxFieldSize() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setMaxFieldSize(int max) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getMaxRows() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setMaxRows(int max) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean getEscapeProcessing() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setEscapeProcessing(boolean enable) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getQueryTimeout() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setQueryTimeout(int seconds) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setType(int type) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setConcurrency(int concurrency) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNull(int parameterIndex, int sqlType) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNull(String parameterName, int sqlType) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNull(int paramIndex, int sqlType, String typeName) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNull(String parameterName, int sqlType, String typeName) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBoolean(int parameterIndex, boolean x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBoolean(String parameterName, boolean x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setByte(int parameterIndex, byte x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setByte(String parameterName, byte x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setShort(int parameterIndex, short x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setShort(String parameterName, short x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setInt(int parameterIndex, int x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setInt(String parameterName, int x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setLong(int parameterIndex, long x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setLong(String parameterName, long x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setFloat(int parameterIndex, float x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setFloat(String parameterName, float x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setDouble(int parameterIndex, double x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setDouble(String parameterName, double x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBigDecimal(String parameterName, BigDecimal x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setString(int parameterIndex, String x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setString(String parameterName, String x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBytes(int parameterIndex, byte[] x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBytes(String parameterName, byte[] x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setDate(int parameterIndex, Date x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setTime(int parameterIndex, Time x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setTimestamp(int parameterIndex, Timestamp x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setTimestamp(String parameterName, Timestamp x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setAsciiStream(int parameterIndex, InputStream x, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setAsciiStream(String parameterName, InputStream x, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBinaryStream(int parameterIndex, InputStream x, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBinaryStream(String parameterName, InputStream x, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setCharacterStream(int parameterIndex, Reader reader, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setCharacterStream(String parameterName, Reader reader, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setAsciiStream(int parameterIndex, InputStream x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setAsciiStream(String parameterName, InputStream x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBinaryStream(int parameterIndex, InputStream x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBinaryStream(String parameterName, InputStream x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setCharacterStream(int parameterIndex, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setCharacterStream(String parameterName, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNCharacterStream(int parameterIndex, Reader value) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setObject(int parameterIndex, Object x, int targetSqlType, int scaleOrLength) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setObject(String parameterName, Object x, int targetSqlType, int scale) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setObject(int parameterIndex, Object x, int targetSqlType) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setObject(String parameterName, Object x, int targetSqlType) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setObject(String parameterName, Object x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setObject(int parameterIndex, Object x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setRef(int i, Ref x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBlob(int i, Blob x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBlob(int parameterIndex, InputStream inputStream, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBlob(int parameterIndex, InputStream inputStream) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBlob(String parameterName, InputStream inputStream, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBlob(String parameterName, Blob x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBlob(String parameterName, InputStream inputStream) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setClob(int i, Clob x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setClob(int parameterIndex, Reader reader, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setClob(int parameterIndex, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setClob(String parameterName, Reader reader, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setClob(String parameterName, Clob x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setClob(String parameterName, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setArray(int i, Array x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setDate(int parameterIndex, Date x, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setDate(String parameterName, Date x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setDate(String parameterName, Date x, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setTime(int parameterIndex, Time x, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setTime(String parameterName, Time x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setTime(String parameterName, Time x, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setTimestamp(int parameterIndex, Timestamp x, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setTimestamp(String parameterName, Timestamp x, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void clearParameters() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void execute() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void addRowSetListener(RowSetListener listener) { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void removeRowSetListener(RowSetListener listener) { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setSQLXML(String parameterName, SQLXML xmlObject) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setRowId(int parameterIndex, RowId x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setRowId(String parameterName, RowId x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNString(int parameterIndex, String value) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNString(String parameterName, String value) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNCharacterStream(int parameterIndex, Reader value, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNCharacterStream(String parameterName, Reader value, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNCharacterStream(String parameterName, Reader value) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNClob(String parameterName, NClob value) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNClob(String parameterName, Reader reader, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNClob(String parameterName, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNClob(int parameterIndex, Reader reader, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNClob(int parameterIndex, NClob value) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNClob(int parameterIndex, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setURL(int parameterIndex, URL x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean next() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void close() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean wasNull() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getString(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean getBoolean(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public byte getByte(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public short getShort(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getInt(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public long getLong(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public float getFloat(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public double getDouble(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public byte[] getBytes(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Date getDate(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Time getTime(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Timestamp getTimestamp(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public InputStream getAsciiStream(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public InputStream getUnicodeStream(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public InputStream getBinaryStream(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getString(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean getBoolean(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public byte getByte(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public short getShort(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getInt(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public long getLong(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public float getFloat(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public double getDouble(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public BigDecimal getBigDecimal(String columnLabel, int scale) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public byte[] getBytes(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Date getDate(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Time getTime(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Timestamp getTimestamp(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public InputStream getAsciiStream(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public InputStream getUnicodeStream(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public InputStream getBinaryStream(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public SQLWarning getWarnings() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void clearWarnings() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getCursorName() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public ResultSetMetaData getMetaData() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Object getObject(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Object getObject(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int findColumn(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Reader getCharacterStream(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Reader getCharacterStream(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public BigDecimal getBigDecimal(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public BigDecimal getBigDecimal(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean isBeforeFirst() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean isAfterLast() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean isFirst() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean isLast() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void beforeFirst() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void afterLast() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean first() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean last() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getRow() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean absolute(int row) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean relative(int rows) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean previous() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setFetchDirection(int direction) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getFetchDirection() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setFetchSize(int rows) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getFetchSize() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getType() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getConcurrency() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean rowUpdated() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean rowInserted() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean rowDeleted() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNull(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBoolean(int columnIndex, boolean x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateByte(int columnIndex, byte x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateShort(int columnIndex, short x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateInt(int columnIndex, int x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateLong(int columnIndex, long x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateFloat(int columnIndex, float x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateDouble(int columnIndex, double x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBigDecimal(int columnIndex, BigDecimal x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateString(int columnIndex, String x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBytes(int columnIndex, byte[] x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateDate(int columnIndex, Date x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateTime(int columnIndex, Time x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateTimestamp(int columnIndex, Timestamp x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateAsciiStream(int columnIndex, InputStream x, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBinaryStream(int columnIndex, InputStream x, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateCharacterStream(int columnIndex, Reader x, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateObject(int columnIndex, Object x, int scaleOrLength) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateObject(int columnIndex, Object x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNull(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBoolean(String columnLabel, boolean x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateByte(String columnLabel, byte x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateShort(String columnLabel, short x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateInt(String columnLabel, int x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateLong(String columnLabel, long x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateFloat(String columnLabel, float x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateDouble(String columnLabel, double x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBigDecimal(String columnLabel, BigDecimal x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateString(String columnLabel, String x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBytes(String columnLabel, byte[] x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateDate(String columnLabel, Date x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateTime(String columnLabel, Time x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateTimestamp(String columnLabel, Timestamp x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateAsciiStream(String columnLabel, InputStream x, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBinaryStream(String columnLabel, InputStream x, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateCharacterStream(String columnLabel, Reader reader, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateObject(String columnLabel, Object x, int scaleOrLength) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateObject(String columnLabel, Object x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void insertRow() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateRow() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void deleteRow() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void refreshRow() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void cancelRowUpdates() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void moveToInsertRow() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void moveToCurrentRow() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Statement getStatement() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Object getObject(int columnIndex, Map> map) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Ref getRef(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Blob getBlob(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Clob getClob(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Array getArray(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Object getObject(String columnLabel, Map> map) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Ref getRef(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Blob getBlob(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Clob getClob(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Array getArray(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Date getDate(int columnIndex, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Date getDate(String columnLabel, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Time getTime(int columnIndex, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Time getTime(String columnLabel, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Timestamp getTimestamp(int columnIndex, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Timestamp getTimestamp(String columnLabel, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public URL getURL(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public URL getURL(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateRef(int columnIndex, Ref x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateRef(String columnLabel, Ref x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBlob(int columnIndex, Blob x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBlob(String columnLabel, Blob x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateClob(int columnIndex, Clob x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateClob(String columnLabel, Clob x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateArray(int columnIndex, Array x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateArray(String columnLabel, Array x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public RowId getRowId(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public RowId getRowId(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateRowId(int columnIndex, RowId x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateRowId(String columnLabel, RowId x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getHoldability() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean isClosed() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNString(int columnIndex, String nString) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNString(String columnLabel, String nString) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNClob(int columnIndex, NClob nClob) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNClob(String columnLabel, NClob nClob) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public NClob getNClob(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public NClob getNClob(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public SQLXML getSQLXML(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public SQLXML getSQLXML(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateSQLXML(int columnIndex, SQLXML xmlObject) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateSQLXML(String columnLabel, SQLXML xmlObject) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getNString(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getNString(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Reader getNCharacterStream(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Reader getNCharacterStream(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNCharacterStream(int columnIndex, Reader x, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNCharacterStream(String columnLabel, Reader reader, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateAsciiStream(int columnIndex, InputStream x, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBinaryStream(int columnIndex, InputStream x, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateCharacterStream(int columnIndex, Reader x, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateAsciiStream(String columnLabel, InputStream x, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBinaryStream(String columnLabel, InputStream x, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateCharacterStream(String columnLabel, Reader reader, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBlob(int columnIndex, InputStream inputStream, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBlob(String columnLabel, InputStream inputStream, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateClob(int columnIndex, Reader reader, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateClob(String columnLabel, Reader reader, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNClob(int columnIndex, Reader reader, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNClob(String columnLabel, Reader reader, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNCharacterStream(int columnIndex, Reader x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNCharacterStream(String columnLabel, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateAsciiStream(int columnIndex, InputStream x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBinaryStream(int columnIndex, InputStream x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateCharacterStream(int columnIndex, Reader x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateAsciiStream(String columnLabel, InputStream x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBinaryStream(String columnLabel, InputStream x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateCharacterStream(String columnLabel, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBlob(int columnIndex, InputStream inputStream) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBlob(String columnLabel, InputStream inputStream) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateClob(int columnIndex, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateClob(String columnLabel, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNClob(int columnIndex, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNClob(String columnLabel, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public T getObject(int columnIndex, Class type) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public T getObject(String columnLabel, Class type) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public T unwrap(Class iface) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean isWrapperFor(Class iface) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setMatchColumn(int columnIdx) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setMatchColumn(int[] columnIdxes) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setMatchColumn(String columnName) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setMatchColumn(String[] columnNames) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int[] getMatchColumnIndexes() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String[] getMatchColumnNames() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void unsetMatchColumn(int columnIdx) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void unsetMatchColumn(int[] columnIdxes) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void unsetMatchColumn(String columnName) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void unsetMatchColumn(String[] columnName) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } +} diff --git a/test/javax/sql/testng/util/StubNClob.java b/test/javax/sql/testng/util/StubNClob.java new file mode 100644 index 000000000..10682578b --- /dev/null +++ b/test/javax/sql/testng/util/StubNClob.java @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package util; + +import java.sql.NClob; + +public class StubNClob extends StubClob implements NClob { + +} diff --git a/test/javax/sql/testng/util/StubRef.java b/test/javax/sql/testng/util/StubRef.java new file mode 100644 index 000000000..052bd92c7 --- /dev/null +++ b/test/javax/sql/testng/util/StubRef.java @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package util; + +import java.io.Serializable; +import java.sql.Ref; +import java.sql.SQLException; +import java.util.Map; + +public class StubRef implements Ref, Serializable { + + private final String baseTypeName; + private Object obj; + + public StubRef(String type, Object o) { + baseTypeName = type; + obj = o; + } + + @Override + public String getBaseTypeName() throws SQLException { + return baseTypeName; + } + + @Override + public Object getObject(Map> map) throws SQLException { + return obj; + } + + @Override + public Object getObject() throws SQLException { + return getObject(null); + } + + @Override + public void setObject(Object value) throws SQLException { + obj = value; + } + +} diff --git a/test/javax/sql/testng/util/StubRowId.java b/test/javax/sql/testng/util/StubRowId.java new file mode 100644 index 000000000..f8e90d498 --- /dev/null +++ b/test/javax/sql/testng/util/StubRowId.java @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package util; + +import java.sql.RowId; + +public class StubRowId implements RowId { + + @Override + public byte[] getBytes() { + throw new UnsupportedOperationException("Not supported yet."); + } + +} diff --git a/test/javax/sql/testng/util/StubRowSetFactory.java b/test/javax/sql/testng/util/StubRowSetFactory.java new file mode 100644 index 000000000..624c53af1 --- /dev/null +++ b/test/javax/sql/testng/util/StubRowSetFactory.java @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package util; + +import java.sql.SQLException; +import javax.sql.rowset.CachedRowSet; +import javax.sql.rowset.FilteredRowSet; +import javax.sql.rowset.JdbcRowSet; +import javax.sql.rowset.JoinRowSet; +import javax.sql.rowset.RowSetFactory; +import javax.sql.rowset.WebRowSet; + +public class StubRowSetFactory implements RowSetFactory { + + @Override + public CachedRowSet createCachedRowSet() throws SQLException { + return new StubCachedRowSetImpl(); + } + + @Override + public FilteredRowSet createFilteredRowSet() throws SQLException { + return new StubFilteredRowSetImpl(); + } + + @Override + public JdbcRowSet createJdbcRowSet() throws SQLException { + return new StubJdbcRowSetImpl(); + } + + @Override + public JoinRowSet createJoinRowSet() throws SQLException { + return new StubJoinRowSetImpl(); + } + + @Override + public WebRowSet createWebRowSet() throws SQLException { + return new StubWebRowSetImpl(); + } + +} diff --git a/test/javax/sql/testng/util/StubSQLXML.java b/test/javax/sql/testng/util/StubSQLXML.java new file mode 100644 index 000000000..44d1351b3 --- /dev/null +++ b/test/javax/sql/testng/util/StubSQLXML.java @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package util; + +import java.io.InputStream; +import java.io.OutputStream; +import java.io.Reader; +import java.io.Writer; +import java.sql.SQLException; +import java.sql.SQLXML; +import javax.xml.transform.Result; +import javax.xml.transform.Source; + +public class StubSQLXML implements SQLXML{ + + @Override + public void free() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public InputStream getBinaryStream() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public OutputStream setBinaryStream() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Reader getCharacterStream() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Writer setCharacterStream() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getString() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setString(String value) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public T getSource(Class sourceClass) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public T setResult(Class resultClass) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + +} diff --git a/test/javax/sql/testng/util/StubStruct.java b/test/javax/sql/testng/util/StubStruct.java new file mode 100644 index 000000000..1dee8028a --- /dev/null +++ b/test/javax/sql/testng/util/StubStruct.java @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package util; + +import java.sql.SQLException; +import java.sql.Struct; +import java.util.Arrays; +import java.util.Map; + +public class StubStruct implements Struct { + + private final String type; + private final Object[] attribs; + + public StubStruct(String type, Object[] o) { + this.type = type; + this.attribs = Arrays.copyOf(o, o.length); + } + + @Override + public String getSQLTypeName() throws SQLException { + return type; + } + + @Override + public Object[] getAttributes() throws SQLException { + return attribs; + } + + @Override + public Object[] getAttributes(Map> map) throws SQLException { + return attribs; + } + +} diff --git a/test/javax/sql/testng/util/StubSyncProvider.java b/test/javax/sql/testng/util/StubSyncProvider.java new file mode 100644 index 000000000..8947455c7 --- /dev/null +++ b/test/javax/sql/testng/util/StubSyncProvider.java @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package util; + +import javax.sql.RowSetReader; +import javax.sql.RowSetWriter; +import javax.sql.rowset.spi.SyncProvider; +import javax.sql.rowset.spi.SyncProviderException; + +public class StubSyncProvider extends SyncProvider { + + /** + * The unique provider identifier. + */ + private String providerID = "util.StubSyncProvider"; + + /** + * The vendor name of this SyncProvider implementation + */ + private String vendorName = "Oracle Corporation"; + + /** + * The version number of this SyncProvider implementation + */ + private String versionNumber = "1.0"; + + @Override + public String getProviderID() { + return providerID; + } + + @Override + public RowSetReader getRowSetReader() { + return null; + } + + @Override + public RowSetWriter getRowSetWriter() { + return null; + } + + @Override + public int getProviderGrade() { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setDataSourceLock(int datasource_lock) throws SyncProviderException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getDataSourceLock() throws SyncProviderException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int supportsUpdatableView() { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getVersion() { + return versionNumber; + } + + @Override + public String getVendor() { + return vendorName; + } + +} diff --git a/test/javax/sql/testng/util/StubSyncResolver.java b/test/javax/sql/testng/util/StubSyncResolver.java new file mode 100644 index 000000000..02477c7f9 --- /dev/null +++ b/test/javax/sql/testng/util/StubSyncResolver.java @@ -0,0 +1,1616 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package util; + +import java.io.InputStream; +import java.io.Reader; +import java.io.Serializable; +import java.math.BigDecimal; +import java.net.URL; +import java.sql.Array; +import java.sql.Blob; +import java.sql.Clob; +import java.sql.Date; +import java.sql.NClob; +import java.sql.Ref; +import java.sql.ResultSetMetaData; +import java.sql.RowId; +import java.sql.SQLException; +import java.sql.SQLWarning; +import java.sql.SQLXML; +import java.sql.Statement; +import java.sql.Time; +import java.sql.Timestamp; +import java.util.Calendar; +import java.util.Map; +import javax.sql.RowSetListener; +import javax.sql.rowset.spi.SyncResolver; + +public class StubSyncResolver implements SyncResolver, Serializable { + + @Override + public int getStatus() { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Object getConflictValue(int index) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Object getConflictValue(String columnName) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setResolvedValue(int index, Object obj) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setResolvedValue(String columnName, Object obj) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean nextConflict() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean previousConflict() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getUrl() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setUrl(String url) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getDataSourceName() { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setDataSourceName(String name) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getUsername() { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setUsername(String name) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getPassword() { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setPassword(String password) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getTransactionIsolation() { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setTransactionIsolation(int level) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Map> getTypeMap() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setTypeMap(Map> map) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getCommand() { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setCommand(String cmd) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean isReadOnly() { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setReadOnly(boolean value) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getMaxFieldSize() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setMaxFieldSize(int max) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getMaxRows() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setMaxRows(int max) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean getEscapeProcessing() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setEscapeProcessing(boolean enable) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getQueryTimeout() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setQueryTimeout(int seconds) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setType(int type) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setConcurrency(int concurrency) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNull(int parameterIndex, int sqlType) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNull(String parameterName, int sqlType) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNull(int paramIndex, int sqlType, String typeName) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNull(String parameterName, int sqlType, String typeName) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBoolean(int parameterIndex, boolean x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBoolean(String parameterName, boolean x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setByte(int parameterIndex, byte x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setByte(String parameterName, byte x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setShort(int parameterIndex, short x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setShort(String parameterName, short x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setInt(int parameterIndex, int x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setInt(String parameterName, int x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setLong(int parameterIndex, long x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setLong(String parameterName, long x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setFloat(int parameterIndex, float x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setFloat(String parameterName, float x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setDouble(int parameterIndex, double x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setDouble(String parameterName, double x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBigDecimal(String parameterName, BigDecimal x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setString(int parameterIndex, String x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setString(String parameterName, String x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBytes(int parameterIndex, byte[] x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBytes(String parameterName, byte[] x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setDate(int parameterIndex, Date x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setTime(int parameterIndex, Time x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setTimestamp(int parameterIndex, Timestamp x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setTimestamp(String parameterName, Timestamp x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setAsciiStream(int parameterIndex, InputStream x, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setAsciiStream(String parameterName, InputStream x, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBinaryStream(int parameterIndex, InputStream x, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBinaryStream(String parameterName, InputStream x, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setCharacterStream(int parameterIndex, Reader reader, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setCharacterStream(String parameterName, Reader reader, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setAsciiStream(int parameterIndex, InputStream x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setAsciiStream(String parameterName, InputStream x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBinaryStream(int parameterIndex, InputStream x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBinaryStream(String parameterName, InputStream x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setCharacterStream(int parameterIndex, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setCharacterStream(String parameterName, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNCharacterStream(int parameterIndex, Reader value) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setObject(int parameterIndex, Object x, int targetSqlType, int scaleOrLength) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setObject(String parameterName, Object x, int targetSqlType, int scale) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setObject(int parameterIndex, Object x, int targetSqlType) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setObject(String parameterName, Object x, int targetSqlType) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setObject(String parameterName, Object x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setObject(int parameterIndex, Object x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setRef(int i, Ref x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBlob(int i, Blob x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBlob(int parameterIndex, InputStream inputStream, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBlob(int parameterIndex, InputStream inputStream) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBlob(String parameterName, InputStream inputStream, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBlob(String parameterName, Blob x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBlob(String parameterName, InputStream inputStream) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setClob(int i, Clob x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setClob(int parameterIndex, Reader reader, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setClob(int parameterIndex, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setClob(String parameterName, Reader reader, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setClob(String parameterName, Clob x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setClob(String parameterName, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setArray(int i, Array x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setDate(int parameterIndex, Date x, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setDate(String parameterName, Date x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setDate(String parameterName, Date x, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setTime(int parameterIndex, Time x, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setTime(String parameterName, Time x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setTime(String parameterName, Time x, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setTimestamp(int parameterIndex, Timestamp x, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setTimestamp(String parameterName, Timestamp x, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void clearParameters() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void execute() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void addRowSetListener(RowSetListener listener) { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void removeRowSetListener(RowSetListener listener) { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setSQLXML(String parameterName, SQLXML xmlObject) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setRowId(int parameterIndex, RowId x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setRowId(String parameterName, RowId x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNString(int parameterIndex, String value) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNString(String parameterName, String value) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNCharacterStream(int parameterIndex, Reader value, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNCharacterStream(String parameterName, Reader value, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNCharacterStream(String parameterName, Reader value) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNClob(String parameterName, NClob value) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNClob(String parameterName, Reader reader, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNClob(String parameterName, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNClob(int parameterIndex, Reader reader, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNClob(int parameterIndex, NClob value) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNClob(int parameterIndex, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setURL(int parameterIndex, URL x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean next() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void close() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean wasNull() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getString(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean getBoolean(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public byte getByte(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public short getShort(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getInt(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public long getLong(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public float getFloat(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public double getDouble(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public byte[] getBytes(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Date getDate(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Time getTime(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Timestamp getTimestamp(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public InputStream getAsciiStream(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public InputStream getUnicodeStream(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public InputStream getBinaryStream(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getString(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean getBoolean(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public byte getByte(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public short getShort(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getInt(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public long getLong(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public float getFloat(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public double getDouble(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public BigDecimal getBigDecimal(String columnLabel, int scale) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public byte[] getBytes(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Date getDate(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Time getTime(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Timestamp getTimestamp(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public InputStream getAsciiStream(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public InputStream getUnicodeStream(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public InputStream getBinaryStream(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public SQLWarning getWarnings() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void clearWarnings() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getCursorName() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public ResultSetMetaData getMetaData() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Object getObject(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Object getObject(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int findColumn(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Reader getCharacterStream(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Reader getCharacterStream(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public BigDecimal getBigDecimal(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public BigDecimal getBigDecimal(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean isBeforeFirst() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean isAfterLast() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean isFirst() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean isLast() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void beforeFirst() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void afterLast() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean first() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean last() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getRow() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean absolute(int row) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean relative(int rows) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean previous() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setFetchDirection(int direction) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getFetchDirection() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setFetchSize(int rows) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getFetchSize() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getType() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getConcurrency() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean rowUpdated() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean rowInserted() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean rowDeleted() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNull(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBoolean(int columnIndex, boolean x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateByte(int columnIndex, byte x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateShort(int columnIndex, short x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateInt(int columnIndex, int x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateLong(int columnIndex, long x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateFloat(int columnIndex, float x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateDouble(int columnIndex, double x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBigDecimal(int columnIndex, BigDecimal x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateString(int columnIndex, String x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBytes(int columnIndex, byte[] x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateDate(int columnIndex, Date x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateTime(int columnIndex, Time x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateTimestamp(int columnIndex, Timestamp x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateAsciiStream(int columnIndex, InputStream x, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBinaryStream(int columnIndex, InputStream x, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateCharacterStream(int columnIndex, Reader x, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateObject(int columnIndex, Object x, int scaleOrLength) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateObject(int columnIndex, Object x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNull(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBoolean(String columnLabel, boolean x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateByte(String columnLabel, byte x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateShort(String columnLabel, short x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateInt(String columnLabel, int x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateLong(String columnLabel, long x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateFloat(String columnLabel, float x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateDouble(String columnLabel, double x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBigDecimal(String columnLabel, BigDecimal x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateString(String columnLabel, String x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBytes(String columnLabel, byte[] x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateDate(String columnLabel, Date x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateTime(String columnLabel, Time x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateTimestamp(String columnLabel, Timestamp x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateAsciiStream(String columnLabel, InputStream x, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBinaryStream(String columnLabel, InputStream x, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateCharacterStream(String columnLabel, Reader reader, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateObject(String columnLabel, Object x, int scaleOrLength) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateObject(String columnLabel, Object x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void insertRow() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateRow() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void deleteRow() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void refreshRow() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void cancelRowUpdates() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void moveToInsertRow() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void moveToCurrentRow() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Statement getStatement() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Object getObject(int columnIndex, Map> map) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Ref getRef(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Blob getBlob(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Clob getClob(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Array getArray(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Object getObject(String columnLabel, Map> map) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Ref getRef(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Blob getBlob(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Clob getClob(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Array getArray(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Date getDate(int columnIndex, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Date getDate(String columnLabel, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Time getTime(int columnIndex, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Time getTime(String columnLabel, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Timestamp getTimestamp(int columnIndex, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Timestamp getTimestamp(String columnLabel, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public URL getURL(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public URL getURL(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateRef(int columnIndex, Ref x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateRef(String columnLabel, Ref x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBlob(int columnIndex, Blob x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBlob(String columnLabel, Blob x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateClob(int columnIndex, Clob x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateClob(String columnLabel, Clob x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateArray(int columnIndex, Array x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateArray(String columnLabel, Array x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public RowId getRowId(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public RowId getRowId(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateRowId(int columnIndex, RowId x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateRowId(String columnLabel, RowId x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getHoldability() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean isClosed() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNString(int columnIndex, String nString) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNString(String columnLabel, String nString) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNClob(int columnIndex, NClob nClob) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNClob(String columnLabel, NClob nClob) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public NClob getNClob(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public NClob getNClob(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public SQLXML getSQLXML(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public SQLXML getSQLXML(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateSQLXML(int columnIndex, SQLXML xmlObject) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateSQLXML(String columnLabel, SQLXML xmlObject) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getNString(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getNString(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Reader getNCharacterStream(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Reader getNCharacterStream(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNCharacterStream(int columnIndex, Reader x, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNCharacterStream(String columnLabel, Reader reader, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateAsciiStream(int columnIndex, InputStream x, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBinaryStream(int columnIndex, InputStream x, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateCharacterStream(int columnIndex, Reader x, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateAsciiStream(String columnLabel, InputStream x, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBinaryStream(String columnLabel, InputStream x, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateCharacterStream(String columnLabel, Reader reader, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBlob(int columnIndex, InputStream inputStream, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBlob(String columnLabel, InputStream inputStream, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateClob(int columnIndex, Reader reader, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateClob(String columnLabel, Reader reader, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNClob(int columnIndex, Reader reader, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNClob(String columnLabel, Reader reader, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNCharacterStream(int columnIndex, Reader x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNCharacterStream(String columnLabel, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateAsciiStream(int columnIndex, InputStream x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBinaryStream(int columnIndex, InputStream x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateCharacterStream(int columnIndex, Reader x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateAsciiStream(String columnLabel, InputStream x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBinaryStream(String columnLabel, InputStream x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateCharacterStream(String columnLabel, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBlob(int columnIndex, InputStream inputStream) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBlob(String columnLabel, InputStream inputStream) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateClob(int columnIndex, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateClob(String columnLabel, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNClob(int columnIndex, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNClob(String columnLabel, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public T getObject(int columnIndex, Class type) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public T getObject(String columnLabel, Class type) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public T unwrap(Class iface) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean isWrapperFor(Class iface) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + +} diff --git a/test/javax/sql/testng/util/StubWebRowSetImpl.java b/test/javax/sql/testng/util/StubWebRowSetImpl.java new file mode 100644 index 000000000..918d5bd04 --- /dev/null +++ b/test/javax/sql/testng/util/StubWebRowSetImpl.java @@ -0,0 +1,1879 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package util; + +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.Reader; +import java.io.Writer; +import java.math.BigDecimal; +import java.net.URL; +import java.sql.Array; +import java.sql.Blob; +import java.sql.Clob; +import java.sql.Connection; +import java.sql.Date; +import java.sql.NClob; +import java.sql.Ref; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.sql.RowId; +import java.sql.SQLException; +import java.sql.SQLWarning; +import java.sql.SQLXML; +import java.sql.Savepoint; +import java.sql.Statement; +import java.sql.Time; +import java.sql.Timestamp; +import java.util.Calendar; +import java.util.Collection; +import java.util.Map; +import javax.sql.RowSet; +import javax.sql.RowSetEvent; +import javax.sql.RowSetListener; +import javax.sql.RowSetMetaData; +import javax.sql.rowset.CachedRowSet; +import javax.sql.rowset.RowSetWarning; +import javax.sql.rowset.WebRowSet; +import javax.sql.rowset.spi.SyncProvider; +import javax.sql.rowset.spi.SyncProviderException; + +public class StubWebRowSetImpl implements WebRowSet { + + @Override + public void readXml(Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void readXml(InputStream iStream) throws SQLException, IOException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void writeXml(ResultSet rs, Writer writer) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void writeXml(ResultSet rs, OutputStream oStream) throws SQLException, IOException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void writeXml(Writer writer) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void writeXml(OutputStream oStream) throws SQLException, IOException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void populate(ResultSet data) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void execute(Connection conn) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void acceptChanges() throws SyncProviderException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void acceptChanges(Connection con) throws SyncProviderException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void restoreOriginal() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void release() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void undoDelete() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void undoInsert() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void undoUpdate() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean columnUpdated(int idx) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean columnUpdated(String columnName) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Collection toCollection() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Collection toCollection(int column) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Collection toCollection(String column) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public SyncProvider getSyncProvider() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setSyncProvider(String provider) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int size() { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setMetaData(RowSetMetaData md) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public ResultSet getOriginal() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public ResultSet getOriginalRow() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setOriginalRow() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getTableName() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setTableName(String tabName) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int[] getKeyColumns() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setKeyColumns(int[] keys) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public RowSet createShared() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public CachedRowSet createCopy() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public CachedRowSet createCopySchema() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public CachedRowSet createCopyNoConstraints() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public RowSetWarning getRowSetWarnings() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean getShowDeleted() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setShowDeleted(boolean b) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void commit() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void rollback() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void rollback(Savepoint s) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void rowSetPopulated(RowSetEvent event, int numRows) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void populate(ResultSet rs, int startRow) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setPageSize(int size) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getPageSize() { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean nextPage() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean previousPage() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getUrl() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setUrl(String url) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getDataSourceName() { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setDataSourceName(String name) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getUsername() { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setUsername(String name) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getPassword() { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setPassword(String password) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getTransactionIsolation() { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setTransactionIsolation(int level) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Map> getTypeMap() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setTypeMap(Map> map) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getCommand() { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setCommand(String cmd) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean isReadOnly() { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setReadOnly(boolean value) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getMaxFieldSize() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setMaxFieldSize(int max) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getMaxRows() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setMaxRows(int max) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean getEscapeProcessing() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setEscapeProcessing(boolean enable) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getQueryTimeout() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setQueryTimeout(int seconds) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setType(int type) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setConcurrency(int concurrency) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNull(int parameterIndex, int sqlType) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNull(String parameterName, int sqlType) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNull(int paramIndex, int sqlType, String typeName) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNull(String parameterName, int sqlType, String typeName) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBoolean(int parameterIndex, boolean x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBoolean(String parameterName, boolean x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setByte(int parameterIndex, byte x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setByte(String parameterName, byte x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setShort(int parameterIndex, short x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setShort(String parameterName, short x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setInt(int parameterIndex, int x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setInt(String parameterName, int x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setLong(int parameterIndex, long x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setLong(String parameterName, long x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setFloat(int parameterIndex, float x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setFloat(String parameterName, float x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setDouble(int parameterIndex, double x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setDouble(String parameterName, double x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBigDecimal(String parameterName, BigDecimal x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setString(int parameterIndex, String x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setString(String parameterName, String x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBytes(int parameterIndex, byte[] x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBytes(String parameterName, byte[] x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setDate(int parameterIndex, Date x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setTime(int parameterIndex, Time x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setTimestamp(int parameterIndex, Timestamp x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setTimestamp(String parameterName, Timestamp x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setAsciiStream(int parameterIndex, InputStream x, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setAsciiStream(String parameterName, InputStream x, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBinaryStream(int parameterIndex, InputStream x, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBinaryStream(String parameterName, InputStream x, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setCharacterStream(int parameterIndex, Reader reader, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setCharacterStream(String parameterName, Reader reader, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setAsciiStream(int parameterIndex, InputStream x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setAsciiStream(String parameterName, InputStream x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBinaryStream(int parameterIndex, InputStream x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBinaryStream(String parameterName, InputStream x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setCharacterStream(int parameterIndex, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setCharacterStream(String parameterName, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNCharacterStream(int parameterIndex, Reader value) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setObject(int parameterIndex, Object x, int targetSqlType, int scaleOrLength) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setObject(String parameterName, Object x, int targetSqlType, int scale) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setObject(int parameterIndex, Object x, int targetSqlType) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setObject(String parameterName, Object x, int targetSqlType) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setObject(String parameterName, Object x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setObject(int parameterIndex, Object x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setRef(int i, Ref x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBlob(int i, Blob x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBlob(int parameterIndex, InputStream inputStream, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBlob(int parameterIndex, InputStream inputStream) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBlob(String parameterName, InputStream inputStream, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBlob(String parameterName, Blob x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setBlob(String parameterName, InputStream inputStream) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setClob(int i, Clob x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setClob(int parameterIndex, Reader reader, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setClob(int parameterIndex, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setClob(String parameterName, Reader reader, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setClob(String parameterName, Clob x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setClob(String parameterName, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setArray(int i, Array x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setDate(int parameterIndex, Date x, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setDate(String parameterName, Date x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setDate(String parameterName, Date x, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setTime(int parameterIndex, Time x, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setTime(String parameterName, Time x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setTime(String parameterName, Time x, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setTimestamp(int parameterIndex, Timestamp x, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setTimestamp(String parameterName, Timestamp x, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void clearParameters() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void execute() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void addRowSetListener(RowSetListener listener) { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void removeRowSetListener(RowSetListener listener) { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setSQLXML(String parameterName, SQLXML xmlObject) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setRowId(int parameterIndex, RowId x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setRowId(String parameterName, RowId x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNString(int parameterIndex, String value) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNString(String parameterName, String value) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNCharacterStream(int parameterIndex, Reader value, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNCharacterStream(String parameterName, Reader value, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNCharacterStream(String parameterName, Reader value) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNClob(String parameterName, NClob value) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNClob(String parameterName, Reader reader, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNClob(String parameterName, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNClob(int parameterIndex, Reader reader, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNClob(int parameterIndex, NClob value) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNClob(int parameterIndex, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setURL(int parameterIndex, URL x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean next() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void close() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean wasNull() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getString(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean getBoolean(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public byte getByte(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public short getShort(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getInt(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public long getLong(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public float getFloat(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public double getDouble(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public byte[] getBytes(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Date getDate(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Time getTime(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Timestamp getTimestamp(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public InputStream getAsciiStream(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public InputStream getUnicodeStream(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public InputStream getBinaryStream(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getString(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean getBoolean(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public byte getByte(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public short getShort(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getInt(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public long getLong(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public float getFloat(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public double getDouble(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public BigDecimal getBigDecimal(String columnLabel, int scale) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public byte[] getBytes(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Date getDate(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Time getTime(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Timestamp getTimestamp(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public InputStream getAsciiStream(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public InputStream getUnicodeStream(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public InputStream getBinaryStream(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public SQLWarning getWarnings() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void clearWarnings() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getCursorName() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public ResultSetMetaData getMetaData() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Object getObject(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Object getObject(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int findColumn(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Reader getCharacterStream(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Reader getCharacterStream(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public BigDecimal getBigDecimal(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public BigDecimal getBigDecimal(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean isBeforeFirst() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean isAfterLast() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean isFirst() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean isLast() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void beforeFirst() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void afterLast() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean first() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean last() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getRow() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean absolute(int row) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean relative(int rows) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean previous() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setFetchDirection(int direction) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getFetchDirection() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setFetchSize(int rows) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getFetchSize() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getType() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getConcurrency() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean rowUpdated() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean rowInserted() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean rowDeleted() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNull(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBoolean(int columnIndex, boolean x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateByte(int columnIndex, byte x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateShort(int columnIndex, short x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateInt(int columnIndex, int x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateLong(int columnIndex, long x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateFloat(int columnIndex, float x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateDouble(int columnIndex, double x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBigDecimal(int columnIndex, BigDecimal x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateString(int columnIndex, String x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBytes(int columnIndex, byte[] x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateDate(int columnIndex, Date x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateTime(int columnIndex, Time x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateTimestamp(int columnIndex, Timestamp x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateAsciiStream(int columnIndex, InputStream x, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBinaryStream(int columnIndex, InputStream x, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateCharacterStream(int columnIndex, Reader x, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateObject(int columnIndex, Object x, int scaleOrLength) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateObject(int columnIndex, Object x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNull(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBoolean(String columnLabel, boolean x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateByte(String columnLabel, byte x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateShort(String columnLabel, short x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateInt(String columnLabel, int x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateLong(String columnLabel, long x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateFloat(String columnLabel, float x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateDouble(String columnLabel, double x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBigDecimal(String columnLabel, BigDecimal x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateString(String columnLabel, String x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBytes(String columnLabel, byte[] x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateDate(String columnLabel, Date x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateTime(String columnLabel, Time x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateTimestamp(String columnLabel, Timestamp x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateAsciiStream(String columnLabel, InputStream x, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBinaryStream(String columnLabel, InputStream x, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateCharacterStream(String columnLabel, Reader reader, int length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateObject(String columnLabel, Object x, int scaleOrLength) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateObject(String columnLabel, Object x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void insertRow() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateRow() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void deleteRow() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void refreshRow() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void cancelRowUpdates() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void moveToInsertRow() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void moveToCurrentRow() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Statement getStatement() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Object getObject(int columnIndex, Map> map) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Ref getRef(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Blob getBlob(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Clob getClob(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Array getArray(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Object getObject(String columnLabel, Map> map) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Ref getRef(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Blob getBlob(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Clob getClob(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Array getArray(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Date getDate(int columnIndex, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Date getDate(String columnLabel, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Time getTime(int columnIndex, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Time getTime(String columnLabel, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Timestamp getTimestamp(int columnIndex, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Timestamp getTimestamp(String columnLabel, Calendar cal) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public URL getURL(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public URL getURL(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateRef(int columnIndex, Ref x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateRef(String columnLabel, Ref x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBlob(int columnIndex, Blob x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBlob(String columnLabel, Blob x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateClob(int columnIndex, Clob x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateClob(String columnLabel, Clob x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateArray(int columnIndex, Array x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateArray(String columnLabel, Array x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public RowId getRowId(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public RowId getRowId(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateRowId(int columnIndex, RowId x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateRowId(String columnLabel, RowId x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getHoldability() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean isClosed() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNString(int columnIndex, String nString) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNString(String columnLabel, String nString) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNClob(int columnIndex, NClob nClob) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNClob(String columnLabel, NClob nClob) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public NClob getNClob(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public NClob getNClob(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public SQLXML getSQLXML(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public SQLXML getSQLXML(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateSQLXML(int columnIndex, SQLXML xmlObject) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateSQLXML(String columnLabel, SQLXML xmlObject) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getNString(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getNString(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Reader getNCharacterStream(int columnIndex) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Reader getNCharacterStream(String columnLabel) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNCharacterStream(int columnIndex, Reader x, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNCharacterStream(String columnLabel, Reader reader, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateAsciiStream(int columnIndex, InputStream x, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBinaryStream(int columnIndex, InputStream x, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateCharacterStream(int columnIndex, Reader x, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateAsciiStream(String columnLabel, InputStream x, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBinaryStream(String columnLabel, InputStream x, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateCharacterStream(String columnLabel, Reader reader, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBlob(int columnIndex, InputStream inputStream, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBlob(String columnLabel, InputStream inputStream, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateClob(int columnIndex, Reader reader, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateClob(String columnLabel, Reader reader, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNClob(int columnIndex, Reader reader, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNClob(String columnLabel, Reader reader, long length) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNCharacterStream(int columnIndex, Reader x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNCharacterStream(String columnLabel, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateAsciiStream(int columnIndex, InputStream x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBinaryStream(int columnIndex, InputStream x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateCharacterStream(int columnIndex, Reader x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateAsciiStream(String columnLabel, InputStream x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBinaryStream(String columnLabel, InputStream x) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateCharacterStream(String columnLabel, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBlob(int columnIndex, InputStream inputStream) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateBlob(String columnLabel, InputStream inputStream) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateClob(int columnIndex, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateClob(String columnLabel, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNClob(int columnIndex, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void updateNClob(String columnLabel, Reader reader) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public T getObject(int columnIndex, Class type) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public T getObject(String columnLabel, Class type) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public T unwrap(Class iface) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean isWrapperFor(Class iface) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setMatchColumn(int columnIdx) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setMatchColumn(int[] columnIdxes) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setMatchColumn(String columnName) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setMatchColumn(String[] columnNames) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int[] getMatchColumnIndexes() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String[] getMatchColumnNames() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void unsetMatchColumn(int columnIdx) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void unsetMatchColumn(int[] columnIdxes) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void unsetMatchColumn(String columnName) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void unsetMatchColumn(String[] columnName) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + +} diff --git a/test/javax/sql/testng/util/SuperHero.java b/test/javax/sql/testng/util/SuperHero.java new file mode 100644 index 000000000..c8afb3831 --- /dev/null +++ b/test/javax/sql/testng/util/SuperHero.java @@ -0,0 +1,110 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package util; + +import java.io.Serializable; +import java.sql.SQLData; +import java.sql.SQLException; +import java.sql.SQLInput; +import java.sql.SQLOutput; + +public class SuperHero implements SQLData, Serializable { + + private String first; + private String last; + private String type = "SUPERHERO"; + private Integer firstYear; + private String secretIdentity; + + public SuperHero() { + + } + + public SuperHero(String sqlType, String fname, String lname, Integer year, + String identity) { + first = fname; + last = lname; + type = sqlType; + firstYear = year; + secretIdentity = identity; + } + + @Override + public String getSQLTypeName() throws SQLException { + return type; + } + + @Override + public void readSQL(SQLInput stream, String typeName) throws SQLException { + first = stream.readString(); + last = stream.readString(); + firstYear = stream.readInt(); + secretIdentity = stream.readString(); + } + + @Override + public void writeSQL(SQLOutput stream) throws SQLException { + stream.writeString(first); + stream.writeString(last); + stream.writeInt(firstYear); + stream.writeString(secretIdentity); + } + + @Override + public String toString() { + return "[ name =" + first + " " + last + " " + + firstYear + " " + secretIdentity + " ]"; + } + + public void setIdentity(String identity) { + secretIdentity = identity; + } + + public String getIdentity() { + return secretIdentity; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj instanceof SuperHero) { + SuperHero ss = (SuperHero) obj; + return first.equals(ss.first) && last.equals(ss.last) + && firstYear.equals(ss.firstYear) + && type.equals(ss.type) + && secretIdentity.equals(ss.secretIdentity); + } + return false; + } + + @Override + public int hashCode() { + return ((31 + first.hashCode()) * 31) * 31 + + ((31 + last.hashCode()) * 31) * 31 + + ((31 + firstYear.hashCode()) * 31) * 31 + + ((31 + type.hashCode()) * 31) * 31 + + secretIdentity.hashCode(); + } +} diff --git a/test/javax/sql/testng/util/TestRowSetListener.java b/test/javax/sql/testng/util/TestRowSetListener.java new file mode 100644 index 000000000..069ade29c --- /dev/null +++ b/test/javax/sql/testng/util/TestRowSetListener.java @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package util; + +import javax.sql.RowSetEvent; +import javax.sql.RowSetListener; + +public class TestRowSetListener implements RowSetListener { + + // Flags to indicate which listener events should have been notified + public final static int ROWSET_CHANGED = 1; + public final static int ROW_CHANGED = 2; + public final static int CURSOR_MOVED = 4; + private int flag; + + @Override + public void rowSetChanged(RowSetEvent event) { + flag |= ROWSET_CHANGED; + } + + @Override + public void rowChanged(RowSetEvent event) { + flag |= ROW_CHANGED; + } + + @Override + public void cursorMoved(RowSetEvent event) { + flag |= CURSOR_MOVED; + } + + /* + * Clear the flag indicating which events we were notified for + */ + public void resetFlag() { + flag = 0; + } + + /* + * Method used to validate that the correct event was notified + */ + public boolean isNotified( int val) { + return flag == val; + } +} diff --git a/test/javax/sql/testng/util/TestSQLDataImpl.java b/test/javax/sql/testng/util/TestSQLDataImpl.java new file mode 100644 index 000000000..0694add3e --- /dev/null +++ b/test/javax/sql/testng/util/TestSQLDataImpl.java @@ -0,0 +1,125 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package util; + +import java.math.BigDecimal; +import java.sql.Date; +import java.sql.SQLData; +import java.sql.SQLException; +import java.sql.SQLInput; +import java.sql.SQLOutput; +import java.sql.Time; +import java.sql.Timestamp; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.util.Arrays; + +public class TestSQLDataImpl implements SQLData { + + private final int stringPos = 0; + private final int datePos = 1; + private final int timePos = 2; + private final int timestampPos = 3; + private final int intPos = 4; + private final int longPos = 5; + private final int shortPos = 6; + private final int bigDecimalPos = 7; + private final int doublePos = 8; + private final int booleanPos = 9; + private final int floatPos = 10; + private final int bytePos = 11; + private final int bytesPos = 12; + private final int MAX_TYPES = bytesPos + 1; + private final Object[] types = new Object[MAX_TYPES]; + + private final static byte[] b = {1, 2, 3}; + + // attributes entries must line up with the ordering of the reading and + // writing of the fields in readSQL and writeSQL + public final static Object[] attributes = {"The Dark Knight", + Date.valueOf(LocalDate.now()), Time.valueOf(LocalTime.now()), + Timestamp.valueOf(LocalDateTime.now()), Integer.MAX_VALUE, + Long.MAX_VALUE, Short.MIN_VALUE, BigDecimal.ONE, + Double.MAX_VALUE, true, 1.5f, Byte.MAX_VALUE, b}; + + private String sqlType; + + public TestSQLDataImpl(String type) { + sqlType = type; + } + + @Override + public String getSQLTypeName() throws SQLException { + return sqlType; + } + + @Override + public void readSQL(SQLInput stream, String typeName) throws SQLException { + + sqlType = typeName; + types[stringPos] = stream.readString(); + types[datePos] = stream.readDate(); + types[timePos] = stream.readTime(); + types[timestampPos] = stream.readTimestamp(); + types[intPos] = stream.readInt(); + types[longPos] = stream.readLong(); + types[shortPos] = stream.readShort(); + types[bigDecimalPos] = stream.readBigDecimal(); + types[doublePos] = stream.readDouble(); + types[booleanPos] = stream.readBoolean(); + types[floatPos] = stream.readFloat(); + types[bytePos] = stream.readByte(); + types[bytesPos] = stream.readBytes(); + } + + @Override + public void writeSQL(SQLOutput stream) throws SQLException { + + stream.writeString((String) types[stringPos]); + stream.writeDate((Date) types[datePos]); + stream.writeTime((Time) types[timePos]); + stream.writeTimestamp((Timestamp) types[timestampPos]); + stream.writeInt((Integer) types[intPos]); + stream.writeLong((Long) types[longPos]); + stream.writeShort((Short) types[shortPos]); + stream.writeBigDecimal((BigDecimal) types[bigDecimalPos]); + stream.writeDouble((Double) types[doublePos]); + stream.writeBoolean((Boolean) types[booleanPos]); + stream.writeFloat((Float) types[floatPos]); + stream.writeByte((Byte) types[bytePos]); + stream.writeBytes((byte[]) types[bytesPos]); + } + + public Object[] toArray() { + + Object[] result = Arrays.copyOf(types, types.length); + return result; + } + + @Override + public String toString() { + return "[" + sqlType + " " + types + "]"; + } + +} diff --git a/test/javax/sql/testng/xml/COFFEE_ROWS.xml b/test/javax/sql/testng/xml/COFFEE_ROWS.xml new file mode 100644 index 000000000..e42eb4405 --- /dev/null +++ b/test/javax/sql/testng/xml/COFFEE_ROWS.xml @@ -0,0 +1,191 @@ + + + + + 1008 + + true + 1000 + 0 + 2 + + + + + 0 + 0 + 0 + true + ResultSet.TYPE_SCROLL_INSENSITIVE + false + COFFEES + + + com.sun.rowset.providers.RIOptimisticProvider + Oracle Corporation + 1.0 + 2 + 1 + + + + 6 + + 1 + false + false + false + 0 + false + false + 0 + + COF_NAME + + 0 + 0 + + + 4 + + + + 2 + false + false + false + 0 + false + false + 0 + + SUP_ID + + 0 + 0 + + + 12 + + + + 3 + false + false + false + 0 + false + false + 0 + + PRICE + + 0 + 0 + + + 4 + + + + 4 + false + false + false + 0 + false + false + 0 + + SALES + + 10 + 2 + + + 2 + + + + 5 + false + false + false + 0 + false + false + 0 + + TOTAL + + 0 + 0 + + + 4 + + + + 6 + false + false + false + 0 + false + false + 0 + + + + 0 + 0 + + + 4 + + + + + + 1 + Colombian + 101 + 7.99 + 0 + 0 + + + 2 + French_Roast + 49 + 8.99 + 0 + 0 + + + 3 + Espresso + 150 + 9.99 + 0 + 0 + + + 4 + Colombian_Decaf + 101 + 8.99 + 0 + 0 + + + 5 + French_Roast_Decaf + 49 + 9.99 + 0 + 0 + + + diff --git a/test/javax/sql/testng/xml/DELETED_COFFEE_ROWS.xml b/test/javax/sql/testng/xml/DELETED_COFFEE_ROWS.xml new file mode 100644 index 000000000..6fd38ff4e --- /dev/null +++ b/test/javax/sql/testng/xml/DELETED_COFFEE_ROWS.xml @@ -0,0 +1,191 @@ + + + + SELECT * FROM COFFEES + 1008 + + true + 1000 + 0 + 2 + + + + + 0 + 0 + 0 + true + ResultSet.TYPE_SCROLL_INSENSITIVE + false + COFFEES + jdbc:derby://localhost:1527/testDB;create=true + + com.sun.rowset.providers.RIOptimisticProvider + Oracle Corporation + 1.0 + 2 + 1 + + + + 6 + + 1 + false + false + false + 0 + false + false + 0 + + COF_NAME + + 0 + 0 + + + 4 + + + + 2 + false + false + false + 0 + false + false + 0 + + SUP_ID + + 0 + 0 + + + 12 + + + + 3 + false + false + false + 0 + false + false + 0 + + PRICE + + 0 + 0 + + + 4 + + + + 4 + false + false + false + 0 + false + false + 0 + + SALES + + 10 + 2 + + + 2 + + + + 5 + false + false + false + 0 + false + false + 0 + + TOTAL + + 0 + 0 + + + 4 + + + + 6 + false + false + false + 0 + false + false + 0 + + + + 0 + 0 + + + 4 + + + + + + 1 + Colombian + 101 + 7.99 + 0 + 0 + + + 2 + French_Roast + 49 + 8.99 + 0 + 0 + + + 3 + Espresso + 150 + 9.99 + 0 + 0 + + + 4 + Colombian_Decaf + 101 + 8.99 + 0 + 0 + + + 5 + French_Roast_Decaf + 49 + 9.99 + 0 + 0 + + + diff --git a/test/javax/sql/testng/xml/INSERTED_COFFEE_ROWS.xml b/test/javax/sql/testng/xml/INSERTED_COFFEE_ROWS.xml new file mode 100644 index 000000000..a700bab5c --- /dev/null +++ b/test/javax/sql/testng/xml/INSERTED_COFFEE_ROWS.xml @@ -0,0 +1,207 @@ + + + + + 1008 + + true + 1000 + 0 + 2 + + + + + 0 + 0 + 0 + true + ResultSet.TYPE_SCROLL_INSENSITIVE + false + COFFEES + + + com.sun.rowset.providers.RIOptimisticProvider + Oracle Corporation + 1.0 + 2 + 1 + + + + 6 + + 1 + false + false + false + 0 + false + false + 0 + + COF_NAME + + 0 + 0 + + + 4 + + + + 2 + false + false + false + 0 + false + false + 0 + + SUP_ID + + 0 + 0 + + + 12 + + + + 3 + false + false + false + 0 + false + false + 0 + + PRICE + + 0 + 0 + + + 4 + + + + 4 + false + false + false + 0 + false + false + 0 + + SALES + + 10 + 2 + + + 2 + + + + 5 + false + false + false + 0 + false + false + 0 + + TOTAL + + 0 + 0 + + + 4 + + + + 6 + false + false + false + 0 + false + false + 0 + + + + 0 + 0 + + + 4 + + + + + + 1 + Colombian + 101 + 7.99 + 0 + 0 + + + 2 + French_Roast + 49 + 8.99 + 0 + 0 + + + 3 + Espresso + 150 + 9.99 + 0 + 0 + + + 4 + Colombian_Decaf + 101 + 8.99 + 0 + 0 + + + 15 + Hazelnut + 101 + 8.99 + 0 + 0 + + + 20 + French Vanilla + 49 + 9.99 + 0 + 0 + + + 5 + French_Roast_Decaf + 49 + 9.99 + 0 + 0 + + + diff --git a/test/javax/sql/testng/xml/MODFIED_DELETED_COFFEE_ROWS.xml b/test/javax/sql/testng/xml/MODFIED_DELETED_COFFEE_ROWS.xml new file mode 100644 index 000000000..2c71a5ffd --- /dev/null +++ b/test/javax/sql/testng/xml/MODFIED_DELETED_COFFEE_ROWS.xml @@ -0,0 +1,191 @@ + + + + + 1008 + + true + 1000 + 0 + 2 + + + + + 0 + 0 + 0 + true + ResultSet.TYPE_SCROLL_INSENSITIVE + false + COFFEES + + + com.sun.rowset.providers.RIOptimisticProvider + Oracle Corporation + 1.0 + 2 + 1 + + + + 6 + + 1 + false + false + false + 0 + false + false + 0 + + COF_NAME + + 0 + 0 + + + 4 + + + + 2 + false + false + false + 0 + false + false + 0 + + SUP_ID + + 0 + 0 + + + 12 + + + + 3 + false + false + false + 0 + false + false + 0 + + PRICE + + 0 + 0 + + + 4 + + + + 4 + false + false + false + 0 + false + false + 0 + + SALES + + 10 + 2 + + + 2 + + + + 5 + false + false + false + 0 + false + false + 0 + + TOTAL + + 0 + 0 + + + 4 + + + + 6 + false + false + false + 0 + false + false + 0 + + + + 0 + 0 + + + 4 + + + + + + 1 + Colombian + 101 + 7.99 + 0 + 0 + + + 2 + French_Roast + 49 + 8.99 + 0 + 0 + + + 3 + Espresso + 150 + 9.99 + 0 + 0 + + + 4 + Colombian_Decaf + 101 + 8.99 + 0 + 0 + + + 5 + French_Roast_Decaf + 49 + 9.99 + 0 + 0 + + + diff --git a/test/javax/sql/testng/xml/UPDATED_COFFEE_ROWS.xml b/test/javax/sql/testng/xml/UPDATED_COFFEE_ROWS.xml new file mode 100644 index 000000000..449ba120b --- /dev/null +++ b/test/javax/sql/testng/xml/UPDATED_COFFEE_ROWS.xml @@ -0,0 +1,193 @@ + + + + SELECT * FROM COFFEES + 1008 + + true + 1000 + 0 + 2 + + + + + 0 + 0 + 0 + true + ResultSet.TYPE_SCROLL_INSENSITIVE + false + COFFEES + jdbc:derby://localhost:1527/testDB;create=true + + com.sun.rowset.providers.RIOptimisticProvider + Oracle Corporation + 1.0 + 2 + 1 + + + + 6 + + 1 + false + false + false + 0 + false + false + 0 + + COF_NAME + + 0 + 0 + + + 4 + + + + 2 + false + false + false + 0 + false + false + 0 + + SUP_ID + + 0 + 0 + + + 12 + + + + 3 + false + false + false + 0 + false + false + 0 + + PRICE + + 0 + 0 + + + 4 + + + + 4 + false + false + false + 0 + false + false + 0 + + SALES + + 10 + 2 + + + 2 + + + + 5 + false + false + false + 0 + false + false + 0 + + TOTAL + + 0 + 0 + + + 4 + + + + 6 + false + false + false + 0 + false + false + 0 + + + + 0 + 0 + + + 4 + + + + + + 1 + Colombian + 101 + 7.99 + 0 + 0 + + + 2 + French_Roast + 49 + 8.99 + 0 + 0 + + + 3 + Espresso + 150 + 9.99 + 0 + 21 + 0 + 69 + + + 4 + Colombian_Decaf + 101 + 8.99 + 0 + 0 + + + 5 + French_Roast_Decaf + 49 + 9.99 + 0 + 0 + + + diff --git a/test/javax/sql/testng/xml/UPDATED_INSERTED_COFFEE_ROWS.xml b/test/javax/sql/testng/xml/UPDATED_INSERTED_COFFEE_ROWS.xml new file mode 100644 index 000000000..0cfc3c9fc --- /dev/null +++ b/test/javax/sql/testng/xml/UPDATED_INSERTED_COFFEE_ROWS.xml @@ -0,0 +1,201 @@ + + + + + 1008 + + true + 1000 + 0 + 2 + + + + + 0 + 0 + 0 + true + ResultSet.TYPE_SCROLL_INSENSITIVE + false + COFFEES + + + com.sun.rowset.providers.RIOptimisticProvider + Oracle Corporation + 1.0 + 2 + 1 + + + + 6 + + 1 + false + false + false + 0 + false + false + 0 + + COF_NAME + + 0 + 0 + + + 4 + + + + 2 + false + false + false + 0 + false + false + 0 + + SUP_ID + + 0 + 0 + + + 12 + + + + 3 + false + false + false + 0 + false + false + 0 + + PRICE + + 0 + 0 + + + 4 + + + + 4 + false + false + false + 0 + false + false + 0 + + SALES + + 10 + 2 + + + 2 + + + + 5 + false + false + false + 0 + false + false + 0 + + TOTAL + + 0 + 0 + + + 4 + + + + 6 + false + false + false + 0 + false + false + 0 + + + + 0 + 0 + + + 4 + + + + + + 1 + Colombian + 101 + 7.99 + 0 + 0 + + + 2 + French_Roast + 49 + 8.99 + 0 + 0 + + + 3 + Espresso + 150 + 9.99 + 0 + 0 + + + 4 + Colombian_Decaf + 101 + 8.99 + 0 + 0 + + + 5 + French_Roast_Decaf + 49 + 9.99 + 0 + 0 + + + 100 + Mocha + 49 + 9.99 + 12.99 + 20 + 35 + 125 + + + -- GitLab