This is an automated email from the ASF dual-hosted git repository. sjaranowski pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/maven-surefire.git
The following commit(s) were added to refs/heads/master by this push: new 76c6233 [SUREFIRE-1955] Switch project to Java 8 76c6233 is described below commit 76c6233b8b44e8d1b40d758fcab4f7ff48ec1aad Author: Slawomir Jaranowski <s.jaranow...@gmail.com> AuthorDate: Fri Dec 24 14:24:19 2021 +0100 [SUREFIRE-1955] Switch project to Java 8 --- Jenkinsfile | 36 ++++------ README.md | 10 +-- maven-failsafe-plugin/pom.xml | 5 -- .../plugin/surefire/AbstractSurefireMojoTest.java | 14 ++-- .../extensions/ConsoleOutputReporterTest.java | 41 +++++------ .../surefire/extensions/StatelessReporterTest.java | 44 ++++++------ .../StatelessTestsetInfoReporterTest.java | 10 +-- .../src/site/apt/developing.apt.vm | 7 +- pom.xml | 80 ++++------------------ .../api/stream/AbstractStreamDecoderTest.java | 31 +++++---- surefire-its/pom.xml | 1 - surefire-its/src/test/resources/toolchains.xml | 2 +- surefire-providers/surefire-junit-platform/pom.xml | 29 -------- 13 files changed, 104 insertions(+), 206 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index f944e22..2ef2b4a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -32,7 +32,7 @@ properties( final def oses = ['linux':'ubuntu', 'windows':'windows-he'] final def mavens = env.BRANCH_NAME == 'master' ? ['3.6.x', '3.2.x'] : ['3.2.x'] // all non-EOL versions and the first EA -final def jdks = [18, 17, 8, 7] +final def jdks = [18, 17, 8] final def options = ['-e', '-V', '-B', '-nsu', '-P', 'run-its'] final def goals = ['clean', 'install'] @@ -44,22 +44,19 @@ oses.eachWithIndex { osMapping, indexOfOs -> jdks.eachWithIndex { jdk, indexOfJdk -> def os = osMapping.key def label = osMapping.value - final String jdkTestName = jenkinsEnv.jdkFromVersion(os, jdk.toString()) - final String jdkName = jenkinsEnv.jdkFromVersion(os, '8') + final String jdkName = jenkinsEnv.jdkFromVersion(os, jdk.toString()) final String mvnName = jenkinsEnv.mvnFromVersion(os, maven) final String stageKey = "${os}-jdk${jdk}-maven${maven}" -// Referenses for TLS: -// https://central.sonatype.org/articles/2018/May/04/discontinued-support-for-tlsv11-and-below/?__hstc=31049440.ab2fd229e7f8b6176196d9f78621e1f5.1534324377408.1534324377408.1534324377408.1&__hssc=31049440.1.1534324377409&__hsfp=2729160845 def mavenOpts = '-Xms64m -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn' mavenOpts += (os == 'linux' ? ' -Xmx1g' : ' -Xmx256m') - if (label == null || jdkTestName == null || mvnName == null) { + if (label == null || jdkName == null || mvnName == null) { println "Skipping ${stageKey} as unsupported by Jenkins Environment." return } - println "${stageKey} ==> Label: ${label}, JDK: ${jdkTestName}, Maven: ${mvnName}." + println "${stageKey} ==> Label: ${label}, JDK: ${jdkName}, Maven: ${mvnName}." stages[stageKey] = { node(label) { @@ -67,14 +64,12 @@ oses.eachWithIndex { osMapping, indexOfOs -> boolean first = indexOfOs == 0 && indexOfMaven == 0 && indexOfJdk == 0 def failsafeItPort = 8000 + 100 * indexOfMaven + 10 * indexOfJdk def allOptions = options + ['-Djava.awt.headless=true', "-Dfailsafe-integration-test-port=${failsafeItPort}", "-Dfailsafe-integration-test-stop-port=${1 + failsafeItPort}"] - if (jdk == 7) { - allOptions += '-Dhttps.protocols=TLSv1.2' - } + if (!maven.startsWith('3.2') && !maven.startsWith('3.3') && !maven.startsWith('3.5')) { allOptions += '--no-transfer-progress' } ws(dir: "${os == 'windows' ? "${TEMP}\\${BUILD_TAG}" : pwd()}") { - buildProcess(stageKey, jdkName, jdkTestName, mvnName, first ? goalsDepl : goals, allOptions, mavenOpts, first) + buildProcess(stageKey, jdkName, mvnName, first ? goalsDepl : goals, allOptions, mavenOpts, first) } } } @@ -118,7 +113,7 @@ timeout(time: 12, unit: 'HOURS') { } } -def buildProcess(String stageKey, String jdkName, String jdkTestName, String mvnName, goals, options, mavenOpts, boolean makeReports) { +def buildProcess(String stageKey, String jdkName, String mvnName, goals, options, mavenOpts, boolean makeReports) { cleanWs() def errorStatus = -99 try { @@ -135,7 +130,6 @@ def buildProcess(String stageKey, String jdkName, String jdkTestName, String mvn assert mvnLocalRepoDir != null : 'Local Maven Repository is undefined.' def properties = ["-Djacoco.skip=${!makeReports}", "\"-Dmaven.repo.local=${mvnLocalRepoDir}\""] - println "Setting JDK for testing ${jdkTestName}" def cmd = ['mvn'] + goals + options + properties stage("build ${stageKey}") { @@ -146,25 +140,21 @@ def buildProcess(String stageKey, String jdkName, String jdkTestName, String mvn if (isUnix()) { withEnv(["JAVA_HOME=${tool(jdkName)}", - "JAVA_HOME_IT=${tool(jdkTestName)}", "MAVEN_OPTS=${mavenOpts}", "PATH+MAVEN=${tool(mvnName)}/bin:${tool(jdkName)}/bin" ]) { - sh '$JAVA_HOME_IT/bin/java -version' - sh 'echo JAVA_HOME=$JAVA_HOME, JAVA_HOME_IT=$JAVA_HOME_IT, PATH=$PATH' - def script = cmd + ['\"-DjdkHome=$JAVA_HOME_IT\"'] - errorStatus = sh(returnStatus: true, script: script.join(' ')) + sh 'echo JAVA_HOME=$JAVA_HOME, PATH=$PATH' + sh '$JAVA_HOME/bin/java -version' + errorStatus = sh(returnStatus: true, script: cmd.join(' ')) } } else { withEnv(["JAVA_HOME=${tool(jdkName)}", - "JAVA_HOME_IT=${tool(jdkTestName)}", "MAVEN_OPTS=${mavenOpts}", "PATH+MAVEN=${tool(mvnName)}\\bin;${tool(jdkName)}\\bin" ]) { - bat '%JAVA_HOME_IT%\\bin\\java -version' - bat 'echo JAVA_HOME=%JAVA_HOME%, JAVA_HOME_IT=%JAVA_HOME_IT%, PATH=%PATH%' - def script = cmd + ['\"-DjdkHome=%JAVA_HOME_IT%\"'] - errorStatus = bat(returnStatus: true, script: script.join(' ')) + bat 'echo JAVA_HOME=%JAVA_HOME%, PATH=%PATH%' + bat '%JAVA_HOME%\\bin\\java -version' + errorStatus = bat(returnStatus: true, script: cmd.join(' ')) } } diff --git a/README.md b/README.md index 6de9b06..8586e6d 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ Usage of [maven-surefire-plugin], [maven-failsafe-plugin], [maven-surefire-repor # Development Information -Build the Surefire project using **Maven 3.1.0+** and **JDK 1.8+**. +Build the Surefire project using **Maven 3.2.5+** and **JDK 1.8+**. * In order to run tests for a release check during the Vote, the following memory requirements are needed: @@ -59,13 +59,9 @@ Build the Surefire project using **Maven 3.1.0+** and **JDK 1.8+**. set MAVEN_OPTS="-server -Xmx256m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=384m -XX:+UseG1GC -XX:+UseStringDeduplication -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -XX:SoftRefLRUPolicyMSPerMB=50 -Djava.awt.headless=true -Dhttps.protocols=TLSv1.2" ``` -* In order to run the tests with **JDK 1.7** (on Linux/Unix modify the system property **jdkHome**): +* In order to build and run the tests: ``` - mvn install site site:stage -P reporting,run-its "-DjdkHome=e:\Program Files\Java\jdk1.7.0_80\" - ``` -* In order to run the build and the tests with **JDK 1.8+**, e.g. JDK 11: - ``` - mvn install site site:stage -P reporting,run-its "-DjdkHome=e:\Program Files\Java\jdk11\" + mvn install site site:stage -P reporting,run-its ``` diff --git a/maven-failsafe-plugin/pom.xml b/maven-failsafe-plugin/pom.xml index 0e69eea..7e6213d 100644 --- a/maven-failsafe-plugin/pom.xml +++ b/maven-failsafe-plugin/pom.xml @@ -271,15 +271,10 @@ <properties> <integration-test-port>${failsafe-integration-test-port}</integration-test-port> <integration-test-stop-port>${failsafe-integration-test-stop-port}</integration-test-stop-port> - <https.protocols>${https.protocols}</https.protocols> - <jdk.tls.client.protocols>${https.protocols}</jdk.tls.client.protocols> </properties> </configuration> </execution> </executions> - <configuration> - <javaHome>${jdkHome}</javaHome> - </configuration> </plugin> </plugins> </build> diff --git a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoTest.java b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoTest.java index 007d24d..9366663 100644 --- a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoTest.java +++ b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoTest.java @@ -172,7 +172,7 @@ public class AbstractSurefireMojoTest assertThat( wrapper.getResolvePathResult() ) .isNull(); - assertThat( invokeMethod( mojo, "existsModuleDescriptor", wrapper ) ) + assertThat( (boolean) invokeMethod( mojo, "existsModuleDescriptor", wrapper ) ) .isEqualTo( false ); when( mojo.useModulePath() ).thenReturn( true ); @@ -180,7 +180,7 @@ public class AbstractSurefireMojoTest File jvmExecutable = new File( jdkHome, IS_OS_WINDOWS ? "bin\\java.exe" : "bin/java" ); JdkAttributes jdkAttributes = new JdkAttributes( jvmExecutable, jdkHome, true ); Platform platform = new Platform().withJdkExecAttributesForTests( jdkAttributes ); - assertThat( invokeMethod( mojo, "canExecuteProviderWithModularPath", platform, wrapper ) ) + assertThat( (boolean) invokeMethod( mojo, "canExecuteProviderWithModularPath", platform, wrapper ) ) .isEqualTo( false ); } @@ -217,7 +217,7 @@ public class AbstractSurefireMojoTest assertThat( wrapper.getResolvePathResult().getModuleDescriptor() ) .isSameAs( descriptor ); - assertThat( invokeMethod( mojo, "existsModuleDescriptor", wrapper ) ) + assertThat( (boolean) invokeMethod( mojo, "existsModuleDescriptor", wrapper ) ) .isEqualTo( true ); when( mojo.useModulePath() ).thenReturn( true ); @@ -225,19 +225,19 @@ public class AbstractSurefireMojoTest File jvmExecutable = new File( jdkHome, IS_OS_WINDOWS ? "bin\\java.exe" : "bin/java" ); JdkAttributes jdkAttributes = new JdkAttributes( jvmExecutable, jdkHome, true ); Platform platform = new Platform().withJdkExecAttributesForTests( jdkAttributes ); - assertThat( invokeMethod( mojo, "canExecuteProviderWithModularPath", platform, wrapper ) ) + assertThat( (boolean) invokeMethod( mojo, "canExecuteProviderWithModularPath", platform, wrapper ) ) .isEqualTo( true ); jdkAttributes = new JdkAttributes( jvmExecutable, jdkHome, false ); platform = new Platform().withJdkExecAttributesForTests( jdkAttributes ); - assertThat( invokeMethod( mojo, "canExecuteProviderWithModularPath", platform, wrapper ) ) + assertThat( (boolean) invokeMethod( mojo, "canExecuteProviderWithModularPath", platform, wrapper ) ) .isEqualTo( false ); when( mojo.useModulePath() ).thenReturn( false ); jdkAttributes = new JdkAttributes( jvmExecutable, jdkHome, true ); platform = new Platform().withJdkExecAttributesForTests( jdkAttributes ); - assertThat( invokeMethod( mojo, "canExecuteProviderWithModularPath", platform, wrapper ) ) + assertThat( (boolean) invokeMethod( mojo, "canExecuteProviderWithModularPath", platform, wrapper ) ) .isEqualTo( false ); } @@ -271,7 +271,7 @@ public class AbstractSurefireMojoTest assertThat( wrapper.getResolvePathResult() ) .isNull(); - assertThat( invokeMethod( mojo, "existsModuleDescriptor", wrapper ) ) + assertThat( (boolean) invokeMethod( mojo, "existsModuleDescriptor", wrapper ) ) .isEqualTo( false ); } diff --git a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/extensions/ConsoleOutputReporterTest.java b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/extensions/ConsoleOutputReporterTest.java index 372c9a8..fe92442 100644 --- a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/extensions/ConsoleOutputReporterTest.java +++ b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/extensions/ConsoleOutputReporterTest.java @@ -19,16 +19,17 @@ package org.apache.maven.plugin.surefire.extensions; * under the License. */ -import org.apache.maven.surefire.extensions.ConsoleOutputReportEventListener; -import org.apache.maven.surefire.extensions.ConsoleOutputReporter; +import java.io.File; +import java.io.PrintStream; + import org.apache.maven.plugin.surefire.extensions.junit5.JUnit5ConsoleOutputReporter; import org.apache.maven.plugin.surefire.report.ConsoleOutputFileReporter; import org.apache.maven.plugin.surefire.report.DirectConsoleOutput; +import org.apache.maven.surefire.extensions.ConsoleOutputReportEventListener; +import org.apache.maven.surefire.extensions.ConsoleOutputReporter; import org.fest.assertions.Assertions; import org.junit.Test; -import java.io.File; - import static org.fest.assertions.Assertions.assertThat; import static org.powermock.reflect.Whitebox.getInternalState; @@ -73,9 +74,9 @@ public class ConsoleOutputReporterTest ConsoleOutputReportEventListener listener1 = extension.createListener( System.out, System.err ); assertThat( listener1 ) .isInstanceOf( DirectConsoleOutput.class ); - assertThat( getInternalState( listener1, "out" ) ) + assertThat( (PrintStream) getInternalState( listener1, "out" ) ) .isSameAs( System.out ); - assertThat( getInternalState( listener1, "err" ) ) + assertThat( (PrintStream) getInternalState( listener1, "err" ) ) .isSameAs( System.err ); File target = new File( System.getProperty( "user.dir" ), "target" ); @@ -89,17 +90,17 @@ public class ConsoleOutputReporterTest extension.createListener( reportsDirectory, reportNameSuffix, forkNumber ); assertThat( listener2 ) .isInstanceOf( ConsoleOutputFileReporter.class ); - assertThat( getInternalState( listener2, "reportsDirectory" ) ) + assertThat( (File) getInternalState( listener2, "reportsDirectory" ) ) .isSameAs( reportsDirectory ); - assertThat( getInternalState( listener2, "reportNameSuffix" ) ) + assertThat( (String) getInternalState( listener2, "reportNameSuffix" ) ) .isSameAs( reportNameSuffix ); - assertThat( getInternalState( listener2, "usePhrasedFileName" ) ) + assertThat( (boolean) getInternalState( listener2, "usePhrasedFileName" ) ) .isEqualTo( usePhrasedFileName ); - assertThat( getInternalState( listener2, "forkNumber" ) ) + assertThat( (Integer) getInternalState( listener2, "forkNumber" ) ) .isSameAs( forkNumber ); - assertThat( getInternalState( listener2, "encoding" ) ) + assertThat( (String) getInternalState( listener2, "encoding" ) ) .isSameAs( encoding ); - assertThat( getInternalState( listener2, "reportEntryName" ) ) + assertThat( (String) getInternalState( listener2, "reportEntryName" ) ) .isNull(); } @@ -142,9 +143,9 @@ public class ConsoleOutputReporterTest ConsoleOutputReportEventListener listener1 = extension.createListener( System.out, System.err ); assertThat( listener1 ) .isInstanceOf( DirectConsoleOutput.class ); - assertThat( getInternalState( listener1, "out" ) ) + assertThat( (PrintStream) getInternalState( listener1, "out" ) ) .isSameAs( System.out ); - assertThat( getInternalState( listener1, "err" ) ) + assertThat( (PrintStream) getInternalState( listener1, "err" ) ) .isSameAs( System.err ); File target = new File( System.getProperty( "user.dir" ), "target" ); @@ -159,17 +160,17 @@ public class ConsoleOutputReporterTest extension.createListener( reportsDirectory, reportNameSuffix, forkNumber ); assertThat( listener2 ) .isInstanceOf( ConsoleOutputFileReporter.class ); - assertThat( getInternalState( listener2, "reportsDirectory" ) ) + assertThat( (File) getInternalState( listener2, "reportsDirectory" ) ) .isSameAs( reportsDirectory ); - assertThat( getInternalState( listener2, "reportNameSuffix" ) ) + assertThat( (String) getInternalState( listener2, "reportNameSuffix" ) ) .isSameAs( reportNameSuffix ); - assertThat( getInternalState( listener2, "usePhrasedFileName" ) ) + assertThat( (boolean) getInternalState( listener2, "usePhrasedFileName" ) ) .isEqualTo( usePhrasedFileName ); - assertThat( getInternalState( listener2, "forkNumber" ) ) + assertThat( (Integer) getInternalState( listener2, "forkNumber" ) ) .isSameAs( forkNumber ); - assertThat( getInternalState( listener2, "encoding" ) ) + assertThat( (String) getInternalState( listener2, "encoding" ) ) .isSameAs( encoding ); - assertThat( getInternalState( listener2, "reportEntryName" ) ) + assertThat( (String) getInternalState( listener2, "reportEntryName" ) ) .isNull(); } } diff --git a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/extensions/StatelessReporterTest.java b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/extensions/StatelessReporterTest.java index 4aa048c..253bbc2 100644 --- a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/extensions/StatelessReporterTest.java +++ b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/extensions/StatelessReporterTest.java @@ -96,27 +96,27 @@ public class StatelessReporterTest StatelessReportEventListener<WrappedReportEntry, TestSetStats> listener = extension.createListener( config ); assertThat( listener ) .isInstanceOf( StatelessXmlReporter.class ); - assertThat( getInternalState( listener, "reportsDirectory" ) ) + assertThat( (File) getInternalState( listener, "reportsDirectory" ) ) .isSameAs( reportsDirectory ); - assertThat( getInternalState( listener, "reportNameSuffix" ) ) + assertThat( (String) getInternalState( listener, "reportNameSuffix" ) ) .isSameAs( reportNameSuffix ); - assertThat( getInternalState( listener, "trimStackTrace" ) ) + assertThat( (boolean) getInternalState( listener, "trimStackTrace" ) ) .isEqualTo( true ); - assertThat( getInternalState( listener, "rerunFailingTestsCount" ) ) + assertThat( (Integer) getInternalState( listener, "rerunFailingTestsCount" ) ) .isEqualTo( 5 ); - assertThat( getInternalState( listener, "xsdSchemaLocation" ) ) + assertThat( (String) getInternalState( listener, "xsdSchemaLocation" ) ) .isSameAs( schema ); - assertThat( getInternalState( listener, "xsdVersion" ) ) + assertThat( (String) getInternalState( listener, "xsdVersion" ) ) .isEqualTo( "V3" ); - assertThat( getInternalState( listener, "testClassMethodRunHistoryMap" ) ) + assertThat( (Map<?, ?>) getInternalState( listener, "testClassMethodRunHistoryMap" ) ) .isSameAs( testClassMethodRunHistory ); - assertThat( getInternalState( listener, "phrasedFileName" ) ) + assertThat( (boolean) getInternalState( listener, "phrasedFileName" ) ) .isEqualTo( false ); - assertThat( getInternalState( listener, "phrasedSuiteName" ) ) + assertThat( (boolean) getInternalState( listener, "phrasedSuiteName" ) ) .isEqualTo( false ); - assertThat( getInternalState( listener, "phrasedClassName" ) ) + assertThat( (boolean) getInternalState( listener, "phrasedClassName" ) ) .isEqualTo( false ); - assertThat( getInternalState( listener, "phrasedMethodName" ) ) + assertThat( (boolean) getInternalState( listener, "phrasedMethodName" ) ) .isEqualTo( false ); } @@ -217,27 +217,27 @@ public class StatelessReporterTest StatelessReportEventListener<WrappedReportEntry, TestSetStats> listener = extension.createListener( config ); assertThat( listener ) .isInstanceOf( StatelessXmlReporter.class ); - assertThat( getInternalState( listener, "reportsDirectory" ) ) + assertThat( (File) getInternalState( listener, "reportsDirectory" ) ) .isSameAs( reportsDirectory ); - assertThat( getInternalState( listener, "reportNameSuffix" ) ) + assertThat( (String) getInternalState( listener, "reportNameSuffix" ) ) .isSameAs( reportNameSuffix ); - assertThat( getInternalState( listener, "trimStackTrace" ) ) + assertThat( (boolean) getInternalState( listener, "trimStackTrace" ) ) .isEqualTo( true ); - assertThat( getInternalState( listener, "rerunFailingTestsCount" ) ) + assertThat( (Integer) getInternalState( listener, "rerunFailingTestsCount" ) ) .isEqualTo( 5 ); - assertThat( getInternalState( listener, "xsdSchemaLocation" ) ) + assertThat( (String) getInternalState( listener, "xsdSchemaLocation" ) ) .isSameAs( schema ); - assertThat( getInternalState( listener, "xsdVersion" ) ) + assertThat( (String) getInternalState( listener, "xsdVersion" ) ) .isEqualTo( "V3" ); - assertThat( getInternalState( listener, "testClassMethodRunHistoryMap" ) ) + assertThat( (Map<?, ?>) getInternalState( listener, "testClassMethodRunHistoryMap" ) ) .isSameAs( testClassMethodRunHistory ); - assertThat( getInternalState( listener, "phrasedFileName" ) ) + assertThat( (boolean) getInternalState( listener, "phrasedFileName" ) ) .isEqualTo( true ); - assertThat( getInternalState( listener, "phrasedSuiteName" ) ) + assertThat( (boolean) getInternalState( listener, "phrasedSuiteName" ) ) .isEqualTo( true ); - assertThat( getInternalState( listener, "phrasedClassName" ) ) + assertThat( (boolean) getInternalState( listener, "phrasedClassName" ) ) .isEqualTo( true ); - assertThat( getInternalState( listener, "phrasedMethodName" ) ) + assertThat( (boolean) getInternalState( listener, "phrasedMethodName" ) ) .isEqualTo( true ); } } diff --git a/maven-surefire-common/src/test/java/org/apache/maven/surefire/extensions/StatelessTestsetInfoReporterTest.java b/maven-surefire-common/src/test/java/org/apache/maven/surefire/extensions/StatelessTestsetInfoReporterTest.java index 389acdf..4576a08 100644 --- a/maven-surefire-common/src/test/java/org/apache/maven/surefire/extensions/StatelessTestsetInfoReporterTest.java +++ b/maven-surefire-common/src/test/java/org/apache/maven/surefire/extensions/StatelessTestsetInfoReporterTest.java @@ -118,11 +118,11 @@ public class StatelessTestsetInfoReporterTest .isSameAs( reportNameSuffix ); assertThat( listener.getEncoding() ) .isSameAs( encoding ); - assertThat( getInternalState( listener, "usePhrasedFileName" ) ) + assertThat( (boolean) getInternalState( listener, "usePhrasedFileName" ) ) .isEqualTo( false ); - assertThat( getInternalState( listener, "usePhrasedClassNameInRunning" ) ) + assertThat( (boolean) getInternalState( listener, "usePhrasedClassNameInRunning" ) ) .isEqualTo( false ); - assertThat( getInternalState( listener, "usePhrasedClassNameInTestCaseSummary" ) ) + assertThat( (boolean) getInternalState( listener, "usePhrasedClassNameInTestCaseSummary" ) ) .isEqualTo( false ); } @@ -143,9 +143,9 @@ public class StatelessTestsetInfoReporterTest .isInstanceOf( ConsoleReporter.class ); assertThat( listener.getConsoleLogger() ) .isSameAs( consoleLogger ); - assertThat( getInternalState( listener, "usePhrasedClassNameInRunning" ) ) + assertThat( (boolean) getInternalState( listener, "usePhrasedClassNameInRunning" ) ) .isEqualTo( false ); - assertThat( getInternalState( listener, "usePhrasedClassNameInTestCaseSummary" ) ) + assertThat( (boolean) getInternalState( listener, "usePhrasedClassNameInTestCaseSummary" ) ) .isEqualTo( false ); } diff --git a/maven-surefire-plugin/src/site/apt/developing.apt.vm b/maven-surefire-plugin/src/site/apt/developing.apt.vm index 7c8ccb2..c1f337b 100644 --- a/maven-surefire-plugin/src/site/apt/developing.apt.vm +++ b/maven-surefire-plugin/src/site/apt/developing.apt.vm @@ -114,12 +114,9 @@ ForkedBooter#main * JDK Versions - The surefire booter is capable of booting all the way back to jdk1.7. Specifically + The surefire booter is capable of booting all the way back to jdk1.8. Specifically this means <<<surefire-api>>>, <<<surefire-booter>>>, <<<common-junit3>>>, <<<surefire-junit3>>> - and other modules are compiled with source/target 1.7. The plugin and several providers are 1.7. - The provider <<<surefire-junit-platform>>> is compiled with jdk1.8. - The project requires using <<<JAVA_HOME>>> jdk1.8 but the tests run with jdk1.7+ which is - configured by system property <<<jdkHome>>>, see <<<README.md>>>. + and other modules are compiled with source/target 1.8. * Provider Isolation diff --git a/pom.xml b/pom.xml index 4692e25..9440300 100644 --- a/pom.xml +++ b/pom.xml @@ -87,7 +87,7 @@ </distributionManagement> <properties> - <javaVersion>7</javaVersion> + <javaVersion>8</javaVersion> <mavenVersion>3.2.5</mavenVersion> <!-- <shadedVersion>3.0.0-M2</shadedVersion> commented out due to https://issues.apache.org/jira/browse/MRELEASE-799 --> <commonsLang3Version>3.8.1</commonsLang3Version> @@ -105,6 +105,7 @@ <maven.site.path>surefire-archives/surefire-LATEST</maven.site.path> <maven.compiler.testSource>1.${javaVersion}</maven.compiler.testSource> <maven.compiler.testTarget>1.${javaVersion}</maven.compiler.testTarget> + <jvm9ArgsTests/> <jvm.args.tests>${jvm9ArgsTests} -Xms32m -Xmx144m -XX:SoftRefLRUPolicyMSPerMB=50 -Djava.awt.headless=true -Djdk.net.URLClassPath.disableClassPathURLCheck=true</jvm.args.tests> <project.build.outputTimestamp>2020-06-10T18:16:37Z</project.build.outputTimestamp> </properties> @@ -414,11 +415,6 @@ <version>3.2.3</version><!-- TODO remove when upgrading parent to 35 --> </plugin> <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>build-helper-maven-plugin</artifactId> - <version>3.2.0</version> - </plugin> - <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <executions> @@ -477,13 +473,11 @@ <artifactId>maven-surefire-plugin</artifactId> <version>3.0.0-M4</version> <!-- ${shadedVersion}, but resolved due to https://issues.apache.org/jira/browse/MRELEASE-799 --> <configuration> - <skipTests>${doSkipTests}</skipTests> <!-- NOTE: Be sure to isolate the Surefire version under test from the version running the tests! --> <useSystemClassLoader>false</useSystemClassLoader> <argLine>${jvm.args.tests}</argLine><!-- -Dnet.bytebuddy.experimental=true ${jacoco.agent}--> <useFile>false</useFile> <redirectTestOutputToFile>false</redirectTestOutputToFile> - <jvm>${jdkHome}/bin/java</jvm> </configuration> </plugin> <plugin> @@ -603,7 +597,6 @@ <configuration> <rules> <requireJavaVersion> - <!-- We use JDK 1.8 to check -Xdoclint:all at compile time but with javac -source 1.7 -target 1.7 --> <version>[1.8, )</version> </requireJavaVersion> </rules> @@ -644,62 +637,6 @@ <fail>true</fail> </configuration> </plugin> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>build-helper-maven-plugin</artifactId> - <executions> - <execution> - <id>bsh-property</id> - <goals> - <goal>bsh-property</goal> - </goals> - <configuration> - <properties> - <property>jdkHome</property> - <property>doSkipTests</property> - <property>jvm9ArgsTests</property> - </properties> - <source> - jdkHome = session.getUserProperties().getProperty("jdkHome", project.getProperties().getProperty("jdkHome")); - if (jdkHome == null || jdkHome.isEmpty()) { - jreHome = System.getProperty("java.home"); - jrePath = new File(jreHome); - jdkHome = "jre".equals(jrePath.getName()) ? jrePath.getParent() : jrePath.getPath(); - } - release = new File(jdkHome, "release"); - System.out.println("Beanshell found jdkHome=" + jdkHome); - System.out.println("Beanshell found jdk-release properties file=" + release.exists()); - props = new Properties(); - reader = new FileReader(release); - props.load(reader); - reader.close(); - javaVersion = props.getProperty("JAVA_VERSION").replace("\"", ""); - System.out.println("Beanshell found java version for tests " + javaVersion); - majorJavaVersion = Integer.parseInt(javaVersion.substring(0, javaVersion.contains(".") ? javaVersion.indexOf('.') : javaVersion.length())); - isSkippedTests = project.getProperties().getProperty("skipTests", session.getUserProperties().getProperty("skipTests")); - if (isSkippedTests == null) { - isSkippedTests = "false"; - } - - skip = isSkippedTests; - args = "--add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.math=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.text=ALL-UNNAMED --add-opens java.base/java.util.regex=ALL-UNNAMED --add-opens java.base/java.nio.channels.spi=ALL-UNNAMED --add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED --add-opens java.base/java.util.concurrent=A [...] - - if (majorJavaVersion == 1) { - isJava7 = javaVersion.matches("^1\\.7.*"); - skip = "surefire-junit-platform".equals(project.getArtifactId()) ? "" + (Boolean.parseBoolean(isSkippedTests) || isJava7) : isSkippedTests; - args = ""; - } - - doSkipTests = skip; - jvm9ArgsTests = args; - - System.out.println("Beanshell doSkipTests=" + doSkipTests); - System.out.println("Beanshell jvm9ArgsTests=" + jvm9ArgsTests); - </source> - </configuration> - </execution> - </executions> - </plugin> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>animal-sniffer-maven-plugin</artifactId> @@ -712,7 +649,7 @@ <configuration> <signature> <groupId>org.codehaus.mojo.signature</groupId> - <artifactId>java17</artifactId> + <artifactId>java18</artifactId> <version>1.0</version> </signature> </configuration> @@ -750,6 +687,17 @@ </reporting> <profiles> + + <profile> + <id>jdk9+</id> + <activation> + <jdk>[9,)</jdk> + </activation> + <properties> + <jvm9ArgsTests>--add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.math=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.text=ALL-UNNAMED --add-opens java.base/java.util.regex=ALL-UNNAMED --add-opens java.base/java.nio.channels.spi=ALL-UNNAMED --add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED --add-opens java.base/java.util.concurrent=ALL-UNNAMED -- [...] + </properties> + </profile> + <profile> <id>reporting</id> <reporting> diff --git a/surefire-api/src/test/java/org/apache/maven/surefire/api/stream/AbstractStreamDecoderTest.java b/surefire-api/src/test/java/org/apache/maven/surefire/api/stream/AbstractStreamDecoderTest.java index 748c467..36ef828 100644 --- a/surefire-api/src/test/java/org/apache/maven/surefire/api/stream/AbstractStreamDecoderTest.java +++ b/surefire-api/src/test/java/org/apache/maven/surefire/api/stream/AbstractStreamDecoderTest.java @@ -19,19 +19,8 @@ package org.apache.maven.surefire.api.stream; * under the License. */ -import org.apache.maven.plugin.surefire.log.api.ConsoleLogger; -import org.apache.maven.surefire.api.booter.Constants; -import org.apache.maven.surefire.api.booter.ForkedProcessEventType; -import org.apache.maven.surefire.api.event.Event; -import org.apache.maven.surefire.api.fork.ForkNodeArguments; -import org.apache.maven.surefire.api.report.RunMode; -import org.apache.maven.surefire.api.stream.AbstractStreamDecoder.MalformedFrameException; -import org.apache.maven.surefire.api.stream.AbstractStreamDecoder.Memento; -import org.apache.maven.surefire.api.stream.AbstractStreamDecoder.Segment; -import org.junit.BeforeClass; -import org.junit.Test; - import javax.annotation.Nonnull; + import java.io.EOFException; import java.io.File; import java.math.BigInteger; @@ -45,6 +34,18 @@ import java.util.HashMap; import java.util.Map; import java.util.concurrent.TimeUnit; +import org.apache.maven.plugin.surefire.log.api.ConsoleLogger; +import org.apache.maven.surefire.api.booter.Constants; +import org.apache.maven.surefire.api.booter.ForkedProcessEventType; +import org.apache.maven.surefire.api.event.Event; +import org.apache.maven.surefire.api.fork.ForkNodeArguments; +import org.apache.maven.surefire.api.report.RunMode; +import org.apache.maven.surefire.api.stream.AbstractStreamDecoder.MalformedFrameException; +import org.apache.maven.surefire.api.stream.AbstractStreamDecoder.Memento; +import org.apache.maven.surefire.api.stream.AbstractStreamDecoder.Segment; +import org.junit.BeforeClass; +import org.junit.Test; + import static java.lang.Math.min; import static java.lang.System.arraycopy; import static java.nio.charset.CodingErrorAction.REPLACE; @@ -275,7 +276,7 @@ public class AbstractStreamDecoderTest Memento memento = thread.new Memento(); // whatever position will be compacted to 0 ( (Buffer) ( (Buffer) memento.getByteBuffer() ).limit( 974 ) ).position( 974 ); - assertThat( invokeMethod( thread, "readString", memento, PATTERN1.length() + 3 ) ) + assertThat( (String) invokeMethod( thread, "readString", memento, PATTERN1.length() + 3 ) ) .isEqualTo( PATTERN1 + "012" ); } @@ -295,7 +296,7 @@ public class AbstractStreamDecoderTest Collections.<Segment, ForkedProcessEventType>emptyMap() ); Memento memento = thread.new Memento(); - assertThat( invokeMethod( thread, "readString", memento, PATTERN1.length() ) ) + assertThat( (String) invokeMethod( thread, "readString", memento, PATTERN1.length() ) ) .isEqualTo( "789" + PATTERN1.substring( 0, 97 ) ); } @@ -325,7 +326,7 @@ public class AbstractStreamDecoderTest expected.append( PATTERN1 ); } expected.setLength( 1100 ); - assertThat( invokeMethod( thread, "readString", memento, 1100 ) ) + assertThat( (String) invokeMethod( thread, "readString", memento, 1100 ) ) .isEqualTo( expected.toString() ); } diff --git a/surefire-its/pom.xml b/surefire-its/pom.xml index 8275230..307d7de 100644 --- a/surefire-its/pom.xml +++ b/surefire-its/pom.xml @@ -768,7 +768,6 @@ <version>3.0.0-M4</version> <!-- ${shadedVersion}, but resolved due to https://issues.apache.org/jira/browse/MRELEASE-799 --> <configuration> <skipTests>${skipTests}</skipTests> - <jvm>${jdkHome}/bin/java</jvm> <runOrder>alphabetical</runOrder> <threadCount>1</threadCount> <perCoreThreadCount>false</perCoreThreadCount> diff --git a/surefire-its/src/test/resources/toolchains.xml b/surefire-its/src/test/resources/toolchains.xml index 235c23a..857c82c 100644 --- a/surefire-its/src/test/resources/toolchains.xml +++ b/surefire-its/src/test/resources/toolchains.xml @@ -29,7 +29,7 @@ <vendor>oracle</vendor> </provides> <configuration> - <jdkHome>${jdkHome}</jdkHome> + <jdkHome>${java.home}</jdkHome> </configuration> </toolchain> </toolchains> diff --git a/surefire-providers/surefire-junit-platform/pom.xml b/surefire-providers/surefire-junit-platform/pom.xml index 54430da..9883364 100644 --- a/surefire-providers/surefire-junit-platform/pom.xml +++ b/surefire-providers/surefire-junit-platform/pom.xml @@ -31,10 +31,6 @@ <name>SureFire JUnit Platform Runner</name> <description>SureFire JUnit Platform Runner</description> - <properties> - <javaVersion>8</javaVersion> - </properties> - <contributors> <contributor> <name>Konstantin Lutovich</name> @@ -135,31 +131,6 @@ </configuration> </plugin> <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>animal-sniffer-maven-plugin</artifactId> - <executions> - <execution> - <id>signature-check</id> - <goals> - <goal>check</goal> - </goals> - <configuration> - <signature combine.self="override"> - <groupId>org.codehaus.mojo.signature</groupId> - <artifactId>java18</artifactId> - <version>1.0</version> - </signature> - <excludeDependencies> - <param>org.junit.platform:junit-platform-commons</param> - </excludeDependencies> - <ignores> - <param>org.junit.platform.commons.*</param> - </ignores> - </configuration> - </execution> - </executions> - </plugin> - <plugin> <artifactId>maven-surefire-plugin</artifactId> <version>3.0.0-M4</version> <!-- ${shadedVersion}, but resolved due to https://issues.apache.org/jira/browse/MRELEASE-799 --> <configuration>