Package org.jboss.narayana.blacktie.jatmibroker.xatmi

Examples of org.jboss.narayana.blacktie.jatmibroker.xatmi.X_OCTET


  public Response tpservice(TPSVCINFO svcinfo) throws ConnectionException {
    log.info("test_ttl_service");

    int timeout = 45;
    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, len);

    log.info("Data was: " + data);
    if (data.contains("counter")) {
      String counter = String.valueOf(n);
      toReturn.setByteArray(counter.getBytes());
      len = counter.length();
    } else {
      n++;
      try {
        log.info("test_ttl_service sleep for " + timeout + " seconds");
        Thread.sleep(timeout * 1000);
        log.info("test_ttl_service slept for " + timeout + " seconds");
        toReturn.setByteArray("test_ttl_service".getBytes());
      } catch (Exception e) {
        log.error("sleep failed with " + e);
      }
    }
    return new Response(Connection.TPSUCCESS, 22, toReturn, 0);
View Full Code Here


        && Arrays.equals(receivedName, expectedName) && fooOne == 1.1F
        && fooTwo == 2.2F && balanceOne == 1.1 && balanceTwo == 2.2) {
      ok = true;
    }
    int len = 60;
    X_OCTET toReturn = (X_OCTET) svcinfo.getConnection().tpalloc("X_OCTET",
        null, len);
    if (ok) {
      toReturn.setByteArray("tpcall_x_c_type".getBytes());
    } else {
      toReturn.setByteArray("fail".getBytes());
    }
    return new Response(Connection.TPSUCCESS, 23, toReturn, 0);
  }
View Full Code Here

  private static final Logger log = LogManager
      .getLogger(TPGetRplyService.class);

  public Response tpservice(TPSVCINFO svcinfo) throws ConnectionException {
    log.info("testtpgetrply_service");
    X_OCTET toReturn = (X_OCTET) svcinfo.getConnection().tpalloc("X_OCTET",
        null, 22);
    toReturn.setByteArray("testtpgetrply_service".getBytes());
    return new Response(Connection.TPSUCCESS, 0, toReturn, 0);
  }
View Full Code Here

  public void test_tpacall() throws ConnectionException {
    server.tpadvertiseTestTPACall();
    log.info("test_tpacall");
    byte[] toSend = "test_tpacall".getBytes();
    int sendlen = toSend.length;
    X_OCTET sendbuf = (X_OCTET) connection
        .tpalloc("X_OCTET", null, sendlen);
    sendbuf.setByteArray(toSend);

    int cd = connection.tpacall(RunServer.getServiceNameTestTPACall(),
        sendbuf, Connection.TPNOREPLY);
    assertTrue(cd == 0);
View Full Code Here

  public void test_tpcall_unknown_service() throws ConnectionException {
    log.info("TestTPCall::test_tpcall_unknown_service");

    String message = "test_tpcall_unknown_service";
    int sendlen = message.length() + 1;
    X_OCTET sendbuf = (X_OCTET) connection
        .tpalloc("X_OCTET", null, sendlen);
    sendbuf.setByteArray("test_tpcall_unknown_service".getBytes());

    try {
      Response rcvbuf = connection.tpcall("UNKNOWN_SERVICE", sendbuf, 0);
      fail("Expected TPENOENT, got a buffer with rval: "
          + rcvbuf.getRval());
View Full Code Here

    log.info("TestTPCall::test_tpcall_x_octet");
    server.tpadvertisetpcallXOctet();

    String toSend = "test_tpcall_x_octet";
    int sendlen = toSend.length() + 1;
    X_OCTET sendbuf = (X_OCTET) connection
        .tpalloc("X_OCTET", null, sendlen);
    sendbuf.setByteArray(toSend.getBytes());

    Response rcvbuf = connection.tpcall(
        RunServer.getServiceNametpcallXOctet(), sendbuf, 0);
    assertTrue(rcvbuf != null);
    assertTrue(rcvbuf.getBuffer() != null);
View Full Code Here

    log.info("TestTPCall::test_tpcall_x_octet_after_delay");
    server.tpadvertisetpcallXOctet();
    Thread.currentThread().sleep(3000);
    String toSend = "test_tpcall_x_octet";
    int sendlen = toSend.length() + 1;
    X_OCTET sendbuf = (X_OCTET) connection
        .tpalloc("X_OCTET", null, sendlen);
    sendbuf.setByteArray(toSend.getBytes());

    Response rcvbuf = connection.tpcall(
        RunServer.getServiceNametpcallXOctet(), sendbuf, 0);
    assertTrue(rcvbuf != null);
    assertTrue(rcvbuf.getBuffer() != null);
View Full Code Here

  public void test_tpcancel() throws ConnectionException {
    log.info("test_tpcancel");
    byte[] message = "cancel".getBytes();
    int sendlen = message.length + 1;
    X_OCTET sendbuf = (X_OCTET) connection
        .tpalloc("X_OCTET", null, sendlen);
    sendbuf.setByteArray(message);

    int cd = connection.tpacall(RunServer.getServiceNameTestTPCancel(),
        sendbuf, 0);
    assertTrue(cd != -1);
    assertTrue(cd != 0);
View Full Code Here

  public void test_tpcancel_noreply() throws ConnectionException {
    log.info("test_tpcancel_noreply");
    byte[] message = "cancel".getBytes();
    int sendlen = message.length + 1;
    X_OCTET sendbuf = (X_OCTET) connection
        .tpalloc("X_OCTET", null, sendlen);
    sendbuf.setByteArray(message);

    int cd = connection.tpacall(RunServer.getServiceNameTestTPCancel(),
        sendbuf, Connection.TPNOREPLY);
    assertTrue(cd == 0);
View Full Code Here

      .getLogger(RollbackOnlyTprecvTPEVSVCFAILService.class);

  public Response tpservice(TPSVCINFO svcinfo) throws ConnectionException {
    log.info("test_tprecv_TPEV_SVCFAIL_service");
    int len = 60;
    X_OCTET toReturn = (X_OCTET) svcinfo.getConnection().tpalloc("X_OCTET",
        null, len);
    toReturn.setByteArray("test_tprecv_TPEV_SVCFAIL_service".getBytes());
    return new Response(Connection.TPFAIL, 0, toReturn, 0);
  }
View Full Code Here

TOP

Related Classes of org.jboss.narayana.blacktie.jatmibroker.xatmi.X_OCTET

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.