org.apache.maven.plugin.source
Class AbstractSourcePluginTestCase

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.apache.maven.plugin.source.AbstractSourcePluginTestCase
All Implemented Interfaces:
Test
Direct Known Subclasses:
SourceJarMojoTest, TestSourceJarMojoTest

public abstract class AbstractSourcePluginTestCase
extends AbstractMojoTestCase

Author:
Stephane Nicoll

Field Summary
protected static String FINAL_NAME_PREFIX
           
protected static String FINAL_NAME_SUFFIX
           
 
Fields inherited from class org.codehaus.plexus.PlexusTestCase
basedir, container
 
Constructor Summary
AbstractSourcePluginTestCase()
           
 
Method Summary
protected  void assertJarContent(File jarFile, String[] expectedFiles)
           
protected  void assertSourceArchive(File testTargetDir, String projectName)
           
protected  void assertTestSourceArchive(File testTargetDir, String projectName)
           
protected  String buildFinalSourceName(String projectName)
           
protected  String buildFinalTestSourceName(String projectName)
           
protected  File doTestProject(String projectName, boolean expectSourceArchive, boolean expectTestSourceArchive, String[] expectedSourceFiles, String[] expectedTestSourceFiles, String classifier)
          Executes the specified projects and asserts the given artifacts.
protected  File doTestProjectWithSourceArchive(String projectName, String[] expectedSourceFiles, String classifier)
          Executes the specified projects and asserts the given artifacts for a source archive.
protected  File doTestProjectWithTestSourceArchive(String projectName, String[] expectedTestSourceFiles, String classifier)
          Executes the specified projects and asserts the given artifacts for a test source archive.
protected  void executeMojo(String projectName, String classifier)
          Execute the source plugin for the specified project.
protected abstract  String getGoal()
           
protected  File getSourceArchive(File testTargetDir, String projectName)
           
protected  File getTestDir(String projectName)
           
protected  File getTestSourceArchive(File testTargetDir, String projectName)
           
protected  File getTestTargetDir(String projectName)
           
 
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, failNotEquals, failNotSame, failSame, format
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

FINAL_NAME_PREFIX

protected static final String FINAL_NAME_PREFIX
See Also:
Constant Field Values

FINAL_NAME_SUFFIX

protected static final String FINAL_NAME_SUFFIX
See Also:
Constant Field Values
Constructor Detail

AbstractSourcePluginTestCase

public AbstractSourcePluginTestCase()
Method Detail

getGoal

protected abstract String getGoal()

executeMojo

protected void executeMojo(String projectName,
                           String classifier)
                    throws Exception
Execute the source plugin for the specified project.

Parameters:
projectName - the name of the project
Throws:
Exception - if an error occurred

doTestProject

protected File doTestProject(String projectName,
                             boolean expectSourceArchive,
                             boolean expectTestSourceArchive,
                             String[] expectedSourceFiles,
                             String[] expectedTestSourceFiles,
                             String classifier)
                      throws Exception
Executes the specified projects and asserts the given artifacts.

Parameters:
projectName - the project to test
expectSourceArchive - if a source archive is expected
expectTestSourceArchive - if a test source archive is expected
expectedSourceFiles - the expected files in the source archive, if any
expectedTestSourceFiles - the expected files in the test source archive, if any
Returns:
the base directory of the project
Throws:
Exception - if any error occurs

doTestProjectWithSourceArchive

protected File doTestProjectWithSourceArchive(String projectName,
                                              String[] expectedSourceFiles,
                                              String classifier)
                                       throws Exception
Executes the specified projects and asserts the given artifacts for a source archive.

Parameters:
projectName - the project to test
expectedSourceFiles - the expected files in the source archive, if any
Returns:
the base directory of the project
Throws:
Exception - if any error occurs

doTestProjectWithTestSourceArchive

protected File doTestProjectWithTestSourceArchive(String projectName,
                                                  String[] expectedTestSourceFiles,
                                                  String classifier)
                                           throws Exception
Executes the specified projects and asserts the given artifacts for a test source archive.

Parameters:
projectName - the project to test
expectedTestSourceFiles - the expected files in the test source archive, if any
Returns:
the base directory of the project
Throws:
Exception - if any error occurs

assertSourceArchive

protected void assertSourceArchive(File testTargetDir,
                                   String projectName)

assertTestSourceArchive

protected void assertTestSourceArchive(File testTargetDir,
                                       String projectName)

getSourceArchive

protected File getSourceArchive(File testTargetDir,
                                String projectName)

getTestSourceArchive

protected File getTestSourceArchive(File testTargetDir,
                                    String projectName)

buildFinalSourceName

protected String buildFinalSourceName(String projectName)

buildFinalTestSourceName

protected String buildFinalTestSourceName(String projectName)

getTestDir

protected File getTestDir(String projectName)
                   throws IOException
Throws:
IOException

assertJarContent

protected void assertJarContent(File jarFile,
                                String[] expectedFiles)
                         throws IOException
Throws:
IOException

getTestTargetDir

protected File getTestTargetDir(String projectName)


Copyright © 2002-2012 The Apache Software Foundation. All Rights Reserved.