@Override
  public int run(String[] args) throws Exception {
    try {
      webServiceClient = WebServiceClient.getWebServiceClient().createClient();
      return runCommand(args);
    } finally {
      if (yarnClient != null) {
        yarnClient.close();
      }
      if (webServiceClient != null) {
        webServiceClient.destroy();
      }
    }
  }
@Test (timeout = 5000)
  public void testWithExclusiveArguments() throws Exception {
    ApplicationId appId1 = ApplicationId.newInstance(0, 1);
    LogsCLI cli = createCli();

    // Specify show_container_log_info and show_application_log_info
    // at the same time
    int exitCode = cli.run(new String[] {"-applicationId", appId1.toString(),
        "-show_container_log_info", "-show_application_log_info"});
    assertTrue(exitCode == -1);
    assertTrue(sysErrStream.toString().contains("Invalid options. "
            + "Can only accept one of show_application_log_info/"
            + "show_container_log_info."));
    sysErrStream.reset();

    // Specify log_files and log_files_pattern
    // at the same time
    exitCode = cli.run(new String[] {"-applicationId", appId1.toString(),
        "-log_files", "*", "-log_files_pattern", ".*"});
    assertTrue(exitCode == -1);
    assertTrue(sysErrStream.toString().contains("Invalid options. "
            + "Can only accept one of log_files/"
            + "log_files_pattern."));
    sysErrStream.reset();
  }