use of org.jboss.narayana.blacktie.jatmibroker.xatmi.Session in project narayana by jbosstm.
the class TestRollbackOnly method test_tprecv_TPEV_DISCONIMM.
public void test_tprecv_TPEV_DISCONIMM() throws ConnectionException {
log.info("test_tprecv_TPEV_DISCONIMM");
server.tpadvertiseTestRollbackOnlyTprecvTPEVDISCONIMMService();
assertTrue(TX.tx_open() == TX.TX_OK);
assertTrue(TX.tx_begin() == TX.TX_OK);
Session cd = connection.tpconnect(RunServer.getServiceNameTestRollbackOnly2(), sendbuf, Connection.TPSENDONLY);
cd.tpdiscon();
TXINFO txinfo = new TXINFO();
int inTx = TX.tx_info(txinfo);
log.info("inTx=" + inTx);
assertTrue(txinfo.transaction_state == TX.TX_ROLLBACK_ONLY);
assertTrue(TX.tx_commit() == TX.TX_ROLLBACK);
}
use of org.jboss.narayana.blacktie.jatmibroker.xatmi.Session in project narayana by jbosstm.
the class TestRollbackOnly method test_tprecv_TPEV_SVCFAIL.
public void test_tprecv_TPEV_SVCFAIL() throws ConnectionException, ConfigurationException {
log.info("test_tprecv_TPEV_SVCFAIL");
server.tpadvertiseTestRollbackOnlyTprecvTPEVSVCFAILService();
assertTrue(TX.tx_open() == TX.TX_OK);
assertTrue(TX.tx_begin() == TX.TX_OK);
Session cd = connection.tpconnect(RunServer.getServiceNameTestRollbackOnly2(), sendbuf, Connection.TPRECVONLY);
try {
cd.tprecv(0);
fail("Expected e.getEvent() == Connection.TPEV_SVCFAIL");
} catch (ResponseException e) {
assertTrue(e.getEvent() == Connection.TPEV_SVCFAIL);
assertTrue(e.getTperrno() == Connection.TPEEVENT);
Buffer rcvbuf = e.getReceived();
assertTrue(TestTPConversation.strcmp(rcvbuf, "test_tprecv_TPEV_SVCFAIL_service") == 0);
} catch (ConnectionException e) {
fail("Expected e.getEvent() == Connection.TPEV_SVCFAIL");
}
TXINFO txinfo = new TXINFO();
int inTx = TX.tx_info(txinfo);
log.info("inTx=" + inTx);
assertTrue(txinfo.transaction_state == TX.TX_ROLLBACK_ONLY);
assertTrue(TX.tx_commit() == TX.TX_ROLLBACK);
}
Aggregations