/**
   * Tests a JDT feature bundle container contains the appropriate bundles for a specific OS.
   *
   * @throws Exception
   */
  public void testMacOSFeatureBundleContainer() throws Exception {
    // extract the feature
    IPath location = extractModifiedFeatures();

    ITargetDefinition definition = getNewTarget();
    definition.setOS(Platform.OS_MACOSX);
    ITargetLocation container =
        getTargetService().newFeatureLocation(location.toOSString(), "org.eclipse.jdt", null);
    container.resolve(definition, null);
    TargetBundle[] bundles = container.getBundles();

    List expected = new ArrayList();
    expected.add("org.eclipse.jdt");
    expected.add("org.eclipse.jdt.launching");
    // 2 versions of JUnit
    expected.add("org.junit");
    expected.add("org.junit");
    expected.add("org.junit4");
    expected.add("org.eclipse.jdt.launching.macosx");

    assertEquals("Wrong number of bundles in JDT feature", expected.size(), bundles.length);
    for (int i = 0; i < bundles.length; i++) {
      String symbolicName = bundles[i].getBundleInfo().getSymbolicName();
      expected.remove(symbolicName);
      if (symbolicName.equals("org.eclipse.jdt.launching.macosx")) {
        // the bundle should be missing unless on Mac
        IStatus status = bundles[i].getStatus();
        if (Platform.getOS().equals(Platform.OS_MACOSX)) {
          assertTrue("Mac bundle should be present", status.isOK());
        } else {
          assertFalse("Mac bundle should be missing", status.isOK());
          assertEquals(
              "Mac bundle should be mssing",
              TargetBundle.STATUS_PLUGIN_DOES_NOT_EXIST,
              status.getCode());
        }
      }
    }
    Iterator iterator = expected.iterator();
    while (iterator.hasNext()) {
      String name = (String) iterator.next();
      System.err.println("Missing: " + name);
    }
    assertTrue("Wrong bundles in JDT feature", expected.isEmpty());

    // should be no source bundles
    for (int i = 0; i < bundles.length; i++) {
      TargetBundle bundle = bundles[i];
      assertFalse("Should be no source bundles", bundle.isSourceBundle());
    }
  }
 /**
  * Add this exception to the collector. If a log was specified in the constructor then the
  * exception will be output to the log. You can retreive exceptions using <code>getStatus</code>.
  *
  * @param exception the exception to collect
  */
 public void handleException(CoreException exception) {
   // log the exception if we have a log
   if (log != null) {
     log.log(new Status(severity, pluginId, 0, message, exception));
   }
   // Record each status individually to flatten the resulting multi-status
   IStatus exceptionStatus = exception.getStatus();
   // Wrap the exception so the stack trace is not lost.
   IStatus status =
       new Status(
           exceptionStatus.getSeverity(),
           exceptionStatus.getPlugin(),
           exceptionStatus.getCode(),
           exceptionStatus.getMessage(),
           exception);
   recordStatus(status);
   IStatus[] children = status.getChildren();
   for (int i = 0; i < children.length; i++) {
     IStatus status2 = children[i];
     recordStatus(status2);
   }
 }