db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmars...@apache.org
Subject svn commit: r560299 - /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/StatementJdbc30Test.java
Date Fri, 27 Jul 2007 16:19:28 GMT
Author: kmarsden
Date: Fri Jul 27 09:19:27 2007
New Revision: 560299

URL: http://svn.apache.org/viewvc?view=rev&rev=560299
Log:
DERBY-2942 Convert jdbcapi/statementJdbc30.java to JUnit
Fix test failure

Contributed by Ramin Moazeni


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

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/StatementJdbc30Test.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/StatementJdbc30Test.java?view=diff&rev=560299&r1=560298&r2=560299
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/StatementJdbc30Test.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/StatementJdbc30Test.java
Fri Jul 27 09:19:27 2007
@@ -155,7 +155,7 @@
                     columnIndexes);
             fail("FAIL -- executeUpdate should have failed...");
         } catch (SQLException ex) {
-            assertFailedExecuteUpdate(ex);
+            assertFailedExecuteUpdateForColumnIndex(ex);
         }
     }
 
@@ -177,7 +177,7 @@
                     columnNames);
             fail("FAIL -- executeUpdate should have failed...");
         } catch (SQLException ex) {
-            assertFailedExecuteUpdate(ex);
+            assertFailedExecuteUpdateForColumnName(ex);
         }
     }
 
@@ -213,17 +213,17 @@
             stmt.execute("insert into tab1 values(2, 3, 4.1)", columnIndexes);
             fail("FAIL -- executeUpdate should have failed...");
         } catch (SQLException ex) {
-            assertFailedExecuteUpdate(ex);
+            assertFailedExecuteUpdateForColumnIndex(ex);
         }
     }
 
     /**
-     * Assert executeUpdate failed. There are different SQLStates for 
-     * client and server.
+     * Assert executeUpdateForColumnIndex failed. There are different SQLStates 
+     * for ColumnName(X0X0E) and ColumnIndex(X0X0F) as well as client and server
      * 
      * @param ex
      */
-    private void assertFailedExecuteUpdate(SQLException ex) {
+    private void assertFailedExecuteUpdateForColumnIndex(SQLException ex) {
         /*
          * DERBY-2943 -- execute() and executeUpdate() return different
          * SQLState in embedded and network client
@@ -237,6 +237,24 @@
     }
 
     /**
+     * Assert executeUpdateForColumnName failed. There are different SQLStates 
+     * for ColumnIndex(X0X0F) and ColumnNam(X0X0E) as well as client and server.
+     *
+     * @param ex
+     */
+    private void assertFailedExecuteUpdateForColumnName(SQLException ex) {
+        /*
+         * DERBY-2943 -- execute() and executeUpdate() return different
+         * SQLState in embedded and network client
+         *
+         */
+        if (usingDerbyNetClient()) {
+            assertSQLState("0A000", ex);
+        } else {
+            assertSQLState("X0X0F", ex);
+        }
+    }
+    /**
      * After doing an insert into a table that doesn't have a generated column,
      * the test should fail.
      * 
@@ -254,7 +272,7 @@
                         columnNames);
                 fail("FAIL -- executeUpdate should have failed...");
             } catch (SQLException ex) {
-                assertFailedExecuteUpdate(ex);
+                assertFailedExecuteUpdateForColumnName(ex);
             }
         
     }



Mime
View raw message