You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by rh...@apache.org on 2007/04/30 18:13:44 UTC

svn commit: r533785 - /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/BlobClob4BlobTest.java

Author: rhillegas
Date: Mon Apr 30 09:13:39 2007
New Revision: 533785

URL: http://svn.apache.org/viewvc?view=rev&rev=533785
Log:
DERBY-2519: Commit Oystein's derby-2519.diff, cleaning up the BlobClob4BlobTest.

Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/BlobClob4BlobTest.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/BlobClob4BlobTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/BlobClob4BlobTest.java?view=diff&rev=533785&r1=533784&r2=533785
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/BlobClob4BlobTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/BlobClob4BlobTest.java Mon Apr 30 09:13:39 2007
@@ -69,10 +69,11 @@
         stmt.executeUpdate("ALTER TABLE testBlob ADD COLUMN crc32 BIGINT");
 
         stmt.close();
-
+        commit();
     }
 
     protected void tearDown() throws Exception {
+        rollback();
         Statement stmt = createStatement();
         stmt.executeUpdate("DROP TABLE testClob");
         stmt.executeUpdate("DROP TABLE testBlob");
@@ -1377,13 +1378,9 @@
      * after updating the clob when using result sets of type
      * TYPE_SCROLL_INSENSITIVE.
      *
-     * The method updateString(int, String) is used to set the value on the
-     * clob because the method updateBlob(int, Blob) has not yet been
-     * implemented for DerbyNetClient.
-     *
      * @throws SQLException
      */
-    public void xTestGetClobBeforeAndAfterUpdate() throws SQLException {
+    public void testGetClobBeforeAndAfterUpdate() throws SQLException {
         String clobData = "initial clob ";
         PreparedStatement ps = prepareStatement("insert into " +
                 "testClob (b, a) values (?, ?)");
@@ -1434,7 +1431,8 @@
         assertEquals("FAIL - wrong clob value", expectedValue, value);
         // update contents
         value = updatedClobData + rs.getInt(1);
-        rs.updateString(2, value);
+        c.setString(1, value);
+        rs.updateClob(2, c);
         rs.updateRow();
         // check update values
         rs.next(); // leave the row
@@ -1454,7 +1452,7 @@
      *
      * @throws SQLException
      */
-    public void xTestGetClobBeforeAndAfterUpdateStream() throws SQLException {
+    public void testGetClobBeforeAndAfterUpdateStream() throws SQLException {
         String clobData = "initial clob ";
         PreparedStatement ps = prepareStatement("insert into " +
                 "testClob (b, a) values (?, ?)");
@@ -2406,13 +2404,9 @@
      * after updating the blob when using result sets of type
      * TYPE_SCROLL_INSENSITIVE.
      *
-     * The method updateBytes(int, byte[]) is used to set the value on the
-     * clob because the method updateClob(int, Clob) has not yet been
-     * implemented for DerbyNetClient.
-     *
      * @throws Exception
      */
-    public void xTestGetBlobBeforeAndAfterUpdate() throws Exception {
+    public void testGetBlobBeforeAndAfterUpdate() throws Exception {
         String blobData = "initial blob ";
         PreparedStatement ps =
                 prepareStatement(
@@ -2464,7 +2458,8 @@
 
         // update contents
         value = (updatedBlobData + rs.getInt(1)).getBytes();
-        rs.updateBytes(2, value);
+        b.setBytes(1, value);
+        rs.updateBlob(2, b);
         rs.updateRow();
         // check update values
         rs.next(); // leave the row
@@ -2485,7 +2480,7 @@
      *
      * @throws Exception
      */
-    public void xTestGetBlobBeforeAndAfterUpdateStream() throws Exception {
+    public void testGetBlobBeforeAndAfterUpdateStream() throws Exception {
 
         String blobData = "initial blob ";
         PreparedStatement ps =
@@ -2772,26 +2767,10 @@
         suite.addTest(
                 TestConfiguration.clientServerSuite(BlobClob4BlobTest.class));
 
-        suite.addTest(derbynetExclude("BlobClob4BlobTest:embedded"));
-        suite.addTest(TestConfiguration.clientServerDecorator(
-                derbynetExclude("BlobClob4BlobTest:client")));
-
         return new CleanDatabaseTestSetup(
                 DatabasePropertyTestSetup.setLockTimeouts(suite, 2, 4));
     }
 
-    private static Test derbynetExclude(String name) {
-        TestSuite suite = new TestSuite(name);
-        suite.addTest(new BlobClob4BlobTest(
-                "xTestGetClobBeforeAndAfterUpdate"));
-        suite.addTest(new BlobClob4BlobTest(
-                "xTestGetClobBeforeAndAfterUpdateStream"));
-        suite.addTest(new BlobClob4BlobTest(
-                "xTestGetBlobBeforeAndAfterUpdate"));
-        suite.addTest(new BlobClob4BlobTest(
-                "xTestGetBlobBeforeAndAfterUpdateStream"));
-        return suite;
-    }
 
     private void insertDefaultData() throws Exception {
         PreparedStatement ps = prepareStatement(
@@ -3066,7 +3045,7 @@
             InputStream inStream = blob.getBinaryStream();
             inStream.skip(pos - 1);
             int numBytes = inStream.read(value);
-            // chech the the two values match
+            // check that the two values match
             if (numBytes >= 0) {
                 byte[] readBytes = new byte[numBytes];
                 System.arraycopy(value, 0, readBytes, 0, numBytes);