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

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


  public Response tpservice(TPSVCINFO svcinfo) throws ConnectionException {
    String response = "test_tpgetrply_TPGETANY_one";
    log.info(response);

    X_OCTET toReturn = (X_OCTET) svcinfo.getConnection().tpalloc("X_OCTET",
        null, response.getBytes().length);
    toReturn.setByteArray(response.getBytes());
    try {
      Thread.sleep(3 * 1000);
    } catch (InterruptedException e) {
      log.error("Could not sleep");
    }
View Full Code Here


      .getLogger(TPConversationShortService.class);

  public Response tpservice(TPSVCINFO svcinfo) throws ConnectionException {
    log.info("testTPConversation_short_service");
    int sendlen = 4;
    X_OCTET sendbuf = (X_OCTET) svcinfo.getConnection().tpalloc("X_OCTET",
        null, sendlen);
    sendbuf.setByteArray("hi0".getBytes());
    svcinfo.getSession().tpsend(sendbuf, 0);
    sendbuf.setByteArray("hi1".getBytes());
    return new Response(Connection.TPSUCCESS, 0, sendbuf, 0);
  }
View Full Code Here

      .getLogger(TPACallService.class);

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

  public Response tpservice(TPSVCINFO svcinfo) throws ConnectionException {
    String response = "test_tpgetrply_TPNOBLOCK";
    log.info(response);

    int sendlen = response.length() + 1;
    X_OCTET toReturn = (X_OCTET) svcinfo.getConnection().tpalloc("X_OCTET",
        null, sendlen);
    toReturn.setByteArray(response.getBytes());
    try {
      Thread.sleep(5000);
    } catch (InterruptedException e) {
      log.error("Was interrupted");
    }
View Full Code Here

        && dptr.getShort("amount") == 50) {
      ok = true;
    }

    int len = 60;
    X_OCTET toReturn = (X_OCTET) svcinfo.getConnection().tpalloc("X_OCTET",
        null, len);
    if (ok) {
      toReturn.setByteArray("tpcall_x_common".getBytes());
    } else {
      toReturn.setByteArray("fail".getBytes());
    }
    return new Response(Connection.TPSUCCESS, 22, toReturn, 0);
  }
View Full Code Here

    byte[] toSend = new byte[recv.length];
    int j = recv.length;
    for (int i = 0; i < toSend.length; i++) {
      toSend[i] = recv[--j];
    }
    X_OCTET toReturn = (X_OCTET) svcinfo.getConnection().tpalloc("X_OCTET",
        null, toSend.length);
    toReturn.setByteArray(toSend);
    return new Response((short) 0, 0, toReturn, 0);
  }
View Full Code Here

      long revent = 0;
      log.info("Chatting");
      for (int i = 0; i < TestTPConversation.interationCount; i++) {
        byte[] bytes = ("hi" + i).getBytes();

        X_OCTET sendbuf = (X_OCTET) svcinfo.getConnection().tpalloc(
            "X_OCTET", null, bytes.length);
        sendbuf.setByteArray(bytes);
        // btlogger((char*) "testTPConversation_service:%s:",
        // sendbuf);
        int result = svcinfo.getSession().tpsend(sendbuf,
            Connection.TPRECVONLY);
        if (result != -1) {
          try {
            svcinfo.getSession().tprecv(0);
            fail = true;
            break;
          } catch (ResponseException e) {
            if (e.getEvent() == Connection.TPEV_SENDONLY) {
              Buffer rcvbuf = e.getReceived();
              if (TestTPConversation.strcmp("yo" + i, rcvbuf) != 0) {
                fail = true;
                break;
              }
            } else {
              fail = true;
              break;
            }
          } catch (ConnectionException e) {
            fail = true;
            break;
          }
        } else {
          fail = true;
          break;
        }
      }
      log.info("Chatted");
    }

    if (fail) {
      return new Response((short) Connection.TPESVCFAIL, 0, null, 0);
    } else {
      byte[] bytes = ("hi" + TestTPConversation.interationCount)
          .getBytes();
      X_OCTET sendbuf = (X_OCTET) svcinfo.getConnection().tpalloc(
          "X_OCTET", null, bytes.length);
      sendbuf.setByteArray(bytes);
      return new Response(Connection.TPSUCCESS, 0, sendbuf, 0);
    }
  }
View Full Code Here

  public Response tpservice(TPSVCINFO svcinfo) throws ConnectionException {
    log.info("testtpcancel_service");
    if ((svcinfo.getFlags() & Connection.TPNOREPLY) != Connection.TPNOREPLY) {
      int len = 21;
      X_OCTET toReturn;
      String received = new String(
          ((X_OCTET) svcinfo.getBuffer()).getByteArray());
      if (received.equals("cancel")) {
        toReturn = (X_OCTET) svcinfo.getConnection().tpalloc("X_OCTET",
            null, len);
        toReturn.setByteArray("testtpcancel_service".getBytes());
        return new Response(Connection.TPSUCCESS, 0, toReturn, 0);
      } else {
        return new Response(Connection.TPFAIL, 1, null, 0);
      }
    } else {
View Full Code Here

    log.info("bar called  - svc: %s data %s len: %d flags: %d"
        + svcinfo.getName() + " " + svcinfo.getBuffer() + " "
        + svcinfo.getLen() + " " + svcinfo.getFlags());

    sendlen = 15;
    X_OCTET buffer = (X_OCTET) svcinfo.getConnection().tpalloc("X_OCTET",
        null, sendlen);
    buffer.setByteArray("BAR SAYS HELLO".getBytes());

    return new Response(Connection.TPSUCCESS, 0, buffer, 0);
  }
View Full Code Here

    // Do local work
    server.tpadvertiseTestTPReturn();

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

    try {
      connection.tpcall(RunServer.getServiceNameTestTPReturn(), sendbuf,
          0);
      fail("Managed to send call");
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.