You are viewing a plain text version of this content. The canonical link for it is here.
Posted to npanday-commits@incubator.apache.org by jf...@apache.org on 2011/07/12 22:49:50 UTC

svn commit: r1145807 - in /incubator/npanday/trunk: components/dotnet-core/src/main/resources/META-INF/npanday/executable-plugins.xml plugins/maven-test-plugin/src/main/java/npanday/plugin/test/TesterMojo.java

Author: jfallows
Date: Tue Jul 12 22:49:50 2011
New Revision: 1145807

URL: http://svn.apache.org/viewvc?rev=1145807&view=rev
Log:
Include support for nunit-console-x86 and add fallback mechanism for custom executable name

Modified:
    incubator/npanday/trunk/components/dotnet-core/src/main/resources/META-INF/npanday/executable-plugins.xml
    incubator/npanday/trunk/plugins/maven-test-plugin/src/main/java/npanday/plugin/test/TesterMojo.java

Modified: incubator/npanday/trunk/components/dotnet-core/src/main/resources/META-INF/npanday/executable-plugins.xml
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/components/dotnet-core/src/main/resources/META-INF/npanday/executable-plugins.xml?rev=1145807&r1=1145806&r2=1145807&view=diff
==============================================================================
--- incubator/npanday/trunk/components/dotnet-core/src/main/resources/META-INF/npanday/executable-plugins.xml (original)
+++ incubator/npanday/trunk/components/dotnet-core/src/main/resources/META-INF/npanday/executable-plugins.xml Tue Jul 12 22:49:50 2011
@@ -35,6 +35,23 @@ under the License.
     </platforms>
   </executablePlugin>
   <executablePlugin>
+    <identifier>nunit-console-x86</identifier>
+    <pluginClass>npanday.executable.impl.DefaultNetExecutable</pluginClass>
+    <vendor>MICROSOFT</vendor>
+    <executable>nunit-console-x86</executable>
+    <profile>nunit-console-x86</profile>
+    <frameworkVersions>
+      <frameworkVersion>4.0</frameworkVersion>
+      <frameworkVersion>3.5</frameworkVersion>
+      <frameworkVersion>2.0.50727</frameworkVersion>
+    </frameworkVersions>
+    <platforms>
+      <platform>
+        <operatingSystem>Windows</operatingSystem>
+      </platform>
+    </platforms>
+  </executablePlugin>
+  <executablePlugin>
     <identifier>nunit-console</identifier>
     <pluginClass>npanday.executable.impl.DefaultNetExecutable</pluginClass>
     <vendor>MONO</vendor>

Modified: incubator/npanday/trunk/plugins/maven-test-plugin/src/main/java/npanday/plugin/test/TesterMojo.java
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/maven-test-plugin/src/main/java/npanday/plugin/test/TesterMojo.java?rev=1145807&r1=1145806&r2=1145807&view=diff
==============================================================================
--- incubator/npanday/trunk/plugins/maven-test-plugin/src/main/java/npanday/plugin/test/TesterMojo.java (original)
+++ incubator/npanday/trunk/plugins/maven-test-plugin/src/main/java/npanday/plugin/test/TesterMojo.java Tue Jul 12 22:49:50 2011
@@ -23,6 +23,7 @@ import npanday.ArtifactTypeHelper;
 import npanday.PlatformUnsupportedException;
 import npanday.artifact.AssemblyResolver;
 import npanday.artifact.NPandayArtifactResolutionException;
+import npanday.executable.CommandExecutor;
 import npanday.executable.ExecutionException;
 import npanday.executable.NetExecutable;
 import npanday.executable.NetExecutableFactory;
@@ -177,7 +178,12 @@ extends AbstractMojo
      */
     private NetExecutableFactory netExecutableFactory;
     
-    private NetExecutable getExecutableFor( VendorInfo vendorInfo, List<String> commands ) throws PlatformUnsupportedException
+    private File getExecutableHome() 
+    {
+        return (nunitHome != null) ? new File(nunitHome, "bin") : null;
+    }
+
+    private String getExecutableNameFor( VendorInfo vendorInfo ) 
     {
         String executableName = nunitCommand;
 
@@ -202,11 +208,7 @@ extends AbstractMojo
 
         }
          
-        File executableHome = (nunitHome != null) ? new File(nunitHome, "bin") : null;
-        Vendor vendor = vendorInfo.getVendor();
-        String vendorName = vendor.getVendorName();
-
-        return netExecutableFactory.getNetExecutableFor( vendorName, executionFrameworkVersion, executableName, commands, executableHome );
+        return executableName;
     }
 
     private List<String> getCommandsFor( VendorInfo vendorInfo )    
@@ -408,14 +410,61 @@ extends AbstractMojo
         // pretty print nunit logs
         getLog().info( System.getProperty( "line.separator" ) );
 
+        String executableName = getExecutableNameFor( vendorInfo );
+        File executableHome = getExecutableHome();
+
         try
         {
-            NetExecutable executable = getExecutableFor( vendorInfo, commands );
-            executable.execute();
-        }
-        catch (PlatformUnsupportedException e)
-        {
-            throw new MojoFailureException( "NPANDAY-1100-008: Platform unsupported, is your npanday-settings.xml configured correctly?", e);
+            try
+            {
+                Vendor vendor = vendorInfo.getVendor();
+                String vendorName = vendor.getVendorName();
+
+                NetExecutable executable = netExecutableFactory.getNetExecutableFor( vendorName, executionFrameworkVersion, executableName, commands, executableHome );
+                executable.execute();
+            }
+            catch (PlatformUnsupportedException pue)
+            {
+                getLog().debug( "NPANDAY-1100-008: Platform unsupported, is your npanday-settings.xml configured correctly?", pue );        
+                CommandExecutor commandExecutor = CommandExecutor.Factory.createDefaultCommmandExecutor();
+                commandExecutor.setLogger( new org.codehaus.plexus.logging.AbstractLogger( 0, "nunit-logger" )
+                {
+                    Log log = getLog();
+
+                    public void debug( String message, Throwable throwable )
+                    {
+                        log.debug( message, throwable );
+                    }
+
+                    public void error( String message, Throwable throwable )
+                    {
+                        log.error( message, throwable );
+                    }
+
+                    public void fatalError( String message, Throwable throwable )
+                    {
+                        log.error( message, throwable );
+                    }
+
+                    public Logger getChildLogger( String message )
+                    {
+                        return null;
+                    }
+
+                    public void info( String message, Throwable throwable )
+                    {
+                        log.info( message, throwable );
+                    }
+
+                    public void warn( String message, Throwable throwable )
+                    {
+                        log.warn( message, throwable );
+                    }
+                } );
+
+                String executablePath = (executableHome != null) ? new File(executableHome, executableName).toString() : executableName;
+                commandExecutor.executeCommand( executablePath, commands );
+            }
         }
         catch ( ExecutionException e )
         {