You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ag...@apache.org on 2015/01/22 21:19:12 UTC

[1/2] maven-surefire git commit: SUREFIRE-1136 Current working directory propagation in forked mode - remove JDK 1.7 API usage in tests, integration test extended to justify deferred directory creation in AbstractSurefireMojo.ensureWorkingDirectoryExists

Repository: maven-surefire
Updated Branches:
  refs/heads/master cebce291f -> 60111e78f


SUREFIRE-1136 Current working directory propagation in forked mode - remove JDK 1.7 API usage in tests, integration test extended to justify deferred directory creation in AbstractSurefireMojo.ensureWorkingDirectoryExists


Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/15da3495
Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/15da3495
Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/15da3495

Branch: refs/heads/master
Commit: 15da3495d5c7be46cf247e4edc0d0c519f1848b6
Parents: cebce29
Author: Norbert Wnuk <no...@sabre.com>
Authored: Thu Jan 22 00:53:02 2015 +0100
Committer: Norbert Wnuk <no...@sabre.com>
Committed: Thu Jan 22 00:53:02 2015 +0100

----------------------------------------------------------------------
 .../booterclient/ForkConfigurationTest.java         | 16 +++++++++++-----
 pom.xml                                             |  1 +
 .../CurrentWorkingDirectoryInForkedModeTest.java    |  4 ++++
 3 files changed, 16 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/15da3495/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ForkConfigurationTest.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ForkConfigurationTest.java b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ForkConfigurationTest.java
index 32eaa61..b3d2151 100644
--- a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ForkConfigurationTest.java
+++ b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ForkConfigurationTest.java
@@ -21,11 +21,11 @@ package org.apache.maven.plugin.surefire.booterclient;
 
 import java.io.File;
 import java.io.IOException;
-import java.nio.file.Files;
 import java.util.Collections;
 import java.util.Properties;
 
 import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang3.RandomStringUtils;
 import org.apache.maven.shared.utils.StringUtils;
 import org.apache.maven.shared.utils.cli.Commandline;
 import org.apache.maven.surefire.booter.Classpath;
@@ -67,7 +67,9 @@ public class ForkConfigurationTest
         throws IOException, SurefireBooterForkException
     {
         // SUREFIRE-1136
-        File baseDir = Files.createTempDirectory( "SUREFIRE-1136-" ).toFile();
+        File baseDir =
+            new File( FileUtils.getTempDirectory(), "SUREFIRE-1136-" + RandomStringUtils.randomAlphabetic( 3 ) );
+        baseDir.mkdirs();
         baseDir.deleteOnExit();
 
         File cwd = new File( baseDir, "fork_${surefire.forkNumber}" );
@@ -85,7 +87,9 @@ public class ForkConfigurationTest
         throws IOException, SurefireBooterForkException
     {
         // SUREFIRE-1136
-        File baseDir = Files.createTempDirectory( "SUREFIRE-1136-" ).toFile();
+        File baseDir =
+            new File( FileUtils.getTempDirectory(), "SUREFIRE-1136-" + RandomStringUtils.randomAlphabetic( 3 ) );
+        baseDir.mkdirs();
         baseDir.deleteOnExit();
 
         File cwd = new File( baseDir, "cwd.txt" );
@@ -113,10 +117,12 @@ public class ForkConfigurationTest
         throws IOException, SurefireBooterForkException
     {
         // SUREFIRE-1136
-        File baseDir = Files.createTempDirectory( "SUREFIRE-1136-" ).toFile();
+        File baseDir =
+            new File( FileUtils.getTempDirectory(), "SUREFIRE-1136-" + RandomStringUtils.randomAlphabetic( 3 ) );
+        baseDir.mkdirs();
         baseDir.deleteOnExit();
 
-        File cwd = new File( baseDir, "\0?InvalidDirectoryName" );
+        File cwd = new File( baseDir, "?\0InvalidDirectoryName" );
         ForkConfiguration config = getForkConfiguration( null, "java", cwd.getAbsoluteFile() );
 
         try

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/15da3495/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 81d00bd..1d6087c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -248,6 +248,7 @@
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-compiler-plugin</artifactId>
         </plugin>
+        <!-- NOTE: animal sniffer does not check test classes: https://jira.codehaus.org/browse/MANIMALSNIFFER-40 -->
         <plugin>
           <groupId>org.codehaus.mojo</groupId>
           <artifactId>animal-sniffer-maven-plugin</artifactId>

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/15da3495/surefire-integration-tests/src/test/resources/surefire-1136-cwd-propagation-in-forked-mode/src/test/java/cwd/CurrentWorkingDirectoryInForkedModeTest.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/resources/surefire-1136-cwd-propagation-in-forked-mode/src/test/java/cwd/CurrentWorkingDirectoryInForkedModeTest.java b/surefire-integration-tests/src/test/resources/surefire-1136-cwd-propagation-in-forked-mode/src/test/java/cwd/CurrentWorkingDirectoryInForkedModeTest.java
index 50cd9b0..1660bfb 100644
--- a/surefire-integration-tests/src/test/resources/surefire-1136-cwd-propagation-in-forked-mode/src/test/java/cwd/CurrentWorkingDirectoryInForkedModeTest.java
+++ b/surefire-integration-tests/src/test/resources/surefire-1136-cwd-propagation-in-forked-mode/src/test/java/cwd/CurrentWorkingDirectoryInForkedModeTest.java
@@ -37,10 +37,14 @@ public class CurrentWorkingDirectoryInForkedModeTest
         File forkDirectory = new File( projectDirectory, "cwd_1" );
         forkDirectory.deleteOnExit();
 
+        // user.dir and current working directory must be aligned, base directory is not affected
         assertThat( System.getProperty( "basedir" ) ).isEqualTo( projectDirectory.getCanonicalPath() );
         assertThat( System.getProperty( "user.dir" ) ).isEqualTo( forkDirectory.getCanonicalPath() );
         assertThat( new File( "." ).getCanonicalPath() ).isEqualTo( forkDirectory.getCanonicalPath() );
 
+        // original working directory (before variable expansion) should not be created
+        assertThat( new File( "cwd_${surefire.forkNumber}" ) ).doesNotExist();
+
     }
 
 }


[2/2] maven-surefire git commit: SUREFIRE-1136 Remove usage of fest-assertions from IT (not JDK 1.5 compatible)

Posted by ag...@apache.org.
SUREFIRE-1136 Remove usage of fest-assertions from IT (not JDK 1.5 compatible)


Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/60111e78
Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/60111e78
Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/60111e78

Branch: refs/heads/master
Commit: 60111e78fa1d10eae0a0b8f2ab653e828f26ad21
Parents: 15da349
Author: Andreas Gudian <ag...@apache.org>
Authored: Thu Jan 22 21:18:31 2015 +0100
Committer: Andreas Gudian <ag...@apache.org>
Committed: Thu Jan 22 21:18:31 2015 +0100

----------------------------------------------------------------------
 .../surefire-1136-cwd-propagation-in-forked-mode/pom.xml |  6 ------
 .../cwd/CurrentWorkingDirectoryInForkedModeTest.java     | 11 ++++++-----
 2 files changed, 6 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/60111e78/surefire-integration-tests/src/test/resources/surefire-1136-cwd-propagation-in-forked-mode/pom.xml
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/resources/surefire-1136-cwd-propagation-in-forked-mode/pom.xml b/surefire-integration-tests/src/test/resources/surefire-1136-cwd-propagation-in-forked-mode/pom.xml
index c85a9ab..943fac7 100644
--- a/surefire-integration-tests/src/test/resources/surefire-1136-cwd-propagation-in-forked-mode/pom.xml
+++ b/surefire-integration-tests/src/test/resources/surefire-1136-cwd-propagation-in-forked-mode/pom.xml
@@ -46,12 +46,6 @@
       <version>4.11</version>
       <scope>test</scope>
     </dependency>
-    <dependency>
-      <groupId>org.easytesting</groupId>
-      <artifactId>fest-assert-core</artifactId>
-      <version>2.0M10</version>
-      <scope>test</scope>
-    </dependency>
   </dependencies>
 
   <build>

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/60111e78/surefire-integration-tests/src/test/resources/surefire-1136-cwd-propagation-in-forked-mode/src/test/java/cwd/CurrentWorkingDirectoryInForkedModeTest.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/resources/surefire-1136-cwd-propagation-in-forked-mode/src/test/java/cwd/CurrentWorkingDirectoryInForkedModeTest.java b/surefire-integration-tests/src/test/resources/surefire-1136-cwd-propagation-in-forked-mode/src/test/java/cwd/CurrentWorkingDirectoryInForkedModeTest.java
index 1660bfb..9dc0ffe 100644
--- a/surefire-integration-tests/src/test/resources/surefire-1136-cwd-propagation-in-forked-mode/src/test/java/cwd/CurrentWorkingDirectoryInForkedModeTest.java
+++ b/surefire-integration-tests/src/test/resources/surefire-1136-cwd-propagation-in-forked-mode/src/test/java/cwd/CurrentWorkingDirectoryInForkedModeTest.java
@@ -23,7 +23,8 @@ import org.junit.Test;
 
 import java.io.File;
 
-import static org.fest.assertions.api.Assertions.assertThat;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
 
 public class CurrentWorkingDirectoryInForkedModeTest
 {
@@ -38,12 +39,12 @@ public class CurrentWorkingDirectoryInForkedModeTest
         forkDirectory.deleteOnExit();
 
         // user.dir and current working directory must be aligned, base directory is not affected
-        assertThat( System.getProperty( "basedir" ) ).isEqualTo( projectDirectory.getCanonicalPath() );
-        assertThat( System.getProperty( "user.dir" ) ).isEqualTo( forkDirectory.getCanonicalPath() );
-        assertThat( new File( "." ).getCanonicalPath() ).isEqualTo( forkDirectory.getCanonicalPath() );
+        assertEquals( System.getProperty( "basedir" ), projectDirectory.getCanonicalPath() );
+        assertEquals( System.getProperty( "user.dir" ), forkDirectory.getCanonicalPath() );
+        assertEquals( new File( "." ).getCanonicalPath(), forkDirectory.getCanonicalPath() );
 
         // original working directory (before variable expansion) should not be created
-        assertThat( new File( "cwd_${surefire.forkNumber}" ) ).doesNotExist();
+        assertFalse( new File( "cwd_${surefire.forkNumber}" ).exists() );
 
     }