org.codehaus.mojo.exec
Class ExecJavaMojoTest

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.ExecJavaMojoTest
All Implemented Interfaces:
junit.framework.Test

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

Version:
$Id: ExecJavaMojoTest.java 10761 2009-09-24 09:38:21Z stephenconnolly $
Author:
Jerome Lacoste

Field Summary
 
Fields inherited from class org.codehaus.plexus.PlexusTestCase
basedir, container
 
Constructor Summary
ExecJavaMojoTest()
           
 
Method Summary
private  String execute(File pom, String goal)
           
private  void setUpProject(File pomFile, org.apache.maven.plugin.AbstractMojo mojo)
           
private  boolean stringContains(String str, String sequence)
           
 void testEmptySystemProperty()
          MEXEC-10 Check that an execution with no arguments and an system property with no value produces the expected result

we load the config from a pom file and fill up the MavenProject property ourselves

 void testIncorrectMainMethodSignature()
          MEXEC-29 exec:java throws NPE if the mainClass main method has not a correct signature

 void testRunWithArgs()
          Test the commandline parsing facilities of the AbstractExecMojo class
 void testSimpleRun()
          Check that a simple execution with no arguments and no system properties produces the expected result

we load the config from a pom file and fill up the MavenProject property ourselves

 void testUncooperativeThread()
          See MEXEC-15.
 void testWaitNoDaemonThreads()
          For cases where the Java code spawns Threads and main returns soon.
 void testWaitNonInterruptibleDaemonThreads()
          For cases where the Java code spawns Threads and main returns soon, but code contains non interruptible threads.
 
Methods inherited from class org.apache.maven.plugin.testing.AbstractMojoTestCase
configureMojo, configureMojo, extractPluginConfiguration, extractPluginConfiguration, getVariablesAndValuesFromObject, getVariablesAndValuesFromObject, getVariableValueFromObject, lookupEmptyMojo, lookupEmptyMojo, lookupMojo, lookupMojo, lookupMojo, setUp, 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
 

Constructor Detail

ExecJavaMojoTest

public ExecJavaMojoTest()
Method Detail

testSimpleRun

public void testSimpleRun()
                   throws Exception
Check that a simple execution with no arguments and no system properties produces the expected result

we load the config from a pom file and fill up the MavenProject property ourselves

Throws:
Exception

testEmptySystemProperty

public void testEmptySystemProperty()
                             throws Exception
MEXEC-10 Check that an execution with no arguments and an system property with no value produces the expected result

we load the config from a pom file and fill up the MavenProject property ourselves

Throws:
Exception

testIncorrectMainMethodSignature

public void testIncorrectMainMethodSignature()
                                      throws Exception
MEXEC-29 exec:java throws NPE if the mainClass main method has not a correct signature

Throws:
Exception

stringContains

private boolean stringContains(String str,
                               String sequence)

testWaitNoDaemonThreads

public void testWaitNoDaemonThreads()
                             throws Exception
For cases where the Java code spawns Threads and main returns soon. See MEXEC-6.

Throws:
Exception

testWaitNonInterruptibleDaemonThreads

public void testWaitNonInterruptibleDaemonThreads()
                                           throws Exception
For cases where the Java code spawns Threads and main returns soon, but code contains non interruptible threads. User is required to timeout the execution, otherwise it will hang. See MEXEC-15.

Throws:
Exception

testUncooperativeThread

public void testUncooperativeThread()
                             throws Exception
See MEXEC-15. FIXME: this sometimes fail with unit.framework.ComparisonFailure: expected:<...> but was:<...3(f)>

Throws:
Exception

testRunWithArgs

public void testRunWithArgs()
                     throws Exception
Test the commandline parsing facilities of the AbstractExecMojo class

Throws:
Exception

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,
                          org.apache.maven.plugin.AbstractMojo mojo)
                   throws Exception
Throws:
Exception


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