/** 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);
    }
  }
  /** 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);
    }
  }
  /** 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);
    }
  }
  /** 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());
    }
  }