Blob Blame History Raw
From 7aae9528d45e45602cf27122c07a065d47a8418d Mon Sep 17 00:00:00 2001
From: Mat Booth <mat.booth@redhat.com>
Date: Mon, 8 Feb 2021 13:49:24 +0000
Subject: [PATCH 7/7] Accomodate API change in surefire 3.0.0~M4

---
 .../META-INF/MANIFEST.MF                        |  1 +
 .../pom.xml                                     |  5 +++++
 .../surefire/osgibooter/OsgiSurefireBooter.java | 17 +++++++++++++----
 3 files changed, 19 insertions(+), 4 deletions(-)

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 9ad1c2e..4ad1fe9 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
@@ -8,6 +8,7 @@ Bundle-ClassPath: .,
  jars/surefire-booter-2.22.2.jar,
  jars/surefire-api-2.22.2.jar,
  jars/surefire-logger-api-2.22.2.jar,
+ jars/surefire-extensions-api-2.22.2.jar,
  jars/maven-surefire-common-2.22.2.jar
 Bundle-Name: Tycho Surefire OSGi Booter Eclipse Application
 Bundle-ManifestVersion: 2
diff --git a/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/pom.xml b/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/pom.xml
index 1ab4254..8255509 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 @@
 									<artifactId>surefire-api</artifactId>
 									<version>${surefire-version}</version>
 								</artifactItem>
+								<artifactItem>
+									<groupId>org.apache.maven.surefire</groupId>
+									<artifactId>surefire-extensions-api</artifactId>
+									<version>${surefire-version}</version>
+								</artifactItem>
 								<artifactItem>
 									<groupId>org.apache.maven.surefire</groupId>
 									<artifactId>surefire-logger-api</artifactId>
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 3680799..165c9a3 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
@@ -28,6 +28,9 @@ import java.util.Properties;
 import java.util.Set;
 
 import org.apache.maven.plugin.surefire.StartupReportConfiguration;
+import org.apache.maven.plugin.surefire.extensions.SurefireConsoleOutputReporter;
+import org.apache.maven.plugin.surefire.extensions.SurefireStatelessReporter;
+import org.apache.maven.plugin.surefire.extensions.SurefireStatelessTestsetInfoReporter;
 import org.apache.maven.plugin.surefire.log.api.PrintStreamLogger;
 import org.apache.maven.plugin.surefire.report.ConsoleReporter;
 import org.apache.maven.plugin.surefire.report.DefaultReporterFactory;
@@ -93,7 +96,7 @@ public class OsgiSurefireBooter {
 
         ClasspathConfiguration classPathConfig = new ClasspathConfiguration(false, false);
         StartupConfiguration startupConfiguration = new StartupConfiguration(provider, classPathConfig,
-                new ClassLoaderConfiguration(useSystemClassloader, useManifestOnlyJar), forkRequested, inForkedVM);
+                new ClassLoaderConfiguration(useSystemClassloader, useManifestOnlyJar), forkRequested, inForkedVM, null);
         // 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,
@@ -106,11 +109,17 @@ public class OsgiSurefireBooter {
                 new RunOrderParameters(runOrder, null), failIfNoTests, reporterConfig, null, testRequest,
                 extractProviderProperties(testProps), null, false, Collections.<CommandLineOption> emptyList(),
                 skipAfterFailureCount, Shutdown.DEFAULT, 30);
+
+        SurefireStatelessReporter xmlReporter = new SurefireStatelessReporter(disableXmlReport, "3.0" );
+        xmlReporter.setDisable(disableXmlReport);
+        SurefireConsoleOutputReporter outReporter = new SurefireConsoleOutputReporter();
+        SurefireStatelessTestsetInfoReporter testsetReporter = new SurefireStatelessTestsetInfoReporter();
+
         StartupReportConfiguration startupReportConfig = new StartupReportConfiguration(useFile, printSummary,
-                ConsoleReporter.PLAIN, redirectTestOutputToFile, disableXmlReport, reportsDir, trimStackTrace, null,
-                new File(reportsDir, "TESTHASH"), false, rerunFailingTestsCount, XSD, null, false);
+                ConsoleReporter.PLAIN, redirectTestOutputToFile, reportsDir, trimStackTrace, null,
+                new File(reportsDir, "TESTHASH"), false, rerunFailingTestsCount, XSD, null, false, xmlReporter, outReporter, testsetReporter);
         ReporterFactory reporterFactory = new DefaultReporterFactory(startupReportConfig,
-                new PrintStreamLogger(startupReportConfig.getOriginalSystemOut()));
+                new PrintStreamLogger(System.out));
         // API indicates we should use testClassLoader below but surefire also tries 
         // to load surefire classes using this classloader
         RunResult result = ProviderFactory.invokeProvider(null, createCombinedClassLoader(testPlugin), reporterFactory,
-- 
2.28.0