db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhille...@apache.org
Subject svn commit: r396669 - in /db/derby/code/trunk/java: client/org/apache/derby/client/am/ client/org/apache/derby/client/net/ testing/org/apache/derbyTesting/functionTests/suites/ testing/org/apache/derbyTesting/functionTests/tests/jdbc4/
Date Mon, 24 Apr 2006 19:43:33 GMT
Author: rhillegas
Date: Mon Apr 24 12:43:30 2006
New Revision: 396669

URL: http://svn.apache.org/viewcvs?rev=396669&view=rev
Log:
DERBY-1180: Committed Kristian's patches providing tests and vacuous implementations for missing
signatures: derby-1180-2a-client.diff and derby-1180-3a-testing.diff.

Added:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/BlobClobTestSetup.java
  (with props)
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/BlobTest.java
  (with props)
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ClobTest.java
  (with props)
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ResultSetTest.java
  (with props)
Modified:
    db/derby/code/trunk/java/client/org/apache/derby/client/am/Blob.java
    db/derby/code/trunk/java/client/org/apache/derby/client/am/Clob.java
    db/derby/code/trunk/java/client/org/apache/derby/client/net/NetResultSet40.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/jdbc40.runall
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestResultSetMethods.java

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/Blob.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/client/org/apache/derby/client/am/Blob.java?rev=396669&r1=396668&r2=396669&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/Blob.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/Blob.java Mon Apr 24 12:43:30
2006
@@ -20,8 +20,11 @@
 
 package org.apache.derby.client.am;
 
+import java.io.InputStream;
 import java.sql.SQLException;
+
 import org.apache.derby.shared.common.reference.SQLState;
+
 public class Blob extends Lob implements java.sql.Blob {
     //-----------------------------state------------------------------------------
 
@@ -362,6 +365,18 @@
         {
             throw se.getSQLException();
         }
+    }
+
+    // -------------------------- JDBC 4.0 -----------------------------------
+
+    public void free()
+        throws SQLException {
+        throw SQLExceptionFactory.notImplemented("free()");
+    }
+
+    public InputStream getBinaryStream(long pos, long length)
+        throws SQLException {
+        throw SQLExceptionFactory.notImplemented("getBinaryStream(long,long)");
     }
 
     //------------------ Material layer event callback methods -------------------

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/Clob.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/client/org/apache/derby/client/am/Clob.java?rev=396669&r1=396668&r2=396669&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/Clob.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/Clob.java Mon Apr 24 12:43:30
2006
@@ -20,7 +20,9 @@
 
 package org.apache.derby.client.am;
 
+import java.io.Reader;
 import java.sql.SQLException;
+
 import org.apache.derby.shared.common.reference.SQLState;
 
 public class Clob extends Lob implements java.sql.Clob {
@@ -538,6 +540,19 @@
         }
     }
 
+    //---------------------------- jdbc 4.0 -------------------------------------
+
+    public void free()
+        throws SQLException {
+        throw SQLExceptionFactory.notImplemented("free()");
+    }
+
+    public Reader getCharacterStream(long pos, long length)
+        throws SQLException {
+        throw SQLExceptionFactory.notImplemented(
+                "getCharacterStream(long,long");
+    }
+    
     //----------------------------helper methods----------------------------------
 
     public boolean isString() {

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/net/NetResultSet40.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/client/org/apache/derby/client/net/NetResultSet40.java?rev=396669&r1=396668&r2=396669&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/net/NetResultSet40.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/net/NetResultSet40.java Mon Apr
24 12:43:30 2006
@@ -57,6 +57,26 @@
               actualResultSetConcurrency, actualResultSetHoldability);
     }
     
+    public Reader getNCharacterStream(int columnIndex)
+        throws SQLException {
+        throw SQLExceptionFactory.notImplemented("getNCharacterStream(int)");
+    }
+
+    public Reader getNCharacterStream(String columnName)
+        throws SQLException {
+        throw SQLExceptionFactory.notImplemented("getNCharacterStream(String)");
+    }
+
+    public String getNString(int columnIndex)
+        throws SQLException {
+        throw SQLExceptionFactory.notImplemented("getNString(int)");
+    }
+
+    public String getNString(String columnName)
+        throws SQLException {
+        throw SQLExceptionFactory.notImplemented("getNString(String)");
+    }
+    
     public RowId getRowId(int columnIndex) throws SQLException {
         throw SQLExceptionFactory.notImplemented ("getRowId (int)");
     }
@@ -80,6 +100,18 @@
     
     public void updateNString(String columnName, String nString) throws SQLException {
         throw SQLExceptionFactory.notImplemented ("updateNString (String, String)");
+    }
+    
+    public void updateNCharacterStream(int columnIndex, Reader x, int length)
+        throws SQLException {
+        throw SQLExceptionFactory.notImplemented(
+                "updateNCharacterStream(int,Reader,int)");
+    }
+    
+    public void updateNCharacterStream(String columnName, Reader x, int length)
+        throws SQLException {
+        throw SQLExceptionFactory.notImplemented(
+                "updateNCharacterStream(String,Reader,int)");
     }
     
     public void updateNClob(int columnIndex, NClob nClob) throws SQLException {

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/jdbc40.runall
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/jdbc40.runall?rev=396669&r1=396668&r2=396669&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/jdbc40.runall
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/jdbc40.runall
Mon Apr 24 12:43:30 2006
@@ -5,11 +5,15 @@
 jdbc4/TestDbMetaData.java
 jdbc4/TestJDBC40Exception.java
 jdbc4/StatementEventsTest.junit
+jdbc4/BlobTest.junit
 jdbc4/CallableStatementTest.junit
+jdbc4/ClobTest.junit
+jdbc4/ResultSetTest.junit
 jdbc4/RowIdNotImplementedTest.junit
 jdbc4/StatementTest.junit
 jdbc4/DataSourceTest.junit
 jdbc4/ResultSetMetaDataTest.junit
 jdbc4/EmbeddedBrokeredConnectionWrapperTest.junit
+jdbc4/ParameterMetaDataWrapperTest.junit
 jdbc4/ParameterMetaDataWrapperTest.junit
 jdbc4/AutoloadTest.junit

Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/BlobClobTestSetup.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/BlobClobTestSetup.java?rev=396669&view=auto
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/BlobClobTestSetup.java
(added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/BlobClobTestSetup.java
Mon Apr 24 12:43:30 2006
@@ -0,0 +1,168 @@
+/*
+ 
+   Derby - Class BlobClobTestSetup
+ 
+   Copyright 2006 The Apache Software Foundation or its licensors, as applicable.
+ 
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+ 
+ */
+
+package org.apache.derbyTesting.functionTests.tests.jdbc4;
+
+import junit.extensions.TestSetup;
+import junit.framework.Test;
+
+import org.apache.derbyTesting.functionTests.util.BaseJDBCTestCase;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.io.IOException;
+import java.io.Reader;
+import java.io.StringReader;
+import java.sql.*;
+
+/**
+ * Create a table with one column for a blob and one column for a clob.
+ * This is shared between tests that need a blob or a clob, and is required
+ * because the createBlob/-Clob methods are not yet implemented.
+ */
+public class BlobClobTestSetup
+    extends TestSetup {
+
+    /** Constant for accessing the row with null values. */
+    public static final int ID_NULLVALUES = 1;
+    /** Constant for accessing the row with sample values. */
+    public static final int ID_SAMPLEVALUES = 2;
+
+    /** ResultSet used to fetch BLOB or CLOB. */
+    private static ResultSet rs = null;
+    /** Statement used to fetch BLOB or CLOB. */
+    private static Statement stmt = null;
+    /** Stream used to insert BLOB. */
+    private static InputStream blobInput = null;
+    /** Blob data. */
+    private static final byte[] blobData = new byte[] {
+        0x65, 0x66, 0x67, 0x68, 0x69,
+        0x69, 0x68, 0x67, 0x66, 0x65
+    };
+    /** Stream used to insert CLOB. */
+    private static Reader clobInput = null;
+    /** Clob data. */
+    private static final String clobData =
+        "This is a string, inserted into a CLOB";
+   
+    static {
+        blobInput = new ByteArrayInputStream(blobData, 0, blobData.length);
+        clobInput = new StringReader(clobData);
+    }
+    
+    /**
+     * Create a test setup for the specified blob or clob test.
+     *
+     * @param test the test to provide setup for.
+     */
+    public BlobClobTestSetup(Test test) {
+        super(test);
+    }
+
+    /**
+     * Create a table with BLOB and CLOB, so that such objects can be
+     * accessed/used from JDBC.
+     */
+    public void setUp() 
+        throws IOException, SQLException {
+        Connection con = BaseJDBCTestCase.getConnection();
+        Statement stmt = con.createStatement();
+        stmt.execute("create table BLOBCLOB (ID int primary key, " +
+                                            "BLOBDATA blob(1k)," + 
+                                            "CLOBDATA clob(1k))");
+        stmt.execute("insert into BLOBCLOB VALUES " +
+                "(" + ID_NULLVALUES + ", null, null)");
+        // Actual data is inserted in the getSample* methods.
+        stmt.execute("insert into BLOBCLOB VALUES " +
+                "(" + ID_SAMPLEVALUES + ", null, null)");
+        stmt.close();
+    }
+
+    /**
+     * Drop the table we created during setup.
+     */
+    public void tearDown()
+        throws SQLException {
+        Connection con = BaseJDBCTestCase.getConnection();
+        Statement stmt = con.createStatement();
+        stmt.execute("drop table BLOBCLOB");
+        stmt.close();
+        con.close();
+    }
+    
+    /**
+     * Fetch a sample Blob.
+     * If this method fails, the test fails.
+     *
+     * @param con database connection to fetch data from.
+     * @return a sample <code>Blob</code> object.
+     */
+    public static Blob getSampleBlob(Connection con) 
+        throws SQLException {
+        PreparedStatement pStmt = 
+            con.prepareStatement("update BLOBCLOB set BLOBDATA = ? where ID = ?");
+        try {
+            blobInput.reset();
+        } catch (IOException ioe) {
+            fail("Failed to reset blob input stream: " + ioe.getMessage());
+        }
+        pStmt.setBlob(1, blobInput, blobData.length);
+        pStmt.setInt(2, ID_SAMPLEVALUES);
+        assertEquals("Invalid update count", 1, pStmt.executeUpdate());
+        stmt = con.createStatement();
+        rs = stmt.executeQuery("select BLOBDATA from BLOBCLOB where ID = " +
+                ID_SAMPLEVALUES);
+        rs.next();
+        Blob blob = rs.getBlob(1);
+        rs.close();
+        stmt.close();
+        return blob;
+    }
+    
+    /**
+     * Fetch a sample Clob.
+     * If this method fails, the test fails.
+     *
+     * @param con database connection to fetch data from.
+     * @return a sample <code>Clob</code> object.
+     */
+    public static Clob getSampleClob(Connection con) 
+        throws SQLException {
+        PreparedStatement pStmt = 
+            con.prepareStatement("update BLOBCLOB set CLOBDATA = ? where ID = ?");
+        try {
+            clobInput.reset();
+        } catch (IOException ioe) {
+            fail("Failed to reset clob input stream: " + ioe.getMessage());
+        }
+        pStmt.setClob(1, clobInput, clobData.length());
+        pStmt.setInt(2, ID_SAMPLEVALUES);
+        assertEquals("Invalid update count", 1, pStmt.executeUpdate());
+        stmt = con.createStatement();
+        rs = stmt.executeQuery("select CLOBDATA from BLOBCLOB where ID = " +
+                ID_SAMPLEVALUES);
+        rs.next();
+        Clob clob = rs.getClob(1);
+        rs.close();
+        stmt.close();
+        return clob;
+    }
+
+} // End class BlobClobTestSetup

Propchange: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/BlobClobTestSetup.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/BlobTest.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/BlobTest.java?rev=396669&view=auto
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/BlobTest.java
(added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/BlobTest.java
Mon Apr 24 12:43:30 2006
@@ -0,0 +1,93 @@
+/*
+ 
+   Derby - Class BlobTest
+ 
+   Copyright 2006 The Apache Software Foundation or its licensors, as applicable.
+ 
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+ 
+ */
+
+package org.apache.derbyTesting.functionTests.tests.jdbc4;
+
+import junit.framework.*;
+
+import org.apache.derbyTesting.functionTests.util.BaseJDBCTestCase;
+
+import java.sql.*;
+
+/*
+ * Tests of the JDBC 4.0 specific <code>Blob</code> methods.
+ */
+public class BlobTest
+    extends BaseJDBCTestCase {
+
+    /** Default Blob object used by the tests. */
+    private Blob blob = null;
+    /** Default connection used by the tests. */
+    private Connection con = null;
+    
+    /**
+     * Create the test with the given name.
+     *
+     * @param name name of the test.
+     */
+    public BlobTest(String name) {
+        super(name);
+    }
+    
+    public void setUp() 
+        throws SQLException {
+        con = getConnection();
+        blob = BlobClobTestSetup.getSampleBlob(con);
+    }
+
+    public void tearDown()
+        throws SQLException {
+        blob = null;
+        if (con != null && !con.isClosed()) {
+            con.rollback();
+            con.close();
+        }
+        con = null;
+    }
+
+    public void testFreeNotImplemented()
+        throws SQLException {
+        try {
+            blob.free();
+            fail("Blob.free() should not be implemented");
+        } catch (SQLFeatureNotSupportedException sfnse) {
+            // Do nothing, we are fine
+        }
+    }
+    
+    public void testGetBinaryStringLongNotImplemented()
+        throws SQLException {
+        try {
+            blob.getBinaryStream(5l, 10l);
+            fail("Blob.getBinaryStream(long,long) should not be implemented");
+        } catch (SQLFeatureNotSupportedException sfnse) {
+            // Do nothing, we are fine
+        }
+    }
+
+    /**
+     * Create test suite for this test.
+     */
+    public static Test suite() {
+        return new BlobClobTestSetup(new TestSuite(BlobTest.class,
+                                                   "BlobTest suite"));
+    }
+
+} // End class BlobTest

Propchange: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/BlobTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ClobTest.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ClobTest.java?rev=396669&view=auto
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ClobTest.java
(added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ClobTest.java
Mon Apr 24 12:43:30 2006
@@ -0,0 +1,95 @@
+
+/*
+ 
+   Derby - Class ClobTest
+ 
+   Copyright 2006 The Apache Software Foundation or its licensors, as applicable.
+ 
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+ 
+ */
+
+package org.apache.derbyTesting.functionTests.tests.jdbc4;
+
+import junit.framework.*;
+
+import org.apache.derbyTesting.functionTests.util.BaseJDBCTestCase;
+
+import java.sql.*;
+
+/*
+ * Tests of the JDBC 4.0 specific <code>Clob</code> methods.
+ */
+public class ClobTest
+    extends BaseJDBCTestCase {
+
+    /** Default Clob object used by the tests. */
+    private Clob clob = null;
+    /** Default connection used by the tests. */
+    private Connection con = null;
+    
+    /**
+     * Create the test with the given name.
+     *
+     * @param name name of the test.
+     */
+    public ClobTest(String name) {
+        super(name);
+    }
+    
+    public void setUp() 
+        throws SQLException {
+        con = getConnection();
+        clob = BlobClobTestSetup.getSampleClob(con);
+    }
+
+    public void tearDown()
+        throws SQLException {
+        clob = null;
+        if (con != null && !con.isClosed()) {
+            con.rollback();
+            con.close();
+        }
+        con = null;
+    }
+
+    public void testFreeNotImplemented()
+        throws SQLException {
+        try {
+            clob.free();
+            fail("Clob.free() should not be implemented");
+        } catch (SQLFeatureNotSupportedException sfnse) {
+            // Do nothing, we are fine
+        }
+    }
+    
+    public void testGetCharacterStreamLongNotImplemented()
+        throws SQLException {
+        try {
+            clob.getCharacterStream(5l, 10l);
+            fail("Clob.getCharacterStream(long,long)" +
+                 "should not be implemented");
+        } catch (SQLFeatureNotSupportedException sfnse) {
+            // Do nothing, we are fine
+        }
+    }
+
+    /**
+     * Create test suite for this test.
+     */
+    public static Test suite() {
+        return new BlobClobTestSetup(new TestSuite(ClobTest.class,
+                                                   "ClobTest suite"));
+    }
+
+} // End class ClobTest

Propchange: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ClobTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ResultSetTest.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ResultSetTest.java?rev=396669&view=auto
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ResultSetTest.java
(added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ResultSetTest.java
Mon Apr 24 12:43:30 2006
@@ -0,0 +1,254 @@
+/*
+ 
+   Derby - Class ResultSetTest
+ 
+   Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ 
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+ 
+ */
+
+package org.apache.derbyTesting.functionTests.tests.jdbc4;
+
+import junit.framework.*;
+
+import org.apache.derbyTesting.functionTests.util.BaseJDBCTestCase;
+
+import java.sql.*;
+
+/**
+ * Tests of JDBC4 features in ResultSet.
+ */
+public class ResultSetTest
+    extends BaseJDBCTestCase {
+
+    /** Default connection used by the tests. */
+    private Connection con = null;
+    /** Statement used to obtain default resultset. */
+    private Statement stmt = null;
+    /** Default resultset used by the tests. */
+    private ResultSet rs = null;
+
+    /**
+     * Create test with given name.
+     *
+     * @param name name of the test.
+     */
+    public ResultSetTest(String name) {
+        super(name);
+    }
+
+    public void setUp()
+        throws SQLException {
+        con = getConnection();
+        stmt = con.createStatement();
+        rs = stmt.executeQuery("SELECT * FROM SYS.SYSTABLES");
+        // Position on first result.
+        rs.next();
+    }
+
+    public void tearDown()
+        throws SQLException {
+        if (rs != null) {
+            rs.close();
+        }
+        if (stmt != null) {
+            stmt.close();
+        }
+        if (con != null && !con.isClosed()) {
+            con.rollback();
+            con.close();
+        }
+    }
+
+    public void testGetNCharacterStreamIntNotImplemented()
+        throws SQLException {
+        try {
+            rs.getNCharacterStream(1);
+            fail("ResultSet.getNCharacterStream(int) " +
+                 "should not be implemented");
+        } catch (SQLFeatureNotSupportedException sfnse) {
+            // We are fine, do nothing.
+        }
+    }
+   
+    public void testGetNCharaterStreamStringNotImplemented()
+        throws SQLException {
+        try {
+            rs.getNCharacterStream("some-column-name");
+            fail("ResultSet.getNCharacterStream(String) " +
+                 "should not be implemented");
+        } catch (SQLFeatureNotSupportedException sfnse) {
+            // We are fine, do nothing.
+        }
+    }
+
+    public void testGetNClobNotIntImplemented()
+        throws SQLException {
+        try {
+            rs.getNClob(1);
+            fail("ResultSet.getNClob(int) " +
+                 "should not be implemented");
+        } catch (SQLFeatureNotSupportedException sfnse) {
+            // We are fine, do nothing.
+        }
+    }
+
+    public void testGetNClobStringNotImplemented()
+        throws SQLException {
+        try {
+            rs.getNClob("some-column-name");
+            fail("ResultSet.getNClob(String) " +
+                 "should not be implemented");
+        } catch (SQLFeatureNotSupportedException sfnse) {
+            // We are fine, do nothing.
+        }
+    }
+    
+    public void testGetNStringIntNotImplemented()
+        throws SQLException {
+        try {
+            rs.getNString(1);
+            fail("ResultSet.getNString(int) " +
+                 "should not be implemented");
+        } catch (SQLFeatureNotSupportedException sfnse) {
+            // We are fine, do nothing.
+        }
+    }
+    
+    public void testGetNStringStringNotImplemented()
+        throws SQLException {
+        try {
+            rs.getNString("some-column-name");
+            fail("ResultSet.getNString(String) " +
+                 "should not be implemented");
+        } catch (SQLFeatureNotSupportedException sfnse) {
+            // We are fine, do nothing.
+        }
+    }
+
+    public void testGetSQLXMLIntNotImplemented()
+        throws SQLException {
+        try {
+            rs.getSQLXML(1);
+            fail("ResultSet.getSQLXML(int) " +
+                 "should not be implemented");
+        } catch (SQLFeatureNotSupportedException sfnse) {
+            // We are fine, do nothing.
+        }
+    }
+
+    public void testGetSQLXMLStringNotImplemented()
+        throws SQLException {
+        try {
+            rs.getSQLXML("some-column-name");
+            fail("ResultSet.getSQLXML(String) " +
+                 "should not be implemented");
+        } catch (SQLFeatureNotSupportedException sfnse) {
+            // We are fine, do nothing.
+        }
+    }
+
+    public void testUpdateNCharacterStreamIntNotImplemented()
+        throws SQLException {
+        try {
+            rs.updateNCharacterStream(1, null, 0);
+            fail("ResultSet.updateNCharacterStream(int, Reader, int) " +
+                 "should not be implemented");
+        } catch (SQLFeatureNotSupportedException sfnse) {
+            // We are fine, do nothing.
+        }
+    }
+   
+    public void testUpdateNCharaterStreamStringNotImplemented()
+        throws SQLException {
+        try {
+            rs.updateNCharacterStream("some-column-name", null, 0);
+            fail("ResultSet.updateNCharacterStream(String, Reader, 0) " +
+                 "should not be implemented");
+        } catch (SQLFeatureNotSupportedException sfnse) {
+            // We are fine, do nothing.
+        }
+    }
+
+    public void testUpdateNClobNotIntImplemented()
+        throws SQLException {
+        try {
+            rs.updateNClob(1, null);
+            fail("ResultSet.updateNClob(int, NClob) " +
+                 "should not be implemented");
+        } catch (SQLFeatureNotSupportedException sfnse) {
+            // We are fine, do nothing.
+        }
+    }
+
+    public void testUpdateNClobStringNotImplemented()
+        throws SQLException {
+        try {
+            rs.updateNClob("some-column-name", null);
+            fail("ResultSet.updateNClob(String, NClob) " +
+                 "should not be implemented");
+        } catch (SQLFeatureNotSupportedException sfnse) {
+            // We are fine, do nothing.
+        }
+    }
+    
+    public void testUpdateNStringIntNotImplemented()
+        throws SQLException {
+        try {
+            rs.updateNString(1, null);
+            fail("ResultSet.updateNString(int, String) " +
+                 "should not be implemented");
+        } catch (SQLFeatureNotSupportedException sfnse) {
+            // We are fine, do nothing.
+        }
+    }
+    
+    public void testUpdateNStringStringNotImplemented()
+        throws SQLException {
+        try {
+            rs.updateNString("some-column-name", null);
+            fail("ResultSet.updateNString(String, String) " +
+                 "should not be implemented");
+        } catch (SQLFeatureNotSupportedException sfnse) {
+            // We are fine, do nothing.
+        }
+    }
+
+    public void testUpdateSQLXMLIntNotImplemented()
+        throws SQLException {
+        try {
+            rs.updateSQLXML(1, null);
+            fail("ResultSet.updateSQLXML(int, SQLXML) " +
+                 "should not be implemented");
+        } catch (SQLFeatureNotSupportedException sfnse) {
+            // We are fine, do nothing.
+        }
+    }
+
+    public void testUpdateSQLXMLStringNotImplemented()
+        throws SQLException {
+        try {
+            rs.updateSQLXML("some-column-name", null);
+            fail("ResultSet.updateSQLXML(String, SQLXML) " +
+                 "should not be implemented");
+        } catch (SQLFeatureNotSupportedException sfnse) {
+            // We are fine, do nothing.
+        }
+    }
+    
+    public static Test suite() {
+        return new TestSuite(ResultSetTest.class,
+                             "ResultSetTest suite");
+    }
+}

Propchange: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ResultSetTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestResultSetMethods.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestResultSetMethods.java?rev=396669&r1=396668&r2=396669&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestResultSetMethods.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestResultSetMethods.java
Mon Apr 24 12:43:30 2006
@@ -263,132 +263,6 @@
         }
     }
     
-    void t_updateNString1() {
-        try {
-            rs.updateNString(0,null);
-            System.out.println("unImplemented Exception not thrown in code");
-        } catch(SQLException e) {
-            if(SQLState.NOT_IMPLEMENTED.equals (e.getSQLState())) {
-                System.out.println("Unexpected SQLException"+e);
-            }
-            
-        } catch(Exception e) {
-            System.out.println("Unexpected exception caught"+e);
-            e.printStackTrace();
-        }
-    }
-    
-    void t_updateNString2() {
-        try {
-            rs.updateNString(null,null);
-            System.out.println("unImplemented Exception not thrown in code");
-        } catch(SQLException e) {
-            if(SQLState.NOT_IMPLEMENTED.equals (e.getSQLState())) {
-                System.out.println("Unexpected SQLException"+e);
-            }
-            
-        } catch(Exception e) {
-            System.out.println("Unexpected exception caught"+e);
-            e.printStackTrace();
-        }
-    }
-    
-    void t_updateNClob1() {
-        try {
-            rs.updateNClob(0,null);
-            System.out.println("unImplemented Exception not thrown in code");
-        } catch(SQLException e) {
-            if(SQLState.NOT_IMPLEMENTED.equals (e.getSQLState())) {
-                System.out.println("Unexpected SQLException"+e);
-            }
-            
-        } catch(Exception e) {
-            System.out.println("Unexpected exception caught"+e);
-            e.printStackTrace();
-        }
-    }
-    
-    void t_updateNClob2() {
-        try {
-            rs.updateNClob(null,null);
-            System.out.println("unImplemented Exception not thrown in code");
-        } catch(SQLException e) {
-            if(SQLState.NOT_IMPLEMENTED.equals (e.getSQLState())) {
-                System.out.println("Unexpected SQLException"+e);
-            }
-            
-        } catch(Exception e) {
-            System.out.println("Unexpected exception caught"+e);
-            e.printStackTrace();
-        }
-    }
-    
-    void t_getNClob1() {
-        try {
-            rs.getNClob(0);
-            System.out.println("unImplemented Exception not thrown in code");
-        } catch(SQLException e) {
-            if(SQLState.NOT_IMPLEMENTED.equals (e.getSQLState())) {
-                System.out.println("Unexpected SQLException"+e);
-            }
-            
-        } catch(Exception e) {
-            System.out.println("Unexpected exception caught"+e);
-            e.printStackTrace();
-        }
-    }
-    
-    void t_getNClob2() {
-        try {
-            rs.getNClob(null);
-            System.out.println("unImplemented Exception not thrown in code");
-        } catch(SQLException e) {
-            if(SQLState.NOT_IMPLEMENTED.equals (e.getSQLState())) {
-                System.out.println("Unexpected SQLException"+e);
-            }
-            
-        } catch(Exception e) {
-            System.out.println("Unexpected exception caught"+e);
-            e.printStackTrace();
-        }
-    }
-    
-    void t_getSQLXML1() {
-        try {
-            rs.getSQLXML(0);
-            System.out.println("unImplemented Exception not thrown in code");
-        } catch(SQLException e) {
-            if(SQLState.NOT_IMPLEMENTED.equals (e.getSQLState())) {
-                System.out.println("Unexpected SQLException"+e);
-            }
-            
-        } catch(Exception e) {
-            System.out.println("Unexpected exception caught"+e);
-            e.printStackTrace();
-        }
-    }
-    
-    void t_getSQLXML2() {
-        try {
-            rs.getSQLXML(null);
-            System.out.println("unImplemented Exception not thrown in code");
-        } catch(SQLException e) {
-            if(SQLState.NOT_IMPLEMENTED.equals (e.getSQLState())) {
-                System.out.println("Unexpected SQLException"+e);
-            }
-            
-        } catch(Exception e) {
-            System.out.println("Unexpected exception caught"+e);
-            e.printStackTrace();
-        }
-    }
-    
-    void t_updateSQLXML1(){
-    }
-    
-    void t_updateSQLXML2() {
-    }
-
     /**
      * Test that an exception is thrown when methods are called
      * on a closed result set (DERBY-1060).
@@ -523,21 +397,6 @@
         t_getHoldability();
         t_isClosed();
         
-        t_updateNString1();
-        t_updateNString2();
-        
-        t_updateNClob1();
-        t_updateNClob2();
-        
-        t_getNClob1();
-        t_getNClob2();
-        
-        t_getSQLXML1();
-        t_getSQLXML2();
-        
-        t_updateSQLXML1();
-        t_updateSQLXML2();
-
         testExceptionWhenClosed();
     }
     



Mime
View raw message