Example #1
0
 private String getTestApplication(EquinoxInstallationDescription testRuntime) {
   if (useUIHarness) {
     ArtifactDescriptor systemBundle = testRuntime.getSystemBundle();
     Version osgiVersion = Version.parseVersion(systemBundle.getKey().getVersion());
     if (osgiVersion.compareTo(EquinoxInstallationDescription.EQUINOX_VERSION_3_3_0) < 0) {
       return "org.sonatype.tycho.surefire.osgibooter.uitest32";
     } else {
       return "org.sonatype.tycho.surefire.osgibooter.uitest";
     }
   } else {
     return "org.sonatype.tycho.surefire.osgibooter.headlesstest";
   }
 }
Example #2
0
  private EquinoxInstallation createEclipseInstallation(
      boolean includeReactorProjects, List<ReactorProject> reactorProjects)
      throws MojoExecutionException {
    TargetPlatformResolver platformResolver =
        targetPlatformResolverLocator.lookupPlatformResolver(project);

    ArrayList<Dependency> dependencies = new ArrayList<Dependency>();

    if (this.dependencies != null) {
      dependencies.addAll(Arrays.asList(this.dependencies));
    }

    dependencies.addAll(getTestDependencies());

    TargetPlatform testTargetPlatform =
        platformResolver.resolvePlatform(session, project, reactorProjects, dependencies);

    if (testTargetPlatform == null) {
      throw new MojoExecutionException(
          "Cannot determinate build target platform location -- not executing tests");
    }

    work.mkdirs();

    EquinoxInstallationDescription testRuntime = new DefaultEquinoxInstallationDescription();
    testRuntime.addBundlesToExplode(getBundlesToExplode());
    testRuntime.addFrameworkExtensions(getFrameworkExtensions());
    if (bundleStartLevel != null) {
      for (BundleStartLevel level : bundleStartLevel) {
        testRuntime.addBundleStartLevel(level);
      }
    }

    BundleProject projectType = (BundleProject) projectTypes.get(project.getPackaging());
    String testFramework = new TestFramework().getTestFramework(projectType.getClasspath(project));
    if (testFramework == null) {
      throw new MojoExecutionException(
          "Could not determine test framework used by test bundle " + project.toString());
    }
    getLog().debug("Using test framework " + testFramework);

    for (ArtifactDescriptor artifact :
        testTargetPlatform.getArtifacts(ArtifactKey.TYPE_ECLIPSE_PLUGIN)) {
      // note that this project is added as directory structure rooted at project basedir.
      // project classes and test-classes are added via dev.properties file (see
      // #createDevProperties())
      // all other projects are added as bundle jars.
      ReactorProject otherProject = artifact.getMavenProject();
      if (otherProject != null) {
        if (otherProject.sameProject(project)) {
          testRuntime.addBundle(artifact.getKey(), project.getBasedir());
          continue;
        }
        File file = otherProject.getArtifact();
        if (file != null) {
          testRuntime.addBundle(artifact.getKey(), file);
          continue;
        }
      }
      testRuntime.addBundle(artifact);
    }

    Set<File> surefireBundles = getSurefirePlugins(testFramework);
    for (File file : surefireBundles) {
      testRuntime.addBundle(getBundleArtifacyKey(file), file, true);
    }

    createDevProperties(includeReactorProjects, reactorProjects);
    createSurefireProperties(
        projectType.getArtifactKey(DefaultReactorProject.adapt(project)).getId(), testFramework);

    reportsDirectory.mkdirs();
    return installationFactory.createInstallation(testRuntime, work);
  }