<!-- 
/*
 * Copyright 2005 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"
>        
  <goal name="testPlugin" prereqs="clean,testWar,testEar,testSingle,test">
  </goal>

  <goal name="testWar">
    <j:set var="goal" value="cactus:test-war"/>
    <attainGoal name="testIt"/>
  </goal>

  <goal name="testEar">
    <j:set var="goal" value="cactus:test-ear"/>
    <attainGoal name="testIt"/>
  </goal>

  <goal name="testSingle">
    <j:set var="goal" value="cactus:single"/>
    <j:set var="testcase" value="org.apache.cactus.integration.maven.test.TestTimeout"/>
    <attainGoal name="testIt"/>
  </goal>

  <goal name="testMatch">
    <j:set var="goal" value="cactus:match"/>
    <j:set var="testmatch" value="org.apache.cactus.integration.maven.test.TestTimeout"/>
    <attainGoal name="testIt"/>
  </goal>

  <goal name="testIt">
    <echo>Testing goal ${goal}</echo>
    <echo>NOTE: this test is only effective if you set at least one container to run cactus tests</echo>

    <j:set var="cactus.containerSet.timeout" value="1"/>
    <j:catch var="timeoutException">
      <attainGoal name="${goal}"/>
    </j:catch>
    <j:if test="${empty(timeoutException)}">
       <fail>Goal ${goal} should have failed due to timeout!</fail>
    </j:if>
    <echo>Got exception: ${timeoutException.message}</echo>

  </goal>


</project>
