<!-- 
/*
 * Copyright 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 default="testPlugin"
         xmlns:j="jelly:core"
         xmlns:assert="assert"
>
        
  <goal name="testPlugin" prereqs="testPropertiesDefined, testCustomProperties">
     <attainGoal name="clean"/>
  </goal>

  <goal name="testPropertiesDefined">
    <j:if test="${pom.getPluginContext('cactus-maven').getVariable('cactus.war') == null}">
      <fail>Property cactus.war is null</fail>
    </j:if>
    <j:if test="${pom.getPluginContext('cactus-maven').getVariable('cactus.ear') == null}">
      <fail>Property cactus.ear is null</fail>
    </j:if>
  </goal>


  <goal name="testCustomProperties">
    <j:set var="newWar" value="${maven.build.dir}/myCactus.war"/>
    <j:set var="newEar" value="${maven.build.dir}/myCactus.ear"/>
    <j:set var="cactus.war" value="${newWar}"/>
    <j:set var="cactus.ear" value="${newEar}"/>
    <attainGoal name="cactus:cactifywar"/>
    <assert:assertFileExists file="${newWar}"/>
    <attainGoal name="cactus:cactifyear"/>
    <assert:assertFileExists file="${newEar}"/>
    
  </goal>

</project>
