use of org.teiid.test.framework.query.AbstractQueryTransactionTest in project teiid by teiid.
the class CommonTransactionTests method testMultipleSourceMultipleVirtualCommands.
/**
* Sources = 2
* Commands = multiple - Success
* Batching = Full Processing, Single Connector Batch
* result = commit
*/
@Test
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);
}
};
// 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 >= 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[varchar2]", "blah" });
}
use of org.teiid.test.framework.query.AbstractQueryTransactionTest in project teiid by teiid.
the class CommonTransactionTests method 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
*/
@Test
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);
}
};
// run test
getTransactionContainter().runTransaction(userTxn);
}
use of org.teiid.test.framework.query.AbstractQueryTransactionTest in project teiid by teiid.
the class CommonTransactionTests method testMultipleSourceSelectInto.
/**
* Sources = 2
* Commands = 1, Update
* Batching = Full Processing, Single Connector Batch
* result = commit
*/
@Test
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");
}
};
// run test
getTransactionContainter().runTransaction(userTxn);
// now verify the results
AbstractQueryTest test = new QueryExecution(userTxn.getSource("pm1"));
test.execute("select * from g1 where e2 = '501'");
test.assertRowCount(1);
test = new QueryExecution(userTxn.getSource("pm2"));
test.execute("select * from g1 where e2 = '501'");
test.assertRowCount(1);
}
use of org.teiid.test.framework.query.AbstractQueryTransactionTest in project teiid by teiid.
the class LocalTransactionTests method testMultipleSourceMultipleCommandsReferentialIntegrityRollback.
/**
* Sources = 2
* Commands = multiple - Success
* Batching = Full Processing, Single Connector Batch
* result = rollback
*/
@Test
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;
}
};
// run test
getTransactionContainter().runTransaction(userTxn);
// now verify the results
AbstractQueryTest test = new QueryExecution(userTxn.getSource("pm1"));
test.execute("select * from g1 where e1 >= 700 and e1 < 720");
test.assertRowCount(0);
test = new QueryExecution(userTxn.getSource("pm2"));
test.execute("select * from g1 where e1 >= 700 and e1 < 720");
test.assertRowCount(0);
}
use of org.teiid.test.framework.query.AbstractQueryTransactionTest in project teiid by teiid.
the class AutoWrapTransactionTests method testMultipleSourceBulkRowInsertRollback.
/**
* Sources = 2
* Commands = 1, Update
* Batching = Full Processing, Single Connector Batch
* result = commit
*/
@Test
public void testMultipleSourceBulkRowInsertRollback() throws Exception {
AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest("testMultipleSourceBulkRowInsertRollback") {
ArrayList list = new ArrayList();
public void testCase() throws Exception {
for (int i = 100; i < 120; i++) {
list.add("insert into vm.g1 (pm1e1, pm1e2, pm2e1, pm2e2) values(" + i + ",'" + i + "'," + i + ",'" + i + "')");
}
list.add("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.
list.add("insert into pm1.g2 (e1, e2) values(9999,'9999')");
executeBatch((String[]) list.toArray(new String[list.size()]));
}
public boolean exceptionExpected() {
return true;
}
};
// run test
getTransactionContainter().runTransaction(userTxn);
// now verify the results
AbstractQueryTest test = new QueryExecution(userTxn.getSource("pm1"));
test.execute("select * from g1 where e1 >= 100 and e1 < 120");
test.assertRowCount(0);
test = new QueryExecution(userTxn.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);
}
Aggregations