コード例 #1
0
  /**
   * Tests the ability to add arguments to a target platform and have them show up on new configs
   *
   * @throws Exception
   */
  public void testArguments() throws Exception {
    ITargetDefinition definition = getNewTarget();

    // Add program arguments
    String programArgs = "-testProgramArgument -testProgramArgument2";
    definition.setProgramArguments(programArgs);
    assertEquals(programArgs, definition.getProgramArguments());

    // Add VM arguments
    String vmArgs = "-testVMArgument -testVMArgument2";
    definition.setVMArguments(vmArgs);
    assertEquals(vmArgs, definition.getVMArguments());

    try {
      getTargetService().saveTargetDefinition(definition);
      setTargetPlatform(definition);

      // Check that new launch configs will be prepopulated from target
      assertEquals(vmArgs, LaunchArgumentsHelper.getInitialVMArguments());
      assertEquals(
          "-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog "
              .concat(programArgs),
          LaunchArgumentsHelper.getInitialProgramArguments());

    } finally {
      getTargetService().deleteTarget(definition.getHandle());
      resetTargetPlatform();
    }
  }
コード例 #2
0
  protected void doIncludeVersions(NameVersionDescriptor[] descriptions) throws Exception {
    String bsn = MULTI_VERSION_LOW_DESCRIPTION.getId();

    IPath extras = extractMultiVersionPlugins();
    ITargetDefinition target = getNewTarget();
    ITargetLocation container = getTargetService().newDirectoryLocation(extras.toOSString());
    target.setTargetLocations(new ITargetLocation[] {container});
    target.setIncluded(descriptions);
    try {
      getTargetService().saveTargetDefinition(target);
      setTargetPlatform(target);
      IPluginModelBase[] models = PluginRegistry.getExternalModels();
      Set enabled = new HashSet();
      for (int i = 0; i < models.length; i++) {
        IPluginModelBase pm = models[i];
        if (pm.getBundleDescription().getSymbolicName().equals(bsn)) {
          NameVersionDescriptor desc =
              new NameVersionDescriptor(
                  pm.getPluginBase().getId(), pm.getPluginBase().getVersion());
          if (pm.isEnabled()) {
            enabled.add(desc);
          }
        }
      }
      if (descriptions == null) {

      } else {
        assertEquals("Wrong number of enabled bundles", descriptions.length, enabled.size());
        for (int i = 0; i < descriptions.length; i++) {
          assertTrue("Missing bundle", enabled.contains(descriptions[i]));
        }
      }
    } finally {
      getTargetService().deleteTarget(target.getHandle());
      resetTargetPlatform();
    }
  }