use of javax.transaction.xa.Xid in project spanner-jdbc by olavloite.
the class XATester method deleteTestRow.
private void deleteTestRow(CloudSpannerXAConnection xaConnection) throws XAException, SQLException {
Xid xid = prepareDeleteRow(xaConnection);
xaConnection.commit(xid, false);
}
use of javax.transaction.xa.Xid in project spanner-jdbc by olavloite.
the class XATester method testXARollback.
private void testXARollback(CloudSpannerXAConnection xaConnection) throws SQLException, XAException {
log.info("Starting XA rollback transaction test");
Xid xid = prepareDeleteRow(xaConnection);
xaConnection.rollback(xid);
boolean found = false;
try (ResultSet rs = xaConnection.getConnection().createStatement().executeQuery("select * from test where id=1000000")) {
if (rs.next())
found = true;
}
Assert.assertTrue(found);
log.info("Finished XA rollback transaction test");
}
use of javax.transaction.xa.Xid in project spanner-jdbc by olavloite.
the class CloudSpannerXAConnectionTest method testPrepareWithOtherXid.
@Test
public void testPrepareWithOtherXid() throws SQLException, XAException {
thrown.expect(CloudSpannerXAException.class);
thrown.expectMessage(CloudSpannerXAException.PREPARE_WITH_SAME);
CloudSpannerXAConnection subject = createSubject();
Xid xid = getRandomXid();
subject.start(xid, XAResource.TMNOFLAGS);
subject.end(xid, XAResource.TMSUCCESS);
subject.prepare(getRandomXid());
}
use of javax.transaction.xa.Xid in project spanner-jdbc by olavloite.
the class CloudSpannerXAConnectionTest method testEnd.
@Test
public void testEnd() throws SQLException, XAException {
CloudSpannerXAConnection subject = createSubject();
Xid xid = createXid();
subject.start(xid, XAResource.TMNOFLAGS);
subject.end(xid, XAResource.TMSUCCESS);
}
use of javax.transaction.xa.Xid in project spanner-jdbc by olavloite.
the class CloudSpannerXAConnectionTest method testCommitOnePhase.
@Test
public void testCommitOnePhase() throws SQLException, XAException {
CloudSpannerXAConnection subject = createSubject();
Xid xid = createXid();
subject.start(xid, XAResource.TMNOFLAGS);
subject.end(xid, XAResource.TMSUCCESS);
subject.commit(xid, true);
}
Aggregations