Fix maven-shared-utils patch

This commit is contained in:
Mikolaj Izdebski 2021-05-17 07:40:27 +02:00
parent a0fab08cc2
commit a8af719ee4
3 changed files with 118 additions and 23 deletions

View File

@ -1,4 +1,4 @@
From 14196b58bc1d96d76636914b575dc22b7cc94b1a Mon Sep 17 00:00:00 2001
From 85887dc85709e8719db0becc17adacd905dcd579 Mon Sep 17 00:00:00 2001
From: Mikolaj Izdebski <mizdebsk@redhat.com>
Date: Mon, 10 Jul 2017 10:37:50 +0200
Subject: [PATCH 1/3] Port to TestNG 6.11
@ -9,7 +9,7 @@ Subject: [PATCH 1/3] Port to TestNG 6.11
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/surefire-providers/surefire-testng/pom.xml b/surefire-providers/surefire-testng/pom.xml
index 49e75b6ea..a9db4a8d9 100644
index 1ce2888..bf93114 100644
--- a/surefire-providers/surefire-testng/pom.xml
+++ b/surefire-providers/surefire-testng/pom.xml
@@ -51,8 +51,7 @@
@ -23,10 +23,10 @@ index 49e75b6ea..a9db4a8d9 100644
</dependency>
</dependencies>
diff --git a/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/conf/AbstractDirectConfigurator.java b/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/conf/AbstractDirectConfigurator.java
index e9667316b..7021ef561 100644
index e966731..7021ef5 100644
--- a/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/conf/AbstractDirectConfigurator.java
+++ b/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/conf/AbstractDirectConfigurator.java
@@ -63,7 +63,7 @@ public void configure( TestNG testng, Map<String, String> options )
@@ -63,7 +63,7 @@ public abstract class AbstractDirectConfigurator
testng.setUseDefaultListeners( false );
configureInstance( testng, options );
// TODO: we should have the Profile so that we can decide if this is needed or not
@ -36,5 +36,5 @@ index e9667316b..7021ef561 100644
@Override
--
2.25.2
2.30.2

View File

@ -1,7 +1,7 @@
From 21890515f3eeba73065b79b6a65678ec1e2a821d Mon Sep 17 00:00:00 2001
From 61a123e7dd146933570a252f147fa83666363de3 Mon Sep 17 00:00:00 2001
From: Mikolaj Izdebski <mizdebsk@redhat.com>
Date: Mon, 27 Apr 2020 10:45:30 +0200
Subject: [PATCH 3/3] Disable JUnit 4.8 test grouping
Subject: [PATCH 2/3] Disable JUnit 4.8 test grouping
---
.../surefire/junitcore/JUnitCoreProvider.java | 25 +++--------------
@ -9,10 +9,10 @@ Subject: [PATCH 3/3] Disable JUnit 4.8 test grouping
2 files changed, 3 insertions(+), 49 deletions(-)
diff --git a/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreProvider.java b/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreProvider.java
index 7c74e8b86..c86bb276c 100644
index 7c74e8b..c86bb27 100644
--- a/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreProvider.java
+++ b/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreProvider.java
@@ -25,7 +25,6 @@
@@ -25,7 +25,6 @@ import org.apache.maven.surefire.booter.CommandReader;
import org.apache.maven.surefire.common.junit4.JUnit4RunListener;
import org.apache.maven.surefire.common.junit4.JUnitTestFailureListener;
import org.apache.maven.surefire.common.junit4.Notifier;
@ -20,7 +20,7 @@ index 7c74e8b86..c86bb276c 100644
import org.apache.maven.surefire.common.junit48.JUnit48Reflector;
import org.apache.maven.surefire.common.junit48.JUnit48TestChecker;
import org.apache.maven.surefire.providerapi.AbstractProvider;
@@ -47,6 +46,7 @@
@@ -47,6 +46,7 @@ import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import static org.apache.maven.surefire.booter.CommandReader.getReader;
@ -28,7 +28,7 @@ index 7c74e8b86..c86bb276c 100644
import static org.apache.maven.surefire.common.junit4.JUnit4ProviderUtil.generateFailingTestDescriptions;
import static org.apache.maven.surefire.common.junit4.JUnit4RunListenerFactory.createCustomListeners;
import static org.apache.maven.surefire.common.junit4.Notifier.pureNotifier;
@@ -126,7 +126,7 @@ public RunResult invoke( Object forkTestSet )
@@ -126,7 +126,7 @@ public class JUnitCoreProvider
new Notifier( createRunListener( reporterFactory, consoleStream ), getSkipAfterFailureCount() );
// startCapture() called in createRunListener() in prior to setTestsToRun()
@ -37,7 +37,7 @@ index 7c74e8b86..c86bb276c 100644
if ( testsToRun == null )
{
@@ -168,8 +168,7 @@ public RunResult invoke( Object forkTestSet )
@@ -168,8 +168,7 @@ public class JUnitCoreProvider
{
Set<Description> failures = generateFailingTestDescriptions( testFailureListener.getAllFailures() );
testFailureListener.reset();
@ -47,7 +47,7 @@ index 7c74e8b86..c86bb276c 100644
rerunCore.execute( testsToRun, failureDescriptionFilter );
}
}
@@ -270,24 +269,6 @@ private boolean isParallelTypes()
@@ -270,24 +269,6 @@ public class JUnitCoreProvider
return jUnitCoreParameters.isParallelClasses() || jUnitCoreParameters.isParallelSuites();
}
@ -73,10 +73,10 @@ index 7c74e8b86..c86bb276c 100644
{
TestsToRun scanned = scanResult.applyFilter( scannerFilter, testClassLoader );
diff --git a/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGExecutor.java b/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGExecutor.java
index 6bc30a300..05c55f55a 100644
index 6bc30a3..05c55f5 100644
--- a/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGExecutor.java
+++ b/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGExecutor.java
@@ -237,36 +237,9 @@ private static XmlMethodSelector createMethodNameFilteringSelector( TestListReso
@@ -237,36 +237,9 @@ final class TestNGExecutor
private static XmlMethodSelector createGroupMatchingSelector( Map<String, String> options )
throws TestSetFailedException
{
@ -114,5 +114,5 @@ index 6bc30a300..05c55f55a 100644
static void run( List<String> suiteFiles, String testSourceDirectory,
--
2.25.2
2.30.2

View File

@ -1,17 +1,18 @@
From 980a109bd3607f1035097d6ad923f82cc58c95d2 Mon Sep 17 00:00:00 2001
From bc4f6405bb6ca0a5c0313edf878c51d5d5af9ffa Mon Sep 17 00:00:00 2001
From: Marian Koncek <mkoncek@redhat.com>
Date: Fri, 11 Sep 2020 12:17:15 +0200
Subject: [PATCH] Port to maven-shared-utils 3.3.3
Subject: [PATCH 3/3] Port to maven-shared-utils 3.3.3
---
.../DefaultForkConfiguration.java | 26 ++++++++++++-------
1 file changed, 16 insertions(+), 10 deletions(-)
.../surefire/report/StatelessXmlReporter.java | 20 +++++++-------
2 files changed, 26 insertions(+), 20 deletions(-)
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/DefaultForkConfiguration.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/DefaultForkConfiguration.java
index fa9945123..ed75ecdff 100644
index 4ab4435..1ce348b 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/DefaultForkConfiguration.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/DefaultForkConfiguration.java
@@ -42,6 +42,8 @@
@@ -42,6 +42,8 @@ import static org.apache.maven.plugin.surefire.util.Relocator.relocate;
import static org.apache.maven.plugin.surefire.SurefireHelper.replaceThreadNumberPlaceholders;
import static org.apache.maven.surefire.booter.Classpath.join;
@ -20,7 +21,7 @@ index fa9945123..ed75ecdff 100644
/**
* Basic framework which constructs CLI.
*
@@ -131,17 +133,21 @@ public OutputStreamFlushableCommandline createCommandLine( @Nonnull StartupConfi
@@ -135,17 +137,21 @@ public abstract class DefaultForkConfiguration
cli.setExecutable( getJdkForTests().getJvmExecutable() );
@ -52,6 +53,100 @@ index fa9945123..ed75ecdff 100644
}
resolveClasspath( cli, findStartClass( config ), config, dumpLogDirectory );
--
2.26.2
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporter.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporter.java
index fcb066e..bfe894e 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporter.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporter.java
@@ -200,7 +200,7 @@ public class StatelessXmlReporter
}
private void serializeTestClass( OutputStream outputStream, OutputStreamWriter fw, XMLWriter ppw,
- List<WrappedReportEntry> methodEntries )
+ List<WrappedReportEntry> methodEntries ) throws IOException
{
if ( rerunFailingTestsCount > 0 )
{
@@ -215,7 +215,7 @@ public class StatelessXmlReporter
}
private void serializeTestClassWithoutRerun( OutputStream outputStream, OutputStreamWriter fw, XMLWriter ppw,
- List<WrappedReportEntry> methodEntries )
+ List<WrappedReportEntry> methodEntries ) throws IOException
{
for ( WrappedReportEntry methodEntry : methodEntries )
{
@@ -231,7 +231,7 @@ public class StatelessXmlReporter
}
private void serializeTestClassWithRerun( OutputStream outputStream, OutputStreamWriter fw, XMLWriter ppw,
- List<WrappedReportEntry> methodEntries )
+ List<WrappedReportEntry> methodEntries ) throws IOException
{
WrappedReportEntry firstMethodEntry = methodEntries.get( 0 );
switch ( getTestResultType( methodEntries ) )
@@ -369,7 +369,7 @@ public class StatelessXmlReporter
return new File( reportsDirectory, stripIllegalFilenameChars( customizedReportName + ".xml" ) );
}
- private void startTestElement( XMLWriter ppw, WrappedReportEntry report )
+ private void startTestElement( XMLWriter ppw, WrappedReportEntry report ) throws IOException
{
ppw.startElement( "testcase" );
String name = phrasedMethodName ? report.getReportName() : report.getName();
@@ -390,7 +390,7 @@ public class StatelessXmlReporter
ppw.addAttribute( "time", report.elapsedTimeAsString() );
}
- private void createTestSuiteElement( XMLWriter ppw, WrappedReportEntry report, TestSetStats testSetStats )
+ private void createTestSuiteElement( XMLWriter ppw, WrappedReportEntry report, TestSetStats testSetStats ) throws IOException
{
ppw.startElement( "testsuite" );
@@ -420,7 +420,7 @@ public class StatelessXmlReporter
private static void getTestProblems( OutputStreamWriter outputStreamWriter, XMLWriter ppw,
WrappedReportEntry report, boolean trimStackTrace, OutputStream fw,
- String testErrorType, boolean createOutErrElementsInside )
+ String testErrorType, boolean createOutErrElementsInside ) throws IOException
{
ppw.startElement( testErrorType );
@@ -477,7 +477,7 @@ public class StatelessXmlReporter
// Create system-out and system-err elements
private static void createOutErrElements( OutputStreamWriter outputStreamWriter, XMLWriter ppw,
- WrappedReportEntry report, OutputStream fw )
+ WrappedReportEntry report, OutputStream fw ) throws IOException
{
EncodingOutputStream eos = new EncodingOutputStream( fw );
addOutputStreamElement( outputStreamWriter, eos, ppw, report.getStdout(), "system-out" );
@@ -487,7 +487,7 @@ public class StatelessXmlReporter
private static void addOutputStreamElement( OutputStreamWriter outputStreamWriter,
EncodingOutputStream eos, XMLWriter xmlWriter,
Utf8RecodingDeferredFileOutputStream utf8RecodingDeferredFileOutputStream,
- String name )
+ String name ) throws IOException
{
if ( utf8RecodingDeferredFileOutputStream != null && utf8RecodingDeferredFileOutputStream.getByteCount() > 0 )
{
@@ -517,7 +517,7 @@ public class StatelessXmlReporter
*
* @param xmlWriter The test suite to report to
*/
- private static void showProperties( XMLWriter xmlWriter, Map<String, String> systemProperties )
+ private static void showProperties( XMLWriter xmlWriter, Map<String, String> systemProperties ) throws IOException
{
xmlWriter.startElement( "properties" );
for ( final Entry<String, String> entry : systemProperties.entrySet() )
@@ -559,7 +559,7 @@ public class StatelessXmlReporter
* @param message The string
*/
private static void extraEscapeElementValue( String message, OutputStreamWriter outputStreamWriter,
- XMLWriter xmlWriter, OutputStream fw )
+ XMLWriter xmlWriter, OutputStream fw ) throws IOException
{
// Someday convert to xml 1.1 which handles everything but 0 inside string
if ( containsEscapesIllegalXml10( message ) )
--
2.30.2