Files
maven-plugins/ear/src/plugin-test/simpleTest/maven.xml
T
2006-02-08 17:04:26 +00:00

67 lines
2.4 KiB
XML

<!--
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<project xmlns:j="jelly:core"
xmlns:u="jelly:util"
xmlns:x="jelly:xml"
xmlns:assert="assert"
xmlns:ear="ear">
<goal name="testPlugin" prereqs="ear,test-ear">
<attainGoal name="clean"/>
</goal>
<goal name="test-ear">
<j:set var="earFile" value="${maven.build.dir}/${maven.ear.final.name}"/>
<!-- tests that the ear is generated -->
<assert:assertFileExists file="${earFile}"/>
<!-- unzip the ear and look for the jars -->
<j:set var="unzipDir" value= "${maven.build.dir}/eartest"/>
<mkdir dir="${unzipDir}"/>
<unzip src="${earFile}" dest="${unzipDir}"/>
<!-- check for commons-logging -->
<assert:assertFileExists file="${unzipDir}/commons-logging-1.0.4.jar"
msg="commons logging was not bundled"/>
<!-- check for commons-collections -->
<assert:assertFileExists file="${unzipDir}/commons-collections-3.0.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"/>
<j:new var="saxReader" className="org.dom4j.io.SAXReader" />
<ear:resolver var="resolver" />
${saxReader.setEntityResolver(resolver)}
<x:parse var="applicationDoc" xml="${appXml.toURL()}" SAXReader="${saxReader}" />
<x:set var="firstJavaModule" select="string($applicationDoc/application/module/java)"/>
<assert:assertEquals
expected="commons-collections-3.0.jar"
value="${firstJavaModule}"
msg="commons collections was not the first java module"/>
<!-- check for resources -->
<assert:assertFileExists file="${unzipDir}/resource.txt"/>
<!-- check for the LICENSE -->
<assert:assertFileExists file="${unzipDir}/META-INF/LICENSE.txt"/>
</goal>
</project>