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/07/25 20:08:16 UTC
svn commit: r425472 -
/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ProcedureTest.java
Author: djd
Date: Tue Jul 25 11:08:16 2006
New Revision: 425472
URL: http://svn.apache.org/viewvc?rev=425472&view=rev
Log:
Convert JUnit ProcedureTest to use the BaseJDBCTestSetup as the parent class
for its decarator.
Modified:
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ProcedureTest.java
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ProcedureTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ProcedureTest.java?rev=425472&r1=425471&r2=425472&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ProcedureTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ProcedureTest.java Tue Jul 25 11:08:16 2006
@@ -30,6 +30,7 @@
import junit.framework.Test;
import junit.framework.TestSuite;
import org.apache.derbyTesting.functionTests.util.BaseJDBCTestCase;
+import org.apache.derbyTesting.functionTests.util.BaseJDBCTestSetup;
/**
* Tests of stored procedures.
@@ -697,12 +698,45 @@
("xtestRollbackStoredProcWhenExecuteUpdateReturnsResults" +
"_prepared"));
}
- return new TestSetup(suite) {
- protected void setUp() throws Exception {
- oneTimeSetUp();
+ return new BaseJDBCTestSetup(suite) {
+ /**
+ * Creates the tables and the stored procedures used in the test
+ * cases.
+ * @exception SQLException if a database error occurs
+ */
+ protected void setUp() throws SQLException {
+ Connection c = getConnection();
+ c.setAutoCommit(false);
+ Statement s = c.createStatement();
+ for (int i = 0; i < PROCEDURES.length; i++) {
+ s.execute(PROCEDURES[i][1]);
+ }
+ for (int i = 0; i < TABLES.length; i++) {
+ s.execute(TABLES[i][1]);
+ }
+ s.close();
+ c.commit();
+ c.close();
}
- protected void tearDown() throws Exception {
- oneTimeTearDown();
+ /**
+ * Drops the stored procedures used in the tests.
+ * @exception SQLException if a database error occurs
+ */
+ protected void tearDown() throws Exception {
+ Connection c = getConnection();
+ c.setAutoCommit(false);
+ Statement s = c.createStatement();
+ for (int i = 0; i < PROCEDURES.length; i++) {
+ s.execute("DROP PROCEDURE " + PROCEDURES[i][0]);
+ }
+ for (int i = 0; i < TABLES.length; i++) {
+ s.execute("DROP TABLE " + TABLES[i][0]);
+ }
+ s.close();
+ c.commit();
+ c.close();
+
+ super.tearDown();
}
};
}
@@ -730,45 +764,6 @@
public void tearDown() throws SQLException {
conn.rollback();
conn.close();
- }
-
- /**
- * Creates the tables and the stored procedures used in the test
- * cases.
- * @exception SQLException if a database error occurs
- */
- private static void oneTimeSetUp() throws SQLException {
- Connection c = getConnection();
- c.setAutoCommit(false);
- Statement s = c.createStatement();
- for (int i = 0; i < PROCEDURES.length; i++) {
- s.execute(PROCEDURES[i][1]);
- }
- for (int i = 0; i < TABLES.length; i++) {
- s.execute(TABLES[i][1]);
- }
- s.close();
- c.commit();
- c.close();
- }
-
- /**
- * Drops the stored procedures used in the tests.
- * @exception SQLException if a database error occurs
- */
- private static void oneTimeTearDown() throws SQLException {
- Connection c = getConnection();
- c.setAutoCommit(false);
- Statement s = c.createStatement();
- for (int i = 0; i < PROCEDURES.length; i++) {
- s.execute("DROP PROCEDURE " + PROCEDURES[i][0]);
- }
- for (int i = 0; i < TABLES.length; i++) {
- s.execute("DROP TABLE " + TABLES[i][0]);
- }
- s.close();
- c.commit();
- c.close();
}
/**