incubator-nmaven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ewor...@apache.org
Subject svn commit: r607658 - /incubator/nmaven/trunk/plugins/dotnet-test-plugin/src/main/java/org/apache/maven/dotnet/plugin/nunit/DotnetTestMojo.java
Date Mon, 31 Dec 2007 04:01:53 GMT
Author: eworley
Date: Sun Dec 30 20:01:52 2007
New Revision: 607658

URL: http://svn.apache.org/viewvc?rev=607658&view=rev
Log:
* Reworked commandline to properly construct executable name and arguments, test plugin is
now ready, just needs the test-assembly work and a system scoped nunit dependency.
* Changed executed command reporting to debug scope

Modified:
    incubator/nmaven/trunk/plugins/dotnet-test-plugin/src/main/java/org/apache/maven/dotnet/plugin/nunit/DotnetTestMojo.java

Modified: incubator/nmaven/trunk/plugins/dotnet-test-plugin/src/main/java/org/apache/maven/dotnet/plugin/nunit/DotnetTestMojo.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/plugins/dotnet-test-plugin/src/main/java/org/apache/maven/dotnet/plugin/nunit/DotnetTestMojo.java?rev=607658&r1=607657&r2=607658&view=diff
==============================================================================
--- incubator/nmaven/trunk/plugins/dotnet-test-plugin/src/main/java/org/apache/maven/dotnet/plugin/nunit/DotnetTestMojo.java
(original)
+++ incubator/nmaven/trunk/plugins/dotnet-test-plugin/src/main/java/org/apache/maven/dotnet/plugin/nunit/DotnetTestMojo.java
Sun Dec 30 20:01:52 2007
@@ -44,15 +44,8 @@
     // TODO: This probably only works on Windows machines
     private static final String COMMAND_NOT_FOUND_FRAGMENT = "is not recognized as an internal
or external command";
 
-    // Command, options, assembly
-    private static final String NUNIT_CALL_FMT = "%s %s %s";
-
     private static final String NUNIT_EXECUTABLE = "nunit-console";
 
-    private static final String NUNIT_OPTIONS = "";
-
-    // private static final String NUNIT_OPTIONS = "/labels /nologo";
-
     /**
      * The maven project.
      * 
@@ -67,14 +60,13 @@
         // The directory where the test artifact exists
         String outputDirectory = project.getBuild().getDirectory();
 
-        String innvocation = getNUnitInvocation();
-
         Commandline commandline = new Commandline();
 
         getLog().debug( "NMaven-test: workingDirectory(" + outputDirectory + ")" );
 
         commandline.setWorkingDirectory( outputDirectory );
-        commandline.setExecutable( innvocation );
+        commandline.setExecutable( NUNIT_EXECUTABLE );
+        commandline.addArguments( getNUnitArguments() );
 
         NUnitStreamConsumer systemOut = new NUnitStreamConsumer( getLog() );
         NUnitStreamConsumer systemErr = new NUnitStreamConsumer( getLog() );
@@ -95,21 +87,27 @@
             throw new MojoExecutionException( "Failure executing commandline, " + e.getMessage()
);
         }
 
-        // TODO: Turn this into a debug
-        getLog().info( "Executed command: " + commandline );
+        getLog().debug( "Executed command: " + commandline );
 
         getLog().info( "Done executing tests.." );
     }
 
-    private String getNUnitInvocation()
-        throws MojoExecutionException
+    private String getTestAssemblyName()
     {
 
         File file = project.getArtifact().getFile();
         String pieces = file.getName().substring( 0, file.getName().lastIndexOf( '.' ) );
         String testAssemblyName = pieces + "-test.dll";
 
-        return String.format( NUNIT_CALL_FMT, NUNIT_EXECUTABLE, NUNIT_OPTIONS, testAssemblyName
);
+        return testAssemblyName;
+    }
+    
+    private String[] getNUnitArguments() {
+        return new String[] {
+            getTestAssemblyName(),
+            "/labels",
+            "/nologo"
+        };
     }
 
     private static class NUnitStreamConsumer



Mime
View raw message