use of javax.transaction.xa.Xid in project spanner-jdbc by olavloite.
the class CloudSpannerXAConnectionTest method testPrepare.
@Test
public void testPrepare() throws SQLException, XAException {
CloudSpannerXAConnection subject = createSubject();
Xid xid = createXid();
subject.start(xid, XAResource.TMNOFLAGS);
subject.end(xid, XAResource.TMSUCCESS);
subject.prepare(xid);
}
use of javax.transaction.xa.Xid in project spanner-jdbc by olavloite.
the class CloudSpannerXAConnectionTest method testSuspend.
@Test
public void testSuspend() throws SQLException, XAException {
thrown.expect(CloudSpannerXAException.class);
thrown.expectMessage(CloudSpannerXAException.SUSPEND_NOT_IMPLEMENTED);
CloudSpannerXAConnection subject = createSubject();
Xid xid = getRandomXid();
subject.start(xid, XAResource.TMNOFLAGS);
subject.end(xid, XAResource.TMSUSPEND);
}
use of javax.transaction.xa.Xid in project spanner-jdbc by olavloite.
the class CloudSpannerXAConnectionTest method testStart.
@Test
public void testStart() throws SQLException, XAException {
CloudSpannerXAConnection subject = createSubject();
ICloudSpannerConnection connection = subject.getConnection();
assertTrue(connection.getAutoCommit());
Xid xid = createXid();
subject.start(xid, XAResource.TMNOFLAGS);
assertNotNull(connection);
assertFalse(connection.getAutoCommit());
thrown.expect(CloudSpannerSQLException.class);
connection.commit();
}
use of javax.transaction.xa.Xid in project spanner-jdbc by olavloite.
the class CloudSpannerXAConnectionTest method testJoin.
@Test
public void testJoin() throws SQLException, XAException {
CloudSpannerXAConnection subject = createSubject();
Xid xid = getRandomXid();
subject.start(xid, XAResource.TMNOFLAGS);
subject.end(xid, XAResource.TMSUCCESS);
subject.start(xid, XAResource.TMJOIN);
}
use of javax.transaction.xa.Xid in project spanner-jdbc by olavloite.
the class RecoveredXidTest method testHashCodeAndEquals.
@Test
public void testHashCodeAndEquals() {
Xid xid1 = RecoveredXid.stringToXid("9999_Z3RyaWQ=_YnF1YWw=");
Xid xid2 = RecoveredXid.stringToXid("9999_Z3RyaWQ=_YnF1YWw=");
Xid xid3 = RecoveredXid.stringToXid("1234_Z3RyaWQ=_YnF1YWw=");
assertEquals(xid1.hashCode(), xid2.hashCode());
assertEquals(xid1, xid2);
assertNotEquals(xid1.hashCode(), xid3.hashCode());
assertNotEquals(xid1, xid3);
xid1 = RecoveredXid.stringToXid("9999_AbCdEfG=_YnF1YWw=");
xid2 = RecoveredXid.stringToXid("9999_AbCdEfG=_YnF1YWw=");
xid3 = RecoveredXid.stringToXid("1234_abcdefg=_YnF1YWw=");
assertEquals(xid1.hashCode(), xid2.hashCode());
assertEquals(xid1, xid2);
assertNotEquals(xid1.hashCode(), xid3.hashCode());
assertNotEquals(xid1, xid3);
}
Aggregations