db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fuzzylo...@apache.org
Subject svn commit: r358591 [6/6] - in /db/derby/code/trunk/java: drda/org/apache/derby/impl/drda/ testing/ testing/org/apache/derbyTesting/functionTests/harness/ testing/org/apache/derbyTesting/functionTests/master/ testing/org/apache/derbyTesting/functionTes...
Date Thu, 22 Dec 2005 17:29:08 GMT
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/resultsetStream.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/resultsetStream.java?rev=358591&r1=358590&r2=358591&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/resultsetStream.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/resultsetStream.java
Thu Dec 22 09:26:55 2005
@@ -31,6 +31,7 @@
 
 import org.apache.derby.tools.ij;
 import org.apache.derby.tools.JDBCDisplayUtil;
+import org.apache.derbyTesting.functionTests.util.TestUtil;
 
 import java.io.InputStream;
 import java.io.IOException;
@@ -70,14 +71,22 @@
 			stmt.execute("create table t2 (len int, data LONG VARCHAR FOR BIT DATA)");
 			PreparedStatement ppw = con.prepareStatement(
 				"insert into t2 (len, data) values (?, ?)");
-			File file = new File("extin/littleclob.txt");
+			String filePath = "extin";
+			String sep = System.getProperty("file.separator");
+			boolean exists = (new File("extin", "littleclob.txt")).exists();
+			if (!exists)
+			{
+				String userDir = System.getProperty("user.dir");
+					filePath = userDir + sep + ".." + sep + filePath;
+			}
+			File file = new File(filePath + sep + "littleclob.txt");
 			int fileSize = (int) file.length();
 			BufferedInputStream fileData = new BufferedInputStream(new FileInputStream(file));
 			ppw.setInt(1, fileSize);
 			ppw.setBinaryStream(2, fileData, fileSize);
 			ppw.executeUpdate();
 
-			file = new File("extin/short.txt");
+			file = new File(filePath + sep + "short.txt");
 			fileSize = (int) file.length();
 			fileData = new BufferedInputStream(new FileInputStream(file));
 			ppw.setInt(1, fileSize);
@@ -89,7 +98,7 @@
 			ppw.executeUpdate();
 
 			// value copied over from original Java object test.
-			File rssg = new java.io.File("extin/resultsetStream.gif");
+			File rssg = new java.io.File(filePath + sep + "resultsetStream.gif");
 			int rssgLength = (int) rssg.length();
 			ppw.setInt(1, (int) rssgLength);
 			ppw.setBinaryStream(2, new FileInputStream(rssg), rssgLength);
@@ -282,10 +291,11 @@
 
 			ppw.close();
 			rs.close();
-			stmt.close();
 			
 			TestOfGetAsciiStream.executeTestOfGetAsciiStream(con);
 
+			cleanUp(stmt);
+			stmt.close();
 			con.close();
 
 		}
@@ -308,6 +318,10 @@
 		}
 	}
 	
+	private static void cleanUp(Statement stmt) throws SQLException {
+		String[] testObjects = { " table t3", "table t2" };
+		TestUtil.cleanUpTest(stmt, testObjects);
+	}
 	
 	static class TestOfGetAsciiStream {
 		

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/rsgetXXXcolumnNames.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/rsgetXXXcolumnNames.java?rev=358591&r1=358590&r2=358591&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/rsgetXXXcolumnNames.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/rsgetXXXcolumnNames.java
Thu Dec 22 09:26:55 2005
@@ -6,6 +6,8 @@
 import org.apache.derby.tools.ij;
 import org.apache.derby.tools.JDBCDisplayUtil;
 
+import org.apache.derbyTesting.functionTests.util.TestUtil;
+
 public class rsgetXXXcolumnNames {
 
     public static void main(String[] args) {
@@ -27,9 +29,14 @@
                         ij.getPropertyArg(args);
                         con = ij.startJBMS();
 					
-			con.setAutoCommit(false);                        			              
 
                         stmt = con.createStatement(); 
+
+                        // first cleanup in case we're using useprocess false
+                        String[] testObjects = {"table caseiscol"};
+                        TestUtil.cleanUpTest(stmt, testObjects);
+
+			con.setAutoCommit(false);                        			              
 
 			// create a table with two columns, their names differ in they being in different cases.
                         stmt.executeUpdate("create table caseiscol(COL1 int ,\"col1\" int)");

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/savepointJdbc30.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/savepointJdbc30.java?rev=358591&r1=358590&r2=358591&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/savepointJdbc30.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/savepointJdbc30.java
Thu Dec 22 09:26:55 2005
@@ -44,8 +44,12 @@
 
 	static private boolean isDerbyNet = false;
 
+    static private String[] testObjects = { "table t1", "table t2", "table savepoint"};
+
+
+
 	public static void main(String[] args) {
-		Connection con = null, con2 = null;
+		Connection con = null, con2 = null, con3 = null;
 		Statement  s;
 		System.out.println("Test savepointJdbc30 starting");
 
@@ -80,6 +84,15 @@
 			s.close();
 			con.close();
 			con2.close();
+
+			con3 = ij.startJBMS();
+			con3.setAutoCommit(true);
+			s = con3.createStatement();
+			TestUtil.cleanUpTest(s, testObjects);
+			s.close();
+			con3.close();
+
+
 		}
 		catch (SQLException e) {
 			dumpSQLExceptions(e);
@@ -873,6 +886,16 @@
 	//Set up the test by creating the table used by the rest of the test.
 	static void setUpTest(Statement s)
 					throws SQLException {
+
+		try {
+			/* Drop the tables, just in case they're there from another test */
+			s.execute("drop table t1");
+			s.execute("drop table t2");
+			s.execute("drop table savepoint");
+		} catch (SQLException se) {
+			//System.out.println("Expected Exception is " + se.getMessage());
+		}
+
 		/* Create a table */
 		s.execute("create table t1 (c11 int, c12 smallint)");
 		s.execute("create table t2 (c11 int)");

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/setTransactionIsolation.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/setTransactionIsolation.java?rev=358591&r1=358590&r2=358591&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/setTransactionIsolation.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/setTransactionIsolation.java
Thu Dec 22 09:26:55 2005
@@ -35,6 +35,7 @@
 
 import org.apache.derby.tools.ij;
 import org.apache.derby.tools.JDBCDisplayUtil;
+import org.apache.derbyTesting.functionTests.util.TestUtil;
 
 
 public class setTransactionIsolation{
@@ -54,6 +55,7 @@
 		createAndPopulateTable(conn);
 		runTests(conn);
 		conn.rollback();
+		cleanUp(conn);
 		conn.close();
     } catch (Throwable  e) {
 		e.printStackTrace();
@@ -342,6 +344,16 @@
 			JDBCDisplayUtil.ShowSQLException(System.out,se);
 		}			
 	}
+
+	static void cleanUp(Connection conn) throws SQLException
+	{
+		String[] testObjects = {"table t1"};
+		Statement stmt = conn.createStatement();
+		TestUtil.cleanUpTest(stmt, testObjects);
+		conn.commit();
+		stmt.close();
+	}
+	
 
 }
 

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/xaSimplePositive.sql
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/xaSimplePositive.sql?rev=358591&r1=358590&r2=358591&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/xaSimplePositive.sql
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/xaSimplePositive.sql
Thu Dec 22 09:26:55 2005
@@ -135,6 +135,7 @@
 
 select * from APP.global_xactTable where gxid is not null order by gxid;
 select * from APP.foo;
+drop table APP.foo;
 xa_end xa_success 5;
 xa_prepare 5;
 xa_commit xa_2Phase 5;
@@ -156,5 +157,9 @@
 insert into t1 values (1,'one'), (2, 'two'), (3,'three');
 create procedure DRS(p1 int) parameter style JAVA READS SQL DATA dynamic result sets 1 language
java external name 'org.apache.derbyTesting.functionTests.util.ProcedureTest.selectRows';
 call DRS(1);
+drop procedure DRS;
+drop table t1;
+drop view APP.global_xacttable;
+drop schema sku restrict;
 xa_end xa_success 6;
 xa_commit xa_1Phase 6;

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/bug5054.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/bug5054.java?rev=358591&r1=358590&r2=358591&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/bug5054.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/bug5054.java
Thu Dec 22 09:26:55 2005
@@ -45,6 +45,7 @@
       	createTables(conn);
       	doUpdates(conn);
       	dumpResult(conn);
+        cleanUp(conn);
 		conn.close();
     } catch (Exception e) {
 		System.out.println("FAIL -- unexpected exception "+e);
@@ -68,6 +69,14 @@
     stmt.close();
   }
 
+  private static void cleanUp(Connection conn) throws SQLException {
+    Statement stmt = conn.createStatement();
+	try {
+    	stmt.executeUpdate( "DROP TABLE T1" );
+	}catch (Exception e) {}
+    stmt.close();
+  }
+
   private static void doUpdates(Connection conn) throws SQLException
   {
     int rc;
@@ -98,6 +107,7 @@
     while (rs.next()) {
       System.out.println(rs.getInt(1)+ " " + rs.getInt(2));
     }
+    rs.close();
   }
 
 }

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/declareGlobalTempTableJavaJDBC30.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/declareGlobalTempTableJavaJDBC30.java?rev=358591&r1=358590&r2=358591&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/declareGlobalTempTableJavaJDBC30.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/declareGlobalTempTableJavaJDBC30.java
Thu Dec 22 09:26:55 2005
@@ -1185,8 +1185,8 @@
 				ds.setDatabaseName("wombat");
 				ds.setUser("cs");
 				ds.setPassword("cs");
-
-				ds.setServerName("localhost");
+				hostName = TestUtil.getHostName();
+				ds.setServerName(hostName);
 				ds.setPortNumber(1527);
 				ds.setDriverType(4);
 				dsp = ds;

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/forupdate.sql
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/forupdate.sql?rev=358591&r1=358590&r2=358591&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/forupdate.sql
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/forupdate.sql
Thu Dec 22 09:26:55 2005
@@ -243,6 +243,7 @@
 -- drop the tables
 drop table t1;
 drop table t2;
+drop table t3;
 
 -- bug 5643
 -- JCC throws NPE when trying to execute a cursor after the resultset is closed

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/holdCursorIJ.sql
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/holdCursorIJ.sql?rev=358591&r1=358590&r2=358591&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/holdCursorIJ.sql
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/holdCursorIJ.sql
Thu Dec 22 09:26:55 2005
@@ -208,4 +208,4 @@
 close scrollCursor;
 
 
-
+drop table t1;

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/holdCursorJava.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/holdCursorJava.java?rev=358591&r1=358590&r2=358591&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/holdCursorJava.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/holdCursorJava.java
Thu Dec 22 09:26:55 2005
@@ -33,10 +33,15 @@
 import org.apache.derby.tools.ij;
 import org.apache.derby.tools.JDBCDisplayUtil;
 
+import org.apache.derbyTesting.functionTests.util.TestUtil;
+
 /**
  * Test hold cursor after commit
  */
 public class holdCursorJava {
+  private static String[] databaseObjects = {"PROCEDURE MYPROC", "TABLE T1", "TABLE T2",
+                                 "TABLE TESTTABLE1", "TABLE TESTTABLE2",
+                                 "TABLE BUG4385"};
 
   public static void main (String args[])
   {
@@ -57,7 +62,13 @@
 		testIsolationLevelChange(conn);
 
 		conn.rollback();
+                conn.setAutoCommit(true);
+		
+		Statement stmt = conn.createStatement();
+                TestUtil.cleanUpTest(stmt, databaseObjects);
 		conn.close();
+               
+
     } catch (Exception e) {
 		System.out.println("FAIL -- unexpected exception "+e);
 		JDBCDisplayUtil.ShowException(System.out, e);
@@ -69,6 +80,9 @@
   private static void createAndPopulateTable(Connection conn) throws SQLException {
     Statement stmt = conn.createStatement();
 
+    // first drop the objects, in case something is left over from past runs or other tests
+    TestUtil.cleanUpTest(stmt, databaseObjects);
+
     System.out.println("Creating table...");
     stmt.executeUpdate( "CREATE TABLE T1 (c11 int, c12 int)" );
     stmt.executeUpdate("INSERT INTO T1 VALUES(1,1)");
@@ -85,6 +99,19 @@
     				"'org.apache.derbyTesting.functionTests.tests.lang.holdCursorJava.testProc' result
sets 2");
     System.out.println("done creating table and inserting data.");
 
+    stmt.close();
+  }
+
+  //drop tables
+  private static void cleanUpTest(Connection conn) throws SQLException {
+    Statement stmt = conn.createStatement();
+    //System.out.println("dropping test objects...");
+    stmt.executeUpdate( "DROP PROCEDURE MYPROC" );
+    stmt.executeUpdate( "DROP TABLE T1" );
+    stmt.executeUpdate( "DROP TABLE T2" );
+    stmt.executeUpdate( "DROP TABLE testtable1" );
+    stmt.executeUpdate( "DROP TABLE testtable2" );
+    stmt.executeUpdate( "DROP TABLE BUG4385" );
     stmt.close();
   }
 

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/holdCursorJavaReflection.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/holdCursorJavaReflection.java?rev=358591&r1=358590&r2=358591&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/holdCursorJavaReflection.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/holdCursorJavaReflection.java
Thu Dec 22 09:26:55 2005
@@ -72,6 +72,7 @@
 		ij.getPropertyArg(args);
 		Connection conn = ij.startJBMS();
 
+        dropTable(conn);
 		createAndPopulateTable(conn);
 
     //set autocommit to off after creating table and inserting data
@@ -80,6 +81,8 @@
 		testPreparedStatement(conn);
 		testCallableStatement(conn);
 		conn.rollback();
+        conn.setAutoCommit(true);
+        dropTable(conn);
 		conn.close();
     } catch (Exception e) {
 		System.out.println("FAIL -- unexpected exception "+e);
@@ -99,6 +102,17 @@
     System.out.println("done creating table and inserting data.");
 
     stmt.close();
+  }
+
+  //drop table
+  private static void dropTable(Connection conn)
+// throws SQLException 
+{
+    try {
+        Statement stmt = conn.createStatement();
+        stmt.executeUpdate( "DROP TABLE T1" );
+        stmt.close();
+    } catch (SQLException se) {} // assume any error is because table doesn't exist  
   }
 
   //test cursor holdability for callable statements

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/optimizerOverrides.sql
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/optimizerOverrides.sql?rev=358591&r1=358590&r2=358591&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/optimizerOverrides.sql
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/optimizerOverrides.sql
Thu Dec 22 09:26:55 2005
@@ -219,3 +219,4 @@
 drop table t2;
 drop table t1;
 drop table temp1;
+commit;

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/procedure.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/procedure.java?rev=358591&r1=358590&r2=358591&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/procedure.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/procedure.java
Thu Dec 22 09:26:55 2005
@@ -48,6 +48,7 @@
 	{
    		ij.getPropertyArg(argv); 
         Connection conn = ij.startJBMS();
+		cleanUp(conn);
 		isDerbyNet = TestUtil.isNetFramework();
 
 		// DB2 !!
@@ -86,6 +87,7 @@
 			testLiterals(conn);
             
             multipleRSTests(conn);
+			cleanUp(conn);
 		} catch (SQLException sqle) {
 			org.apache.derby.tools.JDBCDisplayUtil.ShowSQLException(System.out, sqle);
 			sqle.printStackTrace(System.out);
@@ -1760,5 +1762,22 @@
             return temp.booleanValue();
         } catch (Exception e) {return cs.getMoreResults();}//for jdks prior to jdk14 
     }
+
+    /** 
+     * clean up any objects not cleaned up by previous efforts
+     */
+    private static void cleanUp(Connection conn) throws SQLException {
+        String[] testObjects = {
+            "table t1", "procedure procdup", "schema s1 restrict",
+            "schema s2 restrict", "procedure drs", "procedure drs2",
+            "procedure litt.ty_smallint", "procedure litt.ty_integer", "procedure litt.ty_bigint",
+            "procedure litt.ty_real", "procedure litt.ty_double", "procedure litt.ty_decimal",
+            "procedure litt.ty_char", "procedure litt.ty_varchar",
+            "table SQLC.SQLCONTROL_DDL", "table SQLCONTROL_DDL",
+            "table SQLC.SQLCONTROL_DML",
+             }; 
+        Statement stmt = conn.createStatement();
+        TestUtil.cleanUpTest(stmt, testObjects);
+    } 
 
 }

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/procedureJdbc30.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/procedureJdbc30.java?rev=358591&r1=358590&r2=358591&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/procedureJdbc30.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/procedureJdbc30.java
Thu Dec 22 09:26:55 2005
@@ -32,6 +32,7 @@
 { 
 
 	static private boolean isDerbyNet = false;
+	static private String[] testObjects = { "TABLE MRS.FIVERS", "PROCEDURE MRS.FIVEJP"};
 
 	public static void main (String[] argv) throws Throwable
 	{
@@ -56,6 +57,7 @@
 	private static void testMoreResults(Connection conn) throws SQLException {
 
 		Statement s = conn.createStatement();
+		TestUtil.cleanUpTest(s, testObjects);
 
 		s.executeUpdate("create table MRS.FIVERS(i integer)");
 		PreparedStatement ps = conn.prepareStatement("insert into MRS.FIVERS values (?)");

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/scrollCursors2.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/scrollCursors2.java?rev=358591&r1=358590&r2=358591&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/scrollCursors2.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/scrollCursors2.java
Thu Dec 22 09:26:55 2005
@@ -64,6 +64,7 @@
 			// make the initial connection.
 			ij.getPropertyArg(args);
 			conn = ij.startJBMS();
+			cleanUp(conn);	
 			conn.setAutoCommit(false);
 
 			/* Create the table and do any other set-up */
@@ -1611,17 +1612,15 @@
 	static boolean cleanUp(Connection conn, Statement s) {
 		try {
 			/* Drop the table we created */
-			if (s != null)
+			if (s == null)
 			{
-				s.execute("drop table t");
+				// well, then, we'll have to restart
+				s = conn.createStatement();
 			}
-
+			s.execute("drop table t");
 			/* Close the connection */
-			if (conn != null)
-			{
-				conn.commit();
-				conn.close();
-			}
+			conn.commit();
+			conn.close();
 		} catch (Throwable e) {
 			System.out.println("FAIL -- unexpected exception caught in cleanup()");
 			JDBCDisplayUtil.ShowException(System.out, e);
@@ -1630,4 +1629,17 @@
 
 		return true;
 	}
+
+	/* 
+	 * cleanup also before test start, just in case
+	 * @param conn	The Connection
+	 */
+	static void cleanUp(Connection conn) throws SQLException {
+		Statement cleanupStmt = conn.createStatement();
+		String[] testObjects = {"table t"};
+		TestUtil.cleanUpTest(cleanupStmt, testObjects);
+		cleanupStmt.close();
+	}
+
+
 }

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/simpleScroll.sql
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/simpleScroll.sql?rev=358591&r1=358590&r2=358591&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/simpleScroll.sql
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/simpleScroll.sql
Thu Dec 22 09:26:55 2005
@@ -76,6 +76,7 @@
 select c1 from t1 left outer join t2 on (i1=i2);
 select c2 from t1 left outer join t2 on (i1=i2);
 
+drop table t;
 drop table t1;
 drop table t2;
 

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/supersimple.sql
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/supersimple.sql?rev=358591&r1=358590&r2=358591&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/supersimple.sql
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/supersimple.sql
Thu Dec 22 09:26:55 2005
@@ -88,9 +88,13 @@
 
 -- Bug 4694 Test automatic rollback with close of connection
 -- in ij
+connect 'wombat';
 autocommit off;
 create table a (a int);
-
+select count(*) from a;
+disconnect;
+set connection connection0;
+select count(*) from a;
 
 -- Bug 4758 - Store error does not return properly to client
 autocommit off;
@@ -115,4 +119,8 @@
 select * from t1;
 select c2 from t1;
 drop table t1;
-
+commit;
+disconnect;
+set connection connection0;
+autocommit on;
+drop table t;

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/unaryArithmeticDynamicParameter.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/unaryArithmeticDynamicParameter.java?rev=358591&r1=358590&r2=358591&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/unaryArithmeticDynamicParameter.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/unaryArithmeticDynamicParameter.java
Thu Dec 22 09:26:55 2005
@@ -28,6 +28,7 @@
 import java.sql.Statement;
 
 import org.apache.derby.tools.ij;
+import org.apache.derbyTesting.functionTests.util.TestUtil;
 
 
 /**
@@ -421,7 +422,22 @@
 			System.out.println("SQL State : " + e.getSQLState());
 			System.out.println("Got expected exception " + e.getMessage());
 		}
+		finally {
+			cleanUp(conn);
+		}
 	};
+
+	private static void cleanUp(Connection conn) throws SQLException
+	{
+		Statement stmt = conn.createStatement();
+		String[] testObjects = { "table t1", "table t2", "view v1", 
+					"procedure abs_funct", "procedure max_cni"};
+		// this will drop all testobjects listed
+		TestUtil.cleanUpTest(stmt, testObjects);
+		stmt.close();
+		conn.close();
+	}
+
 	private static void dumpRS(ResultSet s) throws SQLException
 	{
 		if (s == null)

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/updatableResultSet.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/updatableResultSet.java?rev=358591&r1=358590&r2=358591&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/updatableResultSet.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/updatableResultSet.java
Thu Dec 22 09:26:55 2005
@@ -2685,18 +2685,16 @@
 
 	static void teardown() throws SQLException {
 		Statement stmt = conn.createStatement();
-		stmt.executeUpdate("drop table t1");
-		stmt.executeUpdate("drop table t2");
-		stmt.executeUpdate("drop table t3");
-		stmt.executeUpdate("drop table tableWithConstraint");
-		stmt.executeUpdate("drop table tableWithPrimaryKey");
-		stmt.executeUpdate("drop table deleteTriggerInsertIntoThisTable");
-		stmt.executeUpdate("drop table updateTriggerInsertIntoThisTable");
-		stmt.executeUpdate("drop table table0WithTriggers");
-		stmt.executeUpdate("drop table table1WithTriggers");
-		stmt.executeUpdate("drop table table2WithTriggers");
-		stmt.executeUpdate("drop table selfReferencingT1");
-		stmt.executeUpdate("drop table selfReferencingT2");
+		String[] testObjects={"table \" t 11 \"", "table \"t1\"",
+			"trigger tr1", "trigger tr2", "trigger tr3", "trigger tr4",
+			"view v1", "table s2.t1", "schema s2 restrict", "table t2", 
+			"table t1", "table t3",	"table tableWithConstraint",
+			"table tableWithPrimaryKey", "table deleteTriggerInsertIntoThisTable",
+			"table updateTriggerInsertIntoThisTable", "table table0WithTriggers",
+			"table table1WithTriggers", "table table2WithTriggers",
+			"table selfReferencingT1", "table selfReferencingT2",
+			"table AllDataTypesForTestingTable", "table AllDataTypesNewValuesData"};
+		TestUtil.cleanUpTest(stmt, testObjects);	
 		conn.commit();
 		stmt.close();
 	}

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/wisconsin.sql
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/wisconsin.sql?rev=358591&r1=358590&r2=358591&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/wisconsin.sql
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/wisconsin.sql
Thu Dec 22 09:26:55 2005
@@ -3569,3 +3569,10 @@
 close c;
 -- 27, join on onePercent--1 row
 values SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS();
+
+-- cleanup
+drop table TENKTUP1;
+drop table TENKTUP2;
+drop table ONEKTUP;
+drop table BPRIME;
+drop procedure WISCINSERT;

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/wisconsin_derby.properties
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/wisconsin_derby.properties?rev=358591&r1=358590&r2=358591&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/wisconsin_derby.properties
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/wisconsin_derby.properties
Thu Dec 22 09:26:55 2005
@@ -10,3 +10,4 @@
 derby.storage.checkpointInterval=100000
 # override derby.debug.true to speed up test execution.
 derby.debug.true=
+derby.optimize.noTimeout=true

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/bootLock1.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/bootLock1.java?rev=358591&r1=358590&r2=358591&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/bootLock1.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/bootLock1.java
Thu Dec 22 09:26:55 2005
@@ -50,6 +50,9 @@
 			ij.getPropertyArg(args);
 			Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
 			con = DriverManager.getConnection("jdbc:derby:wombat");
+			stmt = con.createStatement();
+			// while we're here, let's cleanup
+			stmt.execute("drop table t1");
 			//infinite loop until it gets killed.
 			for(;;)
 			{

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/holdCursorExternalSortJDBC30.sql
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/holdCursorExternalSortJDBC30.sql?rev=358591&r1=358590&r2=358591&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/holdCursorExternalSortJDBC30.sql
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/holdCursorExternalSortJDBC30.sql
Thu Dec 22 09:26:55 2005
@@ -152,3 +152,4 @@
 drop function PADSTRING;
 drop procedure WAIT_FOR_POST_COMMIT;
 drop table foo;
+commit;

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/holdCursorJDBC30.sql
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/holdCursorJDBC30.sql?rev=358591&r1=358590&r2=358591&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/holdCursorJDBC30.sql
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/holdCursorJDBC30.sql
Thu Dec 22 09:26:55 2005
@@ -1102,4 +1102,13 @@
 commit;
 
 close test12;
+
+
+drop table foo;
+drop table t1;
+drop table t2;
+drop function padstring;
+drop procedure wait_for_post_commit;
+commit;
+
 exit;

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/dblook_test.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/dblook_test.java?rev=358591&r1=358590&r2=358591&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/dblook_test.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/dblook_test.java
Thu Dec 22 09:26:55 2005
@@ -386,7 +386,8 @@
 
 		printAsHeader("\nDumping DDL for all objects, " +
 			"using\nNetwork Server:\n");
-		jdbcProtocol = TestUtil.getJdbcUrlPrefix("localhost",SERVER_PORT);
+		String hostName = TestUtil.getHostName();
+		jdbcProtocol = TestUtil.getJdbcUrlPrefix(hostName,SERVER_PORT);
 
 		String sourceDBUrl;
 		if (TestUtil.isJCCFramework())

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/TestUtil.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/TestUtil.java?rev=358591&r1=358590&r2=358591&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/TestUtil.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/TestUtil.java
Thu Dec 22 09:26:55 2005
@@ -181,14 +181,27 @@
 	/**
 	    Get URL prefix for current framework.
 		
-		@return url, assume localhost and port 1527 for Network Tests
+		@return url, assume localhost - unless set differently in System property - 
+		             and assume port 1527 for Network Tests
 		@see getJdbcUrlPrefix(String server, int port)
 		
 	*/
-	public static String getJdbcUrlPrefix()
-	{
-		return getJdbcUrlPrefix("localhost", 1527);
-	}
+    public static String getJdbcUrlPrefix()
+    {
+        String hostName=getHostName();
+        return getJdbcUrlPrefix(hostName, 1527);
+    }
+
+    /** Get hostName as passed in - if not, set it to "localhost" 
+        @return hostName, as passed into system properties, or "localhost"
+    */
+    public static String getHostName()
+    {
+        String hostName = (System.getProperty("hostName"));
+        if (hostName == null)
+            hostName="localhost";
+        return hostName;
+    }
 
 	/** 
 		Get URL prefix for current framework		
@@ -659,6 +672,26 @@
 		}
 
 	}
+
+    /**
+        Drop the test objects passed in as a string identifying the
+        type of object (e.g. TABLE, PROCEDURE) and its name.
+        Thus, for example, a testObject array could be:
+        {"TABLE MYSCHEMA.MYTABLE", "PROCEDURE THISDUMMY"}
+        The statement passed in must be a 'live' statement in the test.
+    */
+    public static void cleanUpTest (Statement s, String[] testObjects)
+                                    throws SQLException {
+        /* drop each object named */
+        for (int i=0; i < testObjects.length; i++) {
+            try {
+                s.execute("drop " + testObjects[i]);
+                //System.out.println("now dropping " + testObjects[i]);
+            } catch (SQLException se) { // ignore...
+            }
+        }	
+    }
+
 	
 	public static Connection getDataSourceConnection (Properties prop) throws SQLException {
 		DataSource ds = TestUtil.getDataSource(prop);
@@ -683,5 +716,6 @@
 			throw e;
 		}
 	}
+
 }
 

Modified: db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/xaHelper.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/xaHelper.java?rev=358591&r1=358590&r2=358591&view=diff
==============================================================================
--- db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/xaHelper.java (original)
+++ db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/xaHelper.java Thu Dec 22
09:26:55 2005
@@ -89,8 +89,17 @@
 			  
 			  if (isJCC || isNetClient)
 			  {
-			  xaHelper.setDataSourceProperty(currentXADataSource,
-											 "ServerName", "localhost");
+			  	String hostName = System.getProperty("hostName");
+			  	if ((hostName != null ) && (!hostName.equals("localhost")))
+				{			
+			  		xaHelper.setDataSourceProperty(currentXADataSource,
+											 "ServerName", hostName);
+				}
+			  	else
+				{			
+			  		xaHelper.setDataSourceProperty(currentXADataSource,
+							 "ServerName", "localhost");
+				}
 			  xaHelper.setDataSourceProperty(currentXADataSource,
 											 "portNumber", 1527);
 			  



Mime
View raw message