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 1228849 2012-01-08 14:04:07Z rfscholte $
Author:
Stephane Nicoll

Field Summary
protected  String FINAL_NAME_PREFIX
           
protected  String FINAL_NAME_SUFFIX
           
protected  File localRepositoryDir
          Test repository directory.
protected  File settingsFile
           
 
Constructor Summary
AbstractEarPluginIT()
           
 
Method Summary
protected  void assertArchiveContent(File baseDir, String projectName, String[] artifactNames, boolean[] artifactsDirectory)
           
protected  void assertDeploymentDescriptors(File baseDir, String projectName)
          Asserts that the deployment descriptors have been generated successfully.
protected  void assertEarArchive(File baseDir, String projectName)
           
protected  void assertEarDirectory(File baseDir, String projectName)
           
protected  List<File> buildArchiveContentFiles(File baseDir, List<File> expectedDirectories)
           
protected  String buildFinalName(String projectName)
           
protected  File doTestProject(String projectName, String[] expectedArtifacts)
          Executes the specified projects and asserts the given artifacts as artifacts (non directory).
protected  File doTestProject(String projectName, String[] expectedArtifacts, boolean testDeploymentDescriptors)
          Executes the specified projects and asserts the given artifacts as artifacts (non directory)
protected  File doTestProject(String projectName, String[] expectedArtifacts, boolean[] artifactsDirectory)
          Executes the specified projects and asserts the given artifacts.
protected  File doTestProject(String projectName, String[] expectedArtifacts, boolean[] artifactsDirectory, boolean testDeploymentDescriptors)
          Executes the specified projects and asserts the given artifacts.
protected  File executeMojo(String projectName, Properties properties)
          Execute the EAR plugin for the specified project.
protected  File executeMojo(String projectName, Properties properties, boolean expectNoError)
          Execute the EAR plugin for the specified project.
protected  File getBasedir()
           
protected  File getEarArchive(File baseDir, String projectName)
           
protected  File getEarDirectory(File baseDir, String projectName)
           
protected  File getTargetDirectory(File basedir)
           
protected  File getTestDir(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 String FINAL_NAME_PREFIX
See Also:
Constant Field Values

FINAL_NAME_SUFFIX

protected final String FINAL_NAME_SUFFIX
See Also:
Constant Field Values

localRepositoryDir

protected File localRepositoryDir
Test repository directory.


settingsFile

protected File settingsFile
Constructor Detail

AbstractEarPluginIT

public AbstractEarPluginIT()
Method Detail

executeMojo

protected File executeMojo(String projectName,
                           Properties properties,
                           boolean expectNoError)
                    throws 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:
Exception - if an error occurred

executeMojo

protected File executeMojo(String projectName,
                           Properties properties)
                    throws 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:
Exception - if an error occurred

doTestProject

protected File doTestProject(String projectName,
                             String[] expectedArtifacts,
                             boolean[] artifactsDirectory,
                             boolean testDeploymentDescriptors)
                      throws 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 deployment descriptors
Returns:
the base directory of the project
Throws:
Exception

doTestProject

protected File doTestProject(String projectName,
                             String[] expectedArtifacts,
                             boolean[] artifactsDirectory)
                      throws 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:
Exception

doTestProject

protected File doTestProject(String projectName,
                             String[] expectedArtifacts,
                             boolean testDeploymentDescriptors)
                      throws 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 deployment descriptors
Returns:
the base directory of the project
Throws:
Exception

doTestProject

protected File doTestProject(String projectName,
                             String[] expectedArtifacts)
                      throws 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:
Exception

assertEarArchive

protected void assertEarArchive(File baseDir,
                                String projectName)

assertEarDirectory

protected void assertEarDirectory(File baseDir,
                                  String projectName)

getTargetDirectory

protected File getTargetDirectory(File basedir)

getEarArchive

protected File getEarArchive(File baseDir,
                             String projectName)

getEarDirectory

protected File getEarDirectory(File baseDir,
                               String projectName)

buildFinalName

protected String buildFinalName(String projectName)

assertArchiveContent

protected void assertArchiveContent(File baseDir,
                                    String projectName,
                                    String[] artifactNames,
                                    boolean[] artifactsDirectory)

buildArchiveContentFiles

protected List<File> buildArchiveContentFiles(File baseDir,
                                              List<File> expectedDirectories)

getBasedir

protected File getBasedir()

getTestDir

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

assertDeploymentDescriptors

protected void assertDeploymentDescriptors(File baseDir,
                                           String projectName)
                                    throws 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:
IOException


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