public abstract class AbstractMojoTestCase
extends org.codehaus.plexus.PlexusTestCase
| Modifier and Type | Field and Description |
|---|---|
private org.codehaus.plexus.component.configurator.ComponentConfigurator |
configurator |
private org.codehaus.plexus.PlexusContainer |
container |
private static org.apache.maven.artifact.versioning.DefaultArtifactVersion |
MAVEN_VERSION |
private java.util.Map<java.lang.String,org.apache.maven.plugin.descriptor.MojoDescriptor> |
mojoDescriptors |
| Constructor and Description |
|---|
AbstractMojoTestCase() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addGuiceModules(java.util.List<com.google.inject.Module> modules) |
protected org.apache.maven.plugin.Mojo |
configureMojo(org.apache.maven.plugin.Mojo mojo,
org.codehaus.plexus.configuration.PlexusConfiguration pluginConfiguration)
Configure the mojo with the given plexus configuration
|
protected org.apache.maven.plugin.Mojo |
configureMojo(org.apache.maven.plugin.Mojo mojo,
java.lang.String artifactId,
java.io.File pom)
Configure the mojo
|
protected org.codehaus.plexus.configuration.PlexusConfiguration |
extractPluginConfiguration(java.lang.String artifactId,
java.io.File pom) |
protected org.codehaus.plexus.configuration.PlexusConfiguration |
extractPluginConfiguration(java.lang.String artifactId,
org.codehaus.plexus.util.xml.Xpp3Dom pomDom) |
private void |
finalizeMojoConfiguration(org.apache.maven.plugin.MojoExecution mojoExecution) |
protected org.codehaus.plexus.PlexusContainer |
getContainer() |
private java.io.File |
getPluginArtifactFile()
Returns best-effort plugin artifact file.
|
protected java.lang.String |
getPluginDescriptorLocation() |
protected java.lang.String |
getPluginDescriptorPath() |
protected java.io.InputStream |
getPublicDescriptorStream() |
protected java.util.Map<java.lang.String,java.lang.Object> |
getVariablesAndValuesFromObject(java.lang.Class<?> clazz,
java.lang.Object object)
Convenience method to obtain all variables and values from the mojo (including its superclasses)
Note: the values in the map are of type Object so the caller is responsible for casting to desired types.
|
protected java.util.Map<java.lang.String,java.lang.Object> |
getVariablesAndValuesFromObject(java.lang.Object object)
Convenience method to obtain all variables and values from the mojo (including its superclasses)
Note: the values in the map are of type Object so the caller is responsible for casting to desired types.
|
protected java.lang.Object |
getVariableValueFromObject(java.lang.Object object,
java.lang.String variable)
Convenience method to obtain the value of a variable on a mojo that might not have a getter.
|
protected org.apache.maven.plugin.Mojo |
lookupConfiguredMojo(org.apache.maven.project.MavenProject project,
java.lang.String goal) |
protected org.apache.maven.plugin.Mojo |
lookupConfiguredMojo(org.apache.maven.execution.MavenSession session,
org.apache.maven.plugin.MojoExecution execution) |
protected org.apache.maven.plugin.Mojo |
lookupEmptyMojo(java.lang.String goal,
java.io.File pom)
Lookup the mojo leveraging the actual subprojects pom
|
protected org.apache.maven.plugin.Mojo |
lookupEmptyMojo(java.lang.String goal,
java.lang.String pluginPom)
Lookup an empty mojo
|
protected org.apache.maven.plugin.Mojo |
lookupMojo(java.lang.String goal,
java.io.File pom)
Lookup the mojo leveraging the actual subprojects pom
|
protected org.apache.maven.plugin.Mojo |
lookupMojo(java.lang.String goal,
java.lang.String pluginPom)
Lookup the mojo leveraging the subproject pom
|
protected org.apache.maven.plugin.Mojo |
lookupMojo(java.lang.String groupId,
java.lang.String artifactId,
java.lang.String version,
java.lang.String goal,
org.codehaus.plexus.configuration.PlexusConfiguration pluginConfiguration)
lookup the mojo while we have all of the relavent information
|
protected org.apache.maven.execution.MavenSession |
newMavenSession(org.apache.maven.project.MavenProject project) |
protected org.apache.maven.plugin.MojoExecution |
newMojoExecution(java.lang.String goal) |
private java.lang.String |
resolveFromRootThenParent(org.codehaus.plexus.util.xml.Xpp3Dom pluginPomDom,
java.lang.String element)
sometimes the parent element might contain the correct value so generalize that access
TODO find out where this is probably done elsewhere
|
protected void |
setUp() |
protected void |
setupContainer() |
protected org.codehaus.plexus.ContainerConfiguration |
setupContainerConfiguration() |
protected void |
setVariableValueToObject(java.lang.Object object,
java.lang.String variable,
java.lang.Object value)
Convenience method to set values to variables in objects that don't have setters
|
private void |
validateContainerStatus()
We should make sure this is called in each method that makes use of the container,
otherwise we throw ugly NPE's
crops up when the subclassing code defines the setUp method but doesn't call super.setUp()
|
customizeContainerConfiguration, customizeContext, getBasedir, getClassLoader, getConfigurationName, getCustomConfigurationName, getResourceAsStream, getTestConfiguration, getTestConfiguration, getTestFile, getTestFile, getTestPath, getTestPath, lookup, lookup, lookup, lookup, release, tearDown, teardownContainerassertEquals, 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, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runBare, runTest, setName, toStringprivate static final org.apache.maven.artifact.versioning.DefaultArtifactVersion MAVEN_VERSION
private org.codehaus.plexus.component.configurator.ComponentConfigurator configurator
private org.codehaus.plexus.PlexusContainer container
private java.util.Map<java.lang.String,org.apache.maven.plugin.descriptor.MojoDescriptor> mojoDescriptors
protected void setUp()
throws java.lang.Exception
setUp in class org.codehaus.plexus.PlexusTestCasejava.lang.Exceptionprivate java.io.File getPluginArtifactFile()
throws java.io.IOException
First, attempts to determine parent directory of META-INF directory holding the plugin descriptor. If META-INF parent directory cannot be determined, falls back to test basedir.
java.io.IOExceptionprotected java.io.InputStream getPublicDescriptorStream()
throws java.lang.Exception
java.lang.Exceptionprotected java.lang.String getPluginDescriptorPath()
protected java.lang.String getPluginDescriptorLocation()
protected void setupContainer()
setupContainer in class org.codehaus.plexus.PlexusTestCaseprotected void addGuiceModules(java.util.List<com.google.inject.Module> modules)
protected org.codehaus.plexus.ContainerConfiguration setupContainerConfiguration()
protected org.codehaus.plexus.PlexusContainer getContainer()
getContainer in class org.codehaus.plexus.PlexusTestCaseprotected org.apache.maven.plugin.Mojo lookupMojo(java.lang.String goal,
java.lang.String pluginPom)
throws java.lang.Exception
goal - pluginPom - java.lang.Exceptionprotected org.apache.maven.plugin.Mojo lookupEmptyMojo(java.lang.String goal,
java.lang.String pluginPom)
throws java.lang.Exception
goal - pluginPom - java.lang.Exceptionprotected org.apache.maven.plugin.Mojo lookupMojo(java.lang.String goal,
java.io.File pom)
throws java.lang.Exception
goal - pom - java.lang.Exceptionprotected org.apache.maven.plugin.Mojo lookupEmptyMojo(java.lang.String goal,
java.io.File pom)
throws java.lang.Exception
goal - pom - java.lang.Exceptionprotected org.apache.maven.plugin.Mojo lookupMojo(java.lang.String groupId,
java.lang.String artifactId,
java.lang.String version,
java.lang.String goal,
org.codehaus.plexus.configuration.PlexusConfiguration pluginConfiguration)
throws java.lang.Exception
groupId - artifactId - version - goal - pluginConfiguration - java.lang.Exceptionprotected org.apache.maven.plugin.Mojo lookupConfiguredMojo(org.apache.maven.project.MavenProject project,
java.lang.String goal)
throws java.lang.Exception
project - goal - java.lang.Exceptionprotected org.apache.maven.plugin.Mojo lookupConfiguredMojo(org.apache.maven.execution.MavenSession session,
org.apache.maven.plugin.MojoExecution execution)
throws java.lang.Exception,
org.codehaus.plexus.component.configurator.ComponentConfigurationException
session - execution - java.lang.Exceptionorg.codehaus.plexus.component.configurator.ComponentConfigurationExceptionprotected org.apache.maven.execution.MavenSession newMavenSession(org.apache.maven.project.MavenProject project)
project - protected org.apache.maven.plugin.MojoExecution newMojoExecution(java.lang.String goal)
goal - private void finalizeMojoConfiguration(org.apache.maven.plugin.MojoExecution mojoExecution)
protected org.codehaus.plexus.configuration.PlexusConfiguration extractPluginConfiguration(java.lang.String artifactId,
java.io.File pom)
throws java.lang.Exception
artifactId - pom - java.lang.Exceptionprotected org.codehaus.plexus.configuration.PlexusConfiguration extractPluginConfiguration(java.lang.String artifactId,
org.codehaus.plexus.util.xml.Xpp3Dom pomDom)
throws java.lang.Exception
artifactId - pomDom - java.lang.Exceptionprotected org.apache.maven.plugin.Mojo configureMojo(org.apache.maven.plugin.Mojo mojo,
java.lang.String artifactId,
java.io.File pom)
throws java.lang.Exception
mojo - artifactId - pom - java.lang.Exceptionprotected org.apache.maven.plugin.Mojo configureMojo(org.apache.maven.plugin.Mojo mojo,
org.codehaus.plexus.configuration.PlexusConfiguration pluginConfiguration)
throws java.lang.Exception
mojo - pluginConfiguration - java.lang.Exceptionprotected java.lang.Object getVariableValueFromObject(java.lang.Object object,
java.lang.String variable)
throws java.lang.IllegalAccessException
object - variable - java.lang.IllegalArgumentExceptionjava.lang.IllegalAccessExceptionprotected java.util.Map<java.lang.String,java.lang.Object> getVariablesAndValuesFromObject(java.lang.Object object)
throws java.lang.IllegalAccessException
object - java.lang.IllegalAccessExceptionprotected java.util.Map<java.lang.String,java.lang.Object> getVariablesAndValuesFromObject(java.lang.Class<?> clazz,
java.lang.Object object)
throws java.lang.IllegalAccessException
clazz - object - java.lang.IllegalAccessExceptionprotected void setVariableValueToObject(java.lang.Object object,
java.lang.String variable,
java.lang.Object value)
throws java.lang.IllegalAccessException
object - variable - value - java.lang.IllegalAccessExceptionprivate java.lang.String resolveFromRootThenParent(org.codehaus.plexus.util.xml.Xpp3Dom pluginPomDom,
java.lang.String element)
throws java.lang.Exception
pluginPomDom - element - java.lang.Exceptionprivate void validateContainerStatus()
throws java.lang.Exception
java.lang.Exception