<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE project [
  <!ENTITY buildmagic SYSTEM "../../tools/etc/buildfragments/buildmagic.ent">
  <!ENTITY tools      SYSTEM "../../tools/etc/buildfragments/tools.ent">
  <!ENTITY libraries  SYSTEM "../../tools/etc/buildfragments/libraries.ent">
  <!ENTITY modules    SYSTEM "../../tools/etc/buildfragments/modules.ent">
  <!ENTITY defaults   SYSTEM "../../tools/etc/buildfragments/defaults.ent">
  <!ENTITY targets    SYSTEM "../../tools/etc/buildfragments/targets.ent">
]>


<!-- ====================================================================== -->
<!--                                                                        -->
<!--  JBoss, the OpenSource J2EE webOS                                      -->
<!--                                                                        -->
<!--  Distributable under LGPL license.                                     -->
<!--  See terms of license at http://www.gnu.org.                           -->
<!--                                                                        -->
<!-- ====================================================================== -->

<!-- $Id: build.xml,v 1.25 2003/03/13 12:59:10 cgjung Exp $ -->

<project default="main" name="JBoss/JBoss.net/TestSuite" basedir="../">

  <!--+====================================================================+-->
  <!--| Setup                                                              |-->
  <!--|                                                                    |-->
  <!--| Include the common build elements.                                 |-->
  <!--|                                                                    |-->
  <!--| This defines several different targets, properties and paths.      |-->
  <!--| It also sets up the basic extention tasks amoung other things.     |-->
  <!--+====================================================================+-->

  &buildmagic;
  &libraries;
  &modules;
  &defaults;
  &tools;
  &targets;

  <!--+====================================================================+-->
  <!--| Initialization                                                     |-->
  <!--|                                                                    |-->
  <!--| Initialize the build system.  Other targets should depend on       |-->
  <!--| 'init'.                                                            |-->
  <!--+====================================================================+-->

  <target name="init" depends="_default:init">
    <!-- Add module specific elements here. -->
  </target>


  <!--+====================================================================+-->
  <!--| Configuration                                                      |-->
  <!--|                                                                    |-->
  <!--| This target is invoked by the Buildmagic initialization logic      |-->
  <!--| and should contain module specific configuration elements.         |-->
  <!--+====================================================================+-->

  <target name="configure" unless="configure.disable">

    <property name="module.local.output" value="${basedir}/testsuite/output"/>


    <!--+================================+-->
    <!--| Library & Module Dependencies. |-->
    <!--+================================+-->

    <!-- Configure thirdparty libraries -->
    <call target="configure-libraries"/>

    <path id="library.classpath">
      <path refid="sun.jsse.classpath"/>
      <path refid="sun.javamail.classpath"/>
      <path refid="sun.jaxp.classpath"/>
      <path refid="apache.log4j.classpath"/>
      <path refid="oswego.concurrent.classpath"/>
      <path refid="junit.junit.classpath"/>
      <path refid="apache.axis.classpath"/>
      <path refid="sun.jsse.classpath"/>
      <path refid="apache.commons.classpath"/>
      <path refid="juddi.juddi.classpath"/>
      <path refid="ibm.uddi4j.classpath"/>
    </path>

    <path id="apache.axis.generate.classpath">
	<path refid="library.classpath"/>
	<path refid="ibm.wsdl4j.classpath"/>
    </path>

    <property name="jboss.net.etc" value="${basedir}/output/etc"/>

    <!-- Configure modules -->
    <call target="configure-modules"/>

    <path id="jboss.net.classpath">
      <pathelement path="${basedir}/output/lib/jboss-net.jar"/>
    </path>

   <path id="jboss.test.classpath">
      <pathelement path="${basedir}/../testsuite/output/classes"/>
   </path>

   <property name="jboss.test.root" value="${basedir}/../testsuite/output"/>

    <path id="dependentmodule.classpath">
      <path refid="jetty.servlet.classpath"/>
      <path refid="jboss.j2ee.classpath"/>
      <path refid="jboss.naming.classpath"/>
      <path refid="jboss.server.classpath"/>
      <path refid="jboss.jmx.classpath"/>
      <path refid="jboss.common.classpath"/>
      <path refid="jboss.system.classpath"/>
      <path refid="jboss.messaging.classpath"/>
      <path refid="jboss.security.classpath"/>
      <path refid="jboss.cluster.classpath"/>
      <path refid="jboss.net.classpath"/>
      <path refid="jboss.test.classpath"/>
      <path refid="jboss.common.classpath"/>
    </path>

    <!-- Where source files live -->
    <property name="source.java" value="${basedir}/testsuite/src/main"/>
    <property name="source.etc" value="${basedir}/testsuite/src/etc"/>
    <property name="source.bin" value="${basedir}/testsuite/src/bin"/>
    <property name="source.docs" value="${basedir}/testsuite/src/docs"/>
    <property name="source.resources" value="${basedir}/testsuite/src/resources"/>
    <property name="source.stylesheets" value="${basedir}/testsuite/src/stylesheets"/>

    <!-- Where build generated files will go -->
    <property name="build.classes" value="${basedir}/testsuite/output/classes"/>
    <property name="build.lib" value="${basedir}/testsuite/output/lib"/>
    <property name="build.api" value="${basedir}/testsuite/output/api"/>
    <property name="build.etc" value="${basedir}/testsuite/output/etc"/>
    <property name="build.bin" value="${basedir}/testsuite/output/bin"/>
    <property name="build.docs" value="${basedir}/testsuite/output/docs"/>
    <property name="build.resources" value="${basedir}/testsuite/output/resources"/>
    <property name="build.stylesheets" value="${basedir}/testsuite/output/stylesheets"/>
    <property name="build.reports" value="${basedir}/testsuite/output/reports"/>
    <property name="build.testlog" value="${basedir}/testsuite/output/log"/>
    <property name="build.gen-src" value="${basedir}/testsuite/output/gen-src"/>

    <call target="_configure:xdoclet:tasks"/>
    <call target="_configure:xdoclet:ejbdoclet"/>

    <!-- The classpath required to build classes. -->
    <path id="xdoclet.classpath">
      <path refid="ejbdoclet.task.classpath"/>
      <pathelement path="${basedir}/output/lib/xdoclet-module-jboss-net.jar"/>
    </path>

    <!--xdoclet output directories-->
    <property name="build.gen-src" value="${basedir}/testsuite/output/gen-src/"/>

    <!--+=======================================+-->
    <!--| Override any default properties here. |-->
    <!--+=======================================+-->

    <!-- Override JUnit defaults -->
    <property name="junit.timeout" value="1200000"/> <!-- 20 minutes -->
    <property name="junit.batchtest.todir" value="${build.reports}"/>

    <!-- Configure defaults & build tools --> 
    <call target="configure-defaults"/>
    <call target="configure-tools"/>

    <!--+=======================================+-->
    <!--| Define module specific elements here. |-->
    <!--+=======================================+-->

    <property name="jbosstest.iterationcount" value="10"/>
    <property name="jbosstest.threadcount" value="5"/>
    <property name="jbosstest.beancount" value="5"/>

    <property name="jbosstest.server.name" value="local"/>

    <property name="jbosstest.data.dir" value="${module.local.output}/data"/>


    <!-- Override JUnit Marathon defaults -->
    <property name="marathon.timeout" value="3900000"/> <!-- 65 minutes -->
    <property name="marathon.duration" value="3600000"/> <!-- 60 minutes -->
    <property name="marathon.threadcount" value="100"/>


    <!-- Install/Release structure -->
    <property name="install.id" value="${module.name}-${module.version}"/>
    <property name="release.id" value="${install.id}"/>
    <property name="install.root" value="${module.local.output}/${install.id}"/>

    <!-- The combined thirdparty classpath -->
    <path id="thirdparty.classpath">
      <path refid="library.classpath"/>
      <path refid="dependentmodule.classpath"/>
    </path>

    <!-- This module is based on Java 1.2 -->
    <property name="javac.target" value="1.2"/>

    <!-- RMIC should generate stubs compatible with Java 1.2+ -->
    <property name="rmic.stubVersion" value="1.2"/>

    <!-- classpath and local.classpath must have a value using with a path -->
    <property name="classpath" value=""/>
    <property name="local.classpath" value=""/>

    <!-- The classpath required to build classes. -->
    <path id="javac.classpath">
      <pathelement path="${classpath}"/>
      <pathelement path="${local.classpath}"/>
      <path refid="thirdparty.classpath"/>
    </path>

  </target>

  <!-- ================================================================== -->
  <!-- Compile                                                            -->
  <!-- ================================================================== -->

  <!-- 
     |  Compile everything.
     |
     |  This target should depend on other compile-* targets for each 
     |  different type of compile that needs to be performed, short of
     |  documentation compiles.
    -->
  <target name="compile" 
	  depends="compile-classes, compile-etc, compile-stylesheets, compile-resources, compile-bin"
	  description="Compile all source files."/>

  <!-- Compile all class files -->
  <target name="compile-classes" depends="init">

    <mkdir dir="${build.gen-src}"/>
    
    <!-- call wsdl4j emitter -->
    <java dir="${build.gen-src}" fork="yes" failOnError="true" className="org.apache.axis.wsdl.WSDL2Java">
        <arg line="-s -d Session -Nhttp://net.jboss.org/samples/AddressBook=samples.addr ${source.resources}/addr/wsr/META-INF/AddressBook.wsdl"/> 
	<classpath refid="apache.axis.generate.classpath"/>
    </java>

    <!-- call wsdl4j emitter -->
    <java dir="${build.gen-src}" fork="yes" failOnError="true" className="org.apache.axis.wsdl.WSDL2Java">
        <arg line="-d Session -Nhttp://www.xmethods.net/sd/BabelFishService.wsdl=org.jboss.test.net.external.babelfish ${source.resources}/external/wsr/META-INF/babelfish.wsdl"/> 
	<classpath refid="apache.axis.generate.classpath"/>
    </java>

    <!-- call wsdl4j emitter -->
    <java dir="${build.gen-src}" fork="yes" failOnError="true" className="org.apache.axis.wsdl.WSDL2Java">
        <arg line="-d Session -Nurn:GoogleSearch=org.jboss.test.net.external.google ${source.resources}/external/wsr/META-INF/google.wsdl"/> 
	<classpath refid="apache.axis.generate.classpath"/>
    </java>

    <!-- remove the empty service impl -->
    <delete file="${build.gen-src}/samples/addr/AddressBookSOAPBindingImpl.java"/>

	<taskdef name="webservicedoclet" classname="xdoclet.modules.ejb.EjbDocletTask" classpathref="xdoclet.classpath"/>

    <webservicedoclet destdir="${build.gen-src}"
	     ejbspec="2.0"
	     excludedtags="@version,@author">
      <fileset dir="${source.java}">
        <include name="org/jboss/test/net/hello/server/Hello*Bean.java"/>
        <include name="org/jboss/test/net/hello/HelloData.java"/>
      </fileset>
      <entitycmp cmpspec="2.x"/>
      <remoteinterface/>
      <homeinterface/>
      <deploymentdescriptor xmlencoding ="UTF-8"
         destdir="${build.resources}/hello/ejb/META-INF"/>
      <jboss xmlencoding="UTF-8"
         version="3.0"
         destdir="${build.resources}/hello/ejb/META-INF"/>
      <jbossnet webDeploymentName="Hello" 
      	prefix="hello" 
      	destdir="${build.resources}/hello/wsr/META-INF" 
      	targetNameSpace="http://net.jboss.org/hello" />
    </webservicedoclet>
    	
    <webservicedoclet destdir="${build.gen-src}"
	     ejbspec="2.0"
	     excludedtags="@version,@author">
      <fileset dir="${source.java}">
        <include name="org/jboss/test/net/state/server/*Bean.java"/>
      </fileset>
      <entitycmp cmpspec="2.x"/>
      <remoteinterface/>
      <homeinterface/>
      <deploymentdescriptor xmlencoding ="UTF-8"
         destdir="${build.resources}/state/ejb/META-INF"/>
      <jboss xmlencoding="UTF-8"
         version="3.0"
         destdir="${build.resources}/state/ejb/META-INF"/>
      <jbossnet webDeploymentName="State" 
      	prefix="state" 
      	destdir="${build.resources}/state/wsr/META-INF" 
      	targetNameSpace="http://net.jboss.org/state" />
    </webservicedoclet>

    <webservicedoclet destdir="${build.gen-src}"
	     ejbspec="2.0"
	     excludedtags="@version,@author">
      <fileset dir="${source.java}">
        <include name="org/jboss/test/net/security/server/*Bean.java"/>
      </fileset>
      <entitycmp cmpspec="2.x"/>
      <remoteinterface/>
      <homeinterface/>
      <deploymentdescriptor xmlencoding ="UTF-8"
         destdir="${build.resources}/security/ejb/META-INF"/>
      <jboss xmlencoding="UTF-8"
         version="3.0"
	     securitydomain="java:/jaas/other"
         destdir="${build.resources}/security/ejb/META-INF"/>
      <jbossnet webDeploymentName="Security" 
      	prefix="security" 
      	destdir="${build.resources}/security/wsr/META-INF" 
      	targetNameSpace="http://net.jboss.org/security" />
    </webservicedoclet>

    <mkdir dir="${build.classes}"/>

    <javac destdir="${build.classes}"
           optimize="${javac.optimize}"
	   target="${javac.target}"
           debug="${javac.debug}"
	   depend="${javac.depend}"
	   verbose="${javac.verbose}"
	   deprecation="${javac.deprecation}"
	   includeAntRuntime="${javac.include.ant.runtime}"
	   includeJavaRuntime="${javac.include.java.runtime}"
	   failonerror="${javac.fail.onerror}">
       <src path="${source.java}"/>
       <src path="${build.gen-src}"/>
       <classpath refid="javac.classpath"/>
       <include name="${javac.includes}"/>
       <exclude name="${javac.excludes}"/>
    </javac>
  </target>

  <!-- Compile resource files -->
  <target name="compile-resources" depends="init">
    <mkdir dir="${build.resources}"/>
    <copy todir="${build.resources}" filtering="no">
      <fileset dir="${source.resources}">
         <include name="**/*"/>
      </fileset>
    </copy>

  </target>

  <!-- Compile stylesheets files -->
  <target name="compile-stylesheets" depends="init">
    <mkdir dir="${build.stylesheets}"/>
    <copy todir="${build.stylesheets}" filtering="yes">
      <fileset dir="${source.stylesheets}">
         <include name="**/*"/>
      </fileset>
    </copy>
  </target>

  <!-- Compile etc files (manifests and such) -->
  <target name="compile-etc" depends="init">
    <mkdir dir="${build.etc}"/>
    <copy todir="${build.etc}" filtering="yes">
      <fileset dir="${source.etc}">
         <include name="**/*"/>
      </fileset>
    </copy>
  </target>

  <!-- Compile bin scripts -->
  <target name="compile-bin" depends="init">
    <mkdir dir="${build.bin}"/>
    <copy todir="${build.bin}" filtering="yes">
      <fileset dir="${source.bin}">
         <include name="**/*"/>
      </fileset>
    </copy>

    <fixcrlf srcdir="${build.bin}"
	     eol="lf" eof="remove"
	     includes="**/*.sh"/>

    <fixcrlf srcdir="${build.bin}" 
	     eol="crlf" eof="remove"
	     includes="**/*.bat, **/*.cmd"/>

    <chmod perm="+x">
      <fileset dir="${build.bin}">
         <include name="**/*.sh"/>
      </fileset>
    </chmod>
  </target>


  <!--+====================================================================+-->
  <!--| Generate Output                                                    |-->
  <!--|                                                                    |-->
  <!--| Generates the target output for this module. Target output is      |-->
  <!--| the output which is ment to be released or used by external        |-->
  <!--| modules.                                                           |-->
  <!--+====================================================================+-->

  <target name="output"
          description="Generate all target output."
          depends="compile">
                   
     <parallel>
       <call target="_jars-hello"/>
       <call target="_jars-state"/>
       <call target="_jars-security"/>
       <call target="_jars-addr"/>
       <call target="_jars-jmx"/>
       <call target="_jars-axis"/>
       <call target="_jars-jmx-test"/>
       <call target="_jars-store"/>
       <call target="_jars-external"/>
     </parallel>
  </target>

  <!--
     | These targets are meant to be invoked from the 'jars' target.  They
     | do not depend on 'compile' to avoid recursing over those tasks over
     | and over.
     |
     | If you really want to run these outside of 'jars', then besure that
     | the 'compile' targets has be run or you are bound to run into lots of
     | errors.
   -->

  <patternset id="common.test.client.classes">
    <include name="org/jboss/test/util/**"/>
  </patternset>

  <patternset id="common.test.application.classes">
    <include name="org/jboss/test/util/ejb/**"/>
  </patternset>

  <!-- addr test -->
  <target name="_jars-addr">

    <mkdir dir="${build.lib}"/>

    <mkdir dir="${build.resources}/addr/wsr/META-INF"/>

    <copy toFile="${build.resources}/addr/wsr/META-INF/web-service.xml" 
	file="${build.gen-src}/samples/addr/deploy.wsdd"/>
 
    <jar jarfile="${build.lib}/addr.wsr">
      <fileset dir="${build.classes}">
        <include name="samples/**/*.class"/>
      </fileset>
      <fileset dir="${build.resources}/addr/wsr/">
        <include name="**/*"/>
      </fileset>
    </jar>

    <jar jarfile="${build.lib}/addrtest.jar">
      <fileset dir="${build.classes}">
        <include name="samples/**/*.class"/>
	<exclude name="samples/addr/AddressBookSOAPBindingImpl.class"/>
	<exclude name="samples/addr/AddressBookSOAPBindingSkeleton.class"/>
      </fileset>
      <fileset dir="${build.classes}">
        <include name="**/test/net/addr/**/*.class"/>
	<exclude name="**/server/**"/>
      </fileset>
    </jar>

  </target>
  
  <!-- jmx access test -->
  <target name="_jars-jmx-test">
   
    <jar jarFile="${build.lib}/jmx.wsr">
      <fileset dir="${build.resources}/jmx/wsr">
        <include name="**/*"/>
      </fileset>
    </jar>
        
    <jar jarFile="${build.lib}/jmx-test.sar">
      <fileset dir="${build.lib}">
        <include name="jmx.wsr"/>
      </fileset>
      <fileset dir="${build.resources}/jmx/sar/">
        <include name="**/*"/>
      </fileset>
      <fileset dir="${build.classes}">
        <include name="**/test/net/jmx/**"/>
      </fileset>
    </jar>
  </target>


  <!-- hello test -->
  <target name="_jars-hello">

    <mkdir dir="${build.lib}"/>

    <jar jarFile="${build.lib}/hello.wsr">
      <fileset dir="${build.resources}/hello/wsr">
        <include name="**/*"/>
      </fileset>
     </jar>
   
     <jar jarFile="${build.lib}/hellotest.jar">
 	 <fileset dir="${build.classes}">
        	<include name="**/test/net/hello/**"/>
			<exclude name="**/server/**"/>
     </fileset>
      </jar>

    <!-- build hello.jar -->
    <jar jarfile="${build.lib}/hello.jar">
      <fileset dir="${jboss.test.root}/classes">
        <include name="**/test/util/**"/>
      </fileset>
      <fileset dir="${build.classes}">
        <include name="**/test/net/hello/**"/>
        <exclude name="**/Test.*"/>
      </fileset>
      <fileset dir="${build.resources}/hello/ejb/">
        <include name="**/*.xml"/>
      </fileset>
    </jar>

    <jar jarFile="${build.lib}/hello.ear">
 	 <fileset dir="${build.lib}">
        <include name="hello.wsr"/>
        </fileset>
 	 <fileset dir="${build.lib}">
        <include name="hello.jar"/>
        </fileset>
      <fileset dir="${build.resources}/hello/ear">
        <include name="**/*"/>
      </fileset>
     </jar>

  </target>

  <!-- state test -->
  <target name="_jars-state">

    <mkdir dir="${build.lib}"/>

    <jar jarFile="${build.lib}/state.wsr">
      <fileset dir="${build.resources}/state/wsr">
        <include name="**/*"/>
      </fileset>
     </jar>
   
     <jar jarFile="${build.lib}/statetest.jar">
 	 <fileset dir="${build.classes}">
        	<include name="**/test/net/state/**"/>
			<exclude name="**/server/**"/>
     </fileset>
      </jar>

    <!-- build sttae.jar -->
    <jar jarfile="${build.lib}/state.jar">
      <fileset dir="${jboss.test.root}/classes">
        <include name="**/test/util/**"/>
      </fileset>
      <fileset dir="${build.classes}">
        <include name="**/test/net/state/**"/>
        <exclude name="**/Test.*"/>
      </fileset>
      <fileset dir="${build.resources}/state/ejb/">
        <include name="**/*.xml"/>
      </fileset>
    </jar>

    <jar jarFile="${build.lib}/state.ear">
 	 <fileset dir="${build.lib}">
        <include name="state.wsr"/>
        </fileset>
 	 <fileset dir="${build.lib}">
        <include name="state.jar"/>
        </fileset>
      <fileset dir="${build.resources}/state/ear">
        <include name="**/*"/>
      </fileset>
     </jar>

  </target>

  <!-- security test -->
  <target name="_jars-security">

    <mkdir dir="${build.lib}"/>

    <jar jarFile="${build.lib}/security.wsr">
      <fileset dir="${build.resources}/security/wsr">
        <include name="**/*"/>
      </fileset>
     </jar>
   
     <jar jarFile="${build.lib}/securitytest.jar">
 	 <fileset dir="${build.classes}">
        	<include name="**/test/net/security/**"/>
			<exclude name="**/server/**"/>
     </fileset>
      </jar>

    <!-- build sec.jar -->
    <jar jarfile="${build.lib}/security.jar">
      <fileset dir="${jboss.test.root}/classes">
        <include name="**/test/util/**"/>
      </fileset>
      <fileset dir="${build.classes}">
        <include name="**/test/net/security/**"/>
        <exclude name="**/Test.*"/>
      </fileset>
      <fileset dir="${build.resources}/security/ejb/">
        <include name="**/*.xml"/>
      </fileset>
    </jar>

    <jar jarFile="${build.lib}/security.ear">
 	 <fileset dir="${build.lib}">
        <include name="security.wsr"/>
        </fileset>
 	 <fileset dir="${build.lib}">
        <include name="security.jar"/>
        </fileset>
      <fileset dir="${build.resources}/security/ear">
        <include name="**/*"/>
      </fileset>
     </jar>

  </target>

  <!-- store sample -->
  <target name="_jars-store">

    <mkdir dir="${build.lib}"/>

     <jar jarFile="${build.lib}/store.wsr">
 		<fileset dir="${build.classes}">
        	<include name="**/samples/store/server/**"/>
            <exclude name="**/*Test*"/>
        </fileset>
        <fileset dir="${build.resources}/store/wsr">
         <include name="**/*"/>
        </fileset>
     </jar>
   
     <jar jarFile="${build.lib}/storetest.jar">
 		<fileset dir="${build.classes}">
        	<include name="**/store/**"/>
			<exclude name="**/server/**"/>
        </fileset>
     </jar>

    <!-- build store.jar -->
    <jar jarfile="${build.lib}/store.jar">
      <fileset dir="${build.classes}">
        <include name="**/samples/store/**"/>
		<exclude name="**/*Test*"/>
      </fileset>
      <fileset dir="${build.resources}/store/jar/">
        <include name="**/*.xml"/>
      </fileset>
    </jar>

     <jar jarFile="${build.lib}/store.ear">
 	<fileset dir="${build.lib}">
        <include name="store.wsr"/>
        </fileset>
 	<fileset dir="${build.lib}">
        <include name="store.jar"/>
        </fileset>
      <fileset dir="${build.resources}/store/ear">
        <include name="**/*"/>
      </fileset>
     </jar>

  </target>

  <!-- addr test -->
  <target name="_jars-external">

    <mkdir dir="${build.lib}"/>

    <mkdir dir="${build.resources}/external/wsr/META-INF"/>

    <copy toFile="${build.resources}/external/wsr/META-INF/web-service.xml" 
	file="${source.resources}/external/wsr/META-INF/web-service.xml"/>
 
    <jar jarfile="${build.lib}/external.wsr">
      <fileset dir="${build.classes}">
        <include name="org/jboss/test/net/external/google/*.class"/>
        <include name="org/jboss/test/net/external/babelfish/*.class"/>
      </fileset>
      <fileset dir="${build.resources}/external/wsr/">
        <include name="**/*"/>
      </fileset>
    </jar>

    <jar jarfile="${build.lib}/external.jar">
      <fileset dir="${build.classes}">
        <include name="org/jboss/test/net/external/**/*.class"/>
	<exclude name="org/jboss/test/net/external/google/**/*.class"/>
	<exclude name="org/jboss/test/net/external/babelfish/**/*.class"/>
	<exclude name="**/*Test*"/>
      </fileset>
      <fileset dir="${build.resources}/external/jar/">
        <include name="**/*"/>
      </fileset>
    </jar>

    <jar jarfile="${build.lib}/external.ear">
 	<fileset dir="${build.lib}">
        <include name="external.wsr"/>
        </fileset>
 	<fileset dir="${build.lib}">
        <include name="external.jar"/>
        </fileset>
      <fileset dir="${build.resources}/external/ear">
        <include name="**/*"/>
      </fileset>
    </jar>

    <jar jarfile="${build.lib}/externaltest.jar">
 	<fileset dir="${build.classes}">
        <include name="**/external/**"/>
		<exclude name="**/server/**"/>
        </fileset>
    </jar>

  </target>

  <!-- axis test -->
  <target name="_jars-axis">

    <mkdir dir="${build.lib}"/>

     <jar jarFile="${build.lib}/axistest.jar">
 	<fileset dir="${build.classes}">
        	<include name="**/test/net/axis/**"/>
		<exclude name="**/server/**"/>
        </fileset>
      </jar>

  </target>

  <!-- jmx test -->
  <target name="_jars-jmx">

    <mkdir dir="${build.lib}"/>

     <jar jarFile="${build.lib}/jmxtest.jar">
 	<fileset dir="${build.classes}">
        	<include name="**/test/net/jmx/**"/>
		<exclude name="**/server/**"/>
        </fileset>
     </jar>

  </target>

  <!-- ================================================================== -->
  <!-- Documents                                                          -->
  <!-- ================================================================== -->

  <!-- 
     | Create all generated documenation.
     |
     | This target should depend on other docs-* targets for each 
     | different type of docuementation that is to be generated.
   -->

  <target name="docs" description="Builds all documentation."
	  depends="init, docs-api">
  </target>


  <!-- ================================================================== -->
  <!-- Install                                                            -->
  <!-- ================================================================== -->

  <target name="install" depends="all">
    <!-- Copy the output directory to the install directory -->
    <mkdir dir="${install.root}"/>
    <copy todir="${install.root}" filtering="no">
      <fileset dir="${module.local.output}">
         <include name="**/*"/>
         <exclude name="${install.id}/**"/>
      </fileset>
    </copy>
  </target>


  <!-- ================================================================== -->
  <!-- Release                                                            -->
  <!-- ================================================================== -->

  <!-- 
     | Builds a release distribution.
   -->

  <target name="release" depends="install">
    <!-- install handles most of the work -->
  </target>

  

  <!-- ================================================================== -->
  <!-- Tests                                                              -->
  <!-- ================================================================== -->

  <!--
     | Run all tests.
   -->

  <target name="maybejars" depends="init" unless="nojars">

    <echo><![CDATA[
junit.timeout:              ${junit.timeout}
jbosstest.iterationcount:   ${jbosstest.iterationcount}
jbosstest.threadcount:      ${jbosstest.threadcount}
jbosstest.beancount:        ${jbosstest.beancount}
marathon.timeout:           ${marathon.timeout}
marathon.duration:          ${marathon.duration}
marathon.threadcount:       ${marathon.threadcount}
]]></echo>

    <call target="output"/>
  </target>

  <!--
     | Run all tests.
   -->

  <target name="tests" description="Execute all tests."
    depends="init, 
             tests-standard-unit, 
             tests-client-unit, 
             tests-security-basic-unit, 
             tests-standard-stress, 
             tests-client-stress, 
             tests-security-basic-stress, 
             tests-report">
  </target>


  <target name="tests-unit" description="Execute all unit tests."
    depends="init, 
             tests-standard-unit, 
             tests-client-unit, 
             tests-security-basic-unit, 
             tests-report"/>
  
  <target name="tests-stress" description="Execute all stress tests."
    depends="init, 
             tests-standard-stress, 
             tests-client-stress, 
             tests-security-basic-stress, 
             tests-report"/>
  
  <!-- 
     | Standard tests that should run successfully against a default JBoss
     | server distribution build.
   -->

  <target name="tests-standard-unit" depends="maybejars">
    <mkdir dir="${build.reports}"/>
    <mkdir dir="${build.testlog}"/>

	<echo message="${jboss.net.etc}"/>

        <junit dir="${module.local.output}"
	   printsummary="${junit.printsummary}" 
	   haltonerror="${junit.haltonerror}" 
	   haltonfailure="${junit.haltonfailure}" 
	   fork="${junit.fork}"
	   timeout="${junit.timeout}"
	   jvm="${junit.jvm}">

      <jvmarg line="${junit.jvm.options}"/>
      <sysproperty key="jbosstest.deploy.dir" file="${build.lib}"/>
      <sysproperty key="log4j.properties" file="${build.resources}/log4j.properties"/>

      <classpath>
        <pathelement location="${build.classes}"/>
        <pathelement location="${build.resources}"/>
        <pathelement location="${jboss.net.etc}/"/>
        <path refid="javac.classpath"/>
        <path refid="ibm.uddi4j.classpath"/>
      </classpath>

      <formatter type="${junit.formatter.type}"
		 usefile="${junit.formatter.usefile}"/>

      <batchtest todir="${build.reports}"
		 haltonerror="${junit.batchtest.haltonerror}" 
		 haltonfailure="${junit.batchtest.haltonfailure}" 
		 fork="${junit.batchtest.fork}">

        <fileset dir="${build.classes}">
          <include name="**/*UnitTestCase.class"/>
        </fileset>
      </batchtest>
    </junit>
  </target>

  <target name="tests-standard-stress" depends="maybejars">

    <mkdir dir="${build.reports}"/>
    <mkdir dir="${build.testlog}"/>
    <junit dir="${module.local.output}"
	   printsummary="${junit.printsummary}" 
	   haltonerror="${junit.haltonerror}" 
	   haltonfailure="${junit.haltonfailure}" 
	   fork="${junit.fork}"
	   timeout="${junit.timeout}"
	   jvm="${junit.jvm}">

      <jvmarg value="${junit.jvm.options}"/>
      <sysproperty key="jbosstest.deploy.dir" file="${build.lib}"/>
      <sysproperty key="log4j.properties" file="${build.resources}/log4j.properties"/>
      <sysproperty key="jbosstest.threadcount" value="${jbosstest.threadcount}"/>
      <sysproperty key="jbosstest.iterationcount" value="${jbosstest.iterationcount}"/>
      <sysproperty key="jbosstest.beancount" value="${jbosstest.beancount}"/>

      <classpath>
        <pathelement location="${build.classes}"/>
        <pathelement location="${build.resources}"/>
        <path refid="javac.classpath"/>
      </classpath>

      <formatter type="${junit.formatter.type}"
		 usefile="${junit.formatter.usefile}"/>

      <batchtest todir="${build.reports}"
		 haltonerror="${junit.batchtest.haltonerror}" 
		 haltonfailure="${junit.batchtest.haltonfailure}" 
		 fork="${junit.batchtest.fork}">

        <fileset dir="${build.classes}">
          <include name="**/*StressTestCase.class"/>

          <!-- do not include the perf or security tests -->
          <!--mq test seems to break things-->
          <exclude name="**/JBossMQPerfStressTestCase.class"/>
          <exclude name="**/test/perf/test/SecurePerfStressTestCase.class"/>
          <exclude name="**/test/security/test/*"/>
        </fileset>
      </batchtest>
    </junit>
  </target>

  <!-- 
     | Tests that need to be run by loading the testcase code from a client
     | jar rather than the build.classes.dir. Typically these tests need to
     | control how classes are loaded.
   -->

  <target name="tests-client-unit" depends="maybejars">
    <mkdir dir="${build.reports}"/>
    <mkdir dir="${build.testlog}"/>


    <junit dir="${module.local.output}"
	   printsummary="${junit.printsummary}" 
	   haltonerror="${junit.haltonerror}" 
	   haltonfailure="${junit.haltonfailure}" 
	   fork="${junit.fork}"
	   timeout="${junit.timeout}"
	   jvm="${junit.jvm}">

      <jvmarg value="${junit.jvm.options}"/>
      <sysproperty key="jbosstest.deploy.dir" file="${build.lib}"/>
      <sysproperty key="log4j.properties" file="${build.resources}/log4j.properties"/>

      <jvmarg value="-Djava.security.manager"/>
      <sysproperty key="java.security.policy"
		   value="${build.resources}/security/tst.policy"/>
      <sysproperty key="java.security.auth.login.config"
                   value="${build.resources}/security/auth.conf"/>
       
      <classpath>
        <pathelement path="${build.lib}/jrmp-dl-client.jar"/>
        <pathelement location="${build.resources}"/>
        <path refid="javac.classpath"/>
      </classpath>

      <formatter type="${junit.formatter.type}"
		 usefile="${junit.formatter.usefile}"/>

      <batchtest todir="${build.reports}"
		 haltonerror="${junit.batchtest.haltonerror}" 
		 haltonfailure="${junit.batchtest.haltonfailure}" 
		 fork="${junit.batchtest.fork}">

        <fileset dir="${build.classes}">
          <include name="**/test/jrmp/test/DynLoadingUnitTestCase.class"/>
        </fileset>
      </batchtest>
    </junit>
  </target>

  <target name="tests-client-stress" depends="maybejars">
    <mkdir dir="${build.reports}"/>
    <mkdir dir="${build.testlog}"/>
    <junit dir="${module.local.output}"
	   printsummary="${junit.printsummary}" 
	   haltonerror="${junit.haltonerror}" 
	   haltonfailure="${junit.haltonfailure}" 
	   fork="${junit.fork}"
	   timeout="${junit.timeout}"
	   jvm="${junit.jvm}">

      <jvmarg value="${junit.jvm.options}"/>
      <sysproperty key="jbosstest.deploy.dir" file="${build.lib}"/>

      <jvmarg value="-Djava.security.manager"/>
      <sysproperty key="java.security.policy"
		   value="${build.resources}/security/tst.policy"/>
      <sysproperty key="java.security.auth.login.config"
                   value="${build.resources}/security/auth.conf"/>
      <sysproperty key="log4j.properties" file="${build.resources}/log4j.properties"/>
      <sysproperty key="jbosstest.threadcount" value="${jbosstest.threadcount}"/>
      <sysproperty key="jbosstest.iterationcount" value="${jbosstest.iterationcount}"/>
      <sysproperty key="jbosstest.beancount" value="${jbosstest.beancount}"/>

       
      <classpath>
        <pathelement path="${build.lib}/jrmp-dl-client.jar"/>
        <pathelement location="${build.resources}"/>
        <path refid="javac.classpath"/>
      </classpath>

      <formatter type="${junit.formatter.type}"
		 usefile="${junit.formatter.usefile}"/>

      <batchtest todir="${build.reports}"
		 haltonerror="${junit.batchtest.haltonerror}" 
		 haltonfailure="${junit.batchtest.haltonfailure}" 
		 fork="${junit.batchtest.fork}">

        <fileset dir="${build.classes}">
          <!--there aren't any of these - included for symmetry-->
          <exclude name="**/*"/>
        </fileset>
      </batchtest>
    </junit>
  </target>

  <!-- 
     | Standard security tests that should run successfully against a default
     | JBoss server distribution build.
   -->

  <target name="tests-security-basic-unit" depends="maybejars">
    <mkdir dir="${build.reports}"/>
    <mkdir dir="${build.testlog}"/>
    <junit dir="${module.local.output}"
	   printsummary="${junit.printsummary}" 
	   haltonerror="${junit.haltonerror}" 
	   haltonfailure="${junit.haltonfailure}" 
	   fork="${junit.fork}"
	   timeout="${junit.timeout}"
	   jvm="${junit.jvm}">

      <jvmarg value="${junit.jvm.options}"/>
      <sysproperty key="jbosstest.deploy.dir" file="${build.lib}"/>

      <jvmarg value="-Djava.security.manager"/>
      <jvmarg value="-Dsecurity.domain=test-domain"/>
      <sysproperty key="java.security.policy"
		   value="${build.resources}/security/tst.policy"/>
      <sysproperty key="java.security.auth.login.config"
                   value="${build.resources}/security/auth.conf"/>
      <sysproperty key="log4j.properties" file="${build.resources}/log4j.properties"/>
       
      <classpath>
        <pathelement location="${build.classes}"/>
        <pathelement location="${build.resources}/security"/>
        <pathelement location="${build.resources}"/>
        <path refid="javac.classpath"/>
      </classpath>

      <formatter type="${junit.formatter.type}"
		 usefile="${junit.formatter.usefile}"/>

      <batchtest todir="${build.reports}"
		 haltonerror="${junit.batchtest.haltonerror}" 
		 haltonfailure="${junit.batchtest.haltonfailure}" 
		 fork="${junit.batchtest.fork}">

        <fileset dir="${build.classes}">
          <include name="**/test/security/test/LoginContextUnitTestCase.class"/>
          <include name="**/test/security/test/NamespacePermissionsUnitTestCase.class"/>
          <include name="**/test/security/test/PermissionNameUnitTestCase.class"/>
          <include name="**/test/security/test/EJBSpecUnitTestCase.class"/>
        </fileset>
      </batchtest>
    </junit>
  </target>


  <target name="tests-security-basic-stress" depends="maybejars">
    <mkdir dir="${build.reports}"/>
    <mkdir dir="${build.testlog}"/>
    <junit dir="${module.local.output}"
	   printsummary="${junit.printsummary}" 
	   haltonerror="${junit.haltonerror}" 
	   haltonfailure="${junit.haltonfailure}" 
	   fork="${junit.fork}"
	   timeout="${junit.timeout}"
	   jvm="${junit.jvm}">

      <jvmarg value="${junit.jvm.options}"/>
      <sysproperty key="jbosstest.deploy.dir" file="${build.lib}"/>

      <jvmarg value="-Djava.security.manager"/>
      <sysproperty key="java.security.policy"
		   value="${build.resources}/security/tst.policy"/>
      <sysproperty key="java.security.auth.login.config"
                   value="${build.resources}/security/auth.conf"/>
      <sysproperty key="log4j.properties" file="${build.resources}/log4j.properties"/>
      <sysproperty key="jbosstest.threadcount" value="${jbosstest.threadcount}"/>
      <sysproperty key="jbosstest.iterationcount" value="${jbosstest.iterationcount}"/>
      <sysproperty key="jbosstest.beancount" value="${jbosstest.beancount}"/>

       
      <classpath>
        <pathelement location="${build.classes}"/>
        <pathelement location="${build.resources}/security"/>
        <pathelement location="${build.resources}"/>
        <path refid="javac.classpath"/>
      </classpath>

      <formatter type="${junit.formatter.type}"
		 usefile="${junit.formatter.usefile}"/>

      <batchtest todir="${build.reports}"
		 haltonerror="${junit.batchtest.haltonerror}" 
		 haltonfailure="${junit.batchtest.haltonfailure}" 
		 fork="${junit.batchtest.fork}">

        <fileset dir="${build.classes}">
          <include name="**/test/perf/test/SecurePerfStressTestCase.class"/>
          <include name="**/test/security/test/*StressTestCase.class"/>
        </fileset>
      </batchtest>
    </junit>
  </target>


  <!--
     | Run testcases in a single directory by specifing the test directory
     | name in -Dtest=dirname in tests/dirname/test/**TestCase.class
   -->

  <target name="test" depends="maybejars" if="test"
	  description="Execute a single test.">
    <mkdir dir="${build.reports}"/>
    <mkdir dir="${build.testlog}"/>
    <junit dir="${module.local.output}"
	   printsummary="${junit.printsummary}" 
	   haltonerror="${junit.haltonerror}" 
	   haltonfailure="${junit.haltonfailure}" 
	   fork="${junit.fork}"
	   timeout="${junit.timeout}"
	   jvm="${junit.jvm}">

      <jvmarg value="${junit.jvm.options}"/>
      <sysproperty key="jbosstest.deploy.dir" file="${build.lib}"/>
      <sysproperty key="log4j.properties" file="${build.resources}/log4j.properties"/>
      <sysproperty key="jbosstest.threadcount" value="${jbosstest.threadcount}"/>
      <sysproperty key="jbosstest.iterationcount" value="${jbosstest.iterationcount}"/>
      <sysproperty key="jbosstest.beancount" value="${jbosstest.beancount}"/>


      <classpath>
        <pathelement location="${build.classes}"/>
        <pathelement location="${build.resources}"/>
        <path refid="javac.classpath"/>
      </classpath>

      <formatter type="${junit.formatter.type}"
		 usefile="${junit.formatter.usefile}"/>

      <batchtest todir="${build.reports}"
		 haltonerror="${junit.batchtest.haltonerror}" 
		 haltonfailure="${junit.batchtest.haltonfailure}" 
		 fork="${junit.batchtest.fork}">

        <fileset dir="${build.classes}">
          <include name="org/jboss/test/${test}/*/*TestCase.class"/>
        </fileset>
      </batchtest>
    </junit>
  </target>

  <!--
     | Run a single testcase by specifing the test name in -Dtest=
     | Here you specify the testcase class, not the directory
   -->

  <target name="one-test" depends="maybejars" if="test"
	  description="Execute a single test.">
    <mkdir dir="${build.reports}"/>
    <mkdir dir="${build.testlog}"/>
    <junit dir="${module.local.output}"
	   printsummary="${junit.printsummary}" 
	   haltonerror="${junit.haltonerror}" 
	   haltonfailure="${junit.haltonfailure}" 
	   fork="${junit.fork}"
	   timeout="${junit.timeout}"
	   jvm="${junit.jvm}">

      <jvmarg value="${junit.jvm.options}"/>
      <sysproperty key="jbosstest.deploy.dir" file="${build.lib}"/>
      <sysproperty key="log4j.properties" file="${build.resources}/log4j.properties"/>
      <sysproperty key="jbosstest.threadcount" value="${jbosstest.threadcount}"/>
      <sysproperty key="jbosstest.iterationcount" value="${jbosstest.iterationcount}"/>
      <sysproperty key="jbosstest.beancount" value="${jbosstest.beancount}"/>


      <classpath>
        <pathelement location="${build.classes}"/>
        <pathelement location="${build.resources}"/>
        <path refid="javac.classpath"/>
      </classpath>

      <formatter type="${junit.formatter.type}"
		 usefile="${junit.formatter.usefile}"/>

      <batchtest todir="${build.reports}"
		 haltonerror="${junit.batchtest.haltonerror}" 
		 haltonfailure="${junit.batchtest.haltonfailure}" 
		 fork="${junit.batchtest.fork}">

        <fileset dir="${build.classes}">
          <include name="org/jboss/test/*/test/${test}.class"/>
          <include name="org/jboss/test/*/perf/${test}.class"/>
        </fileset>
      </batchtest>
    </junit>
  </target>


  <!-- 
     | Generates reports from JUnit output.
   -->

  <target name="reports" depends="tests-report" 
	  description="Generates all reports."/>

  <target name="tests-report" depends="tests-report-html, tests-report-text"/>

  <target name="tests-report-html" depends="compile">
    <mkdir dir="${build.reports}/html"/>

    <junitreport todir="${build.reports}">
      <fileset dir="${build.reports}">
        <include name="TEST-*.xml"/>
      </fileset>
      <report format="frames" 
              todir="${build.reports}/html"
              styledir="${build.stylesheets}"
      />
    </junitreport>
  </target>

  <!-- 
     | this currently spews logs of VariableReference crap, so it is turned
     | off by default.  Once this is fixed, it should be built after
     | tests-report-html
   -->

  <target name="tests-report-text" depends="tests-report-html">
    <mkdir dir="${build.reports}/text"/>

    <tstamp>
       <format property="TIMENOW" pattern="d MMMM yyyy H:m"/>
    </tstamp>

    <style basedir="${build.reports}"
	   destdir="${build.reports}/text"
	   extension=".txt"
	   style="${build.stylesheets}/summary1a.xsl"
	   includes="TESTS-TestSuites.xml">
       <param name="thedate" expression="${TIMENOW}"/>
       <param name="java_version" expression="${java.version}"/>
       <param name="java_vendor" expression="${java.vendor}"/>
       <param name="java_vm_specification_version" expression="${java.vm.specification.version}"/>
       <param name="java_vm_version" expression="${java.vm.version}"/>
       <param name="java_vm_name" expression="${java.vm.name}"/>
       <param name="java_vm_info" expression="${java.vm.info}"/>
       <param name="java_specification_version" expression="${java.specification.version}"/>
       <param name="java_class_version" expression="${java.class.version}"/>
       <param name="os_name" expression="${os.name}"/>
       <param name="os_arch" expression="${os.arch}"/>
       <param name="os_version" expression="${os.version}"/>
    </style>
  </target>


  <!-- ================================================================== -->
  <!-- Cleaning                                                           -->
  <!-- ================================================================== -->

  <!-- Clean up all build output -->
  <target name="clean" depends="init"
	  description="Cleans up most generated files.">
    <delete dir="${module.local.output}"/>
  </target>

  <!-- Clean up all generated files -->
  <target name="clobber" depends="clean"
	  description="Cleans up all generated files.">
    <delete file="${module.root}/local.properties"/>
    <delete file="${module.root}/build.log"/>
  </target>


  <!-- ================================================================== -->
  <!-- Workspace                                                          -->
  <!-- ================================================================== -->

  <target name="update-project" depends="init">
    <echo>Updating project workspace...</echo>
    <cvs command="update -d" dest="${project.root.local}"/>
  </target>

  <target name="update-module" depends="init">
    <echo>Updating module workspace...</echo>
    <cvs command="update -d" dest="${module.root}"/>
  </target>


  <!-- ================================================================== -->
  <!-- Help                                                               -->
  <!-- ================================================================== -->

  <target name="help" depends="init">
    <projecthelp taskname="help">
      <header><![CDATA[
  The ${module.Name} module.
]]></header>
      <footer><![CDATA[
    -projecthelp for all targets
    -help for full options
]]></footer>
    </projecthelp>
  </target>


  <!-- ================================================================== -->
  <!-- Misc.                                                              -->
  <!-- ================================================================== -->

  <target name="main" depends="most"
	  description="Executes the default target (most)."/>
    
  <target name="all" depends="maybejars, docs"
	  description="Builds everything."/>

  <target name="most" depends="maybejars"
	  description="Builds almost everything."/>


</project>
