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

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


    // Do local work
    server.tpadvertiseTestTPReturn2();

    int sendlen = 3;
    X_OCTET sendbuf = (X_OCTET) connection
        .tpalloc("X_OCTET", null, sendlen);
    sendbuf.setByteArray("24".getBytes());
    Response success = connection.tpcall(
        RunServer.getServiceNameTestTPReturn2(), sendbuf, 0);
    assertTrue(success != null);
    assertTrue(success.getRcode() == 24);

    sendbuf.setByteArray("77".getBytes());
    success = connection.tpcall(RunServer.getServiceNameTestTPReturn2(),
        sendbuf, 0);
    assertTrue(success != null);
    assertTrue(success.getRcode() == 77);
  }
View Full Code Here


    server.tpadvertiseTestTPReturn3();
    server.tpadvertiseTestTPReturn4();

    int sendlen = 2;

    X_OCTET sendbuf = (X_OCTET) connection
        .tpalloc("X_OCTET", null, sendlen);
    sendbuf.setByteArray("X".getBytes());
    try {
      connection.tpcall(RunServer.getServiceNameTestTPReturn(), sendbuf,
          0);
      fail("Did not receive the expected exception");
    } catch (ConnectionException e) {
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

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

    X_OCTET toReturn = (X_OCTET) svcinfo.getConnection().tpalloc("X_OCTET",
        null, response.getBytes().length);
    toReturn.setByteArray(response.getBytes());
    return new Response(Connection.TPSUCCESS, 0, toReturn, 0);
  }
View Full Code Here

  public static void main(String[] args) throws Exception {
    log.info("JavaClient");
    ConnectionFactory connectionFactory = ConnectionFactory
        .getConnectionFactory();
    Connection connection = connectionFactory.getConnection();
    X_OCTET sbuf = (X_OCTET) connection.tpalloc("X_OCTET", null, 29);
    sbuf.setByteArray("THIS IS YOUR CLIENT SPEAKING".getBytes());
    log.info("Calling tpcall with input: %s"
        + new String(sbuf.getByteArray()));
    int cd = connection.tpacall("JAVASERV", sbuf, 0);
    Response retbuf = connection.tpgetrply(cd, 0);
    log.info("Called tpcall with length: %d output: %s"
        + retbuf.getBuffer().getLen() + " "
        + new String(((X_OCTET) retbuf.getBuffer()).getByteArray()));
View Full Code Here

    try {
      log.info("send first message");

      String toSend = "test_call_ttl_1";
      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.getServiceNameTTL(),
          sendbuf, 0);
      fail("Expected TPETIME, got a buffer with rval: "
          + rcvbuf.getRval());
    } catch (ConnectionException e) {
      if (e.getTperrno() != Connection.TPETIME) {
        fail("Expected TPETIME, got: " + e.getTperrno());
      }
    }

    try {
      log.info("send second message");

      String toSend = "test_call_ttl_2";
      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.getServiceNameTTL(),
          sendbuf, 0);
      fail("Expected TPETIME, got a buffer with rval: "
          + rcvbuf.getRval());
    } catch (ConnectionException e) {
      if (e.getTperrno() != Connection.TPETIME) {
        fail("Expected TPETIME, got: " + e.getTperrno());
      }
    }

    try {
      log.info("wait 30 second for first message process");
      Thread.sleep(30 * 1000);
      log.info("wait done");
    } catch (Exception e) {
      log.warn("sleep exception " + e);
    }

    String toSend = "counter";
    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.getServiceNameTTL(),
        sendbuf, 0);

    assertTrue(rcvbuf != null);
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.