maven-surefire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From krosenv...@apache.org
Subject svn commit: r1054765 - in /maven/surefire/trunk/maven-surefire-common/src: main/java/org/apache/maven/plugin/surefire/ main/java/org/apache/maven/plugin/surefire/booterclient/ test/java/org/apache/maven/plugin/surefire/booterclient/
Date Mon, 03 Jan 2011 21:31:53 GMT
Author: krosenvold
Date: Mon Jan  3 21:31:52 2011
New Revision: 1054765

URL: http://svn.apache.org/viewvc?rev=1054765&view=rev
Log:
o Simplified construction of ForkConfiguration slightly

Modified:
    maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
    maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkConfiguration.java
    maven/surefire/trunk/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ForkConfigurationTest.java

Modified: maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java?rev=1054765&r1=1054764&r2=1054765&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
(original)
+++ maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
Mon Jan  3 21:31:52 2011
@@ -504,15 +504,14 @@ public abstract class AbstractSurefireMo
 
     protected ForkConfiguration getForkConfiguration()
     {
-        final Classpath bootClasspathConfiguration = new Classpath();
-
-        ForkConfiguration fork = new ForkConfiguration( bootClasspathConfiguration );
-
-        fork.setForkMode( getForkMode() );
-
         File tmpDir = new File( getReportsDirectory().getParentFile(), "surefire" );
         //noinspection ResultOfMethodCallIgnored
         tmpDir.mkdirs();
+
+        final Classpath bootClasspathConfiguration = new Classpath();
+
+        ForkConfiguration fork = new ForkConfiguration( bootClasspathConfiguration, getForkMode(),
tmpDir );
+
         fork.setTempDirectory( tmpDir );
 
         processSystemProperties( !fork.isForking() );

Modified: maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkConfiguration.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkConfiguration.java?rev=1054765&r1=1054764&r2=1054765&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkConfiguration.java
(original)
+++ maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkConfiguration.java
Mon Jan  3 21:31:52 2011
@@ -56,7 +56,7 @@ public class ForkConfiguration
 
     private final Classpath bootClasspathConfiguration;
 
-    private String forkMode;
+    private final String forkMode;
 
     private Properties systemProperties;
 
@@ -74,9 +74,11 @@ public class ForkConfiguration
 
     private String debugLine;
 
-    public ForkConfiguration( Classpath bootClasspathConfiguration )
+    public ForkConfiguration( Classpath bootClasspathConfiguration, String forkMode, File
tmpDir )
     {
         this.bootClasspathConfiguration = bootClasspathConfiguration;
+        this.forkMode = getForkMode( forkMode );
+        this.tempDirectory = tmpDir;
     }
 
     public Classpath getBootClasspath()
@@ -84,19 +86,19 @@ public class ForkConfiguration
         return bootClasspathConfiguration;
     }
 
-    public void setForkMode( String forkMode )
+    private static String getForkMode( String forkMode )
     {
         if ( "pertest".equalsIgnoreCase( forkMode ) )
         {
-            this.forkMode = FORK_ALWAYS;
+            return FORK_ALWAYS;
         }
         else if ( "none".equalsIgnoreCase( forkMode ) )
         {
-            this.forkMode = FORK_NEVER;
+            return FORK_NEVER;
         }
         else if ( forkMode.equals( FORK_NEVER ) || forkMode.equals( FORK_ONCE ) || forkMode.equals(
FORK_ALWAYS ) )
         {
-            this.forkMode = forkMode;
+            return forkMode;
         }
         else
         {

Modified: maven/surefire/trunk/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ForkConfigurationTest.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ForkConfigurationTest.java?rev=1054765&r1=1054764&r2=1054765&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ForkConfigurationTest.java
(original)
+++ maven/surefire/trunk/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ForkConfigurationTest.java
Mon Jan  3 21:31:52 2011
@@ -38,7 +38,6 @@ public class ForkConfigurationTest
     {
         ForkConfiguration config = getForkConfiguration();
         File cpElement = getTempClasspathFile();
-        config.setForkMode( ForkConfiguration.FORK_ONCE );
         config.setJvmExecutable( "java" );
 
         Commandline cli = config.createCommandLine( Collections.singletonList( cpElement.getAbsolutePath()
), true );
@@ -72,7 +71,7 @@ public class ForkConfigurationTest
     public static ForkConfiguration getForkConfiguration()
         throws IOException
     {
-        ForkConfiguration forkConfiguration = new ForkConfiguration( new Classpath() );
+        ForkConfiguration forkConfiguration = new ForkConfiguration( new Classpath(), ForkConfiguration.FORK_ONCE,
null );
         forkConfiguration.setWorkingDirectory( new File( "." ).getCanonicalFile() );
         return forkConfiguration;
     }



Mime
View raw message