use of org.teiid.dqp.service.TransactionContext in project teiid by teiid.
the class TestTransactionServer method testGlobalPrepare.
@Test
public void testGlobalPrepare() throws Exception {
server.start(THREAD1, XID1, XAResource.TMNOFLAGS, 100, false);
TransactionContext tc = server.getOrCreateTransactionContext(THREAD1);
server.end(THREAD1, XID1, XAResource.TMSUCCESS, false);
server.prepare(THREAD1, XID1, false);
Mockito.verify(xaTerminator).prepare(tc.getXid());
server.commit(THREAD1, XID1, true, false);
}
use of org.teiid.dqp.service.TransactionContext in project teiid by teiid.
the class TestTransactionServer method testRequestCommit.
@Test
public void testRequestCommit() throws Exception {
TransactionContext tc = server.getOrCreateTransactionContext(THREAD1);
server.begin(tc);
server.commit(tc);
assertEquals(TransactionContext.Scope.NONE, tc.getTransactionType());
Mockito.verify(tm).commit();
}
use of org.teiid.dqp.service.TransactionContext in project teiid by teiid.
the class TestTransactionServer method testGlobalOnePhaseCommit_force_prepare.
@Test
public void testGlobalOnePhaseCommit_force_prepare() throws Exception {
server.start(THREAD1, XID1, XAResource.TMNOFLAGS, 100, false);
TransactionContext tc = server.getOrCreateTransactionContext(THREAD1);
server.end(THREAD1, XID1, XAResource.TMSUCCESS, false);
server.commit(THREAD1, XID1, true, false);
// since there are two sources the commit is not single phase
Mockito.verify(xaTerminator).prepare(tc.getXid());
Mockito.verify(xaTerminator).commit(tc.getXid(), false);
}
use of org.teiid.dqp.service.TransactionContext in project teiid by teiid.
the class TestTransactionServer method testGlobalOnePhaseCommit_force_prepare_through.
@Test
public void testGlobalOnePhaseCommit_force_prepare_through() throws Exception {
server.start(THREAD1, XID1, XAResource.TMNOFLAGS, 100, false);
TransactionContext tc = server.getOrCreateTransactionContext(THREAD1);
server.end(THREAD1, XID1, XAResource.TMSUCCESS, false);
server.commit(THREAD1, XID1, true, false);
Mockito.verify(xaTerminator).prepare(tc.getXid());
Mockito.verify(xaTerminator).commit(tc.getXid(), false);
}
use of org.teiid.dqp.service.TransactionContext in project teiid by teiid.
the class TestTransactionServer method testGlobalOnePhase_teiid_multiple.
@Test
public void testGlobalOnePhase_teiid_multiple() throws Exception {
server.start(THREAD1, XID1, XAResource.TMNOFLAGS, 100, false);
TransactionContext tc = server.getOrCreateTransactionContext(THREAD1);
server.end(THREAD1, XID1, XAResource.TMSUCCESS, false);
server.prepare(THREAD1, XID1, false);
server.commit(THREAD1, XID1, true, false);
// since there are two sources the commit is not single phase
Mockito.verify(xaTerminator).commit(tc.getXid(), false);
}
Aggregations