* Batching = Full Processing, Single Connector Batch
* result = commit
*/
@Test
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");
}
};
// run test
getTransactionContainter().runTransaction(userTxn);
// now verify the results
AbstractQueryTest test = new QueryExecution(userTxn.getSource("pm1")) {
protected boolean compareCaseSensitive() {
return false;
}
};
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");
// NOTE: if this is an oracle source, it failes because it return varchar2
if (userTxn.getSource("pm1").getMetaData().getDatabaseProductName().toLowerCase().indexOf("oracle") > -1) {
test.assertResultsSetEquals(new String[] {"e2[varchar2]", "blah"});
} else {
test.assertResultsSetEquals(new String[] {"e2[varchar]", "blah"});
}