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 dj...@apache.org on 2006/08/16 06:39:52 UTC
svn commit: r431799 - in
/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi:
ConcurrencyTest.java HoldabilityTest.java SURBaseTest.java
SURDataModelSetup.java ScrollResultSetTest.java URCoveringIndexTest.java
Author: djd
Date: Tue Aug 15 21:39:51 2006
New Revision: 431799
URL: http://svn.apache.org/viewvc?rev=431799&view=rev
Log:
DERBY-1701 (partial) Clean up some of the jdbcapi tests by closing statements when finished and
cleaning up the connection. The connection handling needs to be simplified by having default connection
handling in BaseJDBCTestCase.
Modified:
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ConcurrencyTest.java
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/HoldabilityTest.java
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/SURBaseTest.java
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/SURDataModelSetup.java
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ScrollResultSetTest.java
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/URCoveringIndexTest.java
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ConcurrencyTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ConcurrencyTest.java?rev=431799&r1=431798&r2=431799&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ConcurrencyTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ConcurrencyTest.java Tue Aug 15 21:39:51 2006
@@ -54,17 +54,17 @@
con.commit();
}
- public void tearDown()
+ public void tearDown() throws Exception
{
try {
con.rollback();
Statement dropStatement = con.createStatement();
dropStatement.execute("drop table t1");
- con.commit();
- con.close();
+ dropStatement.close();
} catch (SQLException e) {
printStackTrace(e); // Want to propagate the real exception.
}
+ super.tearDown();
}
/**
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/HoldabilityTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/HoldabilityTest.java?rev=431799&r1=431798&r2=431799&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/HoldabilityTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/HoldabilityTest.java Tue Aug 15 21:39:51 2006
@@ -69,18 +69,19 @@
/**
* Drop the data model, and close the connection
+ * @throws Exception
*/
- public void tearDown()
+ public void tearDown() throws Exception
{
try {
con.rollback();
Statement dropStatement = con.createStatement();
dropStatement.execute("drop table t1");
- con.commit();
- con.close();
+ dropStatement.close();
} catch (SQLException e) {
printStackTrace(e); // Want to propagate the real exception.
}
+ super.tearDown();
}
/**
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/SURBaseTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/SURBaseTest.java?rev=431799&r1=431798&r2=431799&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/SURBaseTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/SURBaseTest.java Tue Aug 15 21:39:51 2006
@@ -19,6 +19,8 @@
*/
package org.apache.derbyTesting.functionTests.tests.jdbcapi;
import org.apache.derbyTesting.functionTests.util.BaseJDBCTestCase;
+import org.apache.derbyTesting.functionTests.util.JDBC;
+
import junit.framework.*;
import java.sql.*;
@@ -72,12 +74,8 @@
*/
public void tearDown() throws Exception {
println("TearDown");
- try {
- con.rollback();
- con.close();
- } catch (SQLException e) {
- printStackTrace(e);
- }
+ JDBC.cleanup(con);
+ con = null;
}
/**
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/SURDataModelSetup.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/SURDataModelSetup.java?rev=431799&r1=431798&r2=431799&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/SURDataModelSetup.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/SURDataModelSetup.java Tue Aug 15 21:39:51 2006
@@ -102,6 +102,8 @@
ps.addBatch();
}
ps.executeBatch();
+ ps.close();
+ statement.close();
con.commit();
}
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ScrollResultSetTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ScrollResultSetTest.java?rev=431799&r1=431798&r2=431799&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ScrollResultSetTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ScrollResultSetTest.java Tue Aug 15 21:39:51 2006
@@ -76,6 +76,7 @@
stmt.execute(createTableWithPK);
stmt.execute(insertData);
+ stmt.close();
}
/**
@@ -83,13 +84,16 @@
*/
public void tearDown() throws Exception {
println("TearDown");
+ Statement s = con.createStatement();
try {
- con.createStatement().executeUpdate("DROP TABLE tableWithPK");
- con.commit();
- con.close();
- } catch (SQLException e) {
+
+ s.executeUpdate("DROP TABLE tableWithPK");
+ } catch (SQLException e) {
printStackTrace(e);
- }
+ }
+ s.close();
+ JDBC.cleanup(con);
+ con = null;
}
/**
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/URCoveringIndexTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/URCoveringIndexTest.java?rev=431799&r1=431798&r2=431799&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/URCoveringIndexTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/URCoveringIndexTest.java Tue Aug 15 21:39:51 2006
@@ -18,6 +18,7 @@
* language governing permissions and limitations under the License.
*/
package org.apache.derbyTesting.functionTests.tests.jdbcapi;
+import org.apache.derbyTesting.functionTests.util.JDBC;
import org.apache.derbyTesting.functionTests.util.TestUtil;
import org.apache.derbyTesting.functionTests.util.BaseJDBCTestCase;
import junit.framework.*;
@@ -53,6 +54,8 @@
stmt.execute(createTableWithPK);
stmt.execute(insertData);
+
+ stmt.close();
}
/**
@@ -60,12 +63,8 @@
*/
public void tearDown() throws Exception {
println("TearDown");
- try {
- con.rollback();
- con.close();
- } catch (SQLException e) {
- printStackTrace(e);
- }
+ JDBC.cleanup(con);
+ con = null;
}
private void testUpdateUpdatedTupleWithCoveringIndex(