Author: vhalbert(a)redhat.com
Date: 2009-09-21 16:30:36 -0400 (Mon, 21 Sep 2009)
New Revision: 1434
Modified:
trunk/test-integration/db/src/main/java/org/teiid/test/framework/transaction/TransactionFactory.java
trunk/test-integration/db/src/main/java/org/teiid/test/framework/transaction/XATransaction.java
Log:
Teiid 773 - setting up the xa transaction tests
Modified:
trunk/test-integration/db/src/main/java/org/teiid/test/framework/transaction/TransactionFactory.java
===================================================================
---
trunk/test-integration/db/src/main/java/org/teiid/test/framework/transaction/TransactionFactory.java 2009-09-21
20:30:11 UTC (rev 1433)
+++
trunk/test-integration/db/src/main/java/org/teiid/test/framework/transaction/TransactionFactory.java 2009-09-21
20:30:36 UTC (rev 1434)
@@ -7,6 +7,7 @@
import org.teiid.test.framework.ConfigPropertyLoader;
import org.teiid.test.framework.ConfigPropertyNames;
import org.teiid.test.framework.TransactionContainer;
+import org.teiid.test.framework.exception.QueryTestFailedException;
import org.teiid.test.framework.exception.TransactionRuntimeException;
import org.teiid.test.framework.connection.ConnectionStrategy;
import org.teiid.test.framework.connection.ConnectionStrategyFactory;
@@ -20,7 +21,7 @@
private TransactionFactory(){}
- public static TransactionContainer create() {
+ public static TransactionContainer create() throws QueryTestFailedException {
TransactionContainer transacton = null;
// load the configuration properties defined at this time for the test
Modified:
trunk/test-integration/db/src/main/java/org/teiid/test/framework/transaction/XATransaction.java
===================================================================
---
trunk/test-integration/db/src/main/java/org/teiid/test/framework/transaction/XATransaction.java 2009-09-21
20:30:11 UTC (rev 1433)
+++
trunk/test-integration/db/src/main/java/org/teiid/test/framework/transaction/XATransaction.java 2009-09-21
20:30:36 UTC (rev 1434)
@@ -29,6 +29,8 @@
XAResource xaResource = getXAConnection().getXAResource();
xaResource.setTransactionTimeout(120);
xaResource.start(xid, XAResource.TMNOFLAGS);
+ debug("Start transaction using XID: " + xid.toString());
+
} catch (Exception e) {
throw new TransactionRuntimeException(e);
}
@@ -45,8 +47,11 @@
protected void after(TransactionQueryTest test) {
boolean delistSuccessful = false;
boolean commit = false;
+
+ XAResource xaResource = null;
+ boolean exception = false;
try {
- XAResource xaResource = getXAConnection().getXAResource();
+ xaResource = getXAConnection().getXAResource();
xaResource.end(xid, XAResource.TMSUCCESS);
@@ -55,17 +60,20 @@
}
delistSuccessful = true;
} catch (Exception e) {
+ exception = true;
throw new TransactionRuntimeException(e);
} finally {
try {
if (!delistSuccessful || test.rollbackAllways()||
test.exceptionOccurred()) {
- getXAConnection().getXAResource().rollback(xid);
+ xaResource.rollback(xid);
}
else if (commit) {
- getXAConnection().getXAResource().commit(xid, true);
+ xaResource.commit(xid, true);
}
} catch (Exception e) {
- throw new TransactionRuntimeException(e);
+ if (!exception) {
+ throw new TransactionRuntimeException(e);
+ }
}
}
}
Show replies by date