/**
   * Verify that the command line tool for listing missing disk stores contains the PersistentIDs in
   * the given set.
   *
   * @param expected The members that are expected to be in the results of the
   *     list-missing-disk-stores command line tool.
   */
  private static void verifyMissingDiskStoresCommandLineTool(Set<PersistentID> expected) {
    // Workaround to bug 42432; when this bug is fixed, remove the following if
    if (HostHelper.isWindows() && !CliHelperPrms.getUseCli()) {
      Log.getLogWriter()
          .info("To avoid bug 42432, not running list-missing-disk-stores command line tool");
      return;
    }
    String result = PersistenceUtil.runListMissingDiskStores();

    // convert result in to List of diskDirs
    List<String> actualDiskIds = new ArrayList();
    String[] tokens = result.split("\n");
    if (CliHelperPrms
        .getUseCli()) { // result from gfsh is different than the old gemfire script output
      for (String line : tokens) {
        if (line.indexOf("vm_") >= 0) {
          String[] lineTokens = line.split("[\\s]+"); // split on white space
          actualDiskIds.add(lineTokens[0]); // diskId is first token
        }
      }
    } else {
      for (String line : tokens) { // make resultLines contain only DiskStores
        Matcher matcher = PersistenceUtil.DISK_STORE_ID.matcher(line);
        if (matcher.matches()) {
          actualDiskIds.add(matcher.group(1));
        }
      }
    }

    // convert expected into List of diskDirs
    List<String> expectedDiskDirs = new ArrayList();
    for (PersistentID id : expected) {
      expectedDiskDirs.add(id.getUUID().toString());
    }

    // find disk dirs missing or extra in command line tool results
    List<String> missing = new ArrayList(expectedDiskDirs);
    List<String> extra = new ArrayList(actualDiskIds);
    missing.removeAll(actualDiskIds);
    extra.removeAll(expectedDiskDirs);
    if (missing.size() > 0) {
      throw new TestException(
          "The following DiskStore IDs were expected in the result of"
              + " list or show missing-disk-stores command line tool: "
              + missing
              + ", result of command line tool is "
              + result);
    }
    if (extra.size() > 0) {
      throw new TestException(
          "The following unexpected DiskStore IDs were returned"
              + " from list or show missing-disk-stores command line tool: "
              + extra
              + ", expected "
              + expected);
    }
    Log.getLogWriter().info("list or show missing-disk-stores command returned expected results");
  }