You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ti...@apache.org on 2018/08/12 22:41:25 UTC
[maven-surefire] 01/02: fixed IT, JaCoCo
This is an automated email from the ASF dual-hosted git repository.
tibordigana pushed a commit to branch JAVA11
in repository https://gitbox.apache.org/repos/asf/maven-surefire.git
commit 567c07826e06d8038e23d2d57c9af258b1ad92e5
Author: Tibor17 <ti...@apache.org>
AuthorDate: Mon Aug 13 00:35:08 2018 +0200
fixed IT, JaCoCo
---
pom.xml | 21 ++++++++++++++++++++-
.../apache/maven/surefire/its/Java9FullApiIT.java | 9 ++++++---
.../maven/surefire/its/WorkingDirectoryIT.java | 11 +++++------
.../surefire/its/fixture/HelperAssertions.java | 2 +-
.../surefire/its/fixture/SurefireLauncher.java | 16 ++++++++++------
.../child/src/test/java/workingDir/BasicTest.java | 4 +++-
6 files changed, 45 insertions(+), 18 deletions(-)
diff --git a/pom.xml b/pom.xml
index aefeb00..7db84ad 100644
--- a/pom.xml
+++ b/pom.xml
@@ -101,6 +101,7 @@
<maven.compiler.testSource>1.${javaVersion}</maven.compiler.testSource>
<maven.compiler.testTarget>1.${javaVersion}</maven.compiler.testTarget>
<jvm.args.tests>-server -XX:+UseG1GC -Xms128m -Xmx144m -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -XX:SoftRefLRUPolicyMSPerMB=50 -Djava.awt.headless=true</jvm.args.tests>
+ <skipUnitTests>${skipTests}</skipUnitTests>
</properties>
<dependencyManagement>
@@ -458,6 +459,7 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12.4</version> <!-- ${shadedVersion}, but resolved due to https://issues.apache.org/jira/browse/MRELEASE-799 -->
<configuration>
+ <skipTests>${skipUnitTests}</skipTests>
<!-- NOTE: Be sure to isolate the Surefire version under test from the version running the tests! -->
<useSystemClassLoader>false</useSystemClassLoader>
<argLine>${jvm.args.tests} ${jacoco.agent} -Dnet.bytebuddy.experimental=true</argLine>
@@ -492,7 +494,7 @@
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
- <version>0.8.1</version>
+ <version>0.8.2-SNAPSHOT</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@@ -757,4 +759,21 @@
</build>
</profile>
</profiles>
+
+ <pluginRepositories>
+ <pluginRepository>
+ <id>plugin-snapshots</id>
+ <url>https://oss.sonatype.org/content/repositories/snapshots</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ </pluginRepository>
+ <pluginRepository>
+ <id>plugin-releases</id>
+ <url>http://repo1.maven.org/maven2</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </pluginRepository>
+ </pluginRepositories>
</project>
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/Java9FullApiIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/Java9FullApiIT.java
index 165d745..ec9a688 100644
--- a/surefire-its/src/test/java/org/apache/maven/surefire/its/Java9FullApiIT.java
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/Java9FullApiIT.java
@@ -56,7 +56,8 @@ public class Java9FullApiIT
.verifyTextInLog( "loaded class javax.transaction.TransactionManager" )
.verifyTextInLog( "loaded class javax.transaction.InvalidTransactionException" )
.assertThatLogLine( anyOf( is( "java.specification.version=9" ),
- is( "java.specification.version=10" ) ),
+ is( "java.specification.version=10" ),
+ is( "java.specification.version=11" ) ),
greaterThanOrEqualTo( 1 ) );
}
@@ -76,7 +77,8 @@ public class Java9FullApiIT
.verifyTextInLog( "loaded class javax.transaction.TransactionManager" )
.verifyTextInLog( "loaded class javax.transaction.InvalidTransactionException" )
.assertThatLogLine( anyOf( is( "java.specification.version=9" ),
- is( "java.specification.version=10" ) ),
+ is( "java.specification.version=10" ),
+ is( "java.specification.version=11" ) ),
greaterThanOrEqualTo( 1 ) );
}
@@ -97,7 +99,8 @@ public class Java9FullApiIT
.verifyTextInLog( "loaded class javax.transaction.TransactionManager" )
.verifyTextInLog( "loaded class javax.transaction.InvalidTransactionException" )
.assertThatLogLine( anyOf( is( "java.specification.version=9" ),
- is( "java.specification.version=10" ) ),
+ is( "java.specification.version=10" ),
+ is( "java.specification.version=11" ) ),
greaterThanOrEqualTo( 1 ) );
}
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/WorkingDirectoryIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/WorkingDirectoryIT.java
index 66fa3df..7800f4b 100644
--- a/surefire-its/src/test/java/org/apache/maven/surefire/its/WorkingDirectoryIT.java
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/WorkingDirectoryIT.java
@@ -47,6 +47,7 @@ public class WorkingDirectoryIT
{
final SurefireLauncher unpack = getUnpacked();
final OutputValidator child = getPreparedChild( unpack );
+ child.getTargetFile( "out.txt" ).delete();
unpack.executeTest().verifyErrorFreeLog();
child.assertTestSuiteResults( 1, 0, 0, 0 );
verifyOutputDirectory( child );
@@ -58,6 +59,7 @@ public class WorkingDirectoryIT
{
final SurefireLauncher unpack = getUnpacked();
final OutputValidator child = getPreparedChild( unpack );
+ child.getTargetFile( "out.txt" ).delete();
unpack.forkNever().executeTest().verifyErrorFreeLog();
child.assertTestSuiteResults( 1, 0, 0, 0 );
verifyOutputDirectory( child );
@@ -69,7 +71,7 @@ public class WorkingDirectoryIT
{
final SurefireLauncher unpack = getUnpacked();
final SurefireLauncher child = unpack.getSubProjectLauncher( "child" );
- //child.getTargetFile( "out.txt" ).delete();
+ child.getSubProjectValidator( "child" ).getTargetFile( "out.txt" ).delete();
final OutputValidator outputValidator = child.executeTest().assertTestSuiteResults( 1, 0, 0, 0 );
verifyOutputDirectory( outputValidator );
}
@@ -78,16 +80,14 @@ public class WorkingDirectoryIT
public void testWorkingDirectoryChildOnlyNoFork()
throws Exception
{
-
final SurefireLauncher unpack = getUnpacked();
final SurefireLauncher child = unpack.getSubProjectLauncher( "child" );
- //child.getTargetFile( "out.txt" ).delete();
+ child.getSubProjectValidator( "child" ).getTargetFile( "out.txt" ).delete();
final OutputValidator outputValidator = child.forkNever().executeTest().assertTestSuiteResults( 1, 0, 0, 0 );
verifyOutputDirectory( outputValidator );
}
private SurefireLauncher getUnpacked()
- throws VerificationException, IOException
{
return unpack( "working-directory" );
}
@@ -106,7 +106,7 @@ public class WorkingDirectoryIT
return child.getTargetFile( "out.txt" );
}
- public void verifyOutputDirectory( OutputValidator childTestDir )
+ private void verifyOutputDirectory( OutputValidator childTestDir )
throws IOException
{
final TestFile outFile = getOutFile( childTestDir );
@@ -130,5 +130,4 @@ public class WorkingDirectoryIT
userDir.getCanonicalPath() );
}
}
-
}
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/HelperAssertions.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/HelperAssertions.java
index 3e753de..5bea87e 100644
--- a/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/HelperAssertions.java
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/HelperAssertions.java
@@ -170,7 +170,7 @@ public class HelperAssertions
{
String thisVersion = System.getProperty( "java.specification.version" );
assumeTrue( "java.specification.version: " + thisVersion,
- Double.valueOf( thisVersion ) >= expectedVersion );
+ Double.parseDouble( thisVersion ) >= expectedVersion );
}
public static String convertUnicodeToUTF8( String unicode )
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/SurefireLauncher.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/SurefireLauncher.java
index 7dfe51a..ada9751 100755
--- a/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/SurefireLauncher.java
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/SurefireLauncher.java
@@ -126,15 +126,15 @@ public final class SurefireLauncher
return mavenLauncher.getSubProjectValidator( subProject );
}
- public SurefireLauncher addEnvVar( String key, String value )
+ private SurefireLauncher addEnvVar( String key, String value )
{
mavenLauncher.addEnvVar( key, value );
return this;
}
- public SurefireLauncher setMavenOpts(String opts){
- addEnvVar( "MAVEN_OPTS", opts );
- return this;
+ public SurefireLauncher setMavenOpts(String opts)
+ {
+ return addEnvVar( "MAVEN_OPTS", opts );
}
private List<String> getInitialGoals()
@@ -143,8 +143,12 @@ public final class SurefireLauncher
goals.add( "-Dsurefire.version=" + surefireVersion );
- String jacocoAgent = System.getProperty( "jacoco.agent", "" );
- goals.add( "-Djacoco.agent=" + jacocoAgent );
+ // https://github.com/jacoco/jacoco/issues/663
+ /*if ( Double.parseDouble( System.getProperty( "java.specification.version" ) ) < 11d )
+ {*/
+ String jacocoAgent = System.getProperty( "jacoco.agent", "" );
+ goals.add( "-Djacoco.agent=" + jacocoAgent );
+ /*}*/
return goals;
}
diff --git a/surefire-its/src/test/resources/working-directory/child/src/test/java/workingDir/BasicTest.java b/surefire-its/src/test/resources/working-directory/child/src/test/java/workingDir/BasicTest.java
index 1708202..6f4f7ca 100644
--- a/surefire-its/src/test/resources/working-directory/child/src/test/java/workingDir/BasicTest.java
+++ b/surefire-its/src/test/resources/working-directory/child/src/test/java/workingDir/BasicTest.java
@@ -31,8 +31,10 @@ public class BasicTest
public void testWorkingDir()
throws Exception
{
- File target = new File( "target" ).getAbsoluteFile();
+ File target = new File( System.getProperty( "user.dir" ), "target" ).getAbsoluteFile();
File outFile = new File( target, "out.txt" );
+ System.out.println( "outFile=" + outFile.getPath() );
+ assertTrue( outFile.createNewFile() );
FileOutputStream os = new FileOutputStream( outFile );
String userDir = System.getProperty( "user.dir" );
Properties p = new Properties();