org.codehaus.mojo.exec
Class ExecMojoTest

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.codehaus.plexus.PlexusTestCase
              extended by org.apache.maven.plugin.testing.AbstractMojoTestCase
                  extended by org.codehaus.mojo.exec.ExecMojoTest
All Implemented Interfaces:
junit.framework.Test

public class ExecMojoTest
extends org.apache.maven.plugin.testing.AbstractMojoTestCase

Version:
$Id: ExecMojoTest.java 12372 2010-07-09 20:51:00Z rfscholte $
Author:
Jerome Lacoste

Nested Class Summary
(package private) static class ExecMojoTest.MockExecMojo
           
 
Field Summary
private  ExecMojoTest.MockExecMojo mojo
           
 
Fields inherited from class org.codehaus.plexus.PlexusTestCase
basedir, container
 
Constructor Summary
ExecMojoTest()
           
 
Method Summary
private  void assertFileEquals(String mavenRepo, File expectedFile, File actualFile)
          This method asserts that the two given files are equals in their content.
private  void checkMojo(String expectedCommandLine)
           
private  String execute(File pom, String goal)
           
private  String getCommandLineAsString(org.apache.commons.exec.CommandLine commandline)
           
private  List getLines(String mavenRepo, File file)
          This method gives the list of String in a file.
 void setUp()
           
private  void setUpProject(File pomFile, ExecMojo mojo)
           
 void testGetExecutablePath()
           
 void testIsResultCodeAFailure()
           
 void testOverrides()
           
 void testOverrides3()
           
 void testParseCommandlineOSWin()
           
 void testRunError()
           
 void testRunFailure()
           
 void testRunOK()
           
 
Methods inherited from class org.apache.maven.plugin.testing.AbstractMojoTestCase
configureMojo, configureMojo, extractPluginConfiguration, extractPluginConfiguration, getVariablesAndValuesFromObject, getVariablesAndValuesFromObject, getVariableValueFromObject, lookupEmptyMojo, lookupEmptyMojo, lookupMojo, lookupMojo, lookupMojo, setVariableValueToObject
 
Methods inherited from class org.codehaus.plexus.PlexusTestCase
createContainerInstance, customizeContext, customizeContext, getBasedir, getClassLoader, getConfiguration, getConfiguration, getContainer, getCustomConfiguration, getResourceAsStream, getTestFile, getTestFile, getTestPath, getTestPath, lookup, lookup, release, tearDown
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

mojo

private ExecMojoTest.MockExecMojo mojo
Constructor Detail

ExecMojoTest

public ExecMojoTest()
Method Detail

setUp

public void setUp()
           throws Exception
Overrides:
setUp in class org.apache.maven.plugin.testing.AbstractMojoTestCase
Throws:
Exception

testRunOK

public void testRunOK()
               throws org.apache.maven.plugin.MojoExecutionException
Throws:
org.apache.maven.plugin.MojoExecutionException

execute

private String execute(File pom,
                       String goal)
                throws Exception
Returns:
output from System.out during mojo execution
Throws:
Exception

setUpProject

private void setUpProject(File pomFile,
                          ExecMojo mojo)
                   throws Exception
Throws:
Exception

testGetExecutablePath

public void testGetExecutablePath()
                           throws IOException
Throws:
IOException

testRunFailure

public void testRunFailure()

testRunError

public void testRunError()

testOverrides

public void testOverrides()
                   throws org.apache.maven.plugin.MojoExecutionException
Throws:
org.apache.maven.plugin.MojoExecutionException

testOverrides3

public void testOverrides3()
                    throws org.apache.maven.plugin.MojoExecutionException
Throws:
org.apache.maven.plugin.MojoExecutionException

testIsResultCodeAFailure

public void testIsResultCodeAFailure()

testParseCommandlineOSWin

public void testParseCommandlineOSWin()
                               throws Exception
Throws:
Exception

checkMojo

private void checkMojo(String expectedCommandLine)

getCommandLineAsString

private String getCommandLineAsString(org.apache.commons.exec.CommandLine commandline)

assertFileEquals

private void assertFileEquals(String mavenRepo,
                              File expectedFile,
                              File actualFile)
                       throws IOException
This method asserts that the two given files are equals in their content.

Parameters:
mavenRepo - Not used.
expectedFile - The file that is expected.
actualFile - The file that is.
Throws:
IOException - if something goes wrong.

getLines

private List getLines(String mavenRepo,
                      File file)
               throws IOException
This method gives the list of String in a file.

Parameters:
mavenRepo - Not used.
file - The file to be read.
Returns:
The list of the lines of the file.
Throws:
IOException - if something goes wrong.


Copyright © 2004-2011 The Kuali Foundation. All Rights Reserved.