コード例 #1
0
  /**
   * Unmarshal host data and test java data object result. Alternative choice.
   *
   * @throws Exception if marshaling fails
   */
  public void testRedsimptSecondChoice() throws Exception {

    String hexString = RedsimptCases.getHostBytesHexSecondChoice();
    byte[] hostBytes = HostData.toByteArray(hexString);
    Dfhcommarea dfhcommarea = (Dfhcommarea) Util.unmarshal(hostBytes, "redsimpt");
    RedsimptCases.checkJavaObjectSecondChoice(dfhcommarea);
  }
コード例 #2
0
  /**
   * Transform host data and test java data object result.
   *
   * @throws Exception if transforming fails
   */
  public void testHostToJavaTransformerSecondChoice() throws Exception {

    DfhcommareaHostToJavaTransformer transformer = new DfhcommareaHostToJavaTransformer();
    Dfhcommarea dfhcommarea =
        transformer.transform(HostData.toByteArray(RedsimptCases.getHostBytesHexSecondChoice()));
    RedsimptCases.checkJavaObjectSecondChoice(dfhcommarea);
  }
コード例 #3
0
  /** When passed an empty address, the parameters should come from the base configuration. */
  public void testEmptyAddressWithBinding() {
    try {
      HostInvoker invoker =
          HostInvokerFactory.createHostInvoker(
              CONFIG_FILE, null, new HostProgramProperties("lsfileae.properties"));
      byte[] responseBytes =
          invoker.invoke(
              getName(), HostData.toByteArray(LsfileaeCases.getHostBytesHexRequest100()));
      assertEquals(LsfileaeCases.getHostBytesHexReply100(), HostData.toHexString(responseBytes));

    } catch (HostInvokerException e) {
      fail("testEmptyAddress failed " + e);
    } catch (HostProgramException e) {
      fail("testEmptyAddress failed " + e);
    }
  }
コード例 #4
0
  /** Test a successful access to VARARCOM. */
  public void testInvokeVararcom() {
    try {
      LegStarAddress address = new LegStarAddress("TheMainframe");
      address.setHostUserID(HOST_USERID);
      address.setHostPassword(HOST_PASSWORD);
      HostInvoker invoker =
          HostInvokerFactory.createHostInvoker(
              CONFIG_FILE, address, new HostProgramProperties("vararcom.properties"));
      byte[] responseBytes =
          invoker.invoke(getName(), HostData.toByteArray(VararcomCases.getHostBytesHexEmpty()));
      assertEquals(VararcomCases.getHostBytesHex36(), HostData.toHexString(responseBytes));

    } catch (HostInvokerException e) {
      fail("testValidInvoke failed " + e);
    } catch (HostProgramException e) {
      fail("testValidInvoke failed " + e);
    }
  }
コード例 #5
0
  /** When address is partially filled, the rest should come from the base configuration. */
  public void testPartiallyEmptyAddress() {
    try {
      LegStarAddress address = new LegStarAddress("");
      address.setHostUserID("IBMUSER");
      address.setHostPassword(HOST_PASSWORD);
      HostInvoker invoker =
          HostInvokerFactory.createHostInvoker(
              CONFIG_FILE, address, new HostProgramProperties("lsfileae.properties"));
      byte[] responseBytes =
          invoker.invoke(
              getName(), HostData.toByteArray(LsfileaeCases.getHostBytesHexRequest100()));
      assertEquals(LsfileaeCases.getHostBytesHexReply100(), HostData.toHexString(responseBytes));

    } catch (HostInvokerException e) {
      fail("testPartiallyEmptyAddress failed " + e);
    } catch (HostProgramException e) {
      fail("testPartiallyEmptyAddress failed " + e);
    }
  }
コード例 #6
0
  /** The base configuration uses HTTP connectivity. */
  public void testValidInvokeCommareaOverHttp() {
    try {
      LegStarAddress address = new LegStarAddress("TheMainframe");
      address.setHostUserID(HOST_USERID);
      address.setHostPassword(HOST_PASSWORD);
      HostInvoker invoker =
          HostInvokerFactory.createHostInvoker(
              "config4.xml", address, new HostProgramProperties("lsfileae.properties"));
      byte[] responseBytes =
          invoker.invoke(
              getName(), HostData.toByteArray(LsfileaeCases.getHostBytesHexRequest100()));
      assertEquals(LsfileaeCases.getHostBytesHexReply100(), HostData.toHexString(responseBytes));

    } catch (HostInvokerException e) {
      fail("testValidInvokeCommareaOverHttp failed " + e);
    } catch (HostProgramException e) {
      fail("testValidInvokeCommareaOverHttp failed " + e);
    }
  }
コード例 #7
0
  /** Test failure when program properties are wrong. */
  public void testWrongProgInvokeCommarea() {
    try {
      LegStarAddress address = new LegStarAddress("TheMainframe");
      address.setHostUserID(HOST_USERID);
      address.setHostPassword(HOST_PASSWORD);
      HostInvoker invoker =
          HostInvokerFactory.createHostInvoker(
              CONFIG_FILE, address, new HostProgramProperties("wrongprog.properties"));
      invoker.invoke(getName(), HostData.toByteArray(LsfileaeCases.getHostBytesHexRequest100()));
      fail("testWrongProgInvokeCommarea failed ");

    } catch (HostInvokerException e) {
      assertTrue(
          e.getMessage()
              .contains(
                  "com.legstar.host.access.HostAccessStrategyException:"
                      + " com.legstar.messaging.RequestException:"
                      + " CICS command=LINK COMMAREA failed, resp=PGMIDERR, resp2="));
    } catch (HostProgramException e) {
      fail(e.toString());
    }
  }