org.apache.maven.plugin.surefire
Class AbstractSurefireMojo

java.lang.Object
  extended by org.apache.maven.plugin.AbstractMojo
      extended by org.apache.maven.plugin.surefire.AbstractSurefireMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo, SurefireExecutionParameters

public abstract class AbstractSurefireMojo
extends org.apache.maven.plugin.AbstractMojo
implements SurefireExecutionParameters

Abstract base class for running tests using Surefire.

Version:
$Id: SurefirePlugin.java 945065 2010-05-17 10:26:22Z stephenc $
Author:
Stephen Connolly

Nested Class Summary
 class AbstractSurefireMojo.DynamicProviderInfo
           
 
Field Summary
 
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
 
Constructor Summary
AbstractSurefireMojo()
           
 
Method Summary
protected abstract  void addPluginSpecificChecksumItems(ChecksumCalculator checksum)
           
protected  ForkStarter createForkStarter(ProviderInfo provider, ForkConfiguration forkConfiguration, ClassLoaderConfiguration classLoaderConfiguration)
           
protected  ProviderConfiguration createProviderConfiguration(ForkConfiguration forkConfiguration, boolean shadefire)
           
protected  StartupConfiguration createStartupConfiguration(ForkConfiguration forkConfiguration, ProviderInfo provider, ClassLoaderConfiguration classLoaderConfiguration)
           
protected  void ensureParallelRunningCompatibility()
           
protected  void ensureWorkingDirectoryExists()
           
 void execute()
           
protected abstract  void executeAfterPreconditionsChecked()
           
 Classpath generateTestClasspath()
          Generate the test classpath.
protected  ClassLoaderConfiguration getClassLoaderConfiguration(ForkConfiguration fork)
           
protected abstract  String[] getDefaultIncludes()
           
protected  ForkConfiguration getForkConfiguration()
           
protected abstract  String getPluginName()
           
protected  org.apache.maven.artifact.Artifact getTestNgUtilsArtifact()
           
protected  org.apache.maven.toolchain.Toolchain getToolchain()
           
protected  boolean hasExecutedBefore()
           
protected  List initialize()
           
protected  boolean isAnyConcurrencySelected()
           
protected  boolean isForkModeNever()
           
protected abstract  boolean isSkipExecution()
           
 void logClasspath(Classpath classpath, String descriptor)
           
protected  void logReportsDirectory()
           
protected  void processSystemProperties(boolean setInSystem)
           
protected  boolean verifyParameters()
           
protected  void warnIfUselessUseSystemClassLoaderParameter()
           
 
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
 
Methods inherited from interface org.apache.maven.plugin.surefire.SurefireExecutionParameters
getAdditionalClasspathElements, getArgLine, getArtifactFactory, getArtifactResolver, getBasedir, getClassesDirectory, getClasspathDependencyExcludes, getClasspathDependencyScopeExclude, getDebugForkedProcess, getEnvironmentVariables, getExcludedGroups, getExcludes, getFailIfNoTests, getForkedProcessTimeoutInSeconds, getForkMode, getGroups, getIncludes, getInternalSystemProperties, getJunitArtifactName, getJvm, getLocalRepository, getMetadataSource, getObjectFactory, getOriginalSystemProperties, getParallel, getPerCoreThreadCount, getPluginArtifactMap, getProject, getProjectArtifactMap, getProperties, getRemoteRepositories, getReportFormat, getReportsDirectory, getRunOrder, getSession, getSuiteXmlFiles, getSystemProperties, getSystemPropertyVariables, getTest, getTestClassesDirectory, getTestMethod, getTestNGArtifactName, getTestSourceDirectory, getThreadCount, getToolchainManager, getUseUnlimitedThreads, getWorkingDirectory, isChildDelegation, isDisableXmlReport, isEnableAssertions, isMavenParallel, isPrintSummary, isRedirectTestOutputToFile, isSkip, isSkipExec, isSkipTests, isTrimStackTrace, isUseFile, isUseManifestOnlyJar, isUseSystemClassLoader, setAdditionalClasspathElements, setArgLine, setArtifactFactory, setArtifactResolver, setBasedir, setChildDelegation, setClassesDirectory, setClasspathDependencyExcludes, setClasspathDependencyScopeExclude, setDebugForkedProcess, setDisableXmlReport, setEnableAssertions, setEnvironmentVariables, setExcludedGroups, setExcludes, setFailIfNoTests, setForkedProcessTimeoutInSeconds, setForkMode, setGroups, setIncludes, setInternalSystemProperties, setJunitArtifactName, setJvm, setLocalRepository, setMetadataSource, setObjectFactory, setOriginalSystemProperties, setParallel, setPerCoreThreadCount, setPluginArtifactMap, setPrintSummary, setProject, setProjectArtifactMap, setProperties, setRedirectTestOutputToFile, setRemoteRepositories, setReportFormat, setReportsDirectory, setRunOrder, setSession, setSkip, setSkipExec, setSkipTests, setSuiteXmlFiles, setSystemProperties, setSystemPropertyVariables, setTest, setTestClassesDirectory, setTestNGArtifactName, setTestSourceDirectory, setThreadCount, setToolchainManager, setTrimStackTrace, setUseFile, setUseManifestOnlyJar, setUseSystemClassLoader, setUseUnlimitedThreads, setWorkingDirectory
 

Constructor Detail

AbstractSurefireMojo

public AbstractSurefireMojo()
Method Detail

getPluginName

protected abstract String getPluginName()

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

verifyParameters

protected boolean verifyParameters()
                            throws org.apache.maven.plugin.MojoFailureException
Throws:
org.apache.maven.plugin.MojoFailureException

isSkipExecution

protected abstract boolean isSkipExecution()

executeAfterPreconditionsChecked

protected abstract void executeAfterPreconditionsChecked()
                                                  throws org.apache.maven.plugin.MojoExecutionException,
                                                         org.apache.maven.plugin.MojoFailureException
Throws:
org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoFailureException

initialize

protected List initialize()
                   throws org.apache.maven.plugin.MojoFailureException
Throws:
org.apache.maven.plugin.MojoFailureException

logReportsDirectory

protected void logReportsDirectory()

getToolchain

protected final org.apache.maven.toolchain.Toolchain getToolchain()

isAnyConcurrencySelected

protected boolean isAnyConcurrencySelected()

isForkModeNever

protected boolean isForkModeNever()

createProviderConfiguration

protected ProviderConfiguration createProviderConfiguration(ForkConfiguration forkConfiguration,
                                                            boolean shadefire)
                                                     throws org.apache.maven.plugin.MojoExecutionException,
                                                            org.apache.maven.plugin.MojoFailureException
Throws:
org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoFailureException

createStartupConfiguration

protected StartupConfiguration createStartupConfiguration(ForkConfiguration forkConfiguration,
                                                          ProviderInfo provider,
                                                          ClassLoaderConfiguration classLoaderConfiguration)
                                                   throws org.apache.maven.plugin.MojoExecutionException,
                                                          org.apache.maven.plugin.MojoFailureException
Throws:
org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoFailureException

logClasspath

public void logClasspath(Classpath classpath,
                         String descriptor)

createForkStarter

protected ForkStarter createForkStarter(ProviderInfo provider,
                                        ForkConfiguration forkConfiguration,
                                        ClassLoaderConfiguration classLoaderConfiguration)
                                 throws org.apache.maven.plugin.MojoExecutionException,
                                        org.apache.maven.plugin.MojoFailureException
Throws:
org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoFailureException

getForkConfiguration

protected ForkConfiguration getForkConfiguration()

addPluginSpecificChecksumItems

protected abstract void addPluginSpecificChecksumItems(ChecksumCalculator checksum)

hasExecutedBefore

protected boolean hasExecutedBefore()

getClassLoaderConfiguration

protected ClassLoaderConfiguration getClassLoaderConfiguration(ForkConfiguration fork)

getDefaultIncludes

protected abstract String[] getDefaultIncludes()

generateTestClasspath

public Classpath generateTestClasspath()
                                throws org.apache.maven.artifact.DependencyResolutionRequiredException,
                                       org.apache.maven.plugin.MojoExecutionException,
                                       org.apache.maven.artifact.versioning.InvalidVersionSpecificationException,
                                       org.apache.maven.plugin.MojoFailureException,
                                       org.apache.maven.artifact.resolver.ArtifactResolutionException,
                                       org.apache.maven.artifact.resolver.ArtifactNotFoundException
Generate the test classpath.

Returns:
List containing the classpath elements
Throws:
org.apache.maven.artifact.DependencyResolutionRequiredException - when dependency resolution fails
org.apache.maven.plugin.MojoExecutionException - upon other problems
org.apache.maven.artifact.versioning.InvalidVersionSpecificationException - when it happens
org.apache.maven.plugin.MojoFailureException - when it happens
org.apache.maven.artifact.resolver.ArtifactNotFoundException - when it happens
org.apache.maven.artifact.resolver.ArtifactResolutionException - when it happens

getTestNgUtilsArtifact

protected org.apache.maven.artifact.Artifact getTestNgUtilsArtifact()
                                                             throws org.apache.maven.artifact.resolver.ArtifactResolutionException,
                                                                    org.apache.maven.artifact.resolver.ArtifactNotFoundException
Throws:
org.apache.maven.artifact.resolver.ArtifactResolutionException
org.apache.maven.artifact.resolver.ArtifactNotFoundException

processSystemProperties

protected void processSystemProperties(boolean setInSystem)

ensureWorkingDirectoryExists

protected void ensureWorkingDirectoryExists()
                                     throws org.apache.maven.plugin.MojoFailureException
Throws:
org.apache.maven.plugin.MojoFailureException

ensureParallelRunningCompatibility

protected void ensureParallelRunningCompatibility()
                                           throws org.apache.maven.plugin.MojoFailureException
Throws:
org.apache.maven.plugin.MojoFailureException

warnIfUselessUseSystemClassLoaderParameter

protected void warnIfUselessUseSystemClassLoaderParameter()


Copyright © 2004-2011 The Apache Software Foundation. All Rights Reserved.