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

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


    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


    log.info("testtpreturn_service_tpurcode");
    int len = 1;
    Buffer toReturn = (X_OCTET) svcinfo.getConnection().tpalloc("X_OCTET",
        null, len);
    if (TestTPConversation.strcmp(svcinfo.getBuffer(), "24") == 0) {
      return new Response(Connection.TPSUCCESS, 24, toReturn, 0);
    } else {
      return new Response(Connection.TPSUCCESS, 77, toReturn, 0);
    }
  }
View Full Code Here

      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

      }
      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

          ((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 {
      return null;
    }
  }
View Full Code Here

    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

    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());
    } catch (ConnectionException e) {
      if (e.getTperrno() != Connection.TPENOENT) {
        fail("Expected TPENOENT, got: " + e.getTperrno());
      }
    }
View Full Code Here

    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

    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);
    assertTrue(((X_OCTET) rcvbuf.getBuffer()).getByteArray() != null);
    byte[] received = ((X_OCTET) rcvbuf.getBuffer()).getByteArray();
    byte[] expected = new byte[received.length];
    System.arraycopy("tpcall_x_octet".getBytes(), 0, expected, 0,
        "tpcall_x_octet".getBytes().length);
    assertTrue(Arrays.equals(received, expected));
  }
View Full Code Here

    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);
    assertTrue(((X_OCTET) rcvbuf.getBuffer()).getByteArray() != null);
    byte[] received = ((X_OCTET) rcvbuf.getBuffer()).getByteArray();
    byte[] expected = new byte[received.length];
    System.arraycopy("tpcall_x_octet".getBytes(), 0, expected, 0,
        "tpcall_x_octet".getBytes().length);
    assertTrue(Arrays.equals(received, expected));
  }
View Full Code Here

TOP

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

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.