protected void normalizeMap()

in src/main/java/org/apache/openejb/cts/deploy/StandardDeployment14.java [601:661]


  protected void normalizeMap(Target[] targets) throws Exception {
    List targModIDsList = null;

    TestUtil.logHarnessDebug("Target[]");
    for (int i = 0; i < targets.length; i++) {
      TestUtil.logHarnessDebug("[" + targets[i].getDescription() + ", "
          + targets[i].getName() + "]");
    }

    Hashtable result = new Hashtable();
    Iterator iter = htDeployedModules.keySet().iterator();
    while (iter.hasNext()) {
      String modName = (String) iter.next();
      TargetModuleID[] targModIDs = getRunningTargetModuleIDs(modName, targets);
      if (targModIDs == null || targModIDs.length == 0) {
        continue;
      }
      TestUtil.logHarnessDebug("****** Module name = \"" + modName + "\"");
      TestUtil
          .logHarnessDebug("****** targModIDs.length = " + targModIDs.length);
      TestUtil.logHarnessDebug("TargetModuleID[]");
      for (int i = 0; i < targModIDs.length; i++) {
        TestUtil.logHarnessDebug("[" + targModIDs[i].getModuleID() + ", "
            + targModIDs[i].getTarget().getDescription() + ", "
            + targModIDs[i].getTarget().getName() + "]");
      }

      TargetModuleID[] savedIDs = (TargetModuleID[]) htDeployedModules
          .get(modName);

      TestUtil.logHarnessDebug("****** savedIDs.length = " + savedIDs.length);
      TestUtil.logHarnessDebug("TargetModuleID[]");
      for (int i = 0; i < savedIDs.length; i++) {
        TestUtil.logHarnessDebug("[" + savedIDs[i].getModuleID() + "]");
      }

      targModIDsList = new ArrayList();
      for (int i = 0; i < targModIDs.length; i++) {
        if (isValidTargetID(targModIDs[i], savedIDs)) {
          TestUtil.logHarnessDebug(
              "&&&&&&&& Adding = " + targModIDs[i].getModuleID());
          targModIDsList.add(targModIDs[i]);
          TestUtil.logHarnessDebug(
              "&&&&&&&& targModIDsList.size() is " + targModIDsList.size());
          break;
        }
      }
      if (targModIDsList.size() > 0) {
        TargetModuleID[] validSavedIDs = (TargetModuleID[]) (targModIDsList
            .toArray(new TargetModuleID[targModIDsList.size()]));
        result.put(modName, validSavedIDs);
      } else {
        TestUtil.logHarnessDebug(
            "$$$$$ We did not find any valid IDs :  " + modName);
      }
    }
    TestUtil.logHarnessDebug("DUMP OF RESULT");
    dumpDeployedMods(result);
    TestUtil.logHarnessDebug("END DUMP OF RESULT END");
    htDeployedModules = result;
  }