0a4f232
From 7aae9528d45e45602cf27122c07a065d47a8418d Mon Sep 17 00:00:00 2001
0a4f232
From: Mat Booth <mat.booth@redhat.com>
0a4f232
Date: Mon, 8 Feb 2021 13:49:24 +0000
0a4f232
Subject: [PATCH 7/7] Accomodate API change in surefire 3.0.0~M4
0a4f232
0a4f232
---
0a4f232
 .../META-INF/MANIFEST.MF                        |  1 +
0a4f232
 .../pom.xml                                     |  5 +++++
0a4f232
 .../surefire/osgibooter/OsgiSurefireBooter.java | 17 +++++++++++++----
0a4f232
 3 files changed, 19 insertions(+), 4 deletions(-)
0a4f232
0a4f232
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
0a4f232
index 9ad1c2e..4ad1fe9 100644
0a4f232
--- a/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/META-INF/MANIFEST.MF
0a4f232
+++ b/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/META-INF/MANIFEST.MF
0a4f232
@@ -8,6 +8,7 @@ Bundle-ClassPath: .,
0a4f232
  jars/surefire-booter-2.22.2.jar,
0a4f232
  jars/surefire-api-2.22.2.jar,
0a4f232
  jars/surefire-logger-api-2.22.2.jar,
0a4f232
+ jars/surefire-extensions-api-2.22.2.jar,
0a4f232
  jars/maven-surefire-common-2.22.2.jar
0a4f232
 Bundle-Name: Tycho Surefire OSGi Booter Eclipse Application
0a4f232
 Bundle-ManifestVersion: 2
0a4f232
diff --git a/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/pom.xml b/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/pom.xml
0a4f232
index 1ab4254..8255509 100644
0a4f232
--- a/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/pom.xml
0a4f232
+++ b/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/pom.xml
0a4f232
@@ -57,6 +57,11 @@
0a4f232
 									<artifactId>surefire-api</artifactId>
0a4f232
 									<version>${surefire-version}</version>
0a4f232
 								</artifactItem>
0a4f232
+								<artifactItem>
0a4f232
+									<groupId>org.apache.maven.surefire</groupId>
0a4f232
+									<artifactId>surefire-extensions-api</artifactId>
0a4f232
+									<version>${surefire-version}</version>
0a4f232
+								</artifactItem>
0a4f232
 								<artifactItem>
0a4f232
 									<groupId>org.apache.maven.surefire</groupId>
0a4f232
 									<artifactId>surefire-logger-api</artifactId>
0a4f232
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
0a4f232
index 3680799..165c9a3 100644
0a4f232
--- a/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/src/main/java/org/eclipse/tycho/surefire/osgibooter/OsgiSurefireBooter.java
0a4f232
+++ b/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/src/main/java/org/eclipse/tycho/surefire/osgibooter/OsgiSurefireBooter.java
0a4f232
@@ -28,6 +28,9 @@ import java.util.Properties;
0a4f232
 import java.util.Set;
0a4f232
 
0a4f232
 import org.apache.maven.plugin.surefire.StartupReportConfiguration;
0a4f232
+import org.apache.maven.plugin.surefire.extensions.SurefireConsoleOutputReporter;
0a4f232
+import org.apache.maven.plugin.surefire.extensions.SurefireStatelessReporter;
0a4f232
+import org.apache.maven.plugin.surefire.extensions.SurefireStatelessTestsetInfoReporter;
0a4f232
 import org.apache.maven.plugin.surefire.log.api.PrintStreamLogger;
0a4f232
 import org.apache.maven.plugin.surefire.report.ConsoleReporter;
0a4f232
 import org.apache.maven.plugin.surefire.report.DefaultReporterFactory;
0a4f232
@@ -93,7 +96,7 @@ public class OsgiSurefireBooter {
0a4f232
 
0a4f232
         ClasspathConfiguration classPathConfig = new ClasspathConfiguration(false, false);
0a4f232
         StartupConfiguration startupConfiguration = new StartupConfiguration(provider, classPathConfig,
0a4f232
-                new ClassLoaderConfiguration(useSystemClassloader, useManifestOnlyJar), forkRequested, inForkedVM);
0a4f232
+                new ClassLoaderConfiguration(useSystemClassloader, useManifestOnlyJar), forkRequested, inForkedVM, null);
0a4f232
         // TODO dir scanning with no includes done here (done in TestMojo already) 
0a4f232
         // but without dirScannerParams we get an NPE accessing runOrder
0a4f232
         DirectoryScannerParameters dirScannerParams = new DirectoryScannerParameters(testClassesDir,
0a4f232
@@ -106,11 +109,17 @@ public class OsgiSurefireBooter {
0a4f232
                 new RunOrderParameters(runOrder, null), failIfNoTests, reporterConfig, null, testRequest,
0a4f232
                 extractProviderProperties(testProps), null, false, Collections.<CommandLineOption> emptyList(),
0a4f232
                 skipAfterFailureCount, Shutdown.DEFAULT, 30);
0a4f232
+
0a4f232
+        SurefireStatelessReporter xmlReporter = new SurefireStatelessReporter(disableXmlReport, "3.0" );
0a4f232
+        xmlReporter.setDisable(disableXmlReport);
0a4f232
+        SurefireConsoleOutputReporter outReporter = new SurefireConsoleOutputReporter();
0a4f232
+        SurefireStatelessTestsetInfoReporter testsetReporter = new SurefireStatelessTestsetInfoReporter();
0a4f232
+
0a4f232
         StartupReportConfiguration startupReportConfig = new StartupReportConfiguration(useFile, printSummary,
0a4f232
-                ConsoleReporter.PLAIN, redirectTestOutputToFile, disableXmlReport, reportsDir, trimStackTrace, null,
0a4f232
-                new File(reportsDir, "TESTHASH"), false, rerunFailingTestsCount, XSD, null, false);
0a4f232
+                ConsoleReporter.PLAIN, redirectTestOutputToFile, reportsDir, trimStackTrace, null,
0a4f232
+                new File(reportsDir, "TESTHASH"), false, rerunFailingTestsCount, XSD, null, false, xmlReporter, outReporter, testsetReporter);
0a4f232
         ReporterFactory reporterFactory = new DefaultReporterFactory(startupReportConfig,
0a4f232
-                new PrintStreamLogger(startupReportConfig.getOriginalSystemOut()));
0a4f232
+                new PrintStreamLogger(System.out));
0a4f232
         // API indicates we should use testClassLoader below but surefire also tries 
0a4f232
         // to load surefire classes using this classloader
0a4f232
         RunResult result = ProviderFactory.invokeProvider(null, createCombinedClassLoader(testPlugin), reporterFactory,
0a4f232
-- 
0a4f232
2.28.0
0a4f232