use of org.teiid.test.framework.exception.TransactionRuntimeException in project teiid by teiid.
the class LocalTransaction method before.
protected void before(TransactionQueryTestCase test) {
test.getConnectionStrategy().setEnvironmentProperty(CONNECTION_STRATEGY_PROPS.TXN_AUTO_WRAP, TXN_AUTO_WRAP_OPTIONS.AUTO_WRAP_OFF);
try {
debug("Autocommit: " + test.getConnectionStrategy().getAutocommit());
test.getConnection().setAutoCommit(test.getConnectionStrategy().getAutocommit());
} catch (SQLException e) {
throw new TransactionRuntimeException(e);
}
}
use of org.teiid.test.framework.exception.TransactionRuntimeException in project teiid by teiid.
the class StandaloneGlobalTransaction method before.
@Override
protected void before(TransactionQueryTestCase test) {
try {
xid = createXid();
XAResource xaResource = test.getConnectionStrategy().getXAConnection().getXAResource();
xaResource.setTransactionTimeout(120);
xaResource.start(xid, XAResource.TMNOFLAGS);
} catch (Exception e) {
throw new TransactionRuntimeException(e);
}
}
use of org.teiid.test.framework.exception.TransactionRuntimeException in project teiid by teiid.
the class StandaloneGlobalTransaction method after.
@Override
protected void after(TransactionQueryTestCase test) {
boolean delistSuccessful = false;
boolean commit = false;
try {
XAResource xaResource = test.getConnectionStrategy().getXAConnection().getXAResource();
xaResource.end(xid, XAResource.TMSUCCESS);
if (!test.exceptionExpected() && xaResource.prepare(xid) == XAResource.XA_OK) {
commit = true;
}
delistSuccessful = true;
} catch (Exception e) {
throw new TransactionRuntimeException(e);
} finally {
try {
if (!delistSuccessful || test.rollbackAllways() || test.exceptionOccurred()) {
test.getConnectionStrategy().getXAConnection().getXAResource().rollback(xid);
} else if (commit) {
test.getConnectionStrategy().getXAConnection().getXAResource().commit(xid, true);
}
} catch (Exception e) {
throw new TransactionRuntimeException(e);
}
}
}
use of org.teiid.test.framework.exception.TransactionRuntimeException in project teiid by teiid.
the class XATransaction method after.
protected void after(TransactionQueryTestCase test) {
boolean delistSuccessful = false;
boolean commit = false;
XAResource xaResource = null;
boolean exception = false;
try {
xaResource = test.getConnectionStrategy().getXAConnection().getXAResource();
xaResource.end(xid, XAResource.TMSUCCESS);
if (!test.exceptionExpected() && xaResource.prepare(xid) == XAResource.XA_OK) {
commit = true;
}
delistSuccessful = true;
} catch (Exception e) {
exception = true;
throw new TransactionRuntimeException(e);
} finally {
try {
if (!delistSuccessful || test.rollbackAllways() || test.exceptionOccurred()) {
xaResource.rollback(xid);
} else if (commit) {
xaResource.commit(xid, true);
}
} catch (Exception e) {
if (!exception) {
throw new TransactionRuntimeException(e);
}
}
}
}
use of org.teiid.test.framework.exception.TransactionRuntimeException in project teiid by teiid.
the class QueryScenario method setUp.
protected void setUp() {
Collection args = new ArrayList(1);
args.add(scenarioName);
args.add(props);
reader = ClassFactory.createQueryReader(args);
args = new ArrayList(2);
args.add(this.scenarioName);
args.add(this.props);
resultsGen = ClassFactory.createResultsGenerator(args);
if (reader.getQuerySetIDs() == null || reader.getQuerySetIDs().isEmpty()) {
throw new TransactionRuntimeException("The queryreader did not return any queryset ID's to process");
}
validateResultsMode(this.props);
// TODO: deployprops.loc not needed in remote testing
// try {
// setupVDBs(this.getProperties());
// } catch (IOException e) {
// throw new TransactionRuntimeException(e.getMessage());
// }
}
Aggregations