db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r385389 - in /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests: master/triggerGeneral.out tests/lang/triggerGeneral.sql util/Triggers.java
Date Sun, 12 Mar 2006 23:22:06 GMT
Author: djd
Date: Sun Mar 12 15:22:04 2006
New Revision: 385389

URL: http://svn.apache.org/viewcvs?rev=385389&view=rev
Log:
DERBY-1102 (partial) Remove test case of use of stale TriggerExecutionContext in triggerGeneral.sql
because applications no longer have access to the TriggerExecutionContext.

Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/triggerGeneral.out
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/triggerGeneral.sql
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/Triggers.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/triggerGeneral.out
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/triggerGeneral.out?rev=385389&r1=385388&r2=385389&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/triggerGeneral.out
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/triggerGeneral.out
Sun Mar 12 15:22:04 2006
@@ -7,12 +7,6 @@
 ij> create function triggerFires(s varchar(128)) returns varchar(1) PARAMETER STYLE JAVA
LANGUAGE JAVA NO SQL
   EXTERNAL NAME 'org.apache.derbyTesting.functionTests.util.Triggers.triggerFires';
 0 rows inserted/updated/deleted
-ij> create function begInvRefToTECTest() returns varchar(1) PARAMETER STYLE JAVA LANGUAGE
JAVA NO SQL
-  EXTERNAL NAME 'org.apache.derbyTesting.functionTests.util.Triggers.beginInvalidRefToTECTest';
-0 rows inserted/updated/deleted
-ij> create procedure notifyDMLDone() PARAMETER STYLE JAVA LANGUAGE JAVA NO SQL
-  EXTERNAL NAME 'org.apache.derbyTesting.functionTests.util.Triggers.notifyDMLDone';
-0 rows inserted/updated/deleted
 ij> drop table x;
 ERROR 42Y55: 'DROP TABLE' cannot be performed on 'X' because it does not exist.
 ij> create table x (x int, y int, z int, constraint ck1 check (x > 0));
@@ -682,36 +676,6 @@
 0 rows inserted/updated/deleted
 ij> drop table trighistory;
 0 rows inserted/updated/deleted
-ij> -- 
--- Lets make sure that the tec cannot be accessed once
--- the dml that caused it to be pushed is finished.
---
-drop table t;
-0 rows inserted/updated/deleted
-ij> create table t (x int);
-0 rows inserted/updated/deleted
-ij> create trigger t no cascade before insert on t for each statement mode db2sql
-	values app.begInvRefToTECTest();
-0 rows inserted/updated/deleted
-ij> -- causes the trigger to fire, which causes a thread
--- to be cranked up
-insert into t values 1;
-1 row inserted/updated/deleted
-ij> -- tell the background thread that dml is done,
--- it will now try to do some stuff with the stale
--- tec.  We MUST do this in a different thread lest
--- we block the background thread on connection 
--- synchronization
-connect 'wombat' as conn2;
-ij(CONN2)> call app.notifyDMLDone();
-...nested thread running using expired tec
-...trying to loop through stale result set
-Got expected exception: SQL Exception: ResultSet not open. Operation 'next' not permitted.
Verify that autocommit is OFF.
-Got expected exception: java.sql.SQLException: Statement closed.
-Got expected exception: java.sql.SQLException: Statement closed.
-0 rows inserted/updated/deleted
-ij(CONN2)> disconnect;
-ij> set connection connection0;
 ij> -- Test for bug 3495 - triggers were causing deferred insert, which
 -- caused the insert to use a TemporaryRowHolderImpl. This was not
 -- being re-initialized properly when closed, and it was trying to

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/triggerGeneral.sql
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/triggerGeneral.sql?rev=385389&r1=385388&r2=385389&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/triggerGeneral.sql
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/triggerGeneral.sql
Sun Mar 12 15:22:04 2006
@@ -6,10 +6,6 @@
   EXTERNAL NAME 'org.apache.derbyTesting.functionTests.util.Triggers.triggerFiresMinimal';
 create function triggerFires(s varchar(128)) returns varchar(1) PARAMETER STYLE JAVA LANGUAGE
JAVA NO SQL
   EXTERNAL NAME 'org.apache.derbyTesting.functionTests.util.Triggers.triggerFires';
-create function begInvRefToTECTest() returns varchar(1) PARAMETER STYLE JAVA LANGUAGE JAVA
NO SQL
-  EXTERNAL NAME 'org.apache.derbyTesting.functionTests.util.Triggers.beginInvalidRefToTECTest';
-create procedure notifyDMLDone() PARAMETER STYLE JAVA LANGUAGE JAVA NO SQL
-  EXTERNAL NAME 'org.apache.derbyTesting.functionTests.util.Triggers.notifyDMLDone';
 
 drop table x;
 create table x (x int, y int, z int, constraint ck1 check (x > 0));
@@ -369,30 +365,6 @@
 select * from trighistory;
 drop table trigtable1;
 drop table trighistory;
-
--- 
--- Lets make sure that the tec cannot be accessed once
--- the dml that caused it to be pushed is finished.
---
-drop table t;
-create table t (x int);
-create trigger t no cascade before insert on t for each statement mode db2sql
-	values app.begInvRefToTECTest();
-
--- causes the trigger to fire, which causes a thread
--- to be cranked up
-insert into t values 1;
-
--- tell the background thread that dml is done,
--- it will now try to do some stuff with the stale
--- tec.  We MUST do this in a different thread lest
--- we block the background thread on connection 
--- synchronization
-connect 'wombat' as conn2;
-call app.notifyDMLDone();
-disconnect;
-
-set connection connection0;
 
 -- Test for bug 3495 - triggers were causing deferred insert, which
 -- caused the insert to use a TemporaryRowHolderImpl. This was not

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/Triggers.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/Triggers.java?rev=385389&r1=385388&r2=385389&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/Triggers.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/Triggers.java
Sun Mar 12 15:22:04 2006
@@ -30,11 +30,7 @@
  */
 public class Triggers
 {
-
-	// used for threading test
-	static TriggerThread triggerThread;
-
-	public Triggers()
+	private Triggers()
 	{
 	}
 
@@ -197,32 +193,6 @@
 		s.close();
 	}
 
-	// WARNING: will deadlock unless on a separate
-	// connection
-	public static void notifyDMLDone() throws Throwable
-	{
-		if (triggerThread == null)
-		{
-			System.out.println("ERROR: no triggerThread object, has beginInvalidRefToTECTest() been
executed?");
-		}
-		else
-		{
-			triggerThread.goForIt();
-			while (!triggerThread.done())
-			{
-				try {Thread.sleep(1000L); } catch (InterruptedException e) {}
-			}
-			triggerThread = null;
-		}
-	}
-
-	public static String beginInvalidRefToTECTest() throws Throwable
-	{
-		triggerThread = new TriggerThread();
-		triggerThread.start();
-		return "";
-	}
-
 	public static long returnPrimLong(long  x)
 	{
 		return x;
@@ -234,104 +204,4 @@
 	}
 
 
-}
-
-// class for testing valid tec accesses	
-class TriggerThread extends Thread
-{	
-	private TriggerExecutionContext tec;
-	private ResultSet rs;
-	private boolean start; 
-	private boolean done; 
-
-	public TriggerThread() throws Throwable
-	{
-		this.tec = Factory.getTriggerExecutionContext();
-		if (tec == null)
-		{
-			System.out.println("ERROR: no tec found, no trigger appears to be active");
-			return;
-		}
-	
-		this.rs = (tec.getNewRowSet() == null) ?
-			tec.getOldRowSet() :
-			tec.getNewRowSet();
-	}
-
-	public void goForIt()
-	{
-		start = true;
-	}
-
-	public boolean done()
-	{
-		return done;
-	}
-
-	public void run() 
-	{
-		boolean gotException = false;
-	
-		int i;	
-		for (i = 0; !start && i < 1000; i++)
-		{
-			try {Thread.sleep(50L); } catch (InterruptedException e) {}
-		} 
-		if (i == 1000)
-		{
-			System.out.println("ERROR: start never received");
-			return;
-		}
-		// let the other thread get to its pause point
-		try {Thread.sleep(5000L); } catch (InterruptedException e) {}
-
-		System.out.println("...nested thread running using expired tec");
-		try
-		{
-			System.out.println("...trying to loop through stale result set");
-			Triggers.zipThroughRs(rs);
-		} catch (SQLException e)
-		{
-			gotException = true;	
-			System.out.println("Got expected exception: "+e);
-		}
-		if (!gotException)
-		{
-			System.out.println("ERROR: no exception when trying to do next on stale ResultSet");
-		}
-		gotException = false;
-
-		try
-		{	
-			tec.getNewRowSet();
-		} catch (SQLException e)
-		{
-			gotException = true;	
-			System.out.println("Got expected exception: "+e);
-		}
-
-		if (!gotException)
-		{
-			System.out.println("ERROR: getNewRowSet() didn't throw an exception on stale tec");
-		}
-
-		gotException = false;
-
-		try
-		{	
-			tec.getOldRowSet();
-		} catch (SQLException e)
-		{
-			gotException = true;	
-			System.out.println("Got expected exception: "+e);
-		}
-
-		if (!gotException)
-		{
-			System.out.println("ERROR: getOldRowSet() didn't throw an exception on stale tec");
-		}
-
-		// signal that we are done
-		done = true;
-	}
-}
+}
\ No newline at end of file



Mime
View raw message