org.apache.maven.plugin.ear.it
Class AbstractEarPluginIT

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.apache.maven.plugin.ear.it.AbstractEarPluginIT
All Implemented Interfaces:
junit.framework.Test
Direct Known Subclasses:
EarMojoIT

public abstract class AbstractEarPluginIT
extends junit.framework.TestCase

Base class for ear test cases.

Version:
$Id: AbstractEarPluginIT.java 746740 2009-02-22 15:44:32Z snicoll $
Author:
Stephane Nicoll

Field Summary
protected  java.lang.String FINAL_NAME_PREFIX
           
protected  java.lang.String FINAL_NAME_SUFFIX
           
protected  java.io.File localRepositoryDir
          Test repository directory.
protected  java.io.File settingsFile
           
 
Constructor Summary
AbstractEarPluginIT()
           
 
Method Summary
protected  void assertArchiveContent(java.io.File baseDir, java.lang.String projectName, java.lang.String[] artifactNames, boolean[] artifactsDirectory)
           
protected  void assertDeploymentDescriptors(java.io.File baseDir, java.lang.String projectName)
          Asserts that the deployment descriptors have been generated successfully.
protected  void assertEarArchive(java.io.File baseDir, java.lang.String projectName)
           
protected  void assertEarDirectory(java.io.File baseDir, java.lang.String projectName)
           
protected  java.util.List buildArchiveContentFiles(java.io.File baseDir, java.util.List expectedDirectories)
           
protected  java.lang.String buildFinalName(java.lang.String projectName)
           
protected  java.io.File doTestProject(java.lang.String projectName, java.lang.String[] expectedArtifacts)
          Executes the specified projects and asserts the given artifacts as artifacts (non directory).
protected  java.io.File doTestProject(java.lang.String projectName, java.lang.String[] expectedArtifacts, boolean testDeploymentDescriptors)
          Executes the specified projects and asserts the given artifacts as artifacts (non directory)
protected  java.io.File doTestProject(java.lang.String projectName, java.lang.String[] expectedArtifacts, boolean[] artifactsDirectory)
          Executes the specified projects and asserts the given artifacts.
protected  java.io.File doTestProject(java.lang.String projectName, java.lang.String[] expectedArtifacts, boolean[] artifactsDirectory, boolean testDeploymentDescriptors)
          Executes the specified projects and asserts the given artifacts.
protected  java.io.File executeMojo(java.lang.String projectName, java.util.Properties properties)
          Execute the EAR plugin for the specified project.
protected  java.io.File executeMojo(java.lang.String projectName, java.util.Properties properties, boolean expectNoError)
          Execute the EAR plugin for the specified project.
protected  java.io.File getBasedir()
           
protected  java.io.File getEarArchive(java.io.File baseDir, java.lang.String projectName)
           
protected  java.io.File getEarDirectory(java.io.File baseDir, java.lang.String projectName)
           
protected  java.io.File getTargetDirectory(java.io.File basedir)
           
protected  java.io.File getTestDir(java.lang.String projectName)
           
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, setUp, tearDown, 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

FINAL_NAME_PREFIX

protected final java.lang.String FINAL_NAME_PREFIX
See Also:
Constant Field Values

FINAL_NAME_SUFFIX

protected final java.lang.String FINAL_NAME_SUFFIX
See Also:
Constant Field Values

localRepositoryDir

protected java.io.File localRepositoryDir
Test repository directory.


settingsFile

protected java.io.File settingsFile
Constructor Detail

AbstractEarPluginIT

public AbstractEarPluginIT()
Method Detail

executeMojo

protected java.io.File executeMojo(java.lang.String projectName,
                                   java.util.Properties properties,
                                   boolean expectNoError)
                            throws java.lang.Exception
Execute the EAR plugin for the specified project.

Parameters:
projectName - the name of the project
properties - extra properties to be used by the embedder
Returns:
the base directory of the project
Throws:
java.lang.Exception - if an error occured

executeMojo

protected java.io.File executeMojo(java.lang.String projectName,
                                   java.util.Properties properties)
                            throws java.lang.Exception
Execute the EAR plugin for the specified project.

Parameters:
projectName - the name of the project
properties - extra properties to be used by the embedder
Returns:
the base directory of the project
Throws:
java.lang.Exception - if an error occured

doTestProject

protected java.io.File doTestProject(java.lang.String projectName,
                                     java.lang.String[] expectedArtifacts,
                                     boolean[] artifactsDirectory,
                                     boolean testDeploymentDescriptors)
                              throws java.lang.Exception
Executes the specified projects and asserts the given artifacts.

Parameters:
projectName - the project to test
expectedArtifacts - the list of artifacts to be found in the EAR archive
artifactsDirectory - whether the artifact is an exploded artifactsDirectory or not
testDeploymentDescriptors - whether we should test deployemnt descriptors
Returns:
the base directory of the project
Throws:
java.lang.Exception

doTestProject

protected java.io.File doTestProject(java.lang.String projectName,
                                     java.lang.String[] expectedArtifacts,
                                     boolean[] artifactsDirectory)
                              throws java.lang.Exception
Executes the specified projects and asserts the given artifacts. Assert the deployment descriptors are valid

Parameters:
projectName - the project to test
expectedArtifacts - the list of artifacts to be found in the EAR archive
artifactsDirectory - whether the artifact is an exploded artifactsDirectory or not
Returns:
the base directory of the project
Throws:
java.lang.Exception

doTestProject

protected java.io.File doTestProject(java.lang.String projectName,
                                     java.lang.String[] expectedArtifacts,
                                     boolean testDeploymentDescriptors)
                              throws java.lang.Exception
Executes the specified projects and asserts the given artifacts as artifacts (non directory)

Parameters:
projectName - the project to test
expectedArtifacts - the list of artifacts to be found in the EAR archive
testDeploymentDescriptors - whether we should test deployemnt descriptors
Returns:
the base directory of the project
Throws:
java.lang.Exception

doTestProject

protected java.io.File doTestProject(java.lang.String projectName,
                                     java.lang.String[] expectedArtifacts)
                              throws java.lang.Exception
Executes the specified projects and asserts the given artifacts as artifacts (non directory). Assert the deployment descriptors are valid

Parameters:
projectName - the project to test
expectedArtifacts - the list of artifacts to be found in the EAR archive
Returns:
the base directory of the project
Throws:
java.lang.Exception

assertEarArchive

protected void assertEarArchive(java.io.File baseDir,
                                java.lang.String projectName)

assertEarDirectory

protected void assertEarDirectory(java.io.File baseDir,
                                  java.lang.String projectName)

getTargetDirectory

protected java.io.File getTargetDirectory(java.io.File basedir)

getEarArchive

protected java.io.File getEarArchive(java.io.File baseDir,
                                     java.lang.String projectName)

getEarDirectory

protected java.io.File getEarDirectory(java.io.File baseDir,
                                       java.lang.String projectName)

buildFinalName

protected java.lang.String buildFinalName(java.lang.String projectName)

assertArchiveContent

protected void assertArchiveContent(java.io.File baseDir,
                                    java.lang.String projectName,
                                    java.lang.String[] artifactNames,
                                    boolean[] artifactsDirectory)

buildArchiveContentFiles

protected java.util.List buildArchiveContentFiles(java.io.File baseDir,
                                                  java.util.List expectedDirectories)

getBasedir

protected java.io.File getBasedir()

getTestDir

protected java.io.File getTestDir(java.lang.String projectName)
                           throws java.io.IOException
Throws:
java.io.IOException

assertDeploymentDescriptors

protected void assertDeploymentDescriptors(java.io.File baseDir,
                                           java.lang.String projectName)
                                    throws java.io.IOException
Asserts that the deployment descriptors have been generated successfully.

This test assumes that deployment descriptors are located in the expected-META-INF directory of the project. Note that the MANIFEST.mf file is ignored and is not tested.

Parameters:
baseDir - the directory of the tested project
projectName - the name of the project
Throws:
java.io.IOException


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