org.apache.maven.plugin.war
Class AbstractWarMojoTest

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.war.AbstractWarMojoTest
All Implemented Interfaces:
Test
Direct Known Subclasses:
AbstractWarExplodedMojoTest, WarInPlaceMojoTest, WarMojoTest, WarZipTest

public abstract class AbstractWarMojoTest
extends AbstractMojoTestCase


Field Summary
protected static String MANIFEST_PATH
           
protected static File OVERLAYS_ROOT_DIR
           
protected static File OVERLAYS_TEMP_DIR
           
 
Fields inherited from class org.codehaus.plexus.PlexusTestCase
basedir, container
 
Constructor Summary
AbstractWarMojoTest()
           
 
Method Summary
protected  ArtifactStub buildWarOverlayStub(String id)
          Builds a test overlay.
protected  void configureMojo(AbstractWarMojo mojo, List filters, File classesDir, File webAppSource, File webAppDir, MavenProjectBasicStub project)
          initialize required parameters
protected  void createArchive(File directory, File destinationFile)
           
protected  File createClassesDir(String id, boolean empty)
          create a class directory with or without a sample class
protected  void createDir(File dir)
           
protected  void createFile(File testFile)
           
protected  void createFile(File testFile, String body)
           
protected  File createWebAppSource(String id)
           
protected  File createWebAppSource(String id, boolean createSamples)
          create an isolated web source with a sample jsp file
protected  File createXMLConfigDir(String id, String[] xmlFiles)
          create an isolated xml dir
protected  File generateFullOverlayWar(String id)
          Generates test war

Generates war with such a structure: jsp d a.jsp b.jsp c.jsp a.jsp b.jsp c.jsp WEB-INF classes a.class b.class c.class lib a.jar b.jar c.jar web.xml

Each of the files will contain: id+'-'+path

protected  File getOverlayFile(String id, String filePath)
           
protected abstract  File getTestDirectory()
           
protected  File getWebAppSource(String id)
          Returns the webapp source directory for the specified id.
 
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

OVERLAYS_TEMP_DIR

protected static final File OVERLAYS_TEMP_DIR

OVERLAYS_ROOT_DIR

protected static final File OVERLAYS_ROOT_DIR

MANIFEST_PATH

protected static final String MANIFEST_PATH
Constructor Detail

AbstractWarMojoTest

public AbstractWarMojoTest()
Method Detail

getTestDirectory

protected abstract File getTestDirectory()
                                  throws Exception
Throws:
Exception

configureMojo

protected void configureMojo(AbstractWarMojo mojo,
                             List filters,
                             File classesDir,
                             File webAppSource,
                             File webAppDir,
                             MavenProjectBasicStub project)
                      throws Exception
initialize required parameters

Parameters:
mojo -
filters -
classesDir -
webAppSource -
webAppDir -
project -
Throws:
Exception

createXMLConfigDir

protected File createXMLConfigDir(String id,
                                  String[] xmlFiles)
                           throws Exception
create an isolated xml dir

Parameters:
id -
xmlFiles -
Returns:
Throws:
Exception

getWebAppSource

protected File getWebAppSource(String id)
                        throws Exception
Returns the webapp source directory for the specified id.

Parameters:
id - the id of the test
Returns:
the source directory for that test
Throws:
Exception - if an exception occurs

createWebAppSource

protected File createWebAppSource(String id,
                                  boolean createSamples)
                           throws Exception
create an isolated web source with a sample jsp file

Parameters:
id -
Returns:
Throws:
Exception

createWebAppSource

protected File createWebAppSource(String id)
                           throws Exception
Throws:
Exception

createClassesDir

protected File createClassesDir(String id,
                                boolean empty)
                         throws Exception
create a class directory with or without a sample class

Parameters:
id -
empty -
Returns:
Throws:
Exception

createDir

protected void createDir(File dir)

createFile

protected void createFile(File testFile,
                          String body)
                   throws Exception
Throws:
Exception

createFile

protected void createFile(File testFile)
                   throws Exception
Throws:
Exception

generateFullOverlayWar

protected File generateFullOverlayWar(String id)
                               throws Exception
Generates test war

Generates war with such a structure:

Each of the files will contain: id+'-'+path

Parameters:
id - the id of the overlay containing the full structure
Returns:
the war file
Throws:
Exception - if an error occurs

buildWarOverlayStub

protected ArtifactStub buildWarOverlayStub(String id)
Builds a test overlay.

Parameters:
id - the id of the overlay (see test/resources/overlays)
Returns:
a test war artifact with the content of the given test overlay

getOverlayFile

protected File getOverlayFile(String id,
                              String filePath)

createArchive

protected void createArchive(File directory,
                             File destinationFile)


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