Return-Path: Delivered-To: apmail-db-derby-commits-archive@www.apache.org Received: (qmail 30328 invoked from network); 27 Jul 2007 16:19:49 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 27 Jul 2007 16:19:49 -0000 Received: (qmail 7988 invoked by uid 500); 27 Jul 2007 16:19:50 -0000 Delivered-To: apmail-db-derby-commits-archive@db.apache.org Received: (qmail 7965 invoked by uid 500); 27 Jul 2007 16:19:50 -0000 Mailing-List: contact derby-commits-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: "Derby Development" List-Id: Delivered-To: mailing list derby-commits@db.apache.org Received: (qmail 7954 invoked by uid 99); 27 Jul 2007 16:19:50 -0000 Received: from Unknown (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 27 Jul 2007 09:19:50 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 27 Jul 2007 16:19:49 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id B0C2C1A981A; Fri, 27 Jul 2007 09:19:28 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: derby-commits@db.apache.org From: kmarsden@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070727161928.B0C2C1A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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); } }