<!-- 
/*
 * 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:j2ee="j2ee">

  <goal name="testPlugin" prereqs="test-ear">
    <attainGoal name="clean"/>
  </goal>
  
  <goal name="test-ear">
    <attainGoal name="ear"/>

    <!-- tests that the ear is generated -->
    <assert:assertFileExists file="${maven.build.dir}/${maven.final.name}.ear"/>
    
    <!-- unzip the ear and look for the jars -->
    <j:set var="earFile" 
      value="${maven.build.dir}/${maven.final.name}.ear"/>
    <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}/APP-INF/lib/commons-logging-1.0.3.jar"
      msg="commons logging was not bundled"/>
    
    <!-- check that commons-collections has not been packaged -->
    <assert:assertFileNotFound file="${unzipDir}/APP-INF/lib/commons-collections-2.1.jar"
      msg="commons collections was bundled incorrectly"/>


  </goal>
</project>

