org.jboss.maven.plugins.test.ext
Class ExtenderMojo

java.lang.Object
  extended by org.apache.maven.plugin.AbstractMojo
      extended by org.jboss.maven.plugins.test.ext.ExtenderMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo, org.codehaus.plexus.logging.LogEnabled

public class ExtenderMojo
extends org.apache.maven.plugin.AbstractMojo
implements org.codehaus.plexus.logging.LogEnabled

Extends the test environment by expanding the test classpath based on some external configuration. Mainly this is useful in integration testing scenarios where you want to allow end-users (testers) to supply dependencies (jdbc drivers, e.g.) and/or config (properties).

The accepted external configuration format is described by the DTD in this plugins resources (extend.dtd)

Author:
Steve Ebersole

Field Summary
protected  org.apache.maven.artifact.resolver.ArtifactCollector artifactCollector
          INTERNAL : Artifact collector, needed to resolve dependencies.
protected  org.apache.maven.artifact.factory.ArtifactFactory artifactFactory
          INTERNAL : Artifact factory, needed to download dependencies
protected  org.apache.maven.artifact.metadata.ArtifactMetadataSource artifactMetadataSource
          INTERNAL : The artifact metadata source ;)
protected  org.apache.maven.artifact.resolver.ArtifactResolver artifactResolver
          INTERNAL : Artifact resolver, needed to download dependencies
protected  java.lang.String extenderConfig
          The path to the extender configuration file to use.
protected  java.lang.String extenderEnv
          As a matter of convenience, an extender config can name multiple environment entries.
static java.lang.String FILE_SEPARATOR
           
protected  org.apache.maven.artifact.repository.ArtifactRepository localRepository
          INTERNAL : Local maven repository.
protected  org.apache.maven.project.MavenProject project
          INTERNAL : The Maven project
 
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
 
Constructor Summary
ExtenderMojo()
           
 
Method Summary
 java.lang.String alignToBaseDirectory(java.lang.String path, java.io.File basedir)
           
protected  void attachDependencies(java.util.List dependencies)
           
protected  void attachResources(java.util.List resources)
           
 void enableLogging(org.codehaus.plexus.logging.Logger logger)
           
 void execute()
           
protected  void extendTestClasspath(Environment environment)
           
protected  org.dom4j.Document loadExtenderConfigDocument()
           
protected  Environment parseEnvironment()
           
 
Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FILE_SEPARATOR

public static final java.lang.String FILE_SEPARATOR
See Also:
Constant Field Values

project

protected org.apache.maven.project.MavenProject project
INTERNAL : The Maven project


localRepository

protected org.apache.maven.artifact.repository.ArtifactRepository localRepository
INTERNAL : Local maven repository.


artifactCollector

protected org.apache.maven.artifact.resolver.ArtifactCollector artifactCollector
INTERNAL : Artifact collector, needed to resolve dependencies.


artifactFactory

protected org.apache.maven.artifact.factory.ArtifactFactory artifactFactory
INTERNAL : Artifact factory, needed to download dependencies


artifactResolver

protected org.apache.maven.artifact.resolver.ArtifactResolver artifactResolver
INTERNAL : Artifact resolver, needed to download dependencies


artifactMetadataSource

protected org.apache.maven.artifact.metadata.ArtifactMetadataSource artifactMetadataSource
INTERNAL : The artifact metadata source ;)


extenderConfig

protected java.lang.String extenderConfig
The path to the extender configuration file to use. Defined as String so that it can be specified as a build property


extenderEnv

protected java.lang.String extenderEnv
As a matter of convenience, an extender config can name multiple environment entries. However, for a test run a particular one must be selected from the many. This parameter specifies which environment to use.

The anticipated usage here is to set this as a build property...

Constructor Detail

ExtenderMojo

public ExtenderMojo()
Method Detail

enableLogging

public void enableLogging(org.codehaus.plexus.logging.Logger logger)
Specified by:
enableLogging in interface org.codehaus.plexus.logging.LogEnabled

execute

public void execute()
             throws org.apache.maven.plugin.MojoExecutionException,
                    org.apache.maven.plugin.MojoFailureException
Specified by:
execute in interface org.apache.maven.plugin.Mojo
Throws:
org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoFailureException

parseEnvironment

protected Environment parseEnvironment()
                                throws org.apache.maven.plugin.MojoExecutionException
Throws:
org.apache.maven.plugin.MojoExecutionException

loadExtenderConfigDocument

protected org.dom4j.Document loadExtenderConfigDocument()
                                                 throws org.apache.maven.plugin.MojoExecutionException
Throws:
org.apache.maven.plugin.MojoExecutionException

extendTestClasspath

protected void extendTestClasspath(Environment environment)
                            throws org.apache.maven.plugin.MojoExecutionException
Throws:
org.apache.maven.plugin.MojoExecutionException

attachDependencies

protected void attachDependencies(java.util.List dependencies)
                           throws org.apache.maven.plugin.MojoExecutionException
Throws:
org.apache.maven.plugin.MojoExecutionException

attachResources

protected void attachResources(java.util.List resources)

alignToBaseDirectory

public java.lang.String alignToBaseDirectory(java.lang.String path,
                                             java.io.File basedir)


Copyright © 2009 JBoss, a division of Red Hat, Inc.. All Rights Reserved.