- Add a test for the license being included in the EAR

- Add a property so that the license is included in the test project
- Use the assert tags from the plugin plugin


git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@114912 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
dion
2004-03-15 11:51:29 +00:00
parent d876cc18b9
commit 05e33e01e0
2 changed files with 23 additions and 27 deletions

View File

@@ -15,7 +15,11 @@
* limitations under the License.
*/
-->
<project xmlns:j="jelly:core" xmlns:u="jelly:util" xmlns:x="jelly:xml" xmlns:j2ee="j2ee">
<project xmlns:j="jelly:core"
xmlns:u="jelly:util"
xmlns:x="jelly:xml"
xmlns:assert="assert"
xmlns:j2ee="j2ee">
<goal name="testPlugin" prereqs="test-ear">
<attainGoal name="clean"/>
@@ -25,12 +29,7 @@
<attainGoal name="ear"/>
<!-- tests that the ear is generated -->
<j:set var="expectedFile"
value="${maven.build.dir}/test-maven-ear-plugin-1.0-SNAPSHOT.ear"/>
<u:file var="file" name="${expectedFile}" />
<j:if test="${!(file.exists())}">
<fail>${expectedFile} not generated</fail>
</j:if>
<assert:assertFileExists file="${maven.build.dir}/test-maven-ear-plugin-1.0-SNAPSHOT.ear"/>
<!-- unzip the ear and look for the jars -->
<j:set var="earFile"
@@ -38,18 +37,14 @@
<j:set var="unzipDir" value= "${maven.build.dir}/eartest"/>
<mkdir dir="${unzipDir}"/>
<unzip src="${earFile}" dest="${unzipDir}"/>
<!-- check for commons-logging -->
<j:set var="expectedFile" value="${unzipDir}/commons-logging-1.0.3.jar"/>
<u:file var="file" name="${expectedFile}" />
<j:if test="${!(file.exists())}">
<fail>${expectedFile} not bundled</fail>
</j:if>
<assert:assertFileExists file="${unzipDir}/commons-logging-1.0.3.jar"
msg="commons logging was not bundled"/>
<!-- check for commons-collections -->
<j:set var="expectedFile" value="${unzipDir}/commons-collections-2.1.jar"/>
<u:file var="file" name="${expectedFile}" />
<j:if test="${!(file.exists())}">
<fail>${expectedFile} not bundled</fail>
</j:if>
<assert:assertFileExists file="${unzipDir}/commons-collections-2.1.jar"
msg="commons collections was not bundled"/>
<!-- check application.xml got a java module in it -->
<u:file var="appXml" name="${unzipDir}/META-INF/application.xml"/>
@@ -59,18 +54,16 @@
<x:parse var="applicationDoc" xml="${appXml.toURL()}" SAXReader="${saxReader}" />
<x:set var="firstJavaModule" select="string($applicationDoc/application/module/java)"/>
<j:if test="${firstJavaModule != 'commons-collections-2.1.jar'}">
<fail>
commons-collections-2.1.jar not bundled as a java module found '${firstJavaModule}' instead
</fail>
</j:if>
<assert:assertEquals
expected="commons-collections-2.1.jar"
value="${firstJavaModule}"
msg="commons collections was not the first java module"/>
<!-- check for resources -->
<j:set var="expectedFile" value="${unzipDir}/resource.txt"/>
<u:file var="file" name="${expectedFile}" />
<j:if test="${!(file.exists())}">
<fail>${expectedFile} not bundled as a resource</fail>
</j:if>
<assert:assertFileExists file="${unzipDir}/resource.txt"/>
<!-- check for the LICENSE -->
<assert:assertFileExists file="${unzipDir}/META-INF/LICENSE.txt"/>
</goal>
</project>

View File

@@ -17,3 +17,6 @@
maven.deployable.component=${maven.final.name}.ear
maven.j2ee.ear.appxml=${maven.conf.dir}/application.xml
maven.ear.appxml.generate=true
# note the override below is needed, as the ear plugin redefines the licenseFile in
# it's own project.properties, and running plugin:test would otherwise fail
maven.license.licenseFile=${basedir}/LICENSE.txt