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 2006/02/22 01:19:42 UTC
svn commit: r379634 - in
/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4:
TestCallableStatementMethods.java TestConnectionMethods.java
TestPreparedStatementMethods.java TestResultSetMethods.java build.xml
Author: rhillegas
Date: Tue Feb 21 16:19:39 2006
New Revision: 379634
URL: http://svn.apache.org/viewcvs?rev=379634&view=rev
Log:
Anurag's fix to bug 1013: Make JDBC4 tests check for SQLState rather than variable text when catching exceptions from stubbed-out methods.
Modified:
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestCallableStatementMethods.java
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestConnectionMethods.java
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestPreparedStatementMethods.java
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestResultSetMethods.java
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/build.xml
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestCallableStatementMethods.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestCallableStatementMethods.java?rev=379634&r1=379633&r2=379634&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestCallableStatementMethods.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestCallableStatementMethods.java Tue Feb 21 16:19:39 2006
@@ -20,7 +20,6 @@
package org.apache.derbyTesting.functionTests.tests.jdbc4;
-import org.apache.derby.impl.jdbc.Util;
import java.io.Reader;
import java.io.InputStream;
import java.sql.Connection;
@@ -28,21 +27,19 @@
import java.sql.NClob;
import java.sql.SQLException;
import java.sql.SQLXML;
+import org.apache.derby.shared.common.reference.SQLState;
public class TestCallableStatementMethods{
Connection conn=null;
CallableStatement cs=null;
- SQLException sqle = Util.notImplemented();
- String message = sqle.getMessage();
-
void t_getRowId1() {
try {
cs.getRowId(0);
System.out.println("Not Implemented Exception not thrown");
} catch(SQLException e) {
- if(!message.equals(e.getMessage())) {
+ if(SQLState.NOT_IMPLEMENTED.equals (e.getSQLState())) {
System.out.println("Unexpected SQLException"+e);
}
@@ -57,7 +54,7 @@
cs.getRowId(null);
System.out.println("Not Implemented Exception not thrown");
} catch(SQLException e) {
- if(!message.equals(e.getMessage())) {
+ if(SQLState.NOT_IMPLEMENTED.equals (e.getSQLState())) {
System.out.println("Unexpected SQLException"+e);
}
} catch(Exception e) {
@@ -72,7 +69,7 @@
System.out.println("Not Implemented Exception not thrown");
} catch(SQLException e) {
- if(!message.equals(e.getMessage())) {
+ if(SQLState.NOT_IMPLEMENTED.equals (e.getSQLState())) {
System.out.println("Unexpected SQLException"+e);
}
@@ -87,7 +84,7 @@
cs.setNString(null,null);
System.out.println("Not Implemented Exception not thrown");
} catch(SQLException e) {
- if(!message.equals(e.getMessage())) {
+ if(SQLState.NOT_IMPLEMENTED.equals (e.getSQLState())) {
System.out.println("Unexpected SQLException"+e);
}
} catch(Exception e) {
@@ -101,7 +98,7 @@
cs.setNCharacterStream(null,null,0);
System.out.println("Not Implemented Exception not thrown");
} catch(SQLException e) {
- if(!message.equals(e.getMessage())) {
+ if(SQLState.NOT_IMPLEMENTED.equals (e.getSQLState())) {
System.out.println("Unexpected SQLException"+e);
}
} catch(Exception e) {
@@ -115,7 +112,7 @@
cs.setNClob(null,null);
System.out.println("Not Implemented Exception not thrown");
} catch(SQLException e) {
- if(!message.equals(e.getMessage())) {
+ if(SQLState.NOT_IMPLEMENTED.equals (e.getSQLState())) {
System.out.println("Unexpected SQLException"+e);
}
} catch(Exception e) {
@@ -129,7 +126,7 @@
cs.setClob(null,null,0);
System.out.println("Not Implemented Exception not thrown");
} catch(SQLException e) {
- if(!message.equals(e.getMessage())) {
+ if(SQLState.NOT_IMPLEMENTED.equals (e.getSQLState())) {
System.out.println("Unexpected SQLException"+e);
}
@@ -144,7 +141,7 @@
cs.setBlob(null,null,0);
System.out.println("Not Implemented Exception not thrown");
} catch(SQLException e) {
- if(!message.equals(e.getMessage())) {
+ if(SQLState.NOT_IMPLEMENTED.equals (e.getSQLState())) {
System.out.println("Unexpected SQLException"+e);
}
@@ -159,7 +156,7 @@
cs.setNClob(null,null,0);
System.out.println("Not Implemented Exception not thrown");
} catch(SQLException e) {
- if(!message.equals(e.getMessage())) {
+ if(SQLState.NOT_IMPLEMENTED.equals (e.getSQLState())) {
System.out.println("Unexpected SQLException"+e);
}
} catch(Exception e) {
@@ -173,7 +170,7 @@
NClob nclob = cs.getNClob(0);
System.out.println("Not Implemented Exception not thrown");
} catch(SQLException e) {
- if(!message.equals(e.getMessage())) {
+ if(SQLState.NOT_IMPLEMENTED.equals (e.getSQLState())) {
System.out.println("Unexpected SQLException"+e);
}
} catch(Exception e) {
@@ -187,7 +184,7 @@
NClob nclob = cs.getNClob(null);
System.out.println("Not Implemented Exception not thrown");
} catch(SQLException e) {
- if(!message.equals(e.getMessage())) {
+ if(SQLState.NOT_IMPLEMENTED.equals (e.getSQLState())) {
System.out.println("Unexpected SQLException"+e);
}
} catch(Exception e) {
@@ -201,7 +198,7 @@
cs.setSQLXML(null,null);
System.out.println("Not Implemented Exception not thrown");
} catch(SQLException e) {
- if(!message.equals(e.getMessage())) {
+ if(SQLState.NOT_IMPLEMENTED.equals (e.getSQLState())) {
System.out.println("Unexpected SQLException"+e);
}
} catch(Exception e) {
@@ -215,7 +212,7 @@
SQLXML sqlxml = cs.getSQLXML(0);
System.out.println("Not Implemented Exception not thrown");
} catch(SQLException e) {
- if(!message.equals(e.getMessage())) {
+ if(SQLState.NOT_IMPLEMENTED.equals (e.getSQLState())) {
System.out.println("Unexpected SQLException"+e);
}
} catch(Exception e) {
@@ -229,7 +226,7 @@
SQLXML sqlxml = cs.getSQLXML(null);
System.out.println("Not Implemented Exception not thrown");
} catch(SQLException e) {
- if(!message.equals(e.getMessage())) {
+ if(SQLState.NOT_IMPLEMENTED.equals (e.getSQLState())) {
System.out.println("Unexpected SQLException"+e);
}
} catch(Exception e) {
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestConnectionMethods.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestConnectionMethods.java?rev=379634&r1=379633&r2=379634&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestConnectionMethods.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestConnectionMethods.java Tue Feb 21 16:19:39 2006
@@ -27,12 +27,10 @@
import java.sql.SQLException;
import java.sql.SQLXML;
import java.util.Properties;
-import org.apache.derby.impl.jdbc.Util;
+import org.apache.derby.shared.common.reference.SQLState;
public class TestConnectionMethods {
Connection conn = null;
- SQLException sqle = Util.notImplemented();
- String message = sqle.getMessage();
public TestConnectionMethods(Connection connIn) {
conn = connIn;
@@ -44,7 +42,7 @@
clob = conn.createClob();
System.out.println("unimplemented exception not thrown in code");
} catch(SQLException e) {
- if(!message.equals(e.getMessage())) {
+ if(SQLState.NOT_IMPLEMENTED.equals (e.getSQLState())) {
System.out.println("Unexpected SQLException"+e);
}
@@ -58,7 +56,7 @@
blob = conn.createBlob();
System.out.println("unimplemented exception not thrown in code");
} catch(SQLException e) {
- if(!message.equals(e.getMessage())) {
+ if(SQLState.NOT_IMPLEMENTED.equals (e.getSQLState())) {
System.out.println("Unexpected SQLException"+e);
}
} catch(Exception e) {
@@ -71,7 +69,7 @@
nclob = conn.createNClob();
System.out.println("unimplemented exception not thrown in code");
} catch(SQLException e) {
- if(!message.equals(e.getMessage())) {
+ if(SQLState.NOT_IMPLEMENTED.equals (e.getSQLState())) {
System.out.println("Unexpected SQLException"+e);
}
} catch(Exception e) {
@@ -84,7 +82,7 @@
sqlXML = conn.createSQLXML();
System.out.println("unimplemented exception not thrown in code");
} catch(SQLException e) {
- if(!message.equals(e.getMessage())) {
+ if(SQLState.NOT_IMPLEMENTED.equals (e.getSQLState())) {
System.out.println("Unexpected SQLException"+e);
}
} catch(Exception e) {
@@ -99,7 +97,7 @@
ret = conn.isValid(0);
System.out.println("unimplemented exception not thrown in code");
} catch(SQLException e) {
- if(!message.equals(e.getMessage())) {
+ if(SQLState.NOT_IMPLEMENTED.equals (e.getSQLState())) {
System.out.println("Unexpected SQLException"+e);
}
} catch(Exception e) {
@@ -112,7 +110,7 @@
conn.setClientInfo("prop1","value1");
System.out.println("unimplemented exception not thrown in code");
} catch(SQLException e) {
- if(!message.equals(e.getMessage())) {
+ if(SQLState.NOT_IMPLEMENTED.equals (e.getSQLState())) {
System.out.println("Unexpected SQLException"+e);
}
} catch(Exception e) {
@@ -126,7 +124,7 @@
conn.setClientInfo(p);
System.out.println("unimplemented exception not thrown in code");
} catch(SQLException e) {
- if(!message.equals(e.getMessage())) {
+ if(SQLState.NOT_IMPLEMENTED.equals (e.getSQLState())) {
System.out.println("Unexpected SQLException"+e);
}
} catch(Exception e) {
@@ -140,7 +138,7 @@
info = conn.getClientInfo("prop1");
System.out.println("unimplemented exception not thrown in code");
} catch(SQLException e) {
- if(!message.equals(e.getMessage())) {
+ if(SQLState.NOT_IMPLEMENTED.equals (e.getSQLState())) {
System.out.println("Unexpected SQLException"+e);
}
} catch(Exception e) {
@@ -155,7 +153,7 @@
p = conn.getClientInfo();
System.out.println("unimplemented exception not thrown in code");
} catch(SQLException e) {
- if(!message.equals(e.getMessage())) {
+ if(SQLState.NOT_IMPLEMENTED.equals (e.getSQLState())) {
System.out.println("Unexpected SQLException"+e);
}
} catch(Exception e) {
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestPreparedStatementMethods.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestPreparedStatementMethods.java?rev=379634&r1=379633&r2=379634&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestPreparedStatementMethods.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestPreparedStatementMethods.java Tue Feb 21 16:19:39 2006
@@ -27,7 +27,8 @@
import java.sql.SQLException;
import java.sql.NClob;
import java.sql.SQLXML;
-import org.apache.derby.impl.jdbc.Util;
+import org.apache.derby.shared.common.reference.SQLState;
+
import org.apache.derby.tools.ij;
@@ -36,16 +37,12 @@
Connection conn=null;
PreparedStatement ps=null;
- SQLException sqle = Util.notImplemented();
- String message = sqle.getMessage();
-
-
void t_setRowId() {
try {
ps.setRowId(0,null);
System.out.println("UnImplemented Exception not thrown in code");
} catch(SQLException e) {
- if(!message.equals(e.getMessage())) {
+ if(SQLState.NOT_IMPLEMENTED.equals (e.getSQLState())) {
System.out.println("Unexpected SQLException"+e);
}
} catch(Exception e) {
@@ -58,7 +55,7 @@
ps.setNString(0,null);
System.out.println("UnImplemented Exception not thrown in code");
} catch(SQLException e) {
- if(!message.equals(e.getMessage())) {
+ if(SQLState.NOT_IMPLEMENTED.equals (e.getSQLState())) {
System.out.println("Unexpected SQLException"+e);
}
@@ -72,7 +69,7 @@
ps.setNCharacterStream(0,null,0);
System.out.println("UnImplemented Exception not thrown in code");
} catch(SQLException e) {
- if(!message.equals(e.getMessage())) {
+ if(SQLState.NOT_IMPLEMENTED.equals (e.getSQLState())) {
System.out.println("Unexpected SQLException"+e);
}
@@ -86,7 +83,7 @@
ps.setNClob(0,null);
System.out.println("UnImplemented Exception not thrown in code");
} catch(SQLException e) {
- if(!message.equals(e.getMessage())) {
+ if(SQLState.NOT_IMPLEMENTED.equals (e.getSQLState())) {
System.out.println("Unexpected SQLException"+e);
}
@@ -100,7 +97,7 @@
ps.setClob(0,null,0);
System.out.println("UnImplemented Exception not thrown in code");
} catch(SQLException e) {
- if(!message.equals(e.getMessage())) {
+ if(SQLState.NOT_IMPLEMENTED.equals (e.getSQLState())) {
System.out.println("Unexpected SQLException"+e);
}
@@ -114,7 +111,7 @@
ps.setBlob(0,null,0);
System.out.println("UnImplemented Exception not thrown in code");
} catch(SQLException e) {
- if(!message.equals(e.getMessage())) {
+ if(SQLState.NOT_IMPLEMENTED.equals (e.getSQLState())) {
System.out.println("Unexpected SQLException"+e);
}
@@ -128,7 +125,7 @@
ps.setNClob(0,null,0);
System.out.println("UnImplemented Exception not thrown in code");
} catch(SQLException e) {
- if(!message.equals(e.getMessage())) {
+ if(SQLState.NOT_IMPLEMENTED.equals (e.getSQLState())) {
System.out.println("Unexpected SQLException"+e);
}
@@ -142,7 +139,7 @@
ps.setSQLXML(0,null);
System.out.println("UnImplemented Exception not thrown in code");
} catch(SQLException e) {
- if(!message.equals(e.getMessage())) {
+ if(SQLState.NOT_IMPLEMENTED.equals (e.getSQLState())) {
System.out.println("Unexpected SQLException"+e);
}
@@ -156,7 +153,7 @@
ps.setPoolable(false);
System.out.println("UnImplemented Exception not thrown in code");
} catch(SQLException e) {
- if(!message.equals(e.getMessage())) {
+ if(SQLState.NOT_IMPLEMENTED.equals (e.getSQLState())) {
System.out.println("Unexpected SQLException"+e);
}
@@ -171,7 +168,7 @@
b = ps.isPoolable();
System.out.println("UnImplemented Exception not thrown in code");
} catch(SQLException e) {
- if(!message.equals(e.getMessage())) {
+ if(SQLState.NOT_IMPLEMENTED.equals (e.getSQLState())) {
System.out.println("Unexpected SQLException"+e);
}
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=379634&r1=379633&r2=379634&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 Tue Feb 21 16:19:39 2006
@@ -28,6 +28,7 @@
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
+import org.apache.derby.shared.common.reference.SQLState;
public class TestResultSetMethods {
@@ -35,15 +36,13 @@
PreparedStatement ps=null;
ResultSet rs=null;
- SQLException sqle = Util.notImplemented();
- String message = sqle.getMessage();
void t_getRowId1() {
try {
rs.getRowId(0);
System.out.println("unImplemented Exception not thrown in code");
} catch(SQLException e) {
- if(!message.equals(e.getMessage())) {
+ if(SQLState.NOT_IMPLEMENTED.equals (e.getSQLState())) {
System.out.println("Unexpected SQLException"+e);
}
@@ -57,7 +56,7 @@
rs.getRowId(null);
System.out.println("unImplemented Exception not thrown in code");
} catch(SQLException e) {
- if(!message.equals(e.getMessage())) {
+ if(SQLState.NOT_IMPLEMENTED.equals (e.getSQLState())) {
System.out.println("Unexpected SQLException"+e);
}
@@ -72,7 +71,7 @@
rs.updateRowId(0,null);
System.out.println("unImplemented Exception not thrown in code");
} catch(SQLException e) {
- if(!message.equals(e.getMessage())) {
+ if(SQLState.NOT_IMPLEMENTED.equals (e.getSQLState())) {
System.out.println("Unexpected SQLException"+e);
}
@@ -87,7 +86,7 @@
rs.updateRowId(null,null);
System.out.println("unImplemented Exception not thrown in code");
} catch(SQLException e) {
- if(!message.equals(e.getMessage())) {
+ if(SQLState.NOT_IMPLEMENTED.equals (e.getSQLState())) {
System.out.println("Unexpected SQLException"+e);
}
@@ -102,7 +101,7 @@
int i = rs.getHoldability();
System.out.println("unImplemented Exception not thrown in code");
} catch(SQLException e) {
- if(!message.equals(e.getMessage())) {
+ if(SQLState.NOT_IMPLEMENTED.equals (e.getSQLState())) {
System.out.println("Unexpected SQLException"+e);
}
@@ -117,7 +116,7 @@
boolean b = rs.isClosed();
System.out.println("unImplemented Exception not thrown in code");
} catch(SQLException e) {
- if(!message.equals(e.getMessage())) {
+ if(SQLState.NOT_IMPLEMENTED.equals (e.getSQLState())) {
System.out.println("Unexpected SQLException"+e);
}
@@ -132,7 +131,7 @@
rs.updateNString(0,null);
System.out.println("unImplemented Exception not thrown in code");
} catch(SQLException e) {
- if(!message.equals(e.getMessage())) {
+ if(SQLState.NOT_IMPLEMENTED.equals (e.getSQLState())) {
System.out.println("Unexpected SQLException"+e);
}
@@ -147,7 +146,7 @@
rs.updateNString(null,null);
System.out.println("unImplemented Exception not thrown in code");
} catch(SQLException e) {
- if(!message.equals(e.getMessage())) {
+ if(SQLState.NOT_IMPLEMENTED.equals (e.getSQLState())) {
System.out.println("Unexpected SQLException"+e);
}
@@ -162,7 +161,7 @@
rs.updateNClob(0,null);
System.out.println("unImplemented Exception not thrown in code");
} catch(SQLException e) {
- if(!message.equals(e.getMessage())) {
+ if(SQLState.NOT_IMPLEMENTED.equals (e.getSQLState())) {
System.out.println("Unexpected SQLException"+e);
}
@@ -177,7 +176,7 @@
rs.updateNClob(null,null);
System.out.println("unImplemented Exception not thrown in code");
} catch(SQLException e) {
- if(!message.equals(e.getMessage())) {
+ if(SQLState.NOT_IMPLEMENTED.equals (e.getSQLState())) {
System.out.println("Unexpected SQLException"+e);
}
@@ -192,7 +191,7 @@
rs.getNClob(0);
System.out.println("unImplemented Exception not thrown in code");
} catch(SQLException e) {
- if(!message.equals(e.getMessage())) {
+ if(SQLState.NOT_IMPLEMENTED.equals (e.getSQLState())) {
System.out.println("Unexpected SQLException"+e);
}
@@ -207,7 +206,7 @@
rs.getNClob(null);
System.out.println("unImplemented Exception not thrown in code");
} catch(SQLException e) {
- if(!message.equals(e.getMessage())) {
+ if(SQLState.NOT_IMPLEMENTED.equals (e.getSQLState())) {
System.out.println("Unexpected SQLException"+e);
}
@@ -222,7 +221,7 @@
rs.getSQLXML(0);
System.out.println("unImplemented Exception not thrown in code");
} catch(SQLException e) {
- if(!message.equals(e.getMessage())) {
+ if(SQLState.NOT_IMPLEMENTED.equals (e.getSQLState())) {
System.out.println("Unexpected SQLException"+e);
}
@@ -237,7 +236,7 @@
rs.getSQLXML(null);
System.out.println("unImplemented Exception not thrown in code");
} catch(SQLException e) {
- if(!message.equals(e.getMessage())) {
+ if(SQLState.NOT_IMPLEMENTED.equals (e.getSQLState())) {
System.out.println("Unexpected SQLException"+e);
}
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/build.xml
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/build.xml?rev=379634&r1=379633&r2=379634&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/build.xml (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/build.xml Tue Feb 21 16:19:39 2006
@@ -46,6 +46,7 @@
destdir="${out.dir}">
<classpath>
<pathelement path="${java16compile.classpath}"/>
+ <pathelement path="${junit}"/>
</classpath>
<include name="${this.dir}/*.java"/>
</javac>