Search in sources :

Example 1 with Session

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);
}
Also used : Session(org.jboss.narayana.blacktie.jatmibroker.xatmi.Session)

Example 2 with Session

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);
}
Also used : Buffer(org.jboss.narayana.blacktie.jatmibroker.xatmi.Buffer) ResponseException(org.jboss.narayana.blacktie.jatmibroker.xatmi.ResponseException) ConnectionException(org.jboss.narayana.blacktie.jatmibroker.xatmi.ConnectionException) Session(org.jboss.narayana.blacktie.jatmibroker.xatmi.Session)

Aggregations

Session (org.jboss.narayana.blacktie.jatmibroker.xatmi.Session)2 Buffer (org.jboss.narayana.blacktie.jatmibroker.xatmi.Buffer)1 ConnectionException (org.jboss.narayana.blacktie.jatmibroker.xatmi.ConnectionException)1 ResponseException (org.jboss.narayana.blacktie.jatmibroker.xatmi.ResponseException)1