JavaGen JUnitEE Unit Testing

Public Targets

TargetDescription
setupshow ant settings
checkverify proper build settings
compilecompile source code
distpackage target and test distribution file(s)
cleandelete all non-source files
clean.builddelete temporary build files
clean.distdelete distribution files

Source: ejbtest-junitee.xml

				<?xml version="1.0" encoding="UTF-8"?>
<project name="ejbtest">
	<description>
  + ==\_/============J=A=V=A=G=E=N===A=N=T===M=O=D=U=L=E=S================= +
  +  \(_)/                                                                  +
  +  -(_)-              JavaGen JUnitEE Unit Testing                        +
  +  /(_)\                                                                  +
  + ======================================================================= +
  +    Copyright (c) 2002-2005 Outsource Cafe, Inc.  All rights reserved.   +
  + ======================================================================= +
  +
  + OUT OF DATE - NEEDS UPDATING - Oct 2003
  +
  + Supports EJB Integration tests using JUnitEE. 
  +
  + Targets: 
  +   itest     - runs cactus unit test(s) generating reports, no dependencies
  +   testcycle - builds, deploys, starts server (if not running), and tests
  +
  + Note: the 'it' prefix stands for integration tests.
  +
  + Prerequisites: props-global.xml, classpath.xml, appserver-?.xml, ejb.xml
  +
  + developer: RichardEasterling@OutsourceCafe.com
  + ======================================================================= +
  + 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.
  + =J=A=M===========================================J=A=V=A=G=E=N=.=C=O=M= +
	</description>
	<!-- FAIL FAIL -->
	<fail message="OUT OF DATE - NEEDS UPDATING - Oct 2003"></fail>
	<!-- FAIL FAIL -->
	<!-- ===================================================================== -->
	<!-- properties for both this module and the target test module -->
	<!-- ===================================================================== -->
	<property name="testtool.name" value="JUnitEE"></property>
	<property name="target.module.folder" location="${basedir}"></property>
	<property prefix="Test" file="${target.module.folder}/build.properties"></property>
	<property name="target.dist.dir" location="${target.module.folder}/${dist.folder}"></property>
	<property name="target.dist.name" value="${Test.module.name}${dist.ejb.suffix}.jar"></property>
	<property name="target.dist.file" location="${target.dist.dir}/${target.dist.name}"></property>
	<property name="dist.name" value="${Test.module.name}${dist.test.suffix}${dist.ejb.suffix}.ear"></property>
	<property name="dist.file" location="${dist.dir}/${dist.name}"></property>
	<property name="dist.jar.name" value="${Test.module.name}${dist.test.suffix}${dist.ejb.suffix}.jar"></property>
	<property name="dist.jar.file" location="${dist.dir}/${dist.jar.name}"></property>
	<!-- ===================================================================== -->
	<!-- classpaths -->
	<!-- ===================================================================== -->
	<path id="test.build.classpath">
		<path refid="build.classpath"></path>
		<pathelement location="${target.dist.file}"></pathelement>
		<pathelement location="${junit.jar}"></pathelement>
		<pathelement location="${junitee.jar}"></pathelement>
	</path>
	<path id="test.run.classpath">
		<pathelement location="${target.dist.file}"></pathelement>
		<pathelement location="${junit.jar}"></pathelement>
		<fileset dir="${junitee.dist.dir}" includes="*.jar"></fileset>
		<pathelement location="${build.classes.dir}"></pathelement>
	</path>
	<!-- ===================================================================== -->
	<!-- setup -->
	<!-- ===================================================================== -->
	<target name="setup" depends="" description="show ant settings">
		<echo message="+ ==\_/===============&lt;JavaGen&gt;===================== +"></echo>
		<echo message="+  \(_)/                                             +"></echo>
		<echo message="+  -(_)-         Unit Test Settings                  +"></echo>
		<echo message="+  /(_)\                                             +"></echo>
		<echo message="+ ================================================== +"></echo>
		<echo message="target.module.folder  = ${target.module.folder}"></echo>
		<echo message="test.module.name      = ${test.module.name}"></echo>
		<echo message="test.module.version   = ${test.module.version}"></echo>
		<echo message="target.dist.name      = ${target.dist.name}"></echo>
		<echo message="target.dist.dir       = ${target.dist.dir}"></echo>
		<echo message="dist.name             = ${dist.name}"></echo>
		<echo message="testtool.name         = ${testtool.name}"></echo>
		<echo message="javagen.version       = ${javagen.version}"></echo>
		<echo message="appserver.name        = ${appserver.name}"></echo>
		<echo message="appserver.version     = ${appserver.version}"></echo>
		<echo message="author                = ${author}"></echo>
		<echo message="user.home             = ${user.home}"></echo>
		<echo message="compiler.debug        = ${compiler.debug}"></echo>
		<echo message="java.home             = ${java.home}"></echo>
		<echo message="ant.home              = ${ant.home}"></echo>
		<echo message="xdoclet.home          = ${xdoclet.home}"></echo>
		<echo message="+ ================================================== +"></echo>
		<echo message="test.build.classpath  = ${test.build.classpath}"></echo>
		<echo message="+ ================================================== +"></echo>
		<echo message=""></echo>
	</target>
	<!-- ===================================================================== -->
	<!-- sanity checks -->
	<!-- ===================================================================== -->
	<target name="check" depends="check.appserver" description="verify proper build settings">
		<available property="jdk1.3+" classname="java.lang.StrictMath"></available>
	</target>
	<!-- ===================================================================== -->
	<!-- init -->
	<!-- ===================================================================== -->
	<target name="init" depends="">
		<mkdir dir="${src.java.dir}"></mkdir>
		<mkdir dir="${gen.java.dir}"></mkdir>
		<mkdir dir="${xdoclet.build.dir}"></mkdir>
		<mkdir dir="${src.resources.dir}"></mkdir>
		<mkdir dir="${build.classes.dir}"></mkdir>
	</target>
	<!-- =================================================================== -->
	<!-- creates unit tests war = JUnitEE -->
	<!-- =================================================================== -->
	<target name="gen" depends="init">
		<taskdef name="webdoclet" classname="xdoclet.modules.web.WebDocletTask" classpathref="xdoclet.classpath"></taskdef>
		<webdoclet destdir="${build.webinf.dir}" mergeDir="${src.merge.dir}">
			<fileset dir="${src.java.dir}" includes="**/*Servlet.java"></fileset>
			<fileset dir="${gen.java.dir}" includes="**/*Servlet.java"></fileset>
			<deploymentdescriptor servletspec="${servlet.spec.version}" distributable="false"></deploymentdescriptor>
		</webdoclet>
	</target>
	<!-- =================================================================== -->
	<!-- compiles the source code                                            -->
	<!-- =================================================================== -->
	<target name="compile" depends="gen" description="compile source code">
		<javac destdir="${build.classes.dir}" classpathref="test.build.classpath" debug="${compiler.debug}" deprecation="${compiler.deprecation}" optimize="${compiler.optimize}" compiler="${compiler.type}">
			<src path="${xdoclet.build.dir}"></src>
			<src path="${src.java.dir}"></src>
			<src path="${gen.java.dir}"></src>
		</javac>
		<copy todir="${build.class.dir}">
			<fileset dir="${src.resources.dir}" includes="**/*.properties"></fileset>
			<fileset dir="${src.java.dir}" includes="**/*.properties"></fileset>
			<fileset dir="${gen.java.dir}" includes="**/*.properties"></fileset>
			<fileset dir="${xdoclet.build.dir}" includes="**/*.properties"></fileset>
		</copy>
	</target>
	<!-- =================================================================== -->
	<!-- creates ear archive containing target and test distributions -->
	<!-- =================================================================== -->
	<target name="dist" depends="ear" description="package target and test distribution file(s)"></target>
	<target name="dist.target.file.exists">
		<available property="target.dist.file.found" file="${target.dist.file}" type="file"></available>
		<echo message="target.dist.file.found = ${target.dist.file.found}"></echo>
	</target>
	<target name="dist.target" depends="dist.target.file.exists" unless="target.dist.file.found">
		<ant dir="${target.module.folder}" antfile="build.xml" target="dist" inheritAll="false"></ant>
	</target>
	<property name="war.file" location="${dist.dir}/${module.name}${dist.ejb.suffix}.war"></property>
	<target name="war" depends="compile">
		<delete file="{war.file}"></delete>
		<mkdir dir="${dist.dir}"></mkdir>
		<taskdef name="juniteewar" classname="org.junitee.anttask.JUnitEEWarTask" classpathref="test.run.classpath"></taskdef>
		<!--webxml="${build.webinf.dir}/web.xml">-->
		<juniteewar destFile="${war.file}" webxml="${build.webinf.dir}/web.xml">
			<lib dir="${junitee.dist.dir}" includes="*.jar"></lib>
			<lib dir="${junit.dist.dir}" includes="junit*.jar"></lib>
			<webinf dir="${src.webinf.dir}" includes="*.xml"></webinf>
			<!--
			-->
			<classes dir="${build.classes.dir}" includes="**/*Test.class,*Servlet.class"></classes>
			<testcases dir="${build.classes.dir}" includes="**/*Test.class"></testcases>
		</juniteewar>
	</target>
	<target name="ear" depends="dist.target, war">
		<delete file="${dist.file}"></delete>
		<ear destfile="${dist.file}" appxml="${gen.metainf.dir}/application.xml">
			<fileset dir="${dist.dir}" includes="*.war,*.jar"></fileset>
			<fileset dir="${target.dist.dir}" includes="*.war,*.jar"></fileset>
		</ear>
		<!--   
		<delete file="${war.file}"/>
		-->
	</target>
	<!-- =================================================================== -->
	<!-- Clean targets -->
	<!-- =================================================================== -->
	<target name="clean" depends="clean.build, clean.dist" description="delete all non-source files"></target>
	<target name="clean.build" depends="" description="delete temporary build files">
		<delete dir="${build.dir}"></delete>
	</target>
	<target name="clean.dist" depends="" description="delete distribution files">
		<delete dir="${dist.dir}"></delete>
	</target>
</project>