maven-surefire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ken...@apache.org
Subject svn commit: r370944 - /maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/SurefireBooter.java
Date Sat, 21 Jan 2006 01:11:09 GMT
Author: kenney
Date: Fri Jan 20 17:11:07 2006
New Revision: 370944

URL: http://svn.apache.org/viewcvs?rev=370944&view=rev
Log:
PR: MSUREFIRE-44
Submitted by: Dan Tran

Committed on behalf of Dan Tran. 

Adds support for configuring the working directory and
the environment variables for a forked test.

Modified:
    maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/SurefireBooter.java

Modified: maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/SurefireBooter.java
URL: http://svn.apache.org/viewcvs/maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/SurefireBooter.java?rev=370944&r1=370943&r2=370944&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/SurefireBooter.java
(original)
+++ maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/SurefireBooter.java
Fri Jan 20 17:11:07 2006
@@ -37,6 +37,7 @@
 import java.util.Arrays;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
 import java.util.Properties;
 
 /**
@@ -73,6 +74,10 @@
     private Properties systemProperties;
 
     private String argLine;
+    
+    private Map environmentVariables;
+    
+    private File workingDirectory;
 
     private boolean childDelegation;
 
@@ -172,11 +177,21 @@
         this.argLine = argLine;
     }
 
+    public void setEnvironmentVariables( Map environmentVariables )
+    {
+        this.environmentVariables = environmentVariables;
+    }
+    
     public void setBasedir( String basedir )
     {
         this.basedir = basedir;
     }
 
+    public void setWorkingDirectory( File dir )
+    {
+        this.workingDirectory = dir;
+    }    
+
     public void setChildDelegation( boolean childDelegation )
     {
         this.childDelegation = childDelegation;
@@ -333,6 +348,32 @@
         if ( argLine != null )
         {
             cli.addArguments( StringUtils.split( argLine, " " ) );
+        }
+        
+        if ( environmentVariables != null)
+        {
+            Iterator iter = environmentVariables.keySet().iterator();
+            
+            while ( iter.hasNext() )
+            {
+                String key = (String) iter.next();
+                
+                String value = (String) environmentVariables.get( key );
+                
+                cli.addEnvironment( key, value );
+                
+                if ( debug )
+                {
+                    System.out.println( "Environment: " + key + "="  + value + " added."
);
+                }
+                
+            }
+            
+        }
+        
+        if ( workingDirectory != null )
+        {
+            cli.setWorkingDirectory( workingDirectory.getAbsolutePath() );
         }
 
         cli.createArgument().setValue( "-classpath" );



Mime
View raw message