Ejemplo n.º 1
0
  private static void launchTypeBasedConfiguration(
      IJavaProject ijp, String confName, IType[] types, String mode) {
    Map classMethods = new HashMap();
    List typeNames = new ArrayList();

    for (int i = 0; i < types.length; i++) {
      typeNames.add(types[i].getFullyQualifiedName());
      classMethods.put(types[i].getFullyQualifiedName(), EMPTY_ARRAY_PARAM);
    }

    if (haveGroupsDependency(types)) {
      groupDependencyWarning(confName, null);
    }

    ILaunchConfigurationWorkingCopy workingCopy =
        createLaunchConfiguration(ijp.getProject(), confName, null);

    workingCopy.setAttribute(TestNGLaunchConfigurationConstants.TYPE, LaunchType.CLASS.ordinal());
    workingCopy.setAttribute(
        TestNGLaunchConfigurationConstants.ALL_METHODS_LIST,
        ConfigurationHelper.toClassMethodsMap(classMethods));
    workingCopy.setAttribute(TestNGLaunchConfigurationConstants.CLASS_TEST_LIST, typeNames);
    workingCopy.setAttribute(
        TestNGLaunchConfigurationConstants.TESTNG_COMPLIANCE_LEVEL_ATTR,
        getQuickComplianceLevel(types));
    workingCopy.setAttribute(TestNGLaunchConfigurationConstants.PARAMS, solveParameters(types));
    workingCopy.setAttribute(
        TestNGLaunchConfigurationConstants.METHOD_TEST_LIST, EMPTY_ARRAY_PARAM);
    workingCopy.setAttribute(
        TestNGLaunchConfigurationConstants.PACKAGE_TEST_LIST, EMPTY_ARRAY_PARAM);

    runConfig(workingCopy, mode);
  }
Ejemplo n.º 2
0
  /**
   * Creates a Map containing the basic properties of a new launch configuration, based on types.
   */
  public static Map createClassLaunchConfigurationMap(
      IType mainType, IType[] types, String annotationType) {
    Map attrs = new HashMap();

    List<String> classNames = Lists.newArrayList();
    Map<String, List<String>> classMethods = Maps.newHashMap();

    for (int i = 0; i < types.length; i++) {
      classNames.add(types[i].getFullyQualifiedName());
      classMethods.put(types[i].getFullyQualifiedName(), EMPTY_ARRAY_PARAM);
    }

    attrs.put(TestNGLaunchConfigurationConstants.TYPE, LaunchType.CLASS.ordinal());
    attrs.put(TestNGLaunchConfigurationConstants.CLASS_TEST_LIST, classNames);
    attrs.put(TestNGLaunchConfigurationConstants.TESTNG_COMPLIANCE_LEVEL_ATTR, annotationType);
    attrs.put(
        TestNGLaunchConfigurationConstants.ALL_METHODS_LIST,
        ConfigurationHelper.toClassMethodsMap(classMethods));

    return attrs;
  }