[teiid-commits] teiid SVN: r1426 - trunk/test-integration/db/src/test/java/org/teiid/test/testcases.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Sun Sep 20 12:31:17 EDT 2009


Author: vhalbert at redhat.com
Date: 2009-09-20 12:31:17 -0400 (Sun, 20 Sep 2009)
New Revision: 1426

Added:
   trunk/test-integration/db/src/test/java/org/teiid/test/testcases/LocalTransactionDriverFalseOffTest.java
   trunk/test-integration/db/src/test/java/org/teiid/test/testcases/SingleSourceTransactionScenarios.java
   trunk/test-integration/db/src/test/java/org/teiid/test/testcases/TwoSourceTransactionScenarios.java
   trunk/test-integration/db/src/test/java/org/teiid/test/testcases/XATransactionDriverFalseOffTest.java
Removed:
   trunk/test-integration/db/src/test/java/org/teiid/test/testcases/SingleSourceTransaction.java
   trunk/test-integration/db/src/test/java/org/teiid/test/testcases/TwoSourceTransaction.java
Modified:
   trunk/test-integration/db/src/test/java/org/teiid/test/testcases/LocalTransactionDriverTrueOffTest.java
Log:
Teiid 773 - renamed SingelSourceTransaction and TwoSourceTransaction to include the word scenarios in the name because these represent all the defined scenarios that are setup.  And in each transaction type test (i.e., local, xa, etc), all the scenarios should be run and those that are not valid for a certain test type, then it needs to be documented and explicitly overridden.

Added: trunk/test-integration/db/src/test/java/org/teiid/test/testcases/LocalTransactionDriverFalseOffTest.java
===================================================================
--- trunk/test-integration/db/src/test/java/org/teiid/test/testcases/LocalTransactionDriverFalseOffTest.java	                        (rev 0)
+++ trunk/test-integration/db/src/test/java/org/teiid/test/testcases/LocalTransactionDriverFalseOffTest.java	2009-09-20 16:31:17 UTC (rev 1426)
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2000-2007 MetaMatrix, Inc.
+ * All rights reserved.
+ */
+package org.teiid.test.testcases;
+
+import org.teiid.test.framework.ConfigPropertyNames;
+import org.teiid.test.framework.connection.ConnectionStrategy;
+
+
+/** 
+ * Local Transaction Test
+ * 
+ * Settings:
+ * 
+ * -	Using Driver
+ * -	Autocommit = False
+ * -	TxnAutoWrap = Off
+ */
+public class LocalTransactionDriverFalseOffTest extends TwoSourceTransactionScenarios {
+          
+    public LocalTransactionDriverFalseOffTest(String name) {
+		super(name);
+	}
+
+	@Override
+	protected void setUp() throws Exception {
+    	
+    	System.setProperty(ConfigPropertyNames.CONNECTION_TYPE, ConfigPropertyNames.CONNECTION_TYPES.DRIVER_CONNECTION);
+    	System.setProperty(ConnectionStrategy.AUTOCOMMIT, "false");
+    	System.setProperty(ConnectionStrategy.TXN_AUTO_WRAP, "off");
+ //   	System.setProperty(ConnectionStrategy.FETCH_SIZE, "20");
+    	
+		
+	}
+	
+    
+ 
+	
+
+
+ 
+     
+}


Property changes on: trunk/test-integration/db/src/test/java/org/teiid/test/testcases/LocalTransactionDriverFalseOffTest.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: trunk/test-integration/db/src/test/java/org/teiid/test/testcases/LocalTransactionDriverTrueOffTest.java
===================================================================
--- trunk/test-integration/db/src/test/java/org/teiid/test/testcases/LocalTransactionDriverTrueOffTest.java	2009-09-20 04:22:12 UTC (rev 1425)
+++ trunk/test-integration/db/src/test/java/org/teiid/test/testcases/LocalTransactionDriverTrueOffTest.java	2009-09-20 16:31:17 UTC (rev 1426)
@@ -13,12 +13,11 @@
  * 
  * Settings:
  * 
- * -	Transaction Type = local
  * -	Using Driver
  * -	Autocommit = True
  * -	TxnAutoWrap = Off
  */
-public class LocalTransactionDriverTrueOffTest extends TwoSourceTransaction {
+public class LocalTransactionDriverTrueOffTest extends TwoSourceTransactionScenarios {
           
     public LocalTransactionDriverTrueOffTest(String name) {
 		super(name);
@@ -27,16 +26,12 @@
 	@Override
 	protected void setUp() throws Exception {
     	
-    	System.setProperty(ConfigPropertyNames.TRANSACTION_TYPE, ConfigPropertyNames.TRANSACTION_TYPES.LOCAL_TRANSACTION);
-   	
     	System.setProperty(ConfigPropertyNames.CONNECTION_TYPE, ConfigPropertyNames.CONNECTION_TYPES.DRIVER_CONNECTION);
     	System.setProperty(ConnectionStrategy.AUTOCOMMIT, "true");
     	System.setProperty(ConnectionStrategy.TXN_AUTO_WRAP, "off");
  //   	System.setProperty(ConnectionStrategy.FETCH_SIZE, "true");
     	
 		
-	}
-
-
-     
+	}      
+      
 }

Deleted: trunk/test-integration/db/src/test/java/org/teiid/test/testcases/SingleSourceTransaction.java
===================================================================
--- trunk/test-integration/db/src/test/java/org/teiid/test/testcases/SingleSourceTransaction.java	2009-09-20 04:22:12 UTC (rev 1425)
+++ trunk/test-integration/db/src/test/java/org/teiid/test/testcases/SingleSourceTransaction.java	2009-09-20 16:31:17 UTC (rev 1426)
@@ -1,270 +0,0 @@
-/*
- * Copyright (c) 2000-2007 MetaMatrix, Inc.
- * All rights reserved.
- */
-package org.teiid.test.testcases;
-
-import org.teiid.test.framework.AbstractQueryTransactionTest;
-import org.teiid.test.framework.QueryExecution;
-
-import com.metamatrix.jdbc.api.AbstractQueryTest;
-
-
-
-/** 
- * A common SingleSource test case among many different transaction stuff. 
- */
-public class SingleSourceTransaction extends BaseAbstractTransactionTestCase {
-    
-    public SingleSourceTransaction(String name) {
-        super(name);
-    }
-    
- 
-    ///////////////////////////////////////////////////////////////////////////////////////////////
-    //  Single Source - Rows below 500 (for insert/update/delete)
-    ///////////////////////////////////////////////////////////////////////////////////////////////
-    
-    /**
-     * Sources = 1
-     * Commands = 1, Select
-     * Batching = Full Processing, Single Connector Batch
-     * result = commit 
-     */
-    public void testSingleSourceSelect() throws Exception {
-        AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest("testSingleSourceSelect") {
-            public void testCase() throws Exception {
-                execute("select * from pm1.g1 where pm1.g1.e1 < 100");
-                assertRowCount(100);
-            }
-            
-        	public void validateTestCase() throws Exception {
-        		
-        	}
-        };        
-        
-        // run test
-        getTransactionContainter().runTransaction(userTxn);
-        
-        // there is nothing to verify here..
-        
-        System.out.println("Complete CommonTransactionTest.testSingleSourceSelect");
-
-    }
-
-
-	/**
-     * Sources = 1
-     * Commands = 1, Update
-     * Batching = Full Processing, Single Connector Batch
-     * result = commit 
-     */
-    public void testSingleSourceUpdate() throws Exception {
-        AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest("testSingleSourceUpdate") {
-            public void testCase() throws Exception {
-                execute("insert into pm1.g1 (e1, e2) values(100, '100')");
-            }
-        	public void validateTestCase() throws Exception {
-                // now verify the results
-                AbstractQueryTest test = new QueryExecution(getSource("pm1"));
-                test.execute("select * from g1 where e1 = 100");
-                test.assertRowCount(1);
-                test.closeConnection();
-       		
-        	}
-        };        
-        
-        // run test
-        getTransactionContainter().runTransaction(userTxn);       
-        
-        
-        System.out.println("Complete CommonTransactionTest.testSingleSourceUpdate");
-
-    }
-    
-
-    /**
-     * Sources = 1
-     * Commands = 1, Update(prepared statement)
-     * Batching = Full Processing, Single Connector Batch
-     * result = commit 
-     */
-    public void testSingleSourcePreparedUpdate() throws Exception {
-        AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest("testSingleSourcePreparedUpdate") {
-            public void testCase() throws Exception {
-                execute("insert into pm1.g1 (e1, e2) values(?, ?)", new Object[] {new Integer(102), "102"});                
-            }
-           	public void validateTestCase() throws Exception {
-                // now verify the results
-                AbstractQueryTest test = new QueryExecution(getSource("pm1"));
-                test.execute("select * from g1 where e1 = 102");
-                test.assertRowCount(1);
-                test.closeConnection();   
-          	}
-        };        
-        
-        // run test
-        getTransactionContainter().runTransaction(userTxn);
-        
-         
-        System.out.println("Complete CommonTransactionTest.testSingleSourcePreparedUpdate");
-
-    }    
-    
-    /**
-     * Sources = 1
-     * Commands = multiple - Success
-     * Batching = Full Processing, Single Connector Batch
-     * result = commit
-     */
-    public void testSingleSourceMultipleCommands() throws Exception {
-        AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest("testSingleSourceMultipleCommands") {
-            public void testCase() throws Exception {
-                
-                execute("delete from pm1.g1 where pm1.g1.e1 >= ?", new Object[] {new Integer(100)});
-                
-                execute("select * from pm1.g1");
-                assertRowCount(100);
-                
-                for (int i = 100; i < 110; i++) {
-                    Integer val = new Integer(i);
-                    execute("insert into pm1.g1 (e1, e2) values(?,?)", new Object[] {val, val.toString()});
-                    execute("insert into pm1.g2 (e1, e2) values(?,?)", new Object[] {val, val.toString()});
-                }
-            }
-            
-           	public void validateTestCase() throws Exception {
-                // now verify the results
-                AbstractQueryTest test = new QueryExecution(getSource("pm1"));
-                test.execute("select * from g1 where e1 >= 100");
-                test.assertRowCount(10);
-                test.execute("select * from g2 where e1 >= 100");
-                test.assertRowCount(10);        
-                test.closeConnection();      
-          	}
-        };        
-        
-        // run test
-        getTransactionContainter().runTransaction(userTxn);      
-
-        
-        System.out.println("Complete CommonTransactionTest.testSingleSourceMultipleCommands");
-
-    }
-        
-    /**
-     * Sources = 1
-     * Commands = 1, Select
-     * Batching = Partial Processing, Single Connector Batch
-     * result = commit 
-     */
-    public void testSingleSourcePartialProcessing() throws Exception {
-        AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest("testSingleSourcePartialProcessing") {
-            public void testCase() throws Exception {
-                execute("select * from pm1.g1 where pm1.g1.e1 < 100 limit 10");
-                assertRowCount(10);
-            }
-            
-           	public void validateTestCase() throws Exception {
-           	}
-        };        
-        
-        // run test
-        getTransactionContainter().runTransaction(userTxn);      
-        
-        System.out.println("Complete CommonTransactionTest.testSingleSourcePartialProcessing");
-
-    }   
-    
-    /**
-     * Sources = 1
-     * Commands = multiple - Success
-     * Batching = Full Processing, Single Connector Batch
-     * result = rollback
-     */
-    
-    public void xtestSingleSourceMultipleCommandsExplicitRollback() throws Exception {
-        // now it's empty
-        AbstractQueryTest test = new QueryExecution(this.getSource("pm1"));
-        		//getSource("pm1"));
-        test.execute("select * from g1 where e1 >= 200 and e1 < 220");
-        test.assertRowCount(0);
-        test.execute("select * from g2 where e1 >= 200 and e1 < 220");
-        test.assertRowCount(0);        
-        test.closeConnection();  
-
-    	
-        AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest("testSingleSourceMultipleCommandsExplicitRollback") {
-            public void testCase() throws Exception {
-                for (int i = 200; i < 220; i++) {
-                    execute("insert into pm1.g1 (e1, e2) values("+i+",'"+i+"')");
-                    execute("insert into pm1.g2 (e1, e2) values("+i+",'"+i+"')");
-                }                
-            }
-            
-            public boolean rollbackAllways() {
-                return true;
-            }
-            
-           	public void validateTestCase() throws Exception {
-                // now verify the results
-           		AbstractQueryTest test = new QueryExecution(getSource("pm1"));
-                		//getSource("pm1"));
-                test.execute("select * from g1 where e1 >= 200 and e1 < 220");
-                test.assertRowCount(0);
-                test.execute("select * from g2 where e1 >= 200 and e1 < 220");
-                test.assertRowCount(0);        
-                test.closeConnection();  
-          	}
-
-
-        };        
-        
-        // run test
-        getTransactionContainter().runTransaction(userTxn);      
-
-        
-        System.out.println("Complete testSingleSourceMultipleCommandsExplicitRollback");
-    } 
-    
-    /**
-     * Sources = 1
-     * Commands = multiple - Success
-     * Batching = Full Processing, Single Connector Batch
-     * result = rollback
-     */
-    public void xtestSingleSourceMultipleCommandsReferentialIntegrityRollback() throws Exception {
-    	
-        AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest("testSingleSourceMultipleCommandsReferentialIntegrityRollback") {
-            public void testCase() throws Exception {
-                for (int i = 200; i < 220; i++) {
-                    Integer val = new Integer(i);
-                    execute("insert into pm1.g1 (e1, e2) values(?,?)", new Object[] {val, val.toString()});
-                    execute("insert into pm1.g2 (e1, e2) values(?,?)", new Object[] {val, val.toString()});
-                }
-                
-                // force the rollback by trying to insert an invalid row.
-                execute("insert into pm1.g2 (e1, e2) values(?,?)", new Object[] {new Integer(9999), "9999"});
-            }
-            
-            public boolean exceptionExpected() {
-                return true;
-            }
-            
-           	public void validateTestCase() throws Exception {
-                // now verify the results
-                AbstractQueryTest test = new QueryExecution(getSource("pm1"));
-                test.execute("select * from g1 where e1 >= 200 and e1 < 220");
-                test.assertRowCount(0);
-                test.closeConnection();   
-          	}
-        };        
-        
-        // run test
-        getTransactionContainter().runTransaction(userTxn);      
-
-        System.out.println("Complete testSingleSourceMultipleCommandsReferentialIntegrityRollback");
-
-    }    
-
-}

Copied: trunk/test-integration/db/src/test/java/org/teiid/test/testcases/SingleSourceTransactionScenarios.java (from rev 1424, trunk/test-integration/db/src/test/java/org/teiid/test/testcases/SingleSourceTransaction.java)
===================================================================
--- trunk/test-integration/db/src/test/java/org/teiid/test/testcases/SingleSourceTransactionScenarios.java	                        (rev 0)
+++ trunk/test-integration/db/src/test/java/org/teiid/test/testcases/SingleSourceTransactionScenarios.java	2009-09-20 16:31:17 UTC (rev 1426)
@@ -0,0 +1,276 @@
+/*
+ * Copyright (c) 2000-2007 MetaMatrix, Inc.
+ * All rights reserved.
+ */
+package org.teiid.test.testcases;
+
+import org.teiid.test.framework.AbstractQueryTransactionTest;
+import org.teiid.test.framework.QueryExecution;
+import org.teiid.test.framework.TransactionQueryTest;
+
+import com.metamatrix.jdbc.api.AbstractQueryTest;
+
+
+
+/** 
+ * A common SingleSource test case among many different transaction stuff. 
+ */
+public class SingleSourceTransactionScenarios extends BaseAbstractTransactionTestCase {
+    
+    public SingleSourceTransactionScenarios(String name) {
+        super(name);
+    }
+    
+ 
+    ///////////////////////////////////////////////////////////////////////////////////////////////
+    //  Single Source - Rows below 500 (for insert/update/delete)
+    ///////////////////////////////////////////////////////////////////////////////////////////////
+    
+    /**
+     * Sources = 1
+     * Commands = 1, Select
+     * Batching = Full Processing, Single Connector Batch
+     * result = commit 
+     */
+    public void testSingleSourceSelect() throws Exception {
+        AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest("testSingleSourceSelect") {
+            public void testCase() throws Exception {
+                execute("select * from pm1.g1 where pm1.g1.e1 < 100");
+                assertRowCount(100);
+            }
+            
+        	public void validateTestCase() throws Exception {
+        		
+        	}
+        };        
+        
+        // run test
+        getTransactionContainter().runTransaction(userTxn);
+        
+        // there is nothing to verify here..
+        
+        System.out.println("Complete testSingleSourceSelect");
+
+    }
+
+
+	/**
+     * Sources = 1
+     * Commands = 1, Update
+     * Batching = Full Processing, Single Connector Batch
+     * result = commit 
+     */
+    public void testSingleSourceUpdate() throws Exception {
+        AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest("testSingleSourceUpdate") {
+            public void testCase() throws Exception {
+                execute("insert into pm1.g1 (e1, e2) values(100, '100')");
+            }
+        	public void validateTestCase() throws Exception {
+                // now verify the results
+                AbstractQueryTest test = new QueryExecution(getSource("pm1"));
+                test.execute("select * from g1 where e1 = 100");
+                test.assertRowCount(1);
+                test.closeConnection();
+       		
+        	}
+        };        
+        
+        // run test
+        getTransactionContainter().runTransaction(userTxn);       
+        
+        
+        System.out.println("Complete testSingleSourceUpdate");
+
+    }
+    
+
+    /**
+     * Sources = 1
+     * Commands = 1, Update(prepared statement)
+     * Batching = Full Processing, Single Connector Batch
+     * result = commit 
+     */
+    public void testSingleSourcePreparedUpdate() throws Exception {
+        AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest("testSingleSourcePreparedUpdate") {
+            public void testCase() throws Exception {
+                execute("insert into pm1.g1 (e1, e2) values(?, ?)", new Object[] {new Integer(102), "102"});                
+            }
+           	public void validateTestCase() throws Exception {
+                // now verify the results
+                AbstractQueryTest test = new QueryExecution(getSource("pm1"));
+                test.execute("select * from g1 where e1 = 102");
+                test.assertRowCount(1);
+                test.closeConnection();   
+          	}
+        };        
+        
+        // run test
+        getTransactionContainter().runTransaction(userTxn);
+        
+         
+        System.out.println("Complete testSingleSourcePreparedUpdate");
+
+    }    
+    
+    /**
+     * Sources = 1
+     * Commands = multiple - Success
+     * Batching = Full Processing, Single Connector Batch
+     * result = commit
+     */
+    public void testSingleSourceMultipleCommands() throws Exception {
+        AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest("testSingleSourceMultipleCommands") {
+            public void testCase() throws Exception {
+                
+                execute("delete from pm1.g1 where pm1.g1.e1 >= ?", new Object[] {new Integer(100)});
+                
+                execute("select * from pm1.g1");
+                assertRowCount(100);
+                
+                for (int i = 100; i < 110; i++) {
+                    Integer val = new Integer(i);
+                    execute("insert into pm1.g1 (e1, e2) values(?,?)", new Object[] {val, val.toString()});
+                    execute("insert into pm1.g2 (e1, e2) values(?,?)", new Object[] {val, val.toString()});
+                }
+            }
+            
+           	public void validateTestCase() throws Exception {
+                // now verify the results
+                AbstractQueryTest test = new QueryExecution(getSource("pm1"));
+                test.execute("select * from g1 where e1 >= 100");
+                test.assertRowCount(10);
+                test.execute("select * from g2 where e1 >= 100");
+                test.assertRowCount(10);        
+                test.closeConnection();      
+          	}
+        };        
+        
+        // run test
+        getTransactionContainter().runTransaction(userTxn);      
+
+        
+        System.out.println("Complete testSingleSourceMultipleCommands");
+
+    }
+        
+    /**
+     * Sources = 1
+     * Commands = 1, Select
+     * Batching = Partial Processing, Single Connector Batch
+     * result = commit 
+     */
+    public void testSingleSourcePartialProcessing() throws Exception {
+        AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest("testSingleSourcePartialProcessing") {
+            public void testCase() throws Exception {
+                execute("select * from pm1.g1 where pm1.g1.e1 < 100 limit 10");
+                assertRowCount(10);
+            }
+            
+           	public void validateTestCase() throws Exception {
+           	}
+        };        
+        
+        // run test
+        getTransactionContainter().runTransaction(userTxn);      
+        
+        System.out.println("Complete testSingleSourcePartialProcessing");
+
+    }   
+    
+	   /**
+     * Sources = 1
+     * Commands = multiple - Success
+     * Batching = Full Processing, Single Connector Batch
+     * result = rollback
+     */
+    
+    public void testSingleSourceMultipleCommandsExplicitRollback() throws Exception {
+        // now it's empty
+        AbstractQueryTest test = new QueryExecution(getSource("pm1"));
+        		//getSource("pm1"));
+        test.execute("select * from g1 where e1 >= 200 and e1 < 220");
+        test.assertRowCount(0);
+        test.execute("select * from g2 where e1 >= 200 and e1 < 220");
+        test.assertRowCount(0);        
+        test.closeConnection();  
+
+    	
+        AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest("testSingleSourceMultipleCommandsExplicitRollback") {
+            public void testCase() throws Exception {
+                for (int i = 200; i < 220; i++) {
+                    execute("insert into pm1.g1 (e1, e2) values("+i+",'"+i+"')");
+                    execute("insert into pm1.g2 (e1, e2) values("+i+",'"+i+"')");
+                }                
+            }
+            
+            public boolean rollbackAllways() {
+                return true;
+            }
+            
+           	public void validateTestCase() throws Exception {
+                // now verify the results
+           		AbstractQueryTest test = new QueryExecution(getSource("pm1"));
+                		//getSource("pm1"));
+                test.execute("select * from g1 where e1 >= 200 and e1 < 220");
+                test.assertRowCount(0);
+                test.execute("select * from g2 where e1 >= 200 and e1 < 220");
+                test.assertRowCount(0);        
+                test.closeConnection();  
+          	}
+
+
+        };        
+        
+        
+        // run test
+        getTransactionContainter().runTransaction(userTxn);      
+        
+        System.out.println("Complete testSingleSourceMultipleCommandsExplicitRollback");
+
+    } 
+
+    /**
+     * Sources = 1
+     * Commands = multiple - Success
+     * Batching = Full Processing, Single Connector Batch
+     * result = rollback
+     */
+    public void testSingleSourceMultipleCommandsReferentialIntegrityRollback() throws Exception {
+    	
+        AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest("testSingleSourceMultipleCommandsReferentialIntegrityRollback") {
+            public void testCase() throws Exception {
+                for (int i = 200; i < 220; i++) {
+                    Integer val = new Integer(i);
+                    execute("insert into pm1.g1 (e1, e2) values(?,?)", new Object[] {val, val.toString()});
+                    execute("insert into pm1.g2 (e1, e2) values(?,?)", new Object[] {val, val.toString()});
+                }
+                
+                // force the rollback by trying to insert an invalid row.
+                execute("insert into pm1.g2 (e1, e2) values(?,?)", new Object[] {new Integer(9999), "9999"});
+            }
+            
+            public boolean exceptionExpected() {
+                return true;
+            }
+            
+           	public void validateTestCase() throws Exception {
+                // now verify the results
+                AbstractQueryTest test = new QueryExecution(getSource("pm1"));
+                test.execute("select * from g1 where e1 >= 200 and e1 < 220");
+                test.assertRowCount(0);
+                test.closeConnection();   
+          	}
+        };        
+        
+        
+        // run test
+        getTransactionContainter().runTransaction(userTxn);      
+        
+        System.out.println("Complete testSingleSourceMultipleCommandsReferentialIntegrityRollback");
+
+    }    
+
+  
+    
+ 
+}


Property changes on: trunk/test-integration/db/src/test/java/org/teiid/test/testcases/SingleSourceTransactionScenarios.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Deleted: trunk/test-integration/db/src/test/java/org/teiid/test/testcases/TwoSourceTransaction.java
===================================================================
--- trunk/test-integration/db/src/test/java/org/teiid/test/testcases/TwoSourceTransaction.java	2009-09-20 04:22:12 UTC (rev 1425)
+++ trunk/test-integration/db/src/test/java/org/teiid/test/testcases/TwoSourceTransaction.java	2009-09-20 16:31:17 UTC (rev 1426)
@@ -1,801 +0,0 @@
-/*
- * Copyright (c) 2000-2007 MetaMatrix, Inc.
- * All rights reserved.
- */
-package org.teiid.test.testcases;
-
-import java.sql.Connection;
-import java.sql.SQLException;
-import java.util.ArrayList;
-
-import org.teiid.test.framework.AbstractQueryTransactionTest;
-import org.teiid.test.framework.QueryExecution;
-
-import com.metamatrix.jdbc.api.AbstractQueryTest;
-
-
-
-/** 
- * Test cases that require 2 datasources 
- */
-public class TwoSourceTransaction extends SingleSourceTransaction {
-    
-    public TwoSourceTransaction(String name) {
-        super(name);
-    }
-        
-    
-    ///////////////////////////////////////////////////////////////////////////////////////////////
-    //  Multiple Sources     - Rows from 500
-    ///////////////////////////////////////////////////////////////////////////////////////////////
-    
-    /**
-     * Sources = 2
-     * Commands = 1, Select
-     * Batching = Full Processing, Single Connector Batch
-     * result = commit 
-     */
-    public void testMultipleSourceSelect() throws Exception {
-        AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest("testMultipleSourceSelect") {
-            public void testCase() throws Exception {
-                execute("select * from pm1.g1 join pm2.g1 on pm1.g1.e1 = pm2.g1.e1 where pm1.g1.e1 < 100");
-                assertRowCount(100);
-            }
-            
-            public int getNumberRequiredDataSources(){
-            	return 2;
-            }
-            
-          	public void validateTestCase() throws Exception {
-          	}
-        };        
-        
-        // run test
-        getTransactionContainter().runTransaction(userTxn);
-        
-        System.out.println("Complete CommonTransactionTest.testMultipleSourceSelect");
-
-    }
-
-    /**
-     * Sources = 2
-     * Commands = 1, Select
-     * Batching = Full Processing, Single Connector Batch
-     * result = commit 
-     */    
-    public void testMultipleSourceVirtualSelect() throws Exception {
-        AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest("testMultipleSourceVirtualSelect") {
-            public void testCase() throws Exception {
-                execute("select * from vm.g1 where vm.g1.pm1e1 < 100");
-                assertRowCount(100);
-            }
-            public int getNumberRequiredDataSources(){
-            	return 2;
-            }
-         	public void validateTestCase() throws Exception {
-          	}
- 
-        };  
-        
-       
-        // run test
-        getTransactionContainter().runTransaction(userTxn);
-        
-        System.out.println("Complete CommonTransactionTest.testMultipleSourceVirtualSelect");
-
-    }    
-    
-    /**
-     * Sources = 2
-     * Commands = 1, Update
-     * Batching = Full Processing, Single Connector Batch
-     * result = commit 
-     */
-    public void testMultipleSourceUpdate() throws Exception {
-        AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest("testMultipleSourceUpdate") {
-            public void testCase() throws Exception {
-                execute("insert into vm.g1 (pm1e1, pm1e2, pm2e1, pm2e2) values(500, '500', 500, '500')");
-            }
-            
-            public int getNumberRequiredDataSources(){
-            	return 2;
-            }
-             
-         	public void validateTestCase() throws Exception {
-
-                // now verify the results
-                AbstractQueryTest test = new QueryExecution(getSource("pm1"));
-                test.execute("select * from g1 where e2 = '500'");
-                test.assertRowCount(1);
-                test.closeConnection();
-                
-                test = new QueryExecution(getSource("pm2"));
-                test.execute("select * from g1 where e2 = '500'");
-                test.assertRowCount(1);
-                test.closeConnection();
-                   	}
- 
-        };  
-        
-        
-        // run test
-        getTransactionContainter().runTransaction(userTxn);             
-       
-        System.out.println("Complete CommonTransactionTest.testMultipleSourceUpdate");
-
-    }
-    
-    /**
-     * Sources = 2
-     * Commands = 1, Update
-     * Batching = Full Processing, Single Connector Batch
-     * result = commit 
-     */
-    public void testMultipleSourceSelectInto() throws Exception {
-        AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest("testMultipleSourceSelectInto") {
-            public void testCase() throws Exception {
-                execute("insert into vm.g1 (pm1e1, pm1e2, pm2e1, pm2e2) values(501, '501', 501, '501')");
-                execute("select pm1.g1.e1, pm1.g1.e2 into pm2.g2 from pm1.g1 where pm1.g1.e1 = 501");
-            }
-            
-            public int getNumberRequiredDataSources(){
-            	return 2;
-            }
-            
-         	public void validateTestCase() throws Exception {
-                
-                // now verify the results
-                AbstractQueryTest test = new QueryExecution(getSource("pm1"));
-                test.execute("select * from g1 where e2 = '501'");
-                test.assertRowCount(1);
-                test.closeConnection();
-                
-                test = new QueryExecution(getSource("pm2"));
-                test.execute("select * from g1 where e2 = '501'");
-                test.assertRowCount(1);
-                test.closeConnection();
-                
-         	}
- 
-        };     
-               
-        // run test
-        getTransactionContainter().runTransaction(userTxn);    
-        
-        System.out.println("Complete CommonTransactionTest.testMultipleSourceSelectInto");
-
-    }    
-    
-    /**
-     * Sources = 2
-     * Commands = 1, Update
-     * Batching = Full Processing, Single Connector Batch
-     * result = commit 
-     */
-    public void testMultipleSourceBulkRowInsert() throws Exception {
-        AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest("testMultipleSourceBulkRowInsert") {
-            public void testCase() throws Exception {
-                for (int i = 100; i < 112; i++) {
-                    Integer val = new Integer(i);
-                    execute("insert into vm.g1 (pm1e1, pm1e2, pm2e1, pm2e2) values(?,?,?,?)", new Object[] {val, val.toString(), val, val.toString()});
-                }
-                execute("select pm1.g1.e1, pm1.g1.e2 into pm2.g2 from pm1.g1 where pm1.g1.e1 >= 100");
-            }
-            
-            public int getNumberRequiredDataSources(){
-            	return 2;
-            }
-          	public void validateTestCase() throws Exception {
-                
-                // now verify the results
-          		Connection ds = getSource("pm1");
-          		System.out.println("Datasource: " + ds.getMetaData().getDatabaseProductName());
-                AbstractQueryTest test = new QueryExecution(ds);
-                test.execute("select * from g1 where e1 >= 100 and e1 < 112");
-                test.assertRowCount(12);
-                test.closeConnection();
-                
-                test = new QueryExecution(getSource("pm2"));
-                test.execute("select * from g1 where e1 >= 100 and e1 < 112");
-                test.assertRowCount(12);
-                test.execute("select * from g2 where e1 >= 100 and e1 < 112");
-                test.assertRowCount(12);        
-                test.closeConnection();
-          	}
- 
-
-        };        
-
-      
-        // run test
-        getTransactionContainter().runTransaction(userTxn);       
-         
-        System.out.println("Complete CommonTransactionTest.testMultipleSourceBulkRowInsert");
-
-    }    
-
-    /**
-     * Sources = 2
-     * Commands = 1, Update(prepared statement)
-     * Batching = Full Processing, Single Connector Batch
-     * result = commit 
-     */
-    public void testMultipleSourcePreparedUpdate() throws Exception {
-        AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest("testMultipleSourcePreparedUpdate") {
-            public void testCase() throws Exception {
-                Integer value = new Integer(500);
-                execute("insert into vm.g1 (pm1e1, pm1e2, pm2e1, pm2e2) values(?,?,?,?)", new Object[] {value, value.toString(), value, value.toString()});
-            }
-            public int getNumberRequiredDataSources(){
-            	return 2;
-            }
-             
-         	public void validateTestCase() throws Exception {
-                
-                // now verify the results
-                AbstractQueryTest test = new QueryExecution(getSource("pm1"));
-                test.execute("select * from g1 where e1 = 500");
-                test.assertRowCount(1);
-                test.closeConnection();
-                
-                test = new QueryExecution(getSource("pm2"));
-                test.execute("select * from g1 where e1 = 500");
-                test.assertRowCount(1);
-                test.closeConnection();  
-         	}
- 
-        };     
-
-       
-        // run test
-        getTransactionContainter().runTransaction(userTxn);       
-         
-        System.out.println("Complete CommonTransactionTest.testMultipleSourcePreparedUpdate");
-
-    }    
-    
-    
-    /**
-     * Sources = 2
-     * Commands = multiple - Success
-     * Batching = Full Processing, Single Connector Batch
-     * result = commit
-     */
-    public void testMultipleSourceMultipleCommands() throws Exception {
-        AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest("testMultipleSourceMultipleCommands") {
-            public void testCase() throws Exception {
-                execute("delete from pm1.g2 where e1 >= ?", new Object[] {new Integer(100)});
-                execute("delete from pm1.g1 where e1 >= ?", new Object[] {new Integer(100)});
-                execute("delete from pm2.g2 where e1 >= ?", new Object[] {new Integer(100)});
-                execute("delete from pm2.g1 where e1 >= ?", new Object[] {new Integer(100)});
-                
-                execute("select * from pm1.g1");
-                assertRowCount(100);
-                
-                for (int i = 100; i < 115; i++) {
-                    Integer val = new Integer(i);
-                    execute("insert into pm1.g1 (e1, e2) values(?,?)", new Object[] {val, val.toString()});
-                    execute("insert into pm1.g2 (e1, e2) values(?,?)", new Object[] {val, val.toString()});
-                    
-                    execute("insert into pm2.g1 (e1, e2) values(?,?)", new Object[] {val, val.toString()});
-                    execute("insert into pm2.g2 (e1, e2) values(?,?)", new Object[] {val, val.toString()});                    
-                }
-                
-                execute("update pm1.g1 set e2='blah' where e1 > 100");
-            }
-            public int getNumberRequiredDataSources(){
-            	return 2;
-            }
-            
-            // because different databases return "varchar" in all caps "VARCHAR"
-            // the comparison is being done in a noncasesensitive manner
-            public boolean compareResultsCaseSensitive() {
-            	return false;
-            }
-             
-         	public void validateTestCase() throws Exception {
-
-                // now verify the results
-                AbstractQueryTest test = new QueryExecution(getSource("pm1"));
-                test.execute("select * from g1 where e1 >= 100 and e1 < 115");
-                test.assertRowCount(15);
-                test.execute("select * from g2 where e1 >= 100 and e1 < 115");
-                test.assertRowCount(15);
-                test.execute("select distinct e2 from g1 where e1 > 100");
-                
- //               assertResultsSetEquals(this.internalResultSet., new String[] {"e2[varchar]", "blah"});
-                
-                test.assertResultsSetEquals(new String[] {"e2[varchar]", "blah"});
-                test.closeConnection();  
-         	}
- 
-        };     
-        
-        
-        // run test
-        getTransactionContainter().runTransaction(userTxn);      
-        
-        System.out.println("Complete CommonTransactionTest.testMultipleSourceMultipleCommands");
-
-
-    }
-    
-    /**
-     * Sources = 2
-     * Commands = multiple - Success
-     * Batching = Full Processing, Single Connector Batch
-     * result = commit
-     */
-    public void testMultipleSourceMultipleVirtualCommands() throws Exception {
-        AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest("testMultipleSourceMultipleVirtualCommands") {
-            public void testCase() throws Exception {
-
-                for (int i = 200; i < 207; i++) {
-                    Integer val = new Integer(i);
-                    execute("insert into vm.g1 (pm1e1, pm1e2, pm2e1, pm2e2) values(?,?,?,?)", new Object[] {val, val.toString(), val, val.toString()});
-                    execute("insert into vm.g2 (pm1e1, pm1e2, pm2e1, pm2e2) values(?,?,?,?)", new Object[] {val, val.toString(), val, val.toString()});                    
-                }
-                
-                execute("update vm.g1 set pm1e2='blah' where pm1e1 >= 200");
-                
-                execute("delete from vm.g2 where vm.g2.pm1e1 >= 205");
-                execute("delete from vm.g1 where vm.g1.pm1e1 >= 205");
-                
-                execute("select * from vm.g1 where pm1e1 >= 200 and pm1e1 < 207");
-                assertRowCount(5);
-            }
-            public int getNumberRequiredDataSources(){
-            	return 2;
-            }
-            
-         	public void validateTestCase() throws Exception {
-                // now verify the results
-                AbstractQueryTest test = new QueryExecution(getSource("pm1"));
-                test.execute("select * from g1 where e1 >= 200 and e1 < 207");
-                test.assertRowCount(5);
-                test.execute("select * from g2 where e1 >= 200 and e1 < 207");
-                test.assertRowCount(5);
-                test.execute("select distinct e2 from g1 where e1 >= 200 and e1 < 207");
-                test.assertResultsSetEquals(new String[] {"e2[varchar]", "blah"});
-                test.closeConnection();  
-                
-         	}
- 
-        };     
-
-        
-        // run test
-        getTransactionContainter().runTransaction(userTxn);      
-
-        System.out.println("Complete CommonTransactionTest.testMultipleSourceMultipleVirtualCommands");
-
-
-    }    
-        
-    /**
-     * Sources = 2
-     * Commands = multiple - Success
-     * Batching = Full Processing, Single Connector Batch
-     * result = rollback
-     */    
-    public void testMultipleSourceMultipleCommandsCancel() throws Exception {
-        AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest("testMultipleSourceMultipleCommandsCancel") {
-            
-            public void testCase() throws Exception {
-                Thread t = new Thread("Cancel Thread") {
-                    public void run() {
-                        try {
-                            try {
-                                Thread.sleep(500);
-                                cancelQuery();
-                            } catch (SQLException e) {
-                            	print(e);
-                            //    debug(e.getMessage());
-                            }
-                        } catch (InterruptedException e) {}
-                    }
-                };
-                t.start();
-                executeBatch(getMultipleSourceBatch());
-            }
-           
-            /** 
-             * @see com.metamatrix.transaction.test.framework.AbstractQueryTest#exceptionExpected()
-             */
-            public boolean exceptionExpected() {
-                return true;
-            }
-            
-            public int getNumberRequiredDataSources(){
-            	return 2;
-            }
- 
-            
-         	public void validateTestCase() throws Exception {
-                // now verify the results (this may finish under one second, then this test is not valid)
-                AbstractQueryTest test = new QueryExecution(getSource("pm1"));
-                test.execute("select * from g1 where e1 >= 600 and e1 < 650");
-                test.assertRowCount(0);
-                test.execute("select * from g2 where e1 >= 600 and e1 < 650");
-                test.assertRowCount(0);
-                test.execute("select distinct e2 from g1 where e1 >= 600 and e1 < 650");
-                test.assertRowCount(0);
-                test.closeConnection(); 
-                
-          	}
- 
-        };
-        getTransactionContainter().runTransaction(userTxn);
-                
-        System.out.println("Complete CommonTransactionTest.testMultipleSourceMultipleCommandsCancel");
-
-    }
-
-    /**
-     * Sources = 2
-     * Commands = multiple - Success
-     * Batching = Full Processing, Single Connector Batch
-     * result = rollback
-     */    
-    public void testMultipleSourceTimeout() throws Exception{
-        AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest("testMultipleSourceTimeout") {
-            public void testCase() throws Exception {
-                executeBatch(getMultipleSourceBatch(), 1); // time out after 1 sec
-            }
-            
-            public boolean exceptionExpected() {
-                return true;
-            }            
-            
-            public void after() {
-                if (!exceptionOccurred()) {
-                    fail("should have failed with time out exception");
-                }
-                else {
-                    assertTrue(getLastException().getMessage().indexOf("Operation timed out before completion") != -1);
-                }
-            } 
-            
-            public int getNumberRequiredDataSources(){
-            	return 2;
-            }
- 
-            
-         	public void validateTestCase() throws Exception {
-                // now verify the results (this may finish under one second, then this test is not valid)
-                AbstractQueryTest test = new QueryExecution(getSource("pm1"));
-                test.execute("select * from g1 where e1 >= 600 and e1 < 750");
-                test.assertRowCount(0);
-                test.execute("select * from g2 where e1 >= 600 and e1 < 750");
-                test.assertRowCount(0);
-                test.execute("select distinct e2 from g1 where e1 >= 600 and e1 < 750");
-                test.assertRowCount(0);
-                test.closeConnection();   
-         	}
- 
-        };
-        getTransactionContainter().runTransaction(userTxn);
-        
-        
-        System.out.println("Complete CommonTransactionTest.testMultipleSourceTimeout");
-
-    }    
-    
-        
-    static String[] getMultipleSourceBatch() {
-        ArrayList<String> list = new ArrayList<String>();
-        
-        for (int i = 600; i < 750; i++) {
-            list.add("insert into pm1.g1 (e1, e2) values("+i+",'"+i+"')");
-            list.add("insert into pm1.g2 (e1, e2) values ("+i+",'"+i+"')");
-            list.add("insert into pm2.g1 (e1, e2) values("+i+",'"+i+"')");
-            list.add("insert into pm2.g2 (e1, e2) values ("+i+",'"+i+"')");                                
-        }
-        
-        list.add("update pm1.g1 set e2='blah' where pm1.g1.e1 >= 600");
-        list.add("update pm2.g1 set e2='blah' where pm2.g1.e1 >= 600");
-        
-        list.add("delete from pm1.g2 where pm1.g2.e1 >= 610");
-        list.add("delete from pm1.g1 where pm1.g1.e1 >= 610");
-        list.add("delete from pm2.g2 where pm2.g2.e1 >= 610");
-        list.add("delete from pm2.g1 where pm2.g1.e1 >= 610");
-        
-        return(String[])list.toArray(new String[list.size()]);
-    }
-    
-    
-    /**
-     * Sources = 2
-     * Commands = 1, Select
-     * Batching = Partial Processing, Single Connector Batch
-     * result = commit 
-     * Note: This is producing the below error some times; however this is SQL Server issue.
-     * http://support.microsoft.com/?kbid=834849
-     */
-    public void testMultipleSourcePartialProcessingUsingLimit() throws Exception {
-        AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest("testMultipleSourcePartialProcessingUsingLimit") {
-            public void testCase() throws Exception {
-                execute("select * from vm.g1 where pm1e1 < 100 limit 10");
-                assertRowCount(10);
-            }
-            
-            public int getNumberRequiredDataSources(){
-            	return 2;
-            }
- 
-            
-         	public void validateTestCase() throws Exception {
-          	}
- 
-        };        
-        
-        // run test
-        getTransactionContainter().runTransaction(userTxn);      
-        
-        System.out.println("Complete CommonTransactionTest.testMultipleSourcePartialProcessingUsingLimit");
-
-    }  
-
-    /**
-     * Sources = 2
-     * Commands = 1, Select
-     * Batching = Partial Processing, Single Connector Batch
-     * result = commit
-     * Note: This is producing the below error some times; however this is SQL Server issue.
-     * http://support.microsoft.com/?kbid=834849
-     */
-    public void testMultipleSourcePartialProcessingUsingMakedep() throws Exception {
-        AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest("testMultipleSourcePartialProcessingUsingMakedep") {
-            public void testCase() throws Exception {
-                execute("select pm1.g1.e1, pm1.g1.e2 from pm1.g1 LEFT OUTER JOIN pm2.g1 MAKENOTDEP ON pm1.g1.e2 = pm2.g1.e2 where pm2.g1.e1 >= 50 and pm2.g1.e1 < 100");
-                assertRowCount(50);
-            }
-            
-            public int getNumberRequiredDataSources(){
-            	return 2;
-            }
- 
-            
-         	public void validateTestCase() throws Exception {
-          	}
- 
-        };        
-        
-        // run test
-        getTransactionContainter().runTransaction(userTxn);  
-        
-        System.out.println("Complete CommonTransactionTest.testMultipleSourcePartialProcessingUsingMakedep");
-
-    }        
-    
-    /**
-     * Sources = 2
-     * Commands = multiple - Success
-     * Batching = Full Processing, Single Connector Batch
-     * result = rollback
-     */
-    public void testMultipleSourceMultipleCommandsExplicitRollback() throws Exception {
-        AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest("testMultipleSourceMultipleCommandsExplicitRollback") {
-            public void testCase() throws Exception {
-
-                for (int i = 700; i < 720; i++) {
-                    Integer val = new Integer(i);
-                    execute("insert into pm1.g1 (e1, e2) values(?,?)", new Object[] {val, val.toString()});
-                    execute("insert into pm1.g2 (e1, e2) values(?,?)", new Object[] {val, val.toString()});
-                    
-                    execute("insert into pm2.g1 (e1, e2) values(?,?)", new Object[] {val, val.toString()});
-                    execute("insert into pm2.g2 (e1, e2) values(?,?)", new Object[] {val, val.toString()});                    
-                }                
-            }
-            
-            // force the rollback
-            public boolean rollbackAllways() {
-                return true;
-            }
-            
-            public boolean exceptionExpected() {
-                return true;
-            }
-            
-            public int getNumberRequiredDataSources(){
-            	return 2;
-            }
- 
-            
-         	public void validateTestCase() throws Exception {
-                // now verify the results
-                AbstractQueryTest test = new QueryExecution(getSource("pm1"));
-                test.execute("select * from g1 where e1 >= 700 and e1 < 720");
-                test.assertRowCount(0);        
-                test.closeConnection();
-                
-                test = new QueryExecution(getSource("pm2"));
-                test.execute("select * from g1 where e1 >= 700 and e1 < 720");
-                test.assertRowCount(0);        
-                test.closeConnection();    
-                
-         	}
- 
-            
-        };        
-        
-        // run test
-        getTransactionContainter().runTransaction(userTxn);      
-
-        System.out.println("Complete testMultipleSourceMultipleCommandsExplicitRollback");
-
-    }
-    
-    /**
-     * Sources = 2
-     * Commands = multiple - Success
-     * Batching = Full Processing, Single Connector Batch
-     * result = rollback
-     */
-    public void testMultipleSourceMultipleCommandsReferentialIntegrityRollback() throws Exception {
-        AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest("testMultipleSourceMultipleCommandsReferentialIntegrityRollback") {
-            public void testCase() throws Exception {
-
-                for (int i = 700; i < 720; i++) {
-                    Integer val = new Integer(i);
-                    execute("insert into pm1.g1 (e1, e2) values(?,?)", new Object[] {val, val.toString()});
-                    execute("insert into pm1.g2 (e1, e2) values(?,?)", new Object[] {val, val.toString()});
-                    
-                    execute("insert into pm2.g1 (e1, e2) values(?,?)", new Object[] {val, val.toString()});
-                    execute("insert into pm2.g2 (e1, e2) values(?,?)", new Object[] {val, val.toString()});                    
-                }
-                
-                // force the rollback by trying to insert an invalid row.
-                execute("insert into pm1.g2 (e1, e2) values(?,?)", new Object[] {new Integer(9999), "9999"});
-            }
-            
-            public boolean exceptionExpected() {
-                return true;
-            }
-            
-            public int getNumberRequiredDataSources(){
-            	return 2;
-            }
- 
-            
-         	public void validateTestCase() throws Exception {
-                // now verify the results
-                AbstractQueryTest test = new QueryExecution(getSource("pm1"));
-                test.execute("select * from g1 where e1 >= 700 and e1 < 720");
-                test.assertRowCount(0);
-                test.closeConnection();        
-                
-                test = new QueryExecution(getSource("pm2"));
-                test.execute("select * from g1 where e1 >= 700 and e1 < 720");
-                test.assertRowCount(0);        
-                test.closeConnection();   
-         	}
- 
-        };        
-        
-        // run test
-        getTransactionContainter().runTransaction(userTxn);      
-
-         
-        System.out.println("Complete testMultipleSourceMultipleCommandsReferentialIntegrityRollback");
-
-    }
-    
-    /**
-     * Sources = 2
-     * Commands = 1, Update
-     * Batching = Full Processing, Single Connector Batch
-     * result = commit 
-     */
-    public void testMultipleSourceBulkRowInsertRollback() throws Exception {
-        AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest("testMultipleSourceBulkRowInsertRollback") {
-            public void testCase() throws Exception {
-                for (int i = 100; i < 120; i++) {
-                    Integer val = new Integer(i);
-                    execute("insert into vm.g1 (pm1e1, pm1e2, pm2e1, pm2e2) values(?,?,?,?)", new Object[] {val, val.toString(), val, val.toString()});
-                }
-                execute("select pm1.g1.e1, pm1.g1.e2 into pm2.g2 from pm1.g1 where pm1.g1.e1 >= 100");
-                
-                // force the rollback by trying to insert an invalid row.
-                execute("insert into pm1.g2 (e1, e2) values(?,?)", new Object[] {new Integer(9999), "9999"});                
-            }
-            
-            public boolean exceptionExpected() {
-                return true;
-            }
-            
-            public int getNumberRequiredDataSources(){
-            	return 2;
-            }
- 
-            
-         	public void validateTestCase() throws Exception {
-                // now verify the results
-                AbstractQueryTest test = new QueryExecution(getSource("pm1"));
-                test.execute("select * from g1 where e1 >= 100 and e1 < 120");
-                test.assertRowCount(0);
-                test.closeConnection();
-                
-                test = new QueryExecution(getSource("pm2"));
-                test.execute("select * from g1 where e1 >= 100 and e1 < 120");
-                test.assertRowCount(0);
-                test.execute("select * from g2 where e1 >= 100 and e1 < 120");
-                test.assertRowCount(0);        
-                test.closeConnection();
-         	}
- 
-        };        
-        
-        // run test
-        getTransactionContainter().runTransaction(userTxn);       
-        
-        
-        System.out.println("Complete testMultipleSourceBulkRowInsertRollback");
-
-    } 
-    
-    /**
-     * Sources = 2
-     * Commands = multiple - Success
-     * Batching = Full Processing, Single Connector Batch
-     * result = commit
-     */
-    public void testMultipleSourceMultipleVirtualCommandsRollback() throws Exception {
-        AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest("testMultipleSourceMultipleVirtualCommandsRollback") {
-            public void testCase() throws Exception {
-
-                for (int i = 600; i < 615; i++) {
-                    Integer val = new Integer(i);
-                    execute("insert into vm.g1 (pm1e1, pm1e2, pm2e1, pm2e2) values(?,?,?,?)", new Object[] {val, val.toString(), val, val.toString()});
-                    execute("insert into vm.g2 (pm1e1, pm1e2, pm2e1, pm2e2) values(?,?,?,?)", new Object[] {val, val.toString(), val, val.toString()});                    
-                }
-                
-                execute("select * from vm.g1 where pm1e1 >= 600 and pm1e1 < 615");
-                assertRowCount(15);
-
-                
-                execute("update vm.g1 set pm1e2='blah' where pm1e1 >= 605");
-                
-                execute("delete from vm.g2 where vm.g2.pm1e1 >= 610");
-                execute("delete from vm.g1 where vm.g1.pm1e1 >= 610");
-                
-                execute("select * from vm.g1 where pm1e1 >= 600 and pm1e1 < 615");
-                assertRowCount(10);
-                
-                // force the rollback by trying to insert an invalid row.
-                execute("insert into pm1.g2 (e1, e2) values(?,?)", new Object[] {new Integer(9999), "9999"});                                
-            }
-            
-            public boolean exceptionExpected() {
-                return true;
-            }
-            
-            public int getNumberRequiredDataSources(){
-            	return 2;
-            }
- 
-            
-         	public void validateTestCase() throws Exception {
-                // now verify the results
-                AbstractQueryTest test = new QueryExecution(getSource("pm1"));
-                test.execute("select * from g1 where e1 >= 600 and e1 < 615");
-                test.assertRowCount(0);
-                test.execute("select * from g2 where e1 >= 600 and e1 < 615");
-                test.assertRowCount(0);
-                test.execute("select distinct e2 from g1 where e1 >= 600 and e1 < 615");
-                test.assertRowCount(0);
-                test.closeConnection();   
-         	}
- 
-        };        
-        
-        // run test
-        getTransactionContainter().runTransaction(userTxn);      
-
-        
-        System.out.println("Complete testMultipleSourceMultipleVirtualCommandsRollback");
-
-    }    
-    
-
-}

Copied: trunk/test-integration/db/src/test/java/org/teiid/test/testcases/TwoSourceTransactionScenarios.java (from rev 1424, trunk/test-integration/db/src/test/java/org/teiid/test/testcases/TwoSourceTransaction.java)
===================================================================
--- trunk/test-integration/db/src/test/java/org/teiid/test/testcases/TwoSourceTransactionScenarios.java	                        (rev 0)
+++ trunk/test-integration/db/src/test/java/org/teiid/test/testcases/TwoSourceTransactionScenarios.java	2009-09-20 16:31:17 UTC (rev 1426)
@@ -0,0 +1,811 @@
+/*
+ * Copyright (c) 2000-2007 MetaMatrix, Inc.
+ * All rights reserved.
+ */
+package org.teiid.test.testcases;
+
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.util.ArrayList;
+
+import org.teiid.test.framework.AbstractQueryTransactionTest;
+import org.teiid.test.framework.QueryExecution;
+
+import com.metamatrix.jdbc.api.AbstractQueryTest;
+
+
+
+/** 
+ * Test cases that require 2 datasources 
+ */
+public class TwoSourceTransactionScenarios extends SingleSourceTransactionScenarios {
+    
+    public TwoSourceTransactionScenarios(String name) {
+        super(name);
+    }
+        
+    
+    ///////////////////////////////////////////////////////////////////////////////////////////////
+    //  Multiple Sources     - Rows from 500
+    ///////////////////////////////////////////////////////////////////////////////////////////////
+    
+    /**
+     * Sources = 2
+     * Commands = 1, Select
+     * Batching = Full Processing, Single Connector Batch
+     * result = commit 
+     */
+    public void testMultipleSourceSelect() throws Exception {
+        AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest("testMultipleSourceSelect") {
+            public void testCase() throws Exception {
+                execute("select * from pm1.g1 join pm2.g1 on pm1.g1.e1 = pm2.g1.e1 where pm1.g1.e1 < 100");
+                assertRowCount(100);
+            }
+            
+            public int getNumberRequiredDataSources(){
+            	return 2;
+            }
+            
+          	public void validateTestCase() throws Exception {
+          	}
+        };        
+        
+        // run test
+        getTransactionContainter().runTransaction(userTxn);
+        
+        System.out.println("Complete testMultipleSourceSelect");
+
+    }
+
+    /**
+     * Sources = 2
+     * Commands = 1, Select
+     * Batching = Full Processing, Single Connector Batch
+     * result = commit 
+     */    
+    public void testMultipleSourceViewSelect() throws Exception {
+        AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest("testMultipleSourceVirtualSelect") {
+            public void testCase() throws Exception {
+                execute("select * from vm.g1 where vm.g1.pm1e1 < 100");
+                assertRowCount(100);
+            }
+            public int getNumberRequiredDataSources(){
+            	return 2;
+            }
+         	public void validateTestCase() throws Exception {
+          	}
+ 
+        };  
+        
+       
+        // run test
+        getTransactionContainter().runTransaction(userTxn);
+        
+        System.out.println("Complete testMultipleSourceVirtualSelect");
+
+    }    
+    
+    /**
+     * Sources = 2
+     * Commands = 1, Update
+     * Batching = Full Processing, Single Connector Batch
+     * result = commit 
+     */
+    public void testMultipleSourceViewUpdate() throws Exception {
+        AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest("testMultipleSourceUpdate") {
+            public void testCase() throws Exception {
+                execute("insert into vm.g1 (pm1e1, pm1e2, pm2e1, pm2e2) values(500, '500', 500, '500')");
+            }
+            
+            public int getNumberRequiredDataSources(){
+            	return 2;
+            }
+             
+         	public void validateTestCase() throws Exception {
+
+                // now verify the results
+                AbstractQueryTest test = new QueryExecution(getSource("pm1"));
+                test.execute("select * from g1 where e2 = '500'");
+                test.assertRowCount(1);
+                test.closeConnection();
+                
+                test = new QueryExecution(getSource("pm2"));
+                test.execute("select * from g1 where e2 = '500'");
+                test.assertRowCount(1);
+                test.closeConnection();
+                   	}
+ 
+        };  
+        
+        
+        // run test
+        getTransactionContainter().runTransaction(userTxn);             
+       
+        System.out.println("Complete testMultipleSourceUpdate");
+
+    }
+    
+    /**
+     * Sources = 2
+     * Commands = 1, Update
+     * Batching = Full Processing, Single Connector Batch
+     * result = commit 
+     */
+    public void testMultipleSourceViewSelectInto() throws Exception {
+        AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest("testMultipleSourceViewSelectInto") {
+            public void testCase() throws Exception {
+                execute("insert into vm.g1 (pm1e1, pm1e2, pm2e1, pm2e2) values(501, '501', 501, '501')");
+                execute("select pm1.g1.e1, pm1.g1.e2 into pm2.g2 from pm1.g1 where pm1.g1.e1 = 501");
+            }
+            
+            public int getNumberRequiredDataSources(){
+            	return 2;
+            }
+            
+         	public void validateTestCase() throws Exception {
+                
+                // now verify the results
+                AbstractQueryTest test = new QueryExecution(getSource("pm1"));
+                test.execute("select * from g1 where e2 = '501'");
+                test.assertRowCount(1);
+                test.closeConnection();
+                
+                test = new QueryExecution(getSource("pm2"));
+                test.execute("select * from g1 where e2 = '501'");
+                test.assertRowCount(1);
+                test.closeConnection();
+                
+         	}
+ 
+        };     
+               
+        // run test
+        getTransactionContainter().runTransaction(userTxn);    
+        
+        System.out.println("Complete testMultipleSourceViewSelectInto");
+
+    }    
+    
+    /**
+     * Sources = 2
+     * Commands = 1, Update
+     * Batching = Full Processing, Single Connector Batch
+     * result = commit 
+     */
+    public void testMultipleSourceViewBulkRowInsert() throws Exception {
+        AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest("testMultipleSourceViewBulkRowInsert") {
+            public void testCase() throws Exception {
+                for (int i = 100; i < 112; i++) {
+                    Integer val = new Integer(i);
+                    execute("insert into vm.g1 (pm1e1, pm1e2, pm2e1, pm2e2) values(?,?,?,?)", new Object[] {val, val.toString(), val, val.toString()});
+                }
+                execute("select pm1.g1.e1, pm1.g1.e2 into pm2.g2 from pm1.g1 where pm1.g1.e1 >= 100");
+            }
+            
+            public int getNumberRequiredDataSources(){
+            	return 2;
+            }
+          	public void validateTestCase() throws Exception {
+                
+                // now verify the results
+          		Connection ds = getSource("pm1");
+          		System.out.println("Datasource: " + ds.getMetaData().getDatabaseProductName());
+                AbstractQueryTest test = new QueryExecution(ds);
+                test.execute("select * from g1 where e1 >= 100 and e1 < 112");
+                test.assertRowCount(12);
+                test.closeConnection();
+                
+                test = new QueryExecution(getSource("pm2"));
+                test.execute("select * from g1 where e1 >= 100 and e1 < 112");
+                test.assertRowCount(12);
+                test.execute("select * from g2 where e1 >= 100 and e1 < 112");
+                test.assertRowCount(12);        
+                test.closeConnection();
+          	}
+ 
+
+        };        
+
+      
+        // run test
+        getTransactionContainter().runTransaction(userTxn);       
+         
+        System.out.println("Complete testMultipleSourceViewBulkRowInsert");
+
+    }   
+    
+    /**
+     * Sources = 2
+     * Commands = 1, Update
+     * Batching = Full Processing, Single Connector Batch
+     * result = commit 
+     */
+    public void testMultipleSourceViewBulkRowInsertRollback() throws Exception {
+        AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest("testMultipleSourceViewBulkRowInsertRollback") {
+            public void testCase() throws Exception {
+                for (int i = 100; i < 120; i++) {
+                    Integer val = new Integer(i);
+                    execute("insert into vm.g1 (pm1e1, pm1e2, pm2e1, pm2e2) values(?,?,?,?)", new Object[] {val, val.toString(), val, val.toString()});
+                }
+                execute("select pm1.g1.e1, pm1.g1.e2 into pm2.g2 from pm1.g1 where pm1.g1.e1 >= 100");
+                
+                // force the rollback by trying to insert an invalid row.
+                execute("insert into pm1.g2 (e1, e2) values(?,?)", new Object[] {new Integer(9999), "9999"});                
+            }
+            
+            public boolean exceptionExpected() {
+                return true;
+            }
+            
+            public int getNumberRequiredDataSources(){
+            	return 2;
+            }
+ 
+            
+         	public void validateTestCase() throws Exception {
+                // now verify the results
+                AbstractQueryTest test = new QueryExecution(getSource("pm1"));
+                test.execute("select * from g1 where e1 >= 100 and e1 < 120");
+                test.assertRowCount(0);
+                test.closeConnection();
+                
+                test = new QueryExecution(getSource("pm2"));
+                test.execute("select * from g1 where e1 >= 100 and e1 < 120");
+                test.assertRowCount(0);
+                test.execute("select * from g2 where e1 >= 100 and e1 < 120");
+                test.assertRowCount(0);        
+                test.closeConnection();
+         	}
+ 
+        };        
+        
+        // run test
+        getTransactionContainter().runTransaction(userTxn);       
+        
+        
+        System.out.println("Complete testMultipleSourceViewBulkRowInsertRollback");
+
+    } 
+
+
+    /**
+     * Sources = 2
+     * Commands = 1, Update(prepared statement)
+     * Batching = Full Processing, Single Connector Batch
+     * result = commit 
+     */
+    public void testMultipleSourceViewPreparedUpdate() throws Exception {
+        AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest("testMultipleSourceViewPreparedUpdate") {
+            public void testCase() throws Exception {
+                Integer value = new Integer(500);
+                execute("insert into vm.g1 (pm1e1, pm1e2, pm2e1, pm2e2) values(?,?,?,?)", new Object[] {value, value.toString(), value, value.toString()});
+            }
+            public int getNumberRequiredDataSources(){
+            	return 2;
+            }
+             
+         	public void validateTestCase() throws Exception {
+                
+                // now verify the results
+                AbstractQueryTest test = new QueryExecution(getSource("pm1"));
+                test.execute("select * from g1 where e1 = 500");
+                test.assertRowCount(1);
+                test.closeConnection();
+                
+                test = new QueryExecution(getSource("pm2"));
+                test.execute("select * from g1 where e1 = 500");
+                test.assertRowCount(1);
+                test.closeConnection();  
+         	}
+ 
+        };     
+
+       
+        // run test
+        getTransactionContainter().runTransaction(userTxn);       
+         
+        System.out.println("Complete testMultipleSourceViewPreparedUpdate");
+
+    }    
+    
+    
+    /**
+     * Sources = 2
+     * Commands = multiple - Success
+     * Batching = Full Processing, Single Connector Batch
+     * result = commit
+     */
+    public void testMultipleSourceMultipleCommands() throws Exception {
+        AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest("testMultipleSourceMultipleCommands") {
+            public void testCase() throws Exception {
+                execute("delete from pm1.g2 where e1 >= ?", new Object[] {new Integer(100)});
+                execute("delete from pm1.g1 where e1 >= ?", new Object[] {new Integer(100)});
+                execute("delete from pm2.g2 where e1 >= ?", new Object[] {new Integer(100)});
+                execute("delete from pm2.g1 where e1 >= ?", new Object[] {new Integer(100)});
+                
+                execute("select * from pm1.g1");
+                assertRowCount(100);
+                
+                for (int i = 100; i < 115; i++) {
+                    Integer val = new Integer(i);
+                    execute("insert into pm1.g1 (e1, e2) values(?,?)", new Object[] {val, val.toString()});
+                    execute("insert into pm1.g2 (e1, e2) values(?,?)", new Object[] {val, val.toString()});
+                    
+                    execute("insert into pm2.g1 (e1, e2) values(?,?)", new Object[] {val, val.toString()});
+                    execute("insert into pm2.g2 (e1, e2) values(?,?)", new Object[] {val, val.toString()});                    
+                }
+                
+                execute("update pm1.g1 set e2='blah' where e1 > 100");
+            }
+            public int getNumberRequiredDataSources(){
+            	return 2;
+            }
+            
+            // because different databases return "varchar" in all caps "VARCHAR"
+            // the comparison is being done in a noncasesensitive manner
+            public boolean compareResultsCaseSensitive() {
+            	return false;
+            }
+             
+         	public void validateTestCase() throws Exception {
+
+                // now verify the results
+                AbstractQueryTest test = new QueryExecution(getSource("pm1"));
+                test.execute("select * from g1 where e1 >= 100 and e1 < 115");
+                test.assertRowCount(15);
+                test.execute("select * from g2 where e1 >= 100 and e1 < 115");
+                test.assertRowCount(15);
+                test.execute("select distinct e2 from g1 where e1 > 100");
+                
+ //               assertResultsSetEquals(this.internalResultSet., new String[] {"e2[varchar]", "blah"});
+                
+                test.assertResultsSetEquals(new String[] {"e2[varchar]", "blah"});
+                test.closeConnection();  
+         	}
+ 
+        };     
+        
+        
+        // run test
+        getTransactionContainter().runTransaction(userTxn);      
+        
+        System.out.println("Complete testMultipleSourceMultipleCommands");
+
+
+    }
+    
+    /**
+     * Sources = 2
+     * Commands = multiple - Success
+     * Batching = Full Processing, Single Connector Batch
+     * result = commit
+     */
+    public void testMultipleSourceViewMultipleCommands() throws Exception {
+        AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest("testMultipleSourceViewMultipleCommands") {
+            public void testCase() throws Exception {
+
+                for (int i = 200; i < 207; i++) {
+                    Integer val = new Integer(i);
+                    execute("insert into vm.g1 (pm1e1, pm1e2, pm2e1, pm2e2) values(?,?,?,?)", new Object[] {val, val.toString(), val, val.toString()});
+                    execute("insert into vm.g2 (pm1e1, pm1e2, pm2e1, pm2e2) values(?,?,?,?)", new Object[] {val, val.toString(), val, val.toString()});                    
+                }
+                
+                execute("update vm.g1 set pm1e2='blah' where pm1e1 >= 200");
+                
+                execute("delete from vm.g2 where vm.g2.pm1e1 >= 205");
+                execute("delete from vm.g1 where vm.g1.pm1e1 >= 205");
+                
+                execute("select * from vm.g1 where pm1e1 >= 200 and pm1e1 < 207");
+                assertRowCount(5);
+            }
+            public int getNumberRequiredDataSources(){
+            	return 2;
+            }
+            
+         	public void validateTestCase() throws Exception {
+                // now verify the results
+                AbstractQueryTest test = new QueryExecution(getSource("pm1"));
+                test.execute("select * from g1 where e1 >= 200 and e1 < 207");
+                test.assertRowCount(5);
+                test.execute("select * from g2 where e1 >= 200 and e1 < 207");
+                test.assertRowCount(5);
+                test.execute("select distinct e2 from g1 where e1 >= 200 and e1 < 207");
+                test.assertResultsSetEquals(new String[] {"e2[varchar]", "blah"});
+                test.closeConnection();  
+                
+         	}
+ 
+        };     
+
+        
+        // run test
+        getTransactionContainter().runTransaction(userTxn);      
+
+        System.out.println("Complete testMultipleSourceViewMultipleCommands");
+
+
+    }   
+    
+    /**
+     * Sources = 2
+     * Commands = multiple - Success
+     * Batching = Full Processing, Single Connector Batch
+     * result = commit
+     */
+    public void testMultipleSourceViewMultipleCommandsRollback() throws Exception {
+        AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest("testMultipleSourceViewMultipleCommandsRollback") {
+            public void testCase() throws Exception {
+
+                for (int i = 600; i < 615; i++) {
+                    Integer val = new Integer(i);
+                    execute("insert into vm.g1 (pm1e1, pm1e2, pm2e1, pm2e2) values(?,?,?,?)", new Object[] {val, val.toString(), val, val.toString()});
+                    execute("insert into vm.g2 (pm1e1, pm1e2, pm2e1, pm2e2) values(?,?,?,?)", new Object[] {val, val.toString(), val, val.toString()});                    
+                }
+                
+                execute("select * from vm.g1 where pm1e1 >= 600 and pm1e1 < 615");
+                assertRowCount(15);
+
+                
+                execute("update vm.g1 set pm1e2='blah' where pm1e1 >= 605");
+                
+                execute("delete from vm.g2 where vm.g2.pm1e1 >= 610");
+                execute("delete from vm.g1 where vm.g1.pm1e1 >= 610");
+                
+                execute("select * from vm.g1 where pm1e1 >= 600 and pm1e1 < 615");
+                assertRowCount(10);
+                
+                // force the rollback by trying to insert an invalid row.
+                execute("insert into pm1.g2 (e1, e2) values(?,?)", new Object[] {new Integer(9999), "9999"});                                
+            }
+            
+            public boolean exceptionExpected() {
+                return true;
+            }
+            
+            public int getNumberRequiredDataSources(){
+            	return 2;
+            }
+ 
+            
+         	public void validateTestCase() throws Exception {
+                // now verify the results
+                AbstractQueryTest test = new QueryExecution(getSource("pm1"));
+                test.execute("select * from g1 where e1 >= 600 and e1 < 615");
+                test.assertRowCount(0);
+                test.execute("select * from g2 where e1 >= 600 and e1 < 615");
+                test.assertRowCount(0);
+                test.execute("select distinct e2 from g1 where e1 >= 600 and e1 < 615");
+                test.assertRowCount(0);
+                test.closeConnection();   
+         	}
+ 
+        };        
+        
+        // run test
+        getTransactionContainter().runTransaction(userTxn);      
+
+        
+        System.out.println("Complete testMultipleSourceViewMultipleCommandsRollback");
+
+    }    
+
+        
+    /**
+     * Sources = 2
+     * Commands = multiple - Success
+     * Batching = Full Processing, Single Connector Batch
+     * result = rollback
+     */    
+    public void testMultipleSourceMultipleCommandsCancel() throws Exception {
+        AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest("testMultipleSourceMultipleCommandsCancel") {
+            
+            public void testCase() throws Exception {
+                Thread t = new Thread("Cancel Thread") {
+                    public void run() {
+                        try {
+                            try {
+                                Thread.sleep(500);
+                                cancelQuery();
+                            } catch (SQLException e) {
+                            	print(e);
+                            //    debug(e.getMessage());
+                            }
+                        } catch (InterruptedException e) {}
+                    }
+                };
+                t.start();
+                executeBatch(getMultipleSourceBatch());
+            }
+           
+            /** 
+             * @see com.metamatrix.transaction.test.framework.AbstractQueryTest#exceptionExpected()
+             */
+            public boolean exceptionExpected() {
+                return true;
+            }
+            
+            public int getNumberRequiredDataSources(){
+            	return 2;
+            }
+ 
+            
+         	public void validateTestCase() throws Exception {
+                // now verify the results (this may finish under one second, then this test is not valid)
+                AbstractQueryTest test = new QueryExecution(getSource("pm1"));
+                test.execute("select * from g1 where e1 >= 600 and e1 < 650");
+                test.assertRowCount(0);
+                test.execute("select * from g2 where e1 >= 600 and e1 < 650");
+                test.assertRowCount(0);
+                test.execute("select distinct e2 from g1 where e1 >= 600 and e1 < 650");
+                test.assertRowCount(0);
+                test.closeConnection(); 
+                
+          	}
+ 
+        };
+        getTransactionContainter().runTransaction(userTxn);
+                
+        System.out.println("Complete testMultipleSourceMultipleCommandsCancel");
+
+    }
+    
+    
+    /**
+     * Sources = 2
+     * Commands = multiple - Success
+     * Batching = Full Processing, Single Connector Batch
+     * result = rollback
+     */
+    public void testMultipleSourceMultipleCommandsExplicitRollback() throws Exception {
+        AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest("testMultipleSourceMultipleCommandsExplicitRollback") {
+            public void testCase() throws Exception {
+
+                for (int i = 700; i < 720; i++) {
+                    Integer val = new Integer(i);
+                    execute("insert into pm1.g1 (e1, e2) values(?,?)", new Object[] {val, val.toString()});
+                    execute("insert into pm1.g2 (e1, e2) values(?,?)", new Object[] {val, val.toString()});
+                    
+                    execute("insert into pm2.g1 (e1, e2) values(?,?)", new Object[] {val, val.toString()});
+                    execute("insert into pm2.g2 (e1, e2) values(?,?)", new Object[] {val, val.toString()});                    
+                }                
+            }
+            
+            // force the rollback
+            public boolean rollbackAllways() {
+                return true;
+            }
+            
+            public boolean exceptionExpected() {
+                return true;
+            }
+            
+            public int getNumberRequiredDataSources(){
+            	return 2;
+            }
+ 
+            
+         	public void validateTestCase() throws Exception {
+                // now verify the results
+                AbstractQueryTest test = new QueryExecution(getSource("pm1"));
+                test.execute("select * from g1 where e1 >= 700 and e1 < 720");
+                test.assertRowCount(0);        
+                test.closeConnection();
+                
+                test = new QueryExecution(getSource("pm2"));
+                test.execute("select * from g1 where e1 >= 700 and e1 < 720");
+                test.assertRowCount(0);        
+                test.closeConnection();    
+                
+         	}
+ 
+            
+        };        
+        
+        // run test
+        getTransactionContainter().runTransaction(userTxn);      
+
+        System.out.println("Complete testMultipleSourceMultipleCommandsExplicitRollback");
+
+    }
+    
+    /**
+     * Sources = 2
+     * Commands = multiple - Success
+     * Batching = Full Processing, Single Connector Batch
+     * result = rollback
+     */
+    public void testMultipleSourceMultipleCommandsReferentialIntegrityRollback() throws Exception {
+        AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest("testMultipleSourceMultipleCommandsReferentialIntegrityRollback") {
+            public void testCase() throws Exception {
+
+                for (int i = 700; i < 720; i++) {
+                    Integer val = new Integer(i);
+                    execute("insert into pm1.g1 (e1, e2) values(?,?)", new Object[] {val, val.toString()});
+                    execute("insert into pm1.g2 (e1, e2) values(?,?)", new Object[] {val, val.toString()});
+                    
+                    execute("insert into pm2.g1 (e1, e2) values(?,?)", new Object[] {val, val.toString()});
+                    execute("insert into pm2.g2 (e1, e2) values(?,?)", new Object[] {val, val.toString()});                    
+                }
+                
+                // force the rollback by trying to insert an invalid row.
+                execute("insert into pm1.g2 (e1, e2) values(?,?)", new Object[] {new Integer(9999), "9999"});
+            }
+            
+            public boolean exceptionExpected() {
+                return true;
+            }
+            
+            public int getNumberRequiredDataSources(){
+            	return 2;
+            }
+ 
+            
+         	public void validateTestCase() throws Exception {
+                // now verify the results
+                AbstractQueryTest test = new QueryExecution(getSource("pm1"));
+                test.execute("select * from g1 where e1 >= 700 and e1 < 720");
+                test.assertRowCount(0);
+                test.closeConnection();        
+                
+                test = new QueryExecution(getSource("pm2"));
+                test.execute("select * from g1 where e1 >= 700 and e1 < 720");
+                test.assertRowCount(0);        
+                test.closeConnection();   
+         	}
+ 
+        };        
+        
+        // run test
+        getTransactionContainter().runTransaction(userTxn);      
+
+         
+        System.out.println("Complete testMultipleSourceMultipleCommandsReferentialIntegrityRollback");
+
+    }
+
+
+
+    /**
+     * Sources = 2
+     * Commands = multiple - Success
+     * Batching = Full Processing, Single Connector Batch
+     * result = rollback
+     */    
+    public void testMultipleSourceTimeout() throws Exception{
+        AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest("testMultipleSourceTimeout") {
+            public void testCase() throws Exception {
+                executeBatch(getMultipleSourceBatch(), 1); // time out after 1 sec
+            }
+            
+            public boolean exceptionExpected() {
+                return true;
+            }            
+            
+            public void after() {
+                if (!exceptionOccurred()) {
+                    fail("should have failed with time out exception");
+                }
+                else {
+                    assertTrue(getLastException().getMessage().indexOf("Operation timed out before completion") != -1);
+                }
+            } 
+            
+            public int getNumberRequiredDataSources(){
+            	return 2;
+            }
+ 
+            
+         	public void validateTestCase() throws Exception {
+                // now verify the results (this may finish under one second, then this test is not valid)
+                AbstractQueryTest test = new QueryExecution(getSource("pm1"));
+                test.execute("select * from g1 where e1 >= 600 and e1 < 750");
+                test.assertRowCount(0);
+                test.execute("select * from g2 where e1 >= 600 and e1 < 750");
+                test.assertRowCount(0);
+                test.execute("select distinct e2 from g1 where e1 >= 600 and e1 < 750");
+                test.assertRowCount(0);
+                test.closeConnection();   
+         	}
+ 
+        };
+        getTransactionContainter().runTransaction(userTxn);
+        
+        
+        System.out.println("Complete testMultipleSourceTimeout");
+
+    }    
+    
+        
+    static String[] getMultipleSourceBatch() {
+        ArrayList<String> list = new ArrayList<String>();
+        
+        for (int i = 600; i < 750; i++) {
+            list.add("insert into pm1.g1 (e1, e2) values("+i+",'"+i+"')");
+            list.add("insert into pm1.g2 (e1, e2) values ("+i+",'"+i+"')");
+            list.add("insert into pm2.g1 (e1, e2) values("+i+",'"+i+"')");
+            list.add("insert into pm2.g2 (e1, e2) values ("+i+",'"+i+"')");                                
+        }
+        
+        list.add("update pm1.g1 set e2='blah' where pm1.g1.e1 >= 600");
+        list.add("update pm2.g1 set e2='blah' where pm2.g1.e1 >= 600");
+        
+        list.add("delete from pm1.g2 where pm1.g2.e1 >= 610");
+        list.add("delete from pm1.g1 where pm1.g1.e1 >= 610");
+        list.add("delete from pm2.g2 where pm2.g2.e1 >= 610");
+        list.add("delete from pm2.g1 where pm2.g1.e1 >= 610");
+        
+        return(String[])list.toArray(new String[list.size()]);
+    }
+    
+    
+    /**
+     * Sources = 2
+     * Commands = 1, Select
+     * Batching = Partial Processing, Single Connector Batch
+     * result = commit 
+     * Note: This is producing the below error some times; however this is SQL Server issue.
+     * http://support.microsoft.com/?kbid=834849
+     */
+    public void testMultipleSourceViewPartialProcessingUsingLimit() throws Exception {
+        AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest("testMultipleSourceViewPartialProcessingUsingLimit") {
+            public void testCase() throws Exception {
+                execute("select * from vm.g1 where pm1e1 < 100 limit 10");
+                assertRowCount(10);
+            }
+            
+            public int getNumberRequiredDataSources(){
+            	return 2;
+            }
+ 
+            
+         	public void validateTestCase() throws Exception {
+          	}
+ 
+        };        
+        
+        // run test
+        getTransactionContainter().runTransaction(userTxn);      
+        
+        System.out.println("Complete testMultipleSourceViewPartialProcessingUsingLimit");
+
+    }  
+
+    /**
+     * Sources = 2
+     * Commands = 1, Select
+     * Batching = Partial Processing, Single Connector Batch
+     * result = commit
+     * Note: This is producing the below error some times; however this is SQL Server issue.
+     * http://support.microsoft.com/?kbid=834849
+     */
+    public void testMultipleSourcePartialProcessingUsingMakedep() throws Exception {
+        AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest("testMultipleSourcePartialProcessingUsingMakedep") {
+            public void testCase() throws Exception {
+                execute("select pm1.g1.e1, pm1.g1.e2 from pm1.g1 LEFT OUTER JOIN pm2.g1 MAKENOTDEP ON pm1.g1.e2 = pm2.g1.e2 where pm2.g1.e1 >= 50 and pm2.g1.e1 < 100");
+                assertRowCount(50);
+            }
+            
+            public int getNumberRequiredDataSources(){
+            	return 2;
+            }
+ 
+            
+         	public void validateTestCase() throws Exception {
+          	}
+ 
+        };        
+        
+        // run test
+        getTransactionContainter().runTransaction(userTxn);  
+        
+        System.out.println("Complete testMultipleSourcePartialProcessingUsingMakedep");
+
+    }        
+    
+     
+     
+
+    
+    
+
+}


Property changes on: trunk/test-integration/db/src/test/java/org/teiid/test/testcases/TwoSourceTransactionScenarios.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: trunk/test-integration/db/src/test/java/org/teiid/test/testcases/XATransactionDriverFalseOffTest.java
===================================================================
--- trunk/test-integration/db/src/test/java/org/teiid/test/testcases/XATransactionDriverFalseOffTest.java	                        (rev 0)
+++ trunk/test-integration/db/src/test/java/org/teiid/test/testcases/XATransactionDriverFalseOffTest.java	2009-09-20 16:31:17 UTC (rev 1426)
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2000-2007 MetaMatrix, Inc.
+ * All rights reserved.
+ */
+package org.teiid.test.testcases;
+
+import org.teiid.test.framework.ConfigPropertyNames;
+import org.teiid.test.framework.connection.ConnectionStrategy;
+
+
+/** 
+ * Local Transaction Test
+ * 
+ * Settings:
+ * 
+ * -	Transaction Type = local
+ * -	Using Driver
+ * -	Autocommit = True
+ * -	TxnAutoWrap = Off
+ */
+public class XATransactionDriverFalseOffTest extends TwoSourceTransactionScenarios {
+          
+    public XATransactionDriverFalseOffTest(String name) {
+		super(name);
+	}
+
+	@Override
+	protected void setUp() throws Exception {
+    	System.setProperty(ConfigPropertyNames.CONFIG_FILE, "xa-conig.properties");
+		
+    	System.setProperty(ConfigPropertyNames.CONNECTION_TYPE, ConfigPropertyNames.CONNECTION_TYPES.DATASOURCE_CONNECTION);
+    	System.setProperty(ConnectionStrategy.AUTOCOMMIT, "true");
+    	System.setProperty(ConnectionStrategy.TXN_AUTO_WRAP, "off");
+ //   	System.setProperty(ConnectionStrategy.FETCH_SIZE, "true");
+    	
+		
+	}
+
+
+     
+}


Property changes on: trunk/test-integration/db/src/test/java/org/teiid/test/testcases/XATransactionDriverFalseOffTest.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain



More information about the teiid-commits mailing list