Search in sources :

Example 6 with X_OCTET

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

the class TPGetRplyTwoService method tpservice.

public Response tpservice(TPSVCINFO svcinfo) throws ConnectionException, ConfigurationException {
    String response = "test_tpgetrply_TPGETANY_two";
    log.info(response);
    X_OCTET toReturn = (X_OCTET) svcinfo.getConnection().tpalloc("X_OCTET", null);
    toReturn.setByteArray(response.getBytes());
    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 7 with X_OCTET

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

the class TPConversationShortService method tpservice.

public Response tpservice(TPSVCINFO svcinfo) throws ConnectionException, ConfigurationException {
    log.info("testTPConversation_short_service");
    int sendlen = 4;
    X_OCTET sendbuf = (X_OCTET) svcinfo.getConnection().tpalloc("X_OCTET", null);
    sendbuf.setByteArray("hi0".getBytes());
    svcinfo.getSession().tpsend(sendbuf, 0);
    sendbuf.setByteArray("hi1".getBytes());
    return new Response(Connection.TPSUCCESS, 0, sendbuf, 0);
}
Also used : Response(org.jboss.narayana.blacktie.jatmibroker.xatmi.Response) X_OCTET(org.jboss.narayana.blacktie.jatmibroker.xatmi.X_OCTET)

Example 8 with X_OCTET

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

the class TPGetRplyOneService method tpservice.

public Response tpservice(TPSVCINFO svcinfo) throws ConnectionException, ConfigurationException {
    String response = "test_tpgetrply_TPGETANY_one";
    log.info(response);
    X_OCTET toReturn = (X_OCTET) svcinfo.getConnection().tpalloc("X_OCTET", null);
    toReturn.setByteArray(response.getBytes());
    try {
        Thread.sleep(3 * 1000);
    } catch (InterruptedException e) {
        log.error("Could not sleep");
    }
    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 9 with X_OCTET

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

the class TTLService method tpservice.

public Response tpservice(TPSVCINFO svcinfo) throws ConnectionException, ConfigurationException {
    log.info("TTLService");
    X_OCTET dptr = (X_OCTET) svcinfo.getBuffer();
    String data = new String(dptr.getByteArray());
    log.info("test_ttl_service get data: " + data);
    int len = 60;
    X_OCTET toReturn = (X_OCTET) svcinfo.getConnection().tpalloc("X_OCTET", null);
    log.info("Data was: " + data);
    if (data.contains("counter")) {
        String counter = String.valueOf(n);
        toReturn.setByteArray(counter.getBytes());
        len = counter.length();
    } else {
        try {
            int timeout = 60;
            log.info("TTLService sleep for " + timeout + " seconds");
            Thread.sleep(timeout * 1000);
            log.info("TTLService slept for " + timeout + " seconds");
            toReturn.setByteArray("test_ttl_service".getBytes());
        } catch (Exception e) {
            log.error("sleep failed with " + e);
        }
        n++;
    }
    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) ConfigurationException(org.jboss.narayana.blacktie.jatmibroker.core.conf.ConfigurationException) ConnectionException(org.jboss.narayana.blacktie.jatmibroker.xatmi.ConnectionException)

Example 10 with X_OCTET

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

the class TPACallService method tpservice.

public Response tpservice(TPSVCINFO svcinfo) throws ConnectionException, ConfigurationException {
    log.info("testtpacall_service");
    int len = 20;
    X_OCTET toReturn = (X_OCTET) svcinfo.getConnection().tpalloc("X_OCTET", null);
    toReturn.setByteArray("testtpacall_service".getBytes());
    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)

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