|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.nuiton.plugin.AbstractMojoTest<P>
P - type of goal to testpublic abstract class AbstractMojoTest<P extends org.nuiton.plugin.Plugin>
Base test class for a mojo.
Note: replace the previous classorg.nuiton.util.BasePluginTestCase.
Inside each test method, we can use the following objects :
getTestDir() : location of mojo resources (where the pom file for example)getPomFile() : location of the pom filegetMojo() : the instanciated and ready to execute mojogetBasedir() getTestBasedir() getTestDir(java.lang.String, java.lang.String)getPomFile(java.io.File, java.lang.String, java.lang.String)createMojo(java.io.File, java.lang.String)setUpMojo(org.nuiton.plugin.Plugin, java.io.File)
| Nested Class Summary | |
|---|---|
protected class |
AbstractMojoTest.MojoTestRule
To offer inside each test method (annotated by a Test) the
following properties :
AbstractMojoTest.MojoTestRule.testDir : location where to find resources for the test
AbstractMojoTest.MojoTestRule.pomFile : location of the pom file to use to build the mojo
AbstractMojoTest.MojoTestRule.mojo : the instanciated and initialized mojo
|
| Field Summary | |
|---|---|
protected static java.io.File |
basedir
the basedir of the project |
protected static org.apache.commons.logging.Log |
log
Test logger |
AbstractMojoTest.MojoTestRule |
name
Your test rule which offers methodName, testDir, pomFile and mojo inside test methods. |
protected static java.io.File |
testBasedir
the basedir of all tests (by convention getBasedir()/target/test-classes). |
| Constructor Summary | |
|---|---|
AbstractMojoTest()
|
|
| Method Summary | |
|---|---|
protected P |
createMojo(java.io.File pomFile,
java.lang.String goalName)
Create the mojo base on the given pomFile for the
given goalName. |
java.io.File |
getBasedir()
|
protected abstract java.lang.String |
getGoalName(java.lang.String methodName)
Obtain the name of the goal according to the methodName. |
protected java.lang.String |
getMethodName()
|
protected P |
getMojo()
|
protected java.io.File |
getPomFile()
|
protected java.io.File |
getPomFile(java.io.File testDir,
java.lang.String methodName,
java.lang.String goalName)
Obtain the location of the pom file to use for next mojo test. |
java.lang.String |
getRelativePathFromBasedir(java.io.File f)
|
java.lang.String |
getRelativePathFromTestBasedir(java.io.File f)
|
java.io.File |
getTestBasedir()
|
protected java.io.File |
getTestDir()
|
protected java.io.File |
getTestDir(java.lang.String methodName,
java.lang.String goalName)
Obtain the location of the directory where to find resources for the next test. |
protected boolean |
isVerbose()
|
protected void |
setUpMojo(P mojo,
java.io.File pomFile)
Initialize the given mojo. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final org.apache.commons.logging.Log log
protected static java.io.File basedir
protected static java.io.File testBasedir
getBasedir()/target/test-classes).
public AbstractMojoTest.MojoTestRule name
| Constructor Detail |
|---|
public AbstractMojoTest()
| Method Detail |
|---|
public java.io.File getBasedir()
public java.io.File getTestBasedir()
public java.lang.String getRelativePathFromBasedir(java.io.File f)
public java.lang.String getRelativePathFromTestBasedir(java.io.File f)
protected abstract java.lang.String getGoalName(java.lang.String methodName)
methodName - the name of the next test to execute.
protected java.io.File getTestDir(java.lang.String methodName,
java.lang.String goalName)
getTestBasedir().
methodName - the method of the next test to executegoalName - the common goal name to use
protected java.io.File getPomFile(java.io.File testDir,
java.lang.String methodName,
java.lang.String goalName)
methodName+".xml"
in the testDir.
testDir - the location of resources for the next test (is the result
of the method getTestDir(java.lang.String, java.lang.String).methodName - the name of the next testgoalName - the name of the common goal
protected P createMojo(java.io.File pomFile,
java.lang.String goalName)
throws java.lang.Exception
pomFile for the
given goalName.
pomFile - the location of the pom filegoalName - the name of the goal to lookup
java.lang.Exception - if any problem while creating the mojo
protected void setUpMojo(P mojo,
java.io.File pomFile)
throws java.lang.Exception
mojo - the instanciate mojopomFile - the pom file used to instanciate the mojo
java.lang.Exception - if any pbprotected P getMojo()
protected java.lang.String getMethodName()
protected java.io.File getPomFile()
protected java.io.File getTestDir()
protected boolean isVerbose()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||