Repository: maven-surefire
Updated Branches:
  refs/heads/master b08627f0f -> 9c417780b


[SUREFIRE-1353] Integration tests testing jvm forks should use subprocess and 
not embedded mode


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

Branch: refs/heads/master
Commit: 9c417780b512533edbe20f630525f75c6248160c
Parents: b08627f
Author: Tibor17 <tibo...@lycos.com>
Authored: Sat Apr 1 20:44:02 2017 +0200
Committer: Tibor17 <tibo...@lycos.com>
Committed: Sat Apr 1 20:44:02 2017 +0200

----------------------------------------------------------------------
 .../maven/surefire/its/ForkConsoleOutputIT.java | 36 ++++++++++++++------
 .../its/ForkConsoleOutputWithErrorsIT.java      | 18 +++++-----
 .../apache/maven/surefire/its/ForkModeIT.java   |  2 +-
 3 files changed, 36 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/9c417780/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ForkConsoleOutputIT.java
----------------------------------------------------------------------
diff --git 
a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ForkConsoleOutputIT.java
 
b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ForkConsoleOutputIT.java
index 7ec0039..6aac330 100644
--- 
a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ForkConsoleOutputIT.java
+++ 
b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ForkConsoleOutputIT.java
@@ -19,7 +19,6 @@ package org.apache.maven.surefire.its;
  * under the License.
  */
 
-import org.apache.maven.surefire.its.fixture.OutputValidator;
 import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase;
 import org.apache.maven.surefire.its.fixture.SurefireLauncher;
 import org.junit.Test;
@@ -37,30 +36,47 @@ public class ForkConsoleOutputIT
     @Test
     public void printSummaryTrueWithRedirect()
     {
-        final OutputValidator outputValidator = unpack().redirectToFile( true 
).printSummary( true ).executeTest();
-        outputValidator.getSurefireReportsFile( 
"forkConsoleOutput.Test1-output.txt" ).assertFileExists();
+        unpack().setForkJvm()
+                .redirectToFile( true )
+                .printSummary( true )
+                .executeTest()
+                .getSurefireReportsFile( "forkConsoleOutput.Test1-output.txt" )
+                .assertFileExists();
     }
 
     @Test
     public void printSummaryTrueWithoutRedirect()
     {
-        final OutputValidator outputValidator = unpack().redirectToFile( false 
).printSummary( true ).executeTest();
-        outputValidator.getSurefireReportsFile( 
"forkConsoleOutput.Test1-output.txt" ).assertFileNotExists();
+        unpack().setForkJvm()
+                .redirectToFile( false )
+                .printSummary( true )
+                .executeTest()
+                .getSurefireReportsFile( "forkConsoleOutput.Test1-output.txt" )
+                .assertFileNotExists();
     }
 
     @Test
     public void printSummaryFalseWithRedirect()
     {
-        final OutputValidator outputValidator =
-            unpack().redirectToFile( true ).printSummary( false 
).debugLogging().showErrorStackTraces().executeTest();
-        outputValidator.getSurefireReportsFile( 
"forkConsoleOutput.Test1-output.txt" ).assertFileExists();
+        unpack().setForkJvm()
+                .redirectToFile( true )
+                .printSummary( false )
+                .debugLogging()
+                .showErrorStackTraces()
+                .executeTest()
+                .getSurefireReportsFile( "forkConsoleOutput.Test1-output.txt" )
+                .assertFileExists();
     }
 
     @Test
     public void printSummaryFalseWithoutRedirect()
     {
-        final OutputValidator outputValidator = unpack().redirectToFile( false 
).printSummary( false ).executeTest();
-        outputValidator.getSurefireReportsFile( 
"forkConsoleOutput.Test1-output.txt" ).assertFileNotExists();
+        unpack().setForkJvm()
+                .redirectToFile( false )
+                .printSummary( false )
+                .executeTest()
+                .getSurefireReportsFile( "forkConsoleOutput.Test1-output.txt" )
+                .assertFileNotExists();
     }
 
 

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/9c417780/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ForkConsoleOutputWithErrorsIT.java
----------------------------------------------------------------------
diff --git 
a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ForkConsoleOutputWithErrorsIT.java
 
b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ForkConsoleOutputWithErrorsIT.java
index af4a6e6..e5feb7f 100644
--- 
a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ForkConsoleOutputWithErrorsIT.java
+++ 
b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ForkConsoleOutputWithErrorsIT.java
@@ -19,9 +19,7 @@ package org.apache.maven.surefire.its;
  * under the License.
  */
 
-import org.apache.maven.surefire.its.fixture.OutputValidator;
 import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase;
-import org.apache.maven.surefire.its.fixture.TestFile;
 import org.junit.Test;
 
 /**
@@ -32,16 +30,18 @@ import org.junit.Test;
  * @author Kristian Rosenvold
  */
 public class ForkConsoleOutputWithErrorsIT
-    extends SurefireJUnit4IntegrationTestCase
+        extends SurefireJUnit4IntegrationTestCase
 {
     @Test
     public void xmlFileContainsConsoleOutput()
     {
-        final OutputValidator outputValidator = unpack( 
"/fork-consoleOutputWithErrors" ).
-            failNever().redirectToFile( true ).executeTest();
-        final TestFile surefireReportsFile =
-            outputValidator.getSurefireReportsXmlFile( 
"TEST-forkConsoleOutput.Test2.xml" );
-        surefireReportsFile.assertContainsText( "sout: Will Fail soon" );
-        surefireReportsFile.assertContainsText( "serr: Will Fail now" );
+        unpack( "/fork-consoleOutputWithErrors" )
+                .setForkJvm()
+                .failNever()
+                .redirectToFile( true )
+                .executeTest()
+                .getSurefireReportsXmlFile( "TEST-forkConsoleOutput.Test2.xml" 
)
+                .assertContainsText( "sout: Will Fail soon" )
+                .assertContainsText( "serr: Will Fail now" );
     }
 }

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/9c417780/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ForkModeIT.java
----------------------------------------------------------------------
diff --git 
a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ForkModeIT.java
 
b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ForkModeIT.java
index 0be2123..574d144 100644
--- 
a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ForkModeIT.java
+++ 
b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ForkModeIT.java
@@ -144,7 +144,7 @@ public class ForkModeIT
     public void testForkCountTwoNoReuse()
     {
         String[] pids =
-            doTest( unpack( getProject() ).forkCount( 2 ).reuseForks( false 
).addGoal( "-DsleepLength=1200" ) );
+            doTest( unpack( getProject() ).setForkJvm().forkCount( 2 
).reuseForks( false ).addGoal( "-DsleepLength=1200" ) );
         assertDifferentPids( pids );
         assertFalse( "pid 1 is not the same as the main process' pid", 
pids[0].equals( getMainPID() ) );
     }

Reply via email to