use of org.teiid.test.framework.query.AbstractQueryTransactionTest in project teiid by teiid.
the class OnWrapTransactionTests method testSingleSourceBatchCommandReferentialIntegrityRollback.
/**
* Sources = 1 Commands = multiple Success Batching = Full Processing,
* Single Connector Batch result = rollback
*/
@Test
public void testSingleSourceBatchCommandReferentialIntegrityRollback() throws Exception {
AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest("testSingleSourceBatchCommandReferentialIntegrityRollback") {
public void testCase() throws Exception {
ArrayList list = new ArrayList();
for (int i = 200; i < 210; i++) {
list.add("insert into pm1.g1 (e1, e2) values(" + i + ",'" + i + "')");
}
// try to rollback, since we are in single batch it must
// rollback
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 >= 200 and e1 < 210");
test.assertRowCount(0);
test.execute("select * from g2 where e1 = 9999");
test.assertRowCount(0);
}
use of org.teiid.test.framework.query.AbstractQueryTransactionTest in project teiid by teiid.
the class AutoWrapTransactionTests method testSingleSourceMultipleCommandsReferentialIntegrityRollback.
/**
* Sources = 1
* Commands = multiple - Success
* Batching = Full Processing, Single Connector Batch
* result = rollback
*/
@Test
public void testSingleSourceMultipleCommandsReferentialIntegrityRollback() throws Exception {
AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest("testSingleSourceMultipleCommandsReferentialIntegrityRollback") {
public void testCase() throws Exception {
for (int i = 200; i < 210; 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() });
}
// try to rollback, however since this pessimistic above two are already commited
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 >= 200 and e1 < 210");
test.assertRowCount(10);
test.execute("select * from g2 where e1 = 9999");
test.assertRowCount(0);
}
use of org.teiid.test.framework.query.AbstractQueryTransactionTest in project teiid by teiid.
the class AutoWrapTransactionTests method testSingleSourceBatchCommandReferentialIntegrityRollback.
/**
* Sources = 1
* Commands = multiple - Success
* Batching = Full Processing, Single Connector Batch
* result = rollback
*/
@Test
public void testSingleSourceBatchCommandReferentialIntegrityRollback() throws Exception {
AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest("testSingleSourceBatchCommandReferentialIntegrityRollback") {
public void testCase() throws Exception {
ArrayList list = new ArrayList();
for (int i = 200; i < 210; i++) {
list.add("insert into pm1.g1 (e1, e2) values(" + i + ",'" + i + "')");
}
// try to rollback, since we are in single batch it must rollback
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 >= 200 and e1 < 210");
test.assertRowCount(0);
test.execute("select * from g2 where e1 = 9999");
test.assertRowCount(0);
}
use of org.teiid.test.framework.query.AbstractQueryTransactionTest in project teiid by teiid.
the class CommonTransactionTests method testMultipleSourcePartialProcessingUsingMakedep.
/**
* 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 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);
}
};
// run test
getTransactionContainter().runTransaction(userTxn);
}
use of org.teiid.test.framework.query.AbstractQueryTransactionTest in project teiid by teiid.
the class CommonTransactionTests method testSingleSourcePartialProcessing.
/**
* Sources = 1
* Commands = 1, Select
* Batching = Partial Processing, Single Connector Batch
* result = commit
*/
@Test
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);
}
};
// run test
getTransactionContainter().runTransaction(userTxn);
}
Aggregations