Package org.jboss.narayana.blacktie.jatmibroker.jab.factory

Examples of org.jboss.narayana.blacktie.jatmibroker.jab.factory.JABConnectionFactory


      log.error("java JABFactoryClient message");
      return;
    }
    String message = args[0];
    try {
      JABConnectionFactory jcf = new JABConnectionFactory(
          "JABFactoryClientTest");
      JABConnection c = jcf.getConnection("connection");
      Transaction t = c.beginTransaction(-1);
      JABBuffer b = new JABBuffer();
      b.setValue("X_OCTET", message.getBytes());
      log.info("Calling call with input: " + message);
      JABResponse call = c.call("FOOAPP", b, t, "X_OCTET", null);
      log.info("Called call with output: " + call.getValue("X_OCTET"));
      t.commit();
      jcf.closeConnection("connection");
    } catch (JABException e) {
      log.error("JAB error: " + e.getMessage(), e);
    }
  }
View Full Code Here


  }

  public void test_tpcall_x_octet() throws Exception {
    log.info("JABFactoryTestCase::test_tpcall_x_octet");
    runServer.tpadvertisetpcallXOctet();
    JABConnectionFactory factory = new JABConnectionFactory("test");
    JABConnection connection = factory.getConnection("connection");
    JABBuffer toSend = new JABBuffer();
    toSend.setArrayValue("X_OCTET", "test_tpcall_x_octet".getBytes());

    Transaction transaction = connection.beginTransaction(10000);
    JABResponse call = connection.call(
        RunServer.getServiceNametpcallXOctet(), toSend, transaction,
        "X_OCTET", null);
    transaction.commit();

    byte[] expected = new byte[60];
    System.arraycopy("tpcall_x_octet".getBytes(), 0, expected, 0, 14);
    byte[] received = call.getByteArray("X_OCTET");
    assertTrue(Arrays.equals(expected, received));
    factory.closeConnection("connection");
  }
View Full Code Here

  }

  public void test_tpcall_x_c_type() throws Exception {
    log.info("JABFactoryTestCase::test_tpcall_x_c_type");
    runServer.tpadvertisetpcallXCType();
    JABConnectionFactory factory = new JABConnectionFactory("test");
    JABConnection connection = factory.getConnection("connection");

    // Assemble the message ByteArrayOutputStream baos = new
    JABBuffer toSend = new JABBuffer();
    toSend.setValue("acct_no", 12345678l);
    toSend.setArrayValue("name", "TOM".getBytes());
    float[] foo = new float[2];
    foo[0] = 1.1F;
    foo[1] = 2.2F;
    toSend.setArrayValue("foo", foo);

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

    Transaction transaction = connection.beginTransaction(10000);
    JABResponse call = connection.call(
        RunServer.getServiceNametpcallXCType(), toSend, transaction,
        "X_C_TYPE", "acct_info");
    transaction.commit();

    byte[] expected = new byte[60];
    System.arraycopy("tpcall_x_c_type".getBytes(), 0, expected, 0, 15);
    byte[] received = call.getByteArray("X_OCTET");
    assertTrue(Arrays.equals(expected, received));
    factory.closeConnection("connection");
  }
View Full Code Here

  }

  public void test_tpcall_x_octet() throws Exception {
    log.info("JABFactoryTestCase::test_tpcall_x_octet");
    runServer.tpadvertisetpcallXOctet();
    JABConnectionFactory factory = new JABConnectionFactory("test");
    JABConnection connection = factory.getConnection("connection");
    JABBuffer toSend = new JABBuffer();
    toSend.setArrayValue("X_OCTET", "test_tpcall_x_octet".getBytes());

    Transaction transaction = connection.beginTransaction(10000);
    JABResponse call = connection.call(
        RunServer.getServiceNametpcallXOctet(), toSend, transaction,
        "X_OCTET", null);
    transaction.commit();

    byte[] expected = new byte[60];
    System.arraycopy("tpcall_x_octet".getBytes(), 0, expected, 0, 14);
    byte[] received = call.getByteArray("X_OCTET");
    assertTrue(Arrays.equals(expected, received));
    factory.closeConnection("connection");
  }
View Full Code Here

  }

  public void test_tpcall_x_c_type() throws Exception {
    log.info("JABFactoryTestCase::test_tpcall_x_c_type");
    runServer.tpadvertisetpcallXCType();
    JABConnectionFactory factory = new JABConnectionFactory("test");
    JABConnection connection = factory.getConnection("connection");

    // Assemble the message ByteArrayOutputStream baos = new
    JABBuffer toSend = new JABBuffer();
    toSend.setValue("acct_no", 12345678l);
    toSend.setArrayValue("name", "TOM".getBytes());
    float[] foo = new float[2];
    foo[0] = 1.1F;
    foo[1] = 2.2F;
    toSend.setArrayValue("foo", foo);

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

    Transaction transaction = connection.beginTransaction(10000);
    JABResponse call = connection.call(
        RunServer.getServiceNametpcallXCType(), toSend, transaction,
        "X_C_TYPE", "acct_info");
    transaction.commit();

    byte[] expected = new byte[60];
    System.arraycopy("tpcall_x_c_type".getBytes(), 0, expected, 0, 15);
    byte[] received = call.getByteArray("X_OCTET");
    assertTrue(Arrays.equals(expected, received));
    factory.closeConnection("connection");
  }
View Full Code Here

TOP

Related Classes of org.jboss.narayana.blacktie.jatmibroker.jab.factory.JABConnectionFactory

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.