Update to work with maven-surefire 2.19.

This commit is contained in:
Roland Grunberg 2015-10-20 12:27:00 -04:00
parent 594d2bceca
commit 1b6f195d75
2 changed files with 202 additions and 37 deletions

View File

@ -1,4 +1,4 @@
From 3d497c3a1f153eeff65b5c336c3735afc2f5e02c Mon Sep 17 00:00:00 2001
From f72d45fb261a3910885a3073c33cc0f98f14392f Mon Sep 17 00:00:00 2001
From: Jan Sievers <jan.sievers@sap.com>
Date: Tue, 4 Sep 2012 16:02:52 +0200
Subject: [PATCH] Resolve all necessary dependencies for Tycho Surefire.
@ -15,32 +15,49 @@ the additional classes that are in the original jars used upstream.
Change-Id: I9ef0239eed887fa47c380efcdce968934c788c9f
---
.../org.eclipse.tycho.surefire.junit/META-INF/MANIFEST.MF | 5 +++--
tycho-surefire/org.eclipse.tycho.surefire.junit/pom.xml | 5 +++++
.../org.eclipse.tycho.surefire.junit4/META-INF/MANIFEST.MF | 4 +++-
tycho-surefire/org.eclipse.tycho.surefire.junit4/pom.xml | 10 ++++++++++
.../org.eclipse.tycho.surefire.junit47/META-INF/MANIFEST.MF | 4 +++-
tycho-surefire/org.eclipse.tycho.surefire.junit47/pom.xml | 10 ++++++++++
.../org.eclipse.tycho.surefire.osgibooter/META-INF/MANIFEST.MF | 3 ++-
tycho-surefire/org.eclipse.tycho.surefire.osgibooter/pom.xml | 5 +++++
8 files changed, 41 insertions(+), 5 deletions(-)
pom.xml | 2 +-
.../META-INF/MANIFEST.MF | 5 ++--
.../org.eclipse.tycho.surefire.junit/pom.xml | 5 ++++
.../META-INF/MANIFEST.MF | 4 +++-
.../org.eclipse.tycho.surefire.junit4/pom.xml | 10 ++++++++
.../META-INF/MANIFEST.MF | 8 ++++---
.../org.eclipse.tycho.surefire.junit47/pom.xml | 10 ++++++++
.../META-INF/MANIFEST.MF | 7 +++---
.../org.eclipse.tycho.surefire.osgibooter/pom.xml | 5 ++++
.../surefire/osgibooter/OsgiSurefireBooter.java | 17 +++++++++-----
tycho-surefire/pom.xml | 2 +-
.../java/org/eclipse/tycho/surefire/TestMojo.java | 27 +++++++++++++++++++---
12 files changed, 82 insertions(+), 20 deletions(-)
diff --git a/pom.xml b/pom.xml
index c43cc8d..6e5fde4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -380,7 +380,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
- <version>2.17</version>
+ <version>2.19</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
diff --git a/tycho-surefire/org.eclipse.tycho.surefire.junit/META-INF/MANIFEST.MF b/tycho-surefire/org.eclipse.tycho.surefire.junit/META-INF/MANIFEST.MF
index 985c901..d0ae690 100644
index da31140..fb5803f 100644
--- a/tycho-surefire/org.eclipse.tycho.surefire.junit/META-INF/MANIFEST.MF
+++ b/tycho-surefire/org.eclipse.tycho.surefire.junit/META-INF/MANIFEST.MF
@@ -6,6 +6,7 @@ Bundle-Version: 0.22.0
@@ -6,6 +6,7 @@ Bundle-Version: 0.23.0
Fragment-Host: org.eclipse.tycho.surefire.osgibooter;bundle-version="0.14.0"
Bundle-RequiredExecutionEnvironment: J2SE-1.5,
JavaSE-1.6
-Require-Bundle: org.junit;bundle-version="[3.8.0,4.0.0)"
-Bundle-ClassPath: jars/surefire-junit3-2.17.jar
+Require-Bundle: org.junit;bundle-version="[3.8.0,5.0.0)"
+Bundle-ClassPath: jars/surefire-junit3-2.17.jar,
+ jars/common-junit3-2.17.jar
+Bundle-ClassPath: jars/surefire-junit3-2.19.jar,
+ jars/common-junit3-2.19.jar
Bundle-Vendor: %providerName
diff --git a/tycho-surefire/org.eclipse.tycho.surefire.junit/pom.xml b/tycho-surefire/org.eclipse.tycho.surefire.junit/pom.xml
index 108286e..4093a2f 100644
index f99c319..0224cc6 100644
--- a/tycho-surefire/org.eclipse.tycho.surefire.junit/pom.xml
+++ b/tycho-surefire/org.eclipse.tycho.surefire.junit/pom.xml
@@ -44,6 +44,11 @@
@ -56,22 +73,22 @@ index 108286e..4093a2f 100644
</configuration>
</execution>
diff --git a/tycho-surefire/org.eclipse.tycho.surefire.junit4/META-INF/MANIFEST.MF b/tycho-surefire/org.eclipse.tycho.surefire.junit4/META-INF/MANIFEST.MF
index 41cf2a4..1f554ba 100644
index 50be5ea..0d8e8d8 100644
--- a/tycho-surefire/org.eclipse.tycho.surefire.junit4/META-INF/MANIFEST.MF
+++ b/tycho-surefire/org.eclipse.tycho.surefire.junit4/META-INF/MANIFEST.MF
@@ -6,7 +6,9 @@ Bundle-Version: 0.22.0
@@ -6,7 +6,9 @@ Bundle-Version: 0.23.0
Fragment-Host: org.eclipse.tycho.surefire.osgibooter;bundle-version="0.14.0"
Bundle-RequiredExecutionEnvironment: J2SE-1.5,
JavaSE-1.6
-Bundle-ClassPath: jars/surefire-junit4-2.17.jar
+Bundle-ClassPath: jars/surefire-junit4-2.17.jar,
+ jars/common-junit3-2.17.jar,
+ jars/common-junit4-2.17.jar
+Bundle-ClassPath: jars/surefire-junit4-2.19.jar,
+ jars/common-junit3-2.19.jar,
+ jars/common-junit4-2.19.jar
Import-Package: junit.framework;version="3.0.0",
org.junit;version="4.0.0",
org.junit.runner;version="4.0.0",
diff --git a/tycho-surefire/org.eclipse.tycho.surefire.junit4/pom.xml b/tycho-surefire/org.eclipse.tycho.surefire.junit4/pom.xml
index 8b5cf64..ae3b3b1 100644
index 9628b06..2a09e91 100644
--- a/tycho-surefire/org.eclipse.tycho.surefire.junit4/pom.xml
+++ b/tycho-surefire/org.eclipse.tycho.surefire.junit4/pom.xml
@@ -44,6 +44,16 @@
@ -92,22 +109,26 @@ index 8b5cf64..ae3b3b1 100644
</configuration>
</execution>
diff --git a/tycho-surefire/org.eclipse.tycho.surefire.junit47/META-INF/MANIFEST.MF b/tycho-surefire/org.eclipse.tycho.surefire.junit47/META-INF/MANIFEST.MF
index 6bb3710..ebac243 100644
index 595265b..1ac6c5d 100644
--- a/tycho-surefire/org.eclipse.tycho.surefire.junit47/META-INF/MANIFEST.MF
+++ b/tycho-surefire/org.eclipse.tycho.surefire.junit47/META-INF/MANIFEST.MF
@@ -8,7 +8,9 @@ Bundle-RequiredExecutionEnvironment: J2SE-1.5
@@ -6,9 +6,11 @@ Bundle-Version: 0.23.0
Fragment-Host: org.eclipse.tycho.surefire.osgibooter;bundle-version="0.16.0"
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ClassPath: .,
jars/surefire-junit47-2.17.jar,
jars/common-junit48-2.17.jar,
- jars/surefire-junit47-2.17.jar,
- jars/common-junit48-2.17.jar,
- jars/surefire-grouper-2.17.jar
+ jars/surefire-grouper-2.17.jar,
+ jars/common-junit3-2.17.jar,
+ jars/common-junit4-2.17.jar
+ jars/surefire-junit47-2.19.jar,
+ jars/common-junit48-2.19.jar,
+ jars/surefire-grouper-2.19.jar,
+ jars/common-junit3-2.19.jar,
+ jars/common-junit4-2.19.jar
Import-Package: junit.framework;version="3.0.0",
org.junit;version="[4.7,5)",
org.junit.runner;version="[4.7,5)",
diff --git a/tycho-surefire/org.eclipse.tycho.surefire.junit47/pom.xml b/tycho-surefire/org.eclipse.tycho.surefire.junit47/pom.xml
index ba08dc0..afadf96 100644
index dc49a46..db453ac 100644
--- a/tycho-surefire/org.eclipse.tycho.surefire.junit47/pom.xml
+++ b/tycho-surefire/org.eclipse.tycho.surefire.junit47/pom.xml
@@ -54,6 +54,16 @@
@ -128,21 +149,25 @@ index ba08dc0..afadf96 100644
</configuration>
</execution>
diff --git a/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/META-INF/MANIFEST.MF b/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/META-INF/MANIFEST.MF
index 6c9a366..dfe22ae 100644
index 991edc1..83732d5 100644
--- a/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/META-INF/MANIFEST.MF
+++ b/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/META-INF/MANIFEST.MF
@@ -7,7 +7,8 @@ Bundle-Version: 0.22.0
@@ -5,9 +5,10 @@ Require-Bundle: org.eclipse.osgi;bundle-version="3.2.2",
Eclipse-AutoStart: true
Bundle-Version: 0.23.0
Bundle-ClassPath: .,
jars/surefire-booter-2.17.jar,
jars/surefire-api-2.17.jar,
- jars/surefire-booter-2.17.jar,
- jars/surefire-api-2.17.jar,
- jars/maven-surefire-common-2.17.jar
+ jars/maven-surefire-common-2.17.jar,
+ jars/surefire-booter-2.19.jar,
+ jars/surefire-api-2.19.jar,
+ jars/maven-surefire-common-2.19.jar,
+ jars/plexus-utils-3.0.jar
Bundle-Name: Tycho Surefire OSGi Booter Eclipse Application (Incubation)
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.eclipse.tycho.surefire.osgibooter;singleton:=true
diff --git a/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/pom.xml b/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/pom.xml
index e457dce..6fd329f 100644
index 82700eb..3fbc3a3 100644
--- a/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/pom.xml
+++ b/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/pom.xml
@@ -57,6 +57,11 @@
@ -157,6 +182,143 @@ index e457dce..6fd329f 100644
</artifactItems>
</configuration>
</execution>
diff --git a/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/src/main/java/org/eclipse/tycho/surefire/osgibooter/OsgiSurefireBooter.java b/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/src/main/java/org/eclipse/tycho/surefire/osgibooter/OsgiSurefireBooter.java
index 19eeab9..7accf71 100644
--- a/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/src/main/java/org/eclipse/tycho/surefire/osgibooter/OsgiSurefireBooter.java
+++ b/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/src/main/java/org/eclipse/tycho/surefire/osgibooter/OsgiSurefireBooter.java
@@ -21,7 +21,9 @@ import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collections;
import java.util.Enumeration;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
@@ -34,7 +36,9 @@ import org.apache.maven.surefire.booter.ClasspathConfiguration;
import org.apache.maven.surefire.booter.ForkedBooter;
import org.apache.maven.surefire.booter.ProviderConfiguration;
import org.apache.maven.surefire.booter.ProviderFactory;
+import org.apache.maven.surefire.booter.Shutdown;
import org.apache.maven.surefire.booter.StartupConfiguration;
+import org.apache.maven.surefire.cli.CommandLineOption;
import org.apache.maven.surefire.report.ReporterConfiguration;
import org.apache.maven.surefire.report.ReporterFactory;
import org.apache.maven.surefire.suite.RunResult;
@@ -75,13 +79,14 @@ public class OsgiSurefireBooter {
new ClassLoaderConfiguration(useSystemClassloader, useManifestOnlyJar), forkRequested, inForkedVM);
// TODO dir scanning with no includes done here (done in TestMojo already)
// but without dirScannerParams we get an NPE accessing runOrder
- DirectoryScannerParameters dirScannerParams = new DirectoryScannerParameters(testClassesDir, emptyList(),
- emptyList(), emptyList(), failIfNoTests, runOrder);
+ DirectoryScannerParameters dirScannerParams = new DirectoryScannerParameters(testClassesDir, Collections.<String>emptyList(),
+ Collections.<String>emptyList(), Collections.<String>emptyList(), failIfNoTests, runOrder);
ReporterConfiguration reporterConfig = new ReporterConfiguration(reportsDir, trimStacktrace);
TestRequest testRequest = new TestRequest(null, testClassesDir, null);
ProviderConfiguration providerConfiguration = new ProviderConfiguration(dirScannerParams,
new RunOrderParameters(runOrder, null), failIfNoTests, reporterConfig, null, testRequest,
- extractProviderProperties(testProps), null, false);
+ extractProviderProperties(testProps), null, false, Collections.<CommandLineOption>emptyList(),
+ 0, Shutdown.DEFAULT);
StartupReportConfiguration startupReportConfig = new StartupReportConfiguration(useFile, printSummary,
StartupReportConfiguration.PLAIN_REPORT_FORMAT, redirectTestOutputToFile, disableXmlReport, reportsDir,
trimStacktrace, null, "TESTHASH", false, 0);
@@ -103,12 +108,12 @@ public class OsgiSurefireBooter {
/*
* See TestMojo#mergeProviderProperties
*/
- private static Properties extractProviderProperties(Properties surefireProps) {
- Properties providerProps = new Properties();
+ private static Map<String, String> extractProviderProperties(Properties surefireProps) {
+ Map<String, String> providerProps = new HashMap<String, String>();
for (Map.Entry entry : surefireProps.entrySet()) {
String key = (String) entry.getKey();
if (key.startsWith("__provider.")) {
- providerProps.put(key.substring("__provider.".length()), entry.getValue());
+ providerProps.put(key.substring("__provider.".length()), (String)entry.getValue());
}
}
return providerProps;
diff --git a/tycho-surefire/pom.xml b/tycho-surefire/pom.xml
index cb2b826..bbe5f29 100644
--- a/tycho-surefire/pom.xml
+++ b/tycho-surefire/pom.xml
@@ -26,7 +26,7 @@
<name>Tycho Surefire Parent (Incubation)</name>
<properties>
- <surefire-version>2.17</surefire-version>
+ <surefire-version>2.19</surefire-version>
<!-- NOTE: when updating surefire version above, run BND manually to find Import-Package
statements to JUnit packages required for org.eclipse.tycho.surefire.junit* OSGi wrappers.
Surefire jars are shaded but not fully self-contained (various package dependencies to org.apache.maven.*
diff --git a/tycho-surefire/tycho-surefire-plugin/src/main/java/org/eclipse/tycho/surefire/TestMojo.java b/tycho-surefire/tycho-surefire-plugin/src/main/java/org/eclipse/tycho/surefire/TestMojo.java
index 9f1e332..62a16fb 100644
--- a/tycho-surefire/tycho-surefire-plugin/src/main/java/org/eclipse/tycho/surefire/TestMojo.java
+++ b/tycho-surefire/tycho-surefire-plugin/src/main/java/org/eclipse/tycho/surefire/TestMojo.java
@@ -20,6 +20,7 @@ import java.net.MalformedURLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
+import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@@ -45,6 +46,7 @@ import org.apache.maven.plugins.annotations.ResolutionScope;
import org.apache.maven.project.MavenProject;
import org.apache.maven.repository.RepositorySystem;
import org.apache.maven.surefire.booter.ProviderParameterNames;
+import org.apache.maven.surefire.testset.TestListResolver;
import org.apache.maven.surefire.util.DefaultScanResult;
import org.apache.maven.surefire.util.ScanResult;
import org.apache.maven.toolchain.Toolchain;
@@ -835,7 +837,7 @@ public class TestMojo extends AbstractMojo {
p.put("failifnotests", String.valueOf(failIfNoTests));
p.put("runOrder", runOrder);
- Properties mergedProviderProperties = getMergedProviderProperties();
+ Map<String, String> mergedProviderProperties = getMergedProviderPropertiesMap();
ScanResult scanResult = scanForTests();
scanResult.writeTo(mergedProviderProperties);
for (Map.Entry<?, ?> entry : mergedProviderProperties.entrySet()) {
@@ -862,6 +864,24 @@ public class TestMojo extends AbstractMojo {
return result;
}
+ private Map<String, String> getMergedProviderPropertiesMap() {
+ Map<String, String> result = new HashMap<String, String>();
+ for (Map.Entry e : providerProperties.entrySet()) {
+ result.put((String) e.getKey(), (String) e.getValue());
+ }
+ if (parallel != null) {
+ result.put(ProviderParameterNames.PARALLEL_PROP, parallel.name());
+ if (threadCount > 0) {
+ result.put(ProviderParameterNames.THREADCOUNT_PROP, String.valueOf(threadCount));
+ }
+ result.put(/* JUnitCoreParameters.PERCORETHREADCOUNT_KEY */"perCoreThreadCount",
+ String.valueOf(perCoreThreadCount));
+ result.put(/* JUnitCoreParameters.USEUNLIMITEDTHREADS_KEY */"useUnlimitedThreads",
+ String.valueOf(useUnlimitedThreads));
+ }
+ return result;
+ }
+
protected ScanResult scanForTests() {
List<String> defaultIncludes = Arrays.asList("**/Test*.class", "**/*Test.class", "**/*TestCase.class");
List<String> defaultExcludes = Arrays.asList("**/*$*");
@@ -879,8 +899,9 @@ public class TestMojo extends AbstractMojo {
} else {
includeList = defaultIncludes;
}
- DirectoryScanner scanner = new DirectoryScanner(testClassesDirectory, includeList, excludes != null ? excludes
- : defaultExcludes, Collections.<String> emptyList());
+ DirectoryScanner scanner = new DirectoryScanner(testClassesDirectory,
+ new TestListResolver(includeList, excludes != null ? excludes : defaultExcludes),
+ new TestListResolver(Collections.<String> emptyList()));
DefaultScanResult scanResult = scanner.scan();
return scanResult;
}
--
1.9.3
2.4.3

View File

@ -27,7 +27,7 @@
Name: %{?scl_prefix}tycho
Version: 0.23.0
Release: 9%{?dist}
Release: 10%{?dist}
Summary: Plugins and extensions for building Eclipse plugins and OSGI bundles with Maven
# license file is missing but all files having some licensing information are ASL 2.0
@ -422,6 +422,9 @@ ln -s %{_javadir}/tycho/org.fedoraproject.p2.jar %{buildroot}%{_datadir}/xmvn/li
%{_javadocdir}/tycho
%changelog
* Tue Oct 20 2015 Roland Grunberg <rgrunber@redhat.com> - 0.23.0-10
- Update to work with maven-surefire 2.19.
* Thu Aug 27 2015 Roland Grunberg <rgrunber@redhat.com> - 0.23.0-9
- fedoraproject-p2: Enable support for p2 Droplets.