Search in sources :

Example 26 with X_OCTET

use of org.jboss.narayana.blacktie.jatmibroker.xatmi.X_OCTET in project narayana by jbosstm.

the class TPReturnTpurcodeService method tpservice.

public Response tpservice(TPSVCINFO svcinfo) throws ConnectionException, ConfigurationException {
    log.info("testtpreturn_service_tpurcode");
    X_OCTET toReturn = (X_OCTET) svcinfo.getConnection().tpalloc("X_OCTET", null);
    toReturn.setByteArray(new byte[] { 0 });
    if (TestTPConversation.strcmp(svcinfo.getBuffer(), "24") == 0) {
        return new Response(Connection.TPSUCCESS, 24, toReturn, 0);
    } else {
        return new Response(Connection.TPSUCCESS, 77, toReturn, 0);
    }
}
Also used : Response(org.jboss.narayana.blacktie.jatmibroker.xatmi.Response) X_OCTET(org.jboss.narayana.blacktie.jatmibroker.xatmi.X_OCTET)

Example 27 with X_OCTET

use of org.jboss.narayana.blacktie.jatmibroker.xatmi.X_OCTET in project narayana by jbosstm.

the class TPGetRplyTPNOBLOCKService method tpservice.

public Response tpservice(TPSVCINFO svcinfo) throws ConnectionException, ConfigurationException {
    String response = "test_tpgetrply_TPNOBLOCK";
    log.info(response);
    int sendlen = response.length() + 1;
    X_OCTET toReturn = (X_OCTET) svcinfo.getConnection().tpalloc("X_OCTET", null);
    toReturn.setByteArray(response.getBytes());
    try {
        Thread.sleep(5000);
    } catch (InterruptedException e) {
        log.error("Was interrupted");
    }
    return new Response(Connection.TPSUCCESS, 0, toReturn, 0);
}
Also used : Response(org.jboss.narayana.blacktie.jatmibroker.xatmi.Response) X_OCTET(org.jboss.narayana.blacktie.jatmibroker.xatmi.X_OCTET)

Example 28 with X_OCTET

use of org.jboss.narayana.blacktie.jatmibroker.xatmi.X_OCTET in project narayana by jbosstm.

the class TPCallXCommonService method tpservice.

public Response tpservice(TPSVCINFO svcinfo) throws ConnectionException, ConfigurationException {
    log.info("test_tpcall_x_common_service");
    boolean ok = false;
    X_COMMON dptr = (X_COMMON) svcinfo.getBuffer();
    if (dptr.getLong("acct_no") == 12345678 && dptr.getShort("amount") == 50) {
        ok = true;
    }
    int len = 60;
    X_OCTET toReturn = (X_OCTET) svcinfo.getConnection().tpalloc("X_OCTET", null);
    if (ok) {
        toReturn.setByteArray("tpcall_x_common".getBytes());
    } else {
        toReturn.setByteArray("fail".getBytes());
    }
    return new Response(Connection.TPSUCCESS, 22, toReturn, 0);
}
Also used : Response(org.jboss.narayana.blacktie.jatmibroker.xatmi.Response) X_OCTET(org.jboss.narayana.blacktie.jatmibroker.xatmi.X_OCTET) X_COMMON(org.jboss.narayana.blacktie.jatmibroker.xatmi.X_COMMON)

Example 29 with X_OCTET

use of org.jboss.narayana.blacktie.jatmibroker.xatmi.X_OCTET in project narayana by jbosstm.

the class RollbackOnlyTpcallTPETIMEService method tpservice.

public Response tpservice(TPSVCINFO svcinfo) throws ConnectionException, ConfigurationException {
    log.info("RollbackOnlyTpcallTPETIMEService");
    try {
        int timeout = 60;
        log.info("RollbackOnlyTpcallTPETIMEService, sleeping for " + timeout + " seconds");
        Thread.sleep(timeout * 1000);
        log.info("RollbackOnlyTpcallTPETIMEService, slept for " + timeout + " seconds");
        int len = 60;
        X_OCTET toReturn = (X_OCTET) svcinfo.getConnection().tpalloc("X_OCTET", null);
        toReturn.setByteArray("test_tpcall_TPETIME_service".getBytes());
        return new Response(Connection.TPSUCCESS, 0, toReturn, 0);
    } catch (InterruptedException e) {
        return new Response(Connection.TPFAIL, 0, null, 0);
    }
}
Also used : Response(org.jboss.narayana.blacktie.jatmibroker.xatmi.Response) X_OCTET(org.jboss.narayana.blacktie.jatmibroker.xatmi.X_OCTET)

Aggregations

Response (org.jboss.narayana.blacktie.jatmibroker.xatmi.Response)29 X_OCTET (org.jboss.narayana.blacktie.jatmibroker.xatmi.X_OCTET)29 ConnectionException (org.jboss.narayana.blacktie.jatmibroker.xatmi.ConnectionException)9 ConfigurationException (org.jboss.narayana.blacktie.jatmibroker.core.conf.ConfigurationException)8 StringTokenizer (java.util.StringTokenizer)3 IOException (java.io.IOException)2 List (java.util.List)2 StringReader (java.io.StringReader)1 UnknownHostException (java.net.UnknownHostException)1 ArrayList (java.util.ArrayList)1 DocumentBuilder (javax.xml.parsers.DocumentBuilder)1 DocumentBuilderFactory (javax.xml.parsers.DocumentBuilderFactory)1 Buffer (org.jboss.narayana.blacktie.jatmibroker.xatmi.Buffer)1 ConnectionFactory (org.jboss.narayana.blacktie.jatmibroker.xatmi.ConnectionFactory)1 ResponseException (org.jboss.narayana.blacktie.jatmibroker.xatmi.ResponseException)1 X_COMMON (org.jboss.narayana.blacktie.jatmibroker.xatmi.X_COMMON)1 X_C_TYPE (org.jboss.narayana.blacktie.jatmibroker.xatmi.X_C_TYPE)1 Document (org.w3c.dom.Document)1 InputSource (org.xml.sax.InputSource)1