You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by br...@apache.org on 2006/11/10 08:01:16 UTC

svn commit: r473213 - in /maven/sandbox/plugins/maven-nunit-plugin: ./ pom.xml src/main/java/org/apache/maven/plugin/nunit/NUnitEnvironment.java src/main/java/org/apache/maven/plugin/nunit/NUnitMojo.java src/main/java/org/codehaus/

Author: brett
Date: Thu Nov  9 23:01:15 2006
New Revision: 473213

URL: http://svn.apache.org/viewvc?view=rev&rev=473213
Log:
clean up

Removed:
    maven/sandbox/plugins/maven-nunit-plugin/src/main/java/org/codehaus/
Modified:
    maven/sandbox/plugins/maven-nunit-plugin/   (props changed)
    maven/sandbox/plugins/maven-nunit-plugin/pom.xml   (props changed)
    maven/sandbox/plugins/maven-nunit-plugin/src/main/java/org/apache/maven/plugin/nunit/NUnitEnvironment.java   (contents, props changed)
    maven/sandbox/plugins/maven-nunit-plugin/src/main/java/org/apache/maven/plugin/nunit/NUnitMojo.java   (contents, props changed)

Propchange: maven/sandbox/plugins/maven-nunit-plugin/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Nov  9 23:01:15 2006
@@ -0,0 +1,4 @@
+target
+*.ipr
+*.iml
+*.iws

Propchange: maven/sandbox/plugins/maven-nunit-plugin/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: maven/sandbox/plugins/maven-nunit-plugin/src/main/java/org/apache/maven/plugin/nunit/NUnitEnvironment.java
URL: http://svn.apache.org/viewvc/maven/sandbox/plugins/maven-nunit-plugin/src/main/java/org/apache/maven/plugin/nunit/NUnitEnvironment.java?view=diff&rev=473213&r1=473212&r2=473213
==============================================================================
--- maven/sandbox/plugins/maven-nunit-plugin/src/main/java/org/apache/maven/plugin/nunit/NUnitEnvironment.java (original)
+++ maven/sandbox/plugins/maven-nunit-plugin/src/main/java/org/apache/maven/plugin/nunit/NUnitEnvironment.java Thu Nov  9 23:01:15 2006
@@ -1,250 +1,315 @@
-package org.apache.maven.plugin.nunit;
-
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.IOException;
-import java.io.OutputStreamWriter;
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.io.Writer;
-import java.util.Iterator;
-import java.util.List;
-
-import org.apache.commons.io.FileUtils;
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.csharp.helper.PackagingHelper;
-import org.apache.maven.plugin.logging.Log;
-import org.codehaus.plexus.util.StringUtils;
-import org.codehaus.plexus.util.cli.CommandLineException;
-import org.codehaus.plexus.util.cli.CommandLineUtils;
-import org.codehaus.plexus.util.cli.Commandline;
-import org.codehaus.plexus.util.cli.StreamConsumer;
-import org.codehaus.plexus.util.cli.WriterStreamConsumer;
-
-/**
-* NUNIT-CONSOLE [inputfiles] [options]
-    *
-    * Runs a set of NUnit tests from the console.
-    *
-    * You may specify one or more assemblies or a single
-    *project file of type .nunit.
-    *
-    *Options:
-    * \/fixture=STR         Fixture to test
-    * \/config=STR          Project configuration to load
-    * \/xml=STR             Name of XML output file
-    *\/transform=STR       Name of transform file
-    *\/xmlConsole          Display XML to the console
-    *\/output=STR          File to receive test output (Sho
-    *\/err=STR             File to receive test error outpu
-    *\/labels              Label each test in stdOut
-    *\/include=STR         List of categories to include
-    *\/exclude=STR         List of categories to exclude
-    *\/noshadow            Disable shadow copy
-    *\/thread              Run tests on a separate thread
-    *\/wait                Wait for input before closing co
-    *\/nologo              Do not display the logo
-    *\/help                Display help (Short format: /?)
-*/
-
-public class NUnitEnvironment {
-
-	private Log log = null;
-	private static String directoryName = ".nunit";
-	private static String argumentsName = "nunit-arguments";
-	
-	private static String nunitOutputPrefix = "[NUNIT] ";
-	
-	private File directory = null;
-	private File outputDir = null;
-	private File mainAssembly = null;
-	private File testAssembly = null;
-	private File nunitConsoleFile = null;
-	private File unitTestConfig = null; 
-	private String runtime = null;
-	
-	private List artifacts = null;
-	
-	public NUnitEnvironment(Log log, File outputDir, List artifacts, File mainAssembly, File testAssembly, File unitTestConfig, String runtime){
-		this.log = log;
-		this.outputDir = outputDir;
-		this.artifacts = artifacts;
-		this.mainAssembly = mainAssembly;
-		this.testAssembly = testAssembly;
-		this.unitTestConfig = unitTestConfig;
-		this.runtime = runtime;
-	}
-	
-	public void create() throws MojoExecutionException {
-		
-		try {
-			
-			directory = new File( outputDir.getAbsolutePath() + File.separator + directoryName );
-			
-			if( directory.exists() ){
-				
-				FileUtils.deleteDirectory( directory );
-			}
-				
-		    FileUtils.forceMkdir( directory );
-			
-			copyDependencies( directory, artifacts );
-			
-		} catch(IOException ioex){
-			throw new MojoExecutionException("IOException occurred while trying to create local copy of nunit [" + outputDir.getAbsolutePath() + File.separator + ".nunit]", ioex );
-		}
-	}
-	
-	public Log getLog() {
-		return log;
-	}
-
-	public void setLog(Log log) {
-		this.log = log;
-	}
-
-	
-	private void copyDependencies(File directory, List artifacts) throws MojoExecutionException, IOException {
-	
-		for ( Iterator i = artifacts.iterator(); i.hasNext(); ){
-			
-			Artifact a = (Artifact) i.next();
-			
-			if( ! a.getFile().exists() )
-				throw new MojoExecutionException("Artifact file:" + a.getFile() + " does not exist, path provided:" + a.getFile().getAbsolutePath() );
-			
-			//only copy non-syetem deps to directory (system deps you get for free.. :-)
-			if( ! a.getFile().isDirectory() && (! a.getScope().equals( Artifact.SCOPE_SYSTEM ) ) ){
-				//if reference is a non csharp (could be java for an integration test, then ignore it.
-				if( PackagingHelper.isDotnetPackaging( a.getType() ) )
-					FileUtils.copyFileToDirectory( a.getFile(), outputDir );
-			}
-				
-			
-			if( a.getArtifactId().equals("nunit-console") ) nunitConsoleFile = new File( outputDir + File.separator + a.getFile().getName() );
-		}
-		
-		if( nunitConsoleFile == null  )
-			throw new MojoExecutionException("Cannot find dependency with id:nunit.console, cannot execute NUnit Plugin without this.");
-		
-		FileUtils.copyFileToDirectory( this.mainAssembly, outputDir );
-		
-		if( unitTestConfig == null ){
-			this.getLog().info(nunitOutputPrefix +"\t No config file specified.");
-		}
-		else if( unitTestConfig.exists() && unitTestConfig.isFile() ) {
-			FileUtils.copyFile( unitTestConfig, new File( outputDir , this.testAssembly.getName() + ".config" ) );
-			this.getLog().info(nunitOutputPrefix +"\t Copying config [" + unitTestConfig.getAbsolutePath() + "] to [" + new File( directory, this.testAssembly.getName() + ".config" ).getAbsolutePath() );
-		}else 
-			this.getLog().info(nunitOutputPrefix +"\t Config file doesn't exist or is not a file [" + unitTestConfig.getAbsolutePath() + "]");
-			
-	}
-	
-	public void run() throws MojoExecutionException {
-		
-		
-		Commandline cli = new Commandline();
-		try {
-			cli.setWorkingDirectory(outputDir.getCanonicalPath());
-		} catch (IOException e1) {
-			throw new MojoExecutionException("Could not set working directory to: "+outputDir);
-		}
-		
-    	File executable = nunitConsoleFile;
-    	
-    	if( executable == null ) throw new MojoExecutionException("Cannot find dependency with id:nunit.console, cannot execute NUnit Plugin without this.");
-    	
-    	if( StringUtils.isEmpty( runtime ) ){
-    		cli.setExecutable( nunitConsoleFile.getName() );
-    	} else {
-    		cli.setExecutable( runtime );
-        	cli.createArgument().setValue( nunitConsoleFile.getName() );
-    	}
-    	cli.createArgument().setValue( testAssembly.getName() );
-
-      try
-      {
-    	  logEnvironment(cli);
-    	  
-          Writer outWriter = new OutputStreamWriter(System.out);
-          
-          Writer errWriter = new OutputStreamWriter(System.err);
-
-          StreamConsumer out = new WriterStreamConsumer( outWriter );
-
-          StreamConsumer err = new WriterStreamConsumer( errWriter );
-    	  
-          System.out.println("-------------------------------------------------------");
-          System.out.println("T E S T S											   ");
-          System.out.println("-------------------------------------------------------");
-          
-    	  int result = CommandLineUtils.executeCommandLine( cli, out, err );
-        
-//    	  try {
-//    		  //writeNUnitOutputToLog( new BufferedReader( new StringReader( stringWriter.toString() ) ) );
-//    	  }catch(IOException ioex){
-//    		  throw new MojoExecutionException(ioex.getMessage(), ioex);
-//    	  }
-    	  
-          if ( result != 0 )
-          {
-              throw new MojoExecutionException("Result of execution is: \'" + result + "\'. NUnit failed."  );
-          }
-      }
-      catch ( CommandLineException e )
-      {
-          throw new MojoExecutionException( e.getMessage(), e );
-      }
-	}
-	
-	public void delete() throws MojoExecutionException {
-		if(directory != null && directory.exists()){
-			try {
-				FileUtils.deleteDirectory(directory);
-			} catch(IOException ioex){
-				throw new MojoExecutionException("Could not delete temporary nunit dir:" + directory.getAbsolutePath(), ioex );
-			}
-		}
-	}
-	
-//	private void writeNUnitOutputToLog(BufferedReader reader) throws IOException {
-//		
-//        String line = reader.readLine();
-//
-//        while( line != null )
-//        {
-//        	log.info(nunitOutputPrefix + line);
-//        	
-//        	line = reader.readLine();
-//        }
-//	}
-	
-	private void logEnvironment(Commandline cli) throws MojoExecutionException {
-		
-		getLog().info( nunitOutputPrefix + "NUnit config:" );
-      	getLog().info( nunitOutputPrefix + "\t nunit binary [" + nunitConsoleFile.getAbsolutePath() + "]" );
-      	getLog().info( nunitOutputPrefix + "\t test assembly [" + testAssembly.getAbsolutePath() + "]" );
-      	getLog().info( nunitOutputPrefix + "\t main assembly [" + mainAssembly.getAbsolutePath() + "]");
-      	
-      	getLog().info( nunitOutputPrefix + "\t (nb. All references copied locally [" + directory.getAbsolutePath() + "])");
-      	
-      	for( Iterator i = artifacts.iterator(); i.hasNext(); ){
-      		Artifact a = (Artifact) i.next();
-      		if( PackagingHelper.isDotnetPackaging( a.getType() ) )
-      			getLog().info(nunitOutputPrefix +"\t reference:" + a.getFile().getName() ); 
-      	}
-      	
-      	try {
-      	File f = new File( outputDir, "nunit-arguments" );
-      	f.createNewFile();
-      	//params are: 1=file to write to,2=data to write, 3=encoding (null for platform default
-      	FileUtils.writeStringToFile(f, cli.toString(), null );
-      	
-      	getLog().info(nunitOutputPrefix + "\t nunit command line written to [" + f.getAbsolutePath() + "]");
-      	} catch( IOException ioex ){
-      		throw new MojoExecutionException("Could not create nunit-argumnets file @" + outputDir.getAbsolutePath() + File.separator + argumentsName );
-      	}
-	}
-}
+package org.apache.maven.plugin.nunit;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.csharp.helper.PackagingHelper;
+import org.apache.maven.plugin.logging.Log;
+import org.codehaus.plexus.util.StringUtils;
+import org.codehaus.plexus.util.cli.CommandLineException;
+import org.codehaus.plexus.util.cli.CommandLineUtils;
+import org.codehaus.plexus.util.cli.Commandline;
+import org.codehaus.plexus.util.cli.StreamConsumer;
+import org.codehaus.plexus.util.cli.WriterStreamConsumer;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * NUNIT-CONSOLE [inputfiles] [options]
+ * <p/>
+ * Runs a set of NUnit tests from the console.
+ * <p/>
+ * You may specify one or more assemblies or a single
+ * project file of type .nunit.
+ * <p/>
+ * Options:
+ * \/fixture=STR         Fixture to test
+ * \/config=STR          Project configuration to load
+ * \/xml=STR             Name of XML output file
+ * \/transform=STR       Name of transform file
+ * \/xmlConsole          Display XML to the console
+ * \/output=STR          File to receive test output (Sho
+ * \/err=STR             File to receive test error outpu
+ * \/labels              Label each test in stdOut
+ * \/include=STR         List of categories to include
+ * \/exclude=STR         List of categories to exclude
+ * \/noshadow            Disable shadow copy
+ * \/thread              Run tests on a separate thread
+ * \/wait                Wait for input before closing co
+ * \/nologo              Do not display the logo
+ * \/help                Display help (Short format: /?)
+ */
+
+public class NUnitEnvironment
+{
+
+    private Log log = null;
+
+    private static String directoryName = ".nunit";
+
+    private static String argumentsName = "nunit-arguments";
+
+    private static String nunitOutputPrefix = "[NUNIT] ";
+
+    private File directory = null;
+
+    private File outputDir = null;
+
+    private File mainAssembly = null;
+
+    private File testAssembly = null;
+
+    private File nunitConsoleFile = null;
+
+    private File unitTestConfig = null;
+
+    private String runtime = null;
+
+    private List artifacts = null;
+
+    public NUnitEnvironment( Log log, File outputDir, List artifacts, File mainAssembly, File testAssembly,
+                             File unitTestConfig, String runtime )
+    {
+        this.log = log;
+        this.outputDir = outputDir;
+        this.artifacts = artifacts;
+        this.mainAssembly = mainAssembly;
+        this.testAssembly = testAssembly;
+        this.unitTestConfig = unitTestConfig;
+        this.runtime = runtime;
+    }
+
+    public void create()
+        throws MojoExecutionException
+    {
+
+        try
+        {
+
+            directory = new File( outputDir.getAbsolutePath() + File.separator + directoryName );
+
+            if ( directory.exists() )
+            {
+
+                FileUtils.deleteDirectory( directory );
+            }
+
+            FileUtils.forceMkdir( directory );
+
+            copyDependencies( directory, artifacts );
+
+        }
+        catch ( IOException ioex )
+        {
+            throw new MojoExecutionException( "IOException occurred while trying to create local copy of nunit [" +
+                outputDir.getAbsolutePath() + File.separator + ".nunit]", ioex );
+        }
+    }
+
+    public Log getLog()
+    {
+        return log;
+    }
+
+    public void setLog( Log log )
+    {
+        this.log = log;
+    }
+
+
+    private void copyDependencies( File directory, List artifacts )
+        throws MojoExecutionException, IOException
+    {
+
+        for ( Iterator i = artifacts.iterator(); i.hasNext(); )
+        {
+
+            Artifact a = (Artifact) i.next();
+
+            if ( !a.getFile().exists() )
+            {
+                throw new MojoExecutionException( "Artifact file:" + a.getFile() + " does not exist, path provided:" +
+                    a.getFile().getAbsolutePath() );
+            }
+
+            //only copy non-syetem deps to directory (system deps you get for free.. :-)
+            if ( !a.getFile().isDirectory() && ( !a.getScope().equals( Artifact.SCOPE_SYSTEM ) ) )
+            {
+                //if reference is a non csharp (could be java for an integration test, then ignore it.
+                if ( PackagingHelper.isDotnetPackaging( a.getType() ) )
+                {
+                    FileUtils.copyFileToDirectory( a.getFile(), outputDir );
+                }
+            }
+
+            if ( a.getArtifactId().equals( "nunit-console" ) )
+            {
+                nunitConsoleFile = new File( outputDir + File.separator + a.getFile().getName() );
+            }
+        }
+
+        if ( nunitConsoleFile == null )
+        {
+            throw new MojoExecutionException(
+                "Cannot find dependency with id:nunit.console, cannot execute NUnit Plugin without this." );
+        }
+
+        FileUtils.copyFileToDirectory( this.mainAssembly, outputDir );
+
+        if ( unitTestConfig == null )
+        {
+            this.getLog().info( nunitOutputPrefix + "\t No config file specified." );
+        }
+        else if ( unitTestConfig.exists() && unitTestConfig.isFile() )
+        {
+            FileUtils.copyFile( unitTestConfig, new File( outputDir, this.testAssembly.getName() + ".config" ) );
+            this.getLog().info( nunitOutputPrefix + "\t Copying config [" + unitTestConfig.getAbsolutePath() +
+                "] to [" + new File( directory, this.testAssembly.getName() + ".config" ).getAbsolutePath() );
+        }
+        else
+        {
+            this.getLog().info( nunitOutputPrefix + "\t Config file doesn't exist or is not a file [" +
+                unitTestConfig.getAbsolutePath() + "]" );
+        }
+
+    }
+
+    public void run()
+        throws MojoExecutionException
+    {
+
+        Commandline cli = new Commandline();
+        try
+        {
+            cli.setWorkingDirectory( outputDir.getCanonicalPath() );
+        }
+        catch ( IOException e1 )
+        {
+            throw new MojoExecutionException( "Could not set working directory to: " + outputDir );
+        }
+
+        File executable = nunitConsoleFile;
+
+        if ( executable == null )
+        {
+            throw new MojoExecutionException(
+                "Cannot find dependency with id:nunit.console, cannot execute NUnit Plugin without this." );
+        }
+
+        if ( StringUtils.isEmpty( runtime ) )
+        {
+            cli.setExecutable( nunitConsoleFile.getName() );
+        }
+        else
+        {
+            cli.setExecutable( runtime );
+            cli.createArgument().setValue( nunitConsoleFile.getName() );
+        }
+        cli.createArgument().setValue( testAssembly.getName() );
+
+        try
+        {
+            logEnvironment( cli );
+
+            Writer outWriter = new OutputStreamWriter( System.out );
+
+            Writer errWriter = new OutputStreamWriter( System.err );
+
+            StreamConsumer out = new WriterStreamConsumer( outWriter );
+
+            StreamConsumer err = new WriterStreamConsumer( errWriter );
+
+            System.out.println( "-------------------------------------------------------" );
+            System.out.println( "T E S T S											   " );
+            System.out.println( "-------------------------------------------------------" );
+
+            int result = CommandLineUtils.executeCommandLine( cli, out, err );
+
+//    	  try {
+//    		  //writeNUnitOutputToLog( new BufferedReader( new StringReader( stringWriter.toString() ) ) );
+//    	  }catch(IOException ioex){
+//    		  throw new MojoExecutionException(ioex.getMessage(), ioex);
+//    	  }
+
+            if ( result != 0 )
+            {
+                throw new MojoExecutionException( "Result of execution is: \'" + result + "\'. NUnit failed." );
+            }
+        }
+        catch ( CommandLineException e )
+        {
+            throw new MojoExecutionException( e.getMessage(), e );
+        }
+    }
+
+    public void delete()
+        throws MojoExecutionException
+    {
+        if ( directory != null && directory.exists() )
+        {
+            try
+            {
+                FileUtils.deleteDirectory( directory );
+            }
+            catch ( IOException ioex )
+            {
+                throw new MojoExecutionException( "Could not delete temporary nunit dir:" + directory.getAbsolutePath(),
+                                                  ioex );
+            }
+        }
+    }
+
+//	private void writeNUnitOutputToLog(BufferedReader reader) throws IOException {
+//		
+//        String line = reader.readLine();
+//
+//        while( line != null )
+//        {
+//        	log.info(nunitOutputPrefix + line);
+//        	
+//        	line = reader.readLine();
+//        }
+//	}
+
+    private void logEnvironment( Commandline cli )
+        throws MojoExecutionException
+    {
+
+        getLog().info( nunitOutputPrefix + "NUnit config:" );
+        getLog().info( nunitOutputPrefix + "\t nunit binary [" + nunitConsoleFile.getAbsolutePath() + "]" );
+        getLog().info( nunitOutputPrefix + "\t test assembly [" + testAssembly.getAbsolutePath() + "]" );
+        getLog().info( nunitOutputPrefix + "\t main assembly [" + mainAssembly.getAbsolutePath() + "]" );
+
+        getLog().info(
+            nunitOutputPrefix + "\t (nb. All references copied locally [" + directory.getAbsolutePath() + "])" );
+
+        for ( Iterator i = artifacts.iterator(); i.hasNext(); )
+        {
+            Artifact a = (Artifact) i.next();
+            if ( PackagingHelper.isDotnetPackaging( a.getType() ) )
+            {
+                getLog().info( nunitOutputPrefix + "\t reference:" + a.getFile().getName() );
+            }
+        }
+
+        try
+        {
+            File f = new File( outputDir, "nunit-arguments" );
+            f.createNewFile();
+            //params are: 1=file to write to,2=data to write, 3=encoding (null for platform default
+            FileUtils.writeStringToFile( f, cli.toString(), null );
+
+            getLog().info( nunitOutputPrefix + "\t nunit command line written to [" + f.getAbsolutePath() + "]" );
+        }
+        catch ( IOException ioex )
+        {
+            throw new MojoExecutionException( "Could not create nunit-argumnets file @" + outputDir.getAbsolutePath() +
+                File.separator + argumentsName );
+        }
+    }
+}

Propchange: maven/sandbox/plugins/maven-nunit-plugin/src/main/java/org/apache/maven/plugin/nunit/NUnitEnvironment.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: maven/sandbox/plugins/maven-nunit-plugin/src/main/java/org/apache/maven/plugin/nunit/NUnitMojo.java
URL: http://svn.apache.org/viewvc/maven/sandbox/plugins/maven-nunit-plugin/src/main/java/org/apache/maven/plugin/nunit/NUnitMojo.java?view=diff&rev=473213&r1=473212&r2=473213
==============================================================================
--- maven/sandbox/plugins/maven-nunit-plugin/src/main/java/org/apache/maven/plugin/nunit/NUnitMojo.java (original)
+++ maven/sandbox/plugins/maven-nunit-plugin/src/main/java/org/apache/maven/plugin/nunit/NUnitMojo.java Thu Nov  9 23:01:15 2006
@@ -1,181 +1,206 @@
-package org.apache.maven.plugin.nunit;
-
-import java.io.File;
-import java.util.List;
-
-import org.apache.maven.plugin.AbstractMojo;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.csharp.helper.PackagingHelper;
-import org.apache.maven.project.MavenProject;
-import org.codehaus.plexus.util.Os;
-import org.codehaus.plexus.util.StringUtils;
-
-/**
- *
- * @requiresDependencyResolution test
- * @goal test
- * @phase test
- * @description Run tests in project using NUnit 
- * @author <a href="mailto:chris.stevenson@gmail.com">Chris Stevenson</a>
- * 
- */
-public class NUnitMojo extends AbstractMojo {
-
-    /**
-     * Name of the generated assembly
-     *
-     * @parameter alias="jarName" expression="${project.build.finalName}"
-     * @required
-     */
-    private String finalName;
-    
-	/**
-     * Set this to 'true' to bypass unit tests entirely. 
-     * Its use is NOT RECOMMENDED, but quite convenient on occasion.
-     *
-     * @parameter expression="${maven.test.skip}"
-     */
-    private boolean skip;
-
-    /**
-     * The configuration file for the assembly, if required.
-     * @parameter
-     */
-    private File configFile;
-    
-    /**
-     * The directory containing generated test classes of the project being tested.
-     *
-     * @parameter expression="${project.build.testOutputDirectory}"
-     * @required
-     */
-    private File testOutputDirectory;
- 
-    /**
-     * The file name for the unit-tests library. Defaults to unit-tests.dll
-     *
-     * @parameter 
-     */
-    private String testOutputFileName;
-    
-    /**
-     * This is the filename to invoke the runtime environment. On windows
-     * using csc & MS dotnet this should be null.
-     * 
-     * On Windows/*nix using mono this should be mono 
-     * 
-     * Using "default" will detect the current platform and use the 
-     * the default value for the platform.
-     *
-     * @parameter expression="${nunit.runtime}" default-value="default"
-     */
-    private String runtime;
-    
-     /**
-      * @parameter expression="${project}"
-      * @required
-      * @readonly
-      */
-     protected MavenProject project;
-    
-     /**
- 	 * Directory containing the classes.
- 	 *
-      * @parameter expression="${project.build.outputDirectory}"
-      * @required
-      * @readonly
-      */
-     private File outputDirectory;
-     
-	public void execute() throws MojoExecutionException {
-		
-		if(skip){
-			this.getLog().warn("Skipping Unit Tests!!");
-			return;
-		}
-		
-		this.getLog().info("Creating NUnit environment....");
-		
-		List dependencyartifacts = project.getTestArtifacts();
-		
-		String runtimeExecutable  = getRuntimeExecutable( this.runtime );
-		
-		//this is a dirty firkle that is provided by the packaging class :-)
-		File mainAssembly = outputDirectory;
-		
-		File testAssembly = null;
-		
-		if( ! StringUtils.isEmpty( testOutputFileName) )
-			testAssembly = getFile(testOutputDirectory, testOutputFileName );
-		else 
-			testAssembly = getFile(testOutputDirectory, "unit-tests", "dotnet-library" );
-		
-		this.getLog().info("Looking for test assembly at:" + testAssembly.getAbsolutePath() );
-		
-		if( ! testAssembly.exists() )
-			this.getLog().warn("SKIPPING TESTS as no test assembly found. ");
-		
-
-		NUnitEnvironment env = new NUnitEnvironment( this.getLog(), testOutputDirectory, 
-													 dependencyartifacts, mainAssembly, 
-													 testAssembly, configFile,
-													 runtimeExecutable );
-	
-		env.create();
-		
-		//execute Nunit tests.
-		env.run();
-		
-		//if everything works then delete environment (else leave around for debugging)
-		env.delete();
-		
-	}
-	
-	public File getFile(File directory, String fileName, String packaging) throws MojoExecutionException{
-		
-		String fileAbsolutePath = directory.getAbsolutePath() + File.separator + fileName + "." + PackagingHelper.getExtension( packaging );		
-		
-		this.getLog().debug("Looking for file[" + fileAbsolutePath + "]");
-		
-		File f = new File(fileAbsolutePath);
-		
-		if( ! f.exists() ) throw new MojoExecutionException("Cannot find file[" + fileAbsolutePath + "]");
-		
-		return f;
-	}
-	
-	public File getFile(File directory, String fileName) throws MojoExecutionException{
-		
-		String fileAbsolutePath = directory.getAbsolutePath() + File.separator + fileName;		
-		
-		this.getLog().debug("Looking for file[" + fileAbsolutePath + "]");
-		
-		File f = new File(fileAbsolutePath);
-		
-		if( ! f.exists() ) throw new MojoExecutionException("Cannot find file[" + fileAbsolutePath + "]");
-		
-		return f;
-	}
-	
-	private String getRuntimeExecutable(String param) {
-		
-		String exe = null;
-		
-		if( "default".equals( param ) ){
-			//if running windows leave null
-			if ( Os.isFamily("windows") ){
-				exe = null;
-				this.getLog().info("OS Appears to be windows, leaving runtimeExecutable as null");
-			}else {
-				//pop in mono by default.
-				exe = "mono";
-				this.getLog().info("OS Appears to be *nix, setting runtimeExecutable to be \"mono\"");
-			}
-		}else{
-			exe = param;
-			this.getLog().info("User specified runtimeExecutable as:" + param);
-		}
-		
-		return exe;
-	}
-}
+package org.apache.maven.plugin.nunit;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.csharp.helper.PackagingHelper;
+import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.util.Os;
+import org.codehaus.plexus.util.StringUtils;
+
+import java.io.File;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:chris.stevenson@gmail.com">Chris Stevenson</a>
+ * @requiresDependencyResolution test
+ * @goal test
+ * @phase test
+ * @description Run tests in project using NUnit
+ */
+public class NUnitMojo
+    extends AbstractMojo
+{
+
+    /**
+     * Name of the generated assembly
+     *
+     * @parameter alias="jarName" expression="${project.build.finalName}"
+     * @required
+     */
+    private String finalName;
+
+    /**
+     * Set this to 'true' to bypass unit tests entirely.
+     * Its use is NOT RECOMMENDED, but quite convenient on occasion.
+     *
+     * @parameter expression="${maven.test.skip}"
+     */
+    private boolean skip;
+
+    /**
+     * The configuration file for the assembly, if required.
+     *
+     * @parameter
+     */
+    private File configFile;
+
+    /**
+     * The directory containing generated test classes of the project being tested.
+     *
+     * @parameter expression="${project.build.testOutputDirectory}"
+     * @required
+     */
+    private File testOutputDirectory;
+
+    /**
+     * The file name for the unit-tests library. Defaults to unit-tests.dll
+     *
+     * @parameter
+     */
+    private String testOutputFileName;
+
+    /**
+     * This is the filename to invoke the runtime environment. On windows
+     * using csc & MS dotnet this should be null.
+     * <p/>
+     * On Windows/*nix using mono this should be mono
+     * <p/>
+     * Using "default" will detect the current platform and use the
+     * the default value for the platform.
+     *
+     * @parameter expression="${nunit.runtime}" default-value="default"
+     */
+    private String runtime;
+
+    /**
+     * @parameter expression="${project}"
+     * @required
+     * @readonly
+     */
+    protected MavenProject project;
+
+    /**
+     * Directory containing the classes.
+     *
+     * @parameter expression="${project.build.outputDirectory}"
+     * @required
+     * @readonly
+     */
+    private File outputDirectory;
+
+    public void execute()
+        throws MojoExecutionException
+    {
+
+        if ( skip )
+        {
+            this.getLog().warn( "Skipping Unit Tests!!" );
+            return;
+        }
+
+        this.getLog().info( "Creating NUnit environment...." );
+
+        List dependencyartifacts = project.getTestArtifacts();
+
+        String runtimeExecutable = getRuntimeExecutable( this.runtime );
+
+        //this is a dirty firkle that is provided by the packaging class :-)
+        File mainAssembly = outputDirectory;
+
+        File testAssembly = null;
+
+        if ( !StringUtils.isEmpty( testOutputFileName ) )
+        {
+            testAssembly = getFile( testOutputDirectory, testOutputFileName );
+        }
+        else
+        {
+            testAssembly = getFile( testOutputDirectory, "unit-tests", "dotnet-library" );
+        }
+
+        this.getLog().info( "Looking for test assembly at:" + testAssembly.getAbsolutePath() );
+
+        if ( !testAssembly.exists() )
+        {
+            this.getLog().warn( "SKIPPING TESTS as no test assembly found. " );
+        }
+
+        NUnitEnvironment env = new NUnitEnvironment( this.getLog(), testOutputDirectory, dependencyartifacts,
+                                                     mainAssembly, testAssembly, configFile, runtimeExecutable );
+
+        env.create();
+
+        //execute Nunit tests.
+        env.run();
+
+        //if everything works then delete environment (else leave around for debugging)
+        env.delete();
+
+    }
+
+    public File getFile( File directory, String fileName, String packaging )
+        throws MojoExecutionException
+    {
+
+        String fileAbsolutePath =
+            directory.getAbsolutePath() + File.separator + fileName + "." + PackagingHelper.getExtension( packaging );
+
+        this.getLog().debug( "Looking for file[" + fileAbsolutePath + "]" );
+
+        File f = new File( fileAbsolutePath );
+
+        if ( !f.exists() )
+        {
+            throw new MojoExecutionException( "Cannot find file[" + fileAbsolutePath + "]" );
+        }
+
+        return f;
+    }
+
+    public File getFile( File directory, String fileName )
+        throws MojoExecutionException
+    {
+
+        String fileAbsolutePath = directory.getAbsolutePath() + File.separator + fileName;
+
+        this.getLog().debug( "Looking for file[" + fileAbsolutePath + "]" );
+
+        File f = new File( fileAbsolutePath );
+
+        if ( !f.exists() )
+        {
+            throw new MojoExecutionException( "Cannot find file[" + fileAbsolutePath + "]" );
+        }
+
+        return f;
+    }
+
+    private String getRuntimeExecutable( String param )
+    {
+
+        String exe = null;
+
+        if ( "default".equals( param ) )
+        {
+            //if running windows leave null
+            if ( Os.isFamily( "windows" ) )
+            {
+                exe = null;
+                this.getLog().info( "OS Appears to be windows, leaving runtimeExecutable as null" );
+            }
+            else
+            {
+                //pop in mono by default.
+                exe = "mono";
+                this.getLog().info( "OS Appears to be *nix, setting runtimeExecutable to be \"mono\"" );
+            }
+        }
+        else
+        {
+            exe = param;
+            this.getLog().info( "User specified runtimeExecutable as:" + param );
+        }
+
+        return exe;
+    }
+}

Propchange: maven/sandbox/plugins/maven-nunit-plugin/src/main/java/org/apache/maven/plugin/nunit/NUnitMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native