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

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


  public Response tpservice(TPSVCINFO svcinfo) throws ConnectionException {
    log.info("testtpsend_tpsendonly_service");
    svcinfo.getSession().tpsend(svcinfo.getBuffer(), 0);
    // This should not have reached here
    return new Response(Connection.TPFAIL, -1, svcinfo.getBuffer(), 0);
  }
View Full Code Here


  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

    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 = 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

    X_COMMON dptr = (X_COMMON) connection.tpalloc("X_COMMON", "deposit", 0);

    dptr.setLong("acct_no", 12345678);
    dptr.setShort("amount", (short) 50);

    Response rcvbuf = connection.tpcall(
        RunServer.getServiceNametpcallXCommon(), dptr, 0);
    assertTrue(rcvbuf.getRcode() == 22);
    byte[] received = ((X_OCTET) rcvbuf.getBuffer()).getByteArray();
    byte[] expected = new byte[received.length];
    System.arraycopy("tpcall_x_common".getBytes(), 0, expected, 0,
        "tpcall_x_common".getBytes().length);
    assertTrue(Arrays.equals(received, expected));
  }
View Full Code Here

    double[] balances = new double[2];
    balances[0] = 1.1;
    balances[1] = 2.2;
    aptr.setDoubleArray("balances", balances);

    Response rcvbuf = connection.tpcall(
        RunServer.getServiceNametpcallXCType(), aptr,
        Connection.TPNOCHANGE);
    assertTrue(rcvbuf.getRcode() == 23);
    byte[] received = ((X_OCTET) rcvbuf.getBuffer()).getByteArray();
    byte[] expected = new byte[received.length];
    System.arraycopy("tpcall_x_c_type".getBytes(), 0, expected, 0,
        "tpcall_x_c_type".getBytes().length);
    assertTrue(Arrays.equals(received, expected));
  }
View Full Code Here

        log.debug("service_request tx same as current");
      }

      Buffer request = requestMessage.getBuffer();
      log.debug("service_request tpcall");
      Response response = connection.tpcall(serviceName, request,
          noTimeout ? Connection.TPNOTIME : 0);
      responseMessage = new JABMessage(response);
      log.debug("service_request responsed");
    } catch (Exception e) {
      log.warn("service_request exception: " + e.getMessage(), e);
View Full Code Here

    int cancelled = connection.tpcancel(cd);
    assertTrue(cancelled != -1);

    // FAIL TO RETRIEVE THE RESPONSE
    try {
      Response valToTest = connection.tpgetrply(cd, 0);
      assertNull("Could get a reply", valToTest);
      fail("Method completed ok");
    } catch (ConnectionException e) {
      assertTrue(e.getTperrno() == Connection.TPEBADDESC);
    }
View Full Code Here

    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.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.