<?xml version="1.0"?>
<!--
  ~ Licensed to the Apache Software Foundation (ASF) under one or more
  ~ contributor license agreements.  See the NOTICE file distributed with
  ~ this work for additional information regarding copyright ownership.
  ~ The ASF licenses this file to You 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.
  -->

<!-- @version $Rev$ $Date$ -->

<project name="testsuite" default="run" basedir=".">

    <!-- sets the properties eclipse-home, and library-file -->
    <!-- The property ${eclipse-home} should be passed into this script -->
    <!-- Set a meaningful default value for when it is not. -->
    <property name="eclipse-home" value="${basedir}\..\.."/>
    <property name="plugin-name" value="org.apache.geronimo.testsuite.v21"/>
    <property name="library-file"
              value="${eclipse-home}/../../../plugins/org.apache.geronimo.testsuite.common/library.xml"/>
 
    <!-- This target holds all initialization code that needs to be done for -->
    <!-- all tests that are to be run. Initialization for individual tests -->
    <!-- should be done within the body of the suite target. -->
    <target name="init">
        <tstamp/>
        <delete>
            <fileset dir="${eclipse-home}" includes="org*.xml"/>
        </delete>
    </target>

    <!-- This target defines the tests that need to be run. -->
    <target name="suite">
        <property name="jdt-folder"
                  value="${eclipse-home}/jdt_folder"/>
        <delete dir="${jdt-folder}" quiet="true"/>


        <!-- 
         #########################################################################
         ##                                                                     ##
         ## Extra permgen memory required for this testsuite                    ##
         ##                                                                     ##
         #########################################################################
         -->
        <property name="extraVMargs" value="-XX:MaxPermSize=128m" />
        
        
        <!-- 
         #########################################################################
         ##                                                                     ##
         ## Copy the resources required for this testsuite                      ##
         ##                                                                     ##
         #########################################################################
         -->
        <mkdir dir="${jdt-folder}/src"/>
        <copy todir="${jdt-folder}/src">
            <fileset dir="${eclipse-home}/../../../plugins/org.apache.geronimo.testsuite.v21/src">
                <include name="**/*.java"/>
                <include name="**/*.jsp"/>
            </fileset>
        </copy>
        
        
        <!--
         #########################################################################
         ##                                                                     ##
         ## Check UI Installation testcase                                      ##
         ##                                                                     ##
         #########################################################################
         -->
        <!--ant target="ui-test" antfile="${library-file}" dir="${eclipse-home}">
            <property name="data-dir" value="${jdt-folder}"/>
            <property name="plugin-name" value="${plugin-name}"/>
            <property name="classname"
                      value="org.apache.geronimo.testsuite.v21.ui.EclipseUITest"/>
        </ant-->
        
        
        <!--
         #########################################################################
         ##                                                                     ##
         ## Run on Server testcase                                              ##
         ##                                                                     ##
         #########################################################################
         -->
        <!--ant target="ui-test" antfile="${library-file}" dir="${eclipse-home}">
            <property name="data-dir" value="${jdt-folder}"/>
            <property name="plugin-name" value="${plugin-name}"/>
            <property name="classname"
                      value="org.apache.geronimo.testsuite.v21.ui.RunOnServerTest"/>
        </ant-->


        <!--
         #########################################################################                                                                     ##
         ##                                                                     ##
         ## Shared Lib Pojo testcase                                            ##
         ##                                                                     ##
         #########################################################################
         -->
        <!--ant target="ui-test" antfile="${library-file}" dir="${eclipse-home}">
            <property name="data-dir" value="${jdt-folder}"/>
            <property name="plugin-name" value="${plugin-name}"/>
            <property name="classname"
             value="org.apache.geronimo.testsuite.v21.ui.SharedLibPojoTest"/>
        </ant-->
    
    
        <!-- 
         #########################################################################
         ##                                                                     ##
         ## Define new server testcase                                          ##
         ##                                                                     ##
         #########################################################################
         -->
        <ant target="ui-test" antfile="${library-file}" dir="${eclipse-home}">
            <property name="data-dir" value="${jdt-folder}"/>
            <property name="plugin-name" value="${plugin-name}"/>
            <property name="classname"
                      value="org.apache.geronimo.testsuite.v21.ui.NewServerTest"/>
        </ant>


        <!-- 
         #########################################################################
         ##                                                                     ##
         ## 5 minute tutorial testcase                                          ##
         ##                                                                     ##
         #########################################################################
         -->
        <!--ant target="ui-test" antfile="${library-file}" dir="${eclipse-home}">
            <property name="data-dir" value="${jdt-folder}"/>
            <property name="plugin-name" value="${plugin-name}"/>
            <property name="classname"
                      value="org.apache.geronimo.testsuite.v21.ui.Tutorial5MinuteTest"/>
        </ant-->


    </target>

    <!-- This target holds code to cleanup the testing environment after -->
    <!-- after all of the tests have been run. You can use this target to -->
    <!-- delete temporary files that have been created. -->
    <target name="cleanup">
    </target>

    <!-- This target runs the test suite. Any actions that need to happen -->
    <!-- after all the tests have been run should go here. -->
    <target name="run" depends="init,suite,cleanup">
        <ant target="collect" antfile="${library-file}" dir="${eclipse-home}">
            <property name="includes" value="org*.xml"/>
            <property name="output-file" value="${plugin-name}.xml"/>
        </ant>
    </target>

</project>
