org.apache.maven.plugin.war
Class WarOverlaysTest

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
                      extended by org.apache.maven.plugin.war.AbstractWarExplodedMojoTest
                          extended by org.apache.maven.plugin.war.WarOverlaysTest
All Implemented Interfaces:
junit.framework.Test

public class WarOverlaysTest
extends AbstractWarExplodedMojoTest

Author:
Stephane Nicoll

Field Summary
 
Fields inherited from class org.apache.maven.plugin.war.AbstractWarExplodedMojoTest
mojo
 
Fields inherited from class org.apache.maven.plugin.war.AbstractWarMojoTest
MANIFEST_PATH, OVERLAYS_ROOT_DIR, OVERLAYS_TEMP_DIR
 
Fields inherited from class org.codehaus.plexus.PlexusTestCase
basedir, container
 
Constructor Summary
WarOverlaysTest()
           
 
Method Summary
protected  void assertDefaultFileContent(String testId, File webAppDirectory, String filePath)
          Asserts that the content of an overlayed file is correct.
protected  void assertOverlayedFile(File webAppDirectory, String overlayId, String filePath)
          Asserts that the content of an overlayed file is correct.
protected  ArtifactStub generateSimpleWarArtifactStub(String id)
           
protected  File getPomFile()
          Returns the pom configuration to use.
protected  File getTestDirectory()
          Returns the test directory to use.
 void setUp()
           
 void testCacheWithRemovedOverlay()
           
 void testCacheWithUpdatedOverlay()
           
 void testDefaultOverlay()
           
 void testDefaultOverlays()
           
 void testEnvironment()
           
 void testNoOverlay()
           
 void testOverlaysIncludesExcludesWithMultipleDefinitions()
           
 void testOverlaysIncludesExcludesWithMultipleDefinitions2()
           
 void testScenarioOneWithDefaulSettings()
          Merge a dependent WAR when a file in the war source directory overrides one found in the WAR.
 void testScenarioOneWithFullSettings()
          Tests that specifying the overlay explicitely has the same behavior as the default (i.e.
 void testScenarioOneWithOverlaySettings()
          Tests that specifying the overlay explicitely has the same behavior as the default (i.e.
 
Methods inherited from class org.apache.maven.plugin.war.AbstractWarExplodedMojoTest
assertCustomContent, assertDefaultContent, assertWebAppContent, assertWebXml, cleanDirectory, setUpMojo, setUpMojo
 
Methods inherited from class org.apache.maven.plugin.war.AbstractWarMojoTest
buildWarOverlayStub, configureMojo, createArchive, createClassesDir, createDir, createFile, createFile, createWebAppSource, createWebAppSource, createXMLConfigDir, generateFullOverlayWar, getOverlayFile, getWebAppSource
 
Methods inherited from class org.apache.maven.plugin.testing.AbstractMojoTestCase
configureMojo, configureMojo, extractPluginConfiguration, extractPluginConfiguration, getVariablesAndValuesFromObject, getVariablesAndValuesFromObject, getVariableValueFromObject, lookupEmptyMojo, lookupEmptyMojo, lookupMojo, lookupMojo, lookupMojo, 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
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, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runBare, runTest, setName, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WarOverlaysTest

public WarOverlaysTest()
Method Detail

setUp

public void setUp()
           throws Exception
Overrides:
setUp in class AbstractWarExplodedMojoTest
Throws:
Exception

getPomFile

protected File getPomFile()
Description copied from class: AbstractWarExplodedMojoTest
Returns the pom configuration to use.

Specified by:
getPomFile in class AbstractWarExplodedMojoTest
Returns:
the pom configuration

getTestDirectory

protected File getTestDirectory()
Description copied from class: AbstractWarExplodedMojoTest
Returns the test directory to use.

Specified by:
getTestDirectory in class AbstractWarExplodedMojoTest
Returns:
the test directory

testEnvironment

public void testEnvironment()
                     throws Exception
Throws:
Exception

testNoOverlay

public void testNoOverlay()
                   throws Exception
Throws:
Exception

testDefaultOverlay

public void testDefaultOverlay()
                        throws Exception
Throws:
Exception

testDefaultOverlays

public void testDefaultOverlays()
                         throws Exception
Throws:
Exception

testScenarioOneWithDefaulSettings

public void testScenarioOneWithDefaulSettings()
                                       throws Exception
Merge a dependent WAR when a file in the war source directory overrides one found in the WAR.

It also tests completeness of the resulting war as well as the proper order of dependencies.

Throws:
Exception - if any error occurs

testScenarioOneWithOverlaySettings

public void testScenarioOneWithOverlaySettings()
                                        throws Exception
Tests that specifying the overlay explicitely has the same behavior as the default (i.e. order, etc).

The default project is not specified in this case so it is processed first by default

Throws:
Exception - if an error occurs

testScenarioOneWithFullSettings

public void testScenarioOneWithFullSettings()
                                     throws Exception
Tests that specifying the overlay explicitely has the same behavior as the default (i.e. order, etc).

The default project is explicitely specified so this should match the default.

Throws:
Exception - if an error occurs

testOverlaysIncludesExcludesWithMultipleDefinitions

public void testOverlaysIncludesExcludesWithMultipleDefinitions()
                                                         throws Exception
Throws:
Exception

testOverlaysIncludesExcludesWithMultipleDefinitions2

public void testOverlaysIncludesExcludesWithMultipleDefinitions2()
                                                          throws Exception
Throws:
Exception

testCacheWithUpdatedOverlay

public void testCacheWithUpdatedOverlay()
                                 throws Exception
Throws:
Exception

testCacheWithRemovedOverlay

public void testCacheWithRemovedOverlay()
                                 throws Exception
Throws:
Exception

assertOverlayedFile

protected void assertOverlayedFile(File webAppDirectory,
                                   String overlayId,
                                   String filePath)
                            throws IOException
Asserts that the content of an overlayed file is correct.

Note that the filePath is relative to both the webapp directory and the overlayed directory, defined by the overlayId.

Parameters:
webAppDirectory - the webapp directory
overlayId - the id of the overlay
filePath - the relative path
Throws:
IOException - if an error occurred while reading the files

assertDefaultFileContent

protected void assertDefaultFileContent(String testId,
                                        File webAppDirectory,
                                        String filePath)
                                 throws Exception
Asserts that the content of an overlayed file is correct.

Note that the filePath is relative to both the webapp directory and the overlayed directory, defined by the overlayId.

Parameters:
testId - te id of the test
webAppDirectory - the webapp directory
filePath - the relative path
Throws:
IOException - if an error occurred while reading the files
Exception

generateSimpleWarArtifactStub

protected ArtifactStub generateSimpleWarArtifactStub(String id)
                                              throws Exception
Throws:
Exception


Copyright © 2002–2013 The Apache Software Foundation. All rights reserved.