8062198: Add RowSetMetaDataImpl Tests and add column range validation to isdefinitlyWritable
authorlancea
Mon, 27 Oct 2014 16:57:59 -0400
changeset 27259 8dc38c3bad7e
parent 27258 e66ef2eba095
child 27260 8d82d0e9556b
8062198: Add RowSetMetaDataImpl Tests and add column range validation to isdefinitlyWritable Reviewed-by: joehw
jdk/src/java.sql.rowset/share/classes/javax/sql/rowset/RowSetMetaDataImpl.java
jdk/test/java/sql/util/BaseTest.java
jdk/test/java/sql/util/StubBlob.java
jdk/test/javax/sql/testng/TEST.properties
jdk/test/javax/sql/testng/test/rowset/RowSetMetaDataTests.java
jdk/test/javax/sql/testng/util/BaseTest.java
jdk/test/javax/sql/testng/util/TestPolicy.java
--- a/jdk/src/java.sql.rowset/share/classes/javax/sql/rowset/RowSetMetaDataImpl.java	Fri Oct 24 18:33:42 2014 +0200
+++ b/jdk/src/java.sql.rowset/share/classes/javax/sql/rowset/RowSetMetaDataImpl.java	Mon Oct 27 16:57:59 2014 -0400
@@ -803,8 +803,10 @@
      * @throws SQLException if a database access error occurs
      * or the given column number is out of bounds
      */
-    public  boolean isDefinitelyWritable(int columnIndex)
-        throws SQLException { return true;}
+    public  boolean isDefinitelyWritable(int columnIndex) throws SQLException {
+        checkColRange(columnIndex);
+        return true;
+    }
 
     /**
      * Retrieves the fully-qualified name of the class in the Java
--- a/jdk/test/java/sql/util/BaseTest.java	Fri Oct 24 18:33:42 2014 +0200
+++ b/jdk/test/java/sql/util/BaseTest.java	Mon Oct 27 16:57:59 2014 -0400
@@ -28,11 +28,13 @@
 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 {
 
@@ -96,4 +98,29 @@
     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;
+    }
 }
--- a/jdk/test/java/sql/util/StubBlob.java	Fri Oct 24 18:33:42 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,73 +0,0 @@
-/*
- * 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.sql.Blob;
-import java.sql.SQLException;
-
-
-public class StubBlob implements Blob {
-    public long length() throws SQLException {
-        return 0;
-    }
-    public byte[] getBytes(long pos, int length)
-        throws SQLException {
-        return null;
-    }
-    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 {
-        return null;
-    }
-    public void truncate(long len)
-        throws SQLException {
-    }
-    /* 6.0 implementation */
-
-    public void free() throws SQLException {}
-
-    public InputStream getBinaryStream(long pos, long length) throws SQLException {
-       return null;
-    }
-}
--- a/jdk/test/javax/sql/testng/TEST.properties	Fri Oct 24 18:33:42 2014 +0200
+++ b/jdk/test/javax/sql/testng/TEST.properties	Mon Oct 27 16:57:59 2014 -0400
@@ -1,3 +1,4 @@
 # JDBC unit tests uses TestNG
 TestNG.dirs= .
 othervm.dirs= .
+lib.dirs = /java/sql/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/sql/testng/test/rowset/RowSetMetaDataTests.java	Mon Oct 27 16:57:59 2014 -0400
@@ -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"}
+
+        };
+
+    }
+
+}
--- a/jdk/test/javax/sql/testng/util/BaseTest.java	Fri Oct 24 18:33:42 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,99 +0,0 @@
-/*
- * 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.SQLException;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.BeforeMethod;
-
-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 extends SQLException> T
-            createSerializedException(T ex)
-            throws IOException, ClassNotFoundException {
-        return (T) serializeDeserializeObject(ex);
-    }
-
-    /*
-     * Utility method to serialize and deserialize an object
-     */
-    @SuppressWarnings("unchecked")
-    protected <T> 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);
-    }
-}
--- a/jdk/test/javax/sql/testng/util/TestPolicy.java	Fri Oct 24 18:33:42 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,135 +0,0 @@
-/*
- * 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;
-
-/*
- * 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"),
-     * and setSyncFactory(SQLPermission(setSyncFactory),
-     *
-     * @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;
-            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("<<ALL FILES>>",
-                "read, write, delete"));
-    }
-
-    /*
-     * Overloaded methods from the Policy class
-     */
-    @Override
-    public String toString() {
-        StringJoiner sj = new StringJoiner("\n", "policy: ", "");
-        Enumeration<Permission> 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);
-    }
-}