JdbcMapper/system-controls/test/ejb/build.xml

312 lines
12 KiB
XML

<?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.
$Header:$
-->
<project name="Beehive/EJBControlDRT" default="test" basedir=".">
<property environment="os"/>
<property name="servlet.runtime" value="geronimo"/>
<import file="../../systemcontrols-imports.xml"/>
<import file="../../ant/geronimo-imports.xml"/>
<path id="test.classpath">
<path refid="controls.dependency.path"/>
<path refid="ejb.dependency.path"/>
<path refid="velocity.dependency.path"/>
<path refid="tools.dependency.path"/>
<pathelement location="${beehive.home}/system-controls/build/jars/beehive-ejb-control.jar"/>
</path>
<target name="clean">
<delete dir="build"/>
</target>
<target name="build">
<mkdir dir="build/classes"/>
<mkdir dir="build/testresults"/>
<javac srcdir="src/assemblyTests" destdir="build/classes" classpathref="test.classpath" debug="true"/>
<copy todir="build/classes">
<fileset dir="src/assemblyTests" includes="**/*.xml"/>
</copy>
</target>
<target name="run">
<junit printsummary="true"
fork="true"
haltonfailure="fail"
haltonerror="fail"
showOutput="true">
<sysproperty key="build.dir" value="build/"/>
<classpath>
<path refid="test.classpath"/>
<pathelement location="build/classes"/>
</classpath>
<formatter type="plain"/>
<batchtest fork="yes" todir="build/testresults">
<fileset dir="build/classes">
<include name="org/apache/beehive/test/controls/system/ejb/*Test.class"/>
</fileset>
</batchtest>
</junit>
</target>
<target name="test" depends="clean,build,run"/>
<!-- ***************************************************************** -->
<!-- CACTUS SETTINGS -->
<!-- ***************************************************************** -->
<property name="cactus.home" location="${os.CACTUS_HOME}"/>
<property name="geronimo.home" location="${os.GERONIMO_HOME}"/>
<property name="webapp.src.dir" location="src/webapp"/>
<property name="webapp.build.dir" location="build/webapp"/>
<property name="jars.dir" location="build/jars"/>
<property name="cactus.build.dir" location="build/cactus"/>
<property name="cactus.gen.dir" location="build/cactus-gen"/>
<property name="cactus.src.dir" location="src/tests"/>
<property name="controls.build.dir" location="build/controls"/>
<property name="controls.gen.dir" location="build/controls-gen"/>
<property name="controls.src.dir" location="src/controls"/>
<property name="ejbs.build.dir" location="build/ejbs"/>
<property name="ejbs.src.dir" location="src/ejbs"/>
<property name="cactus.log.dir" location="build/logs"/>
<property name="waitfor.url" value="http://localhost:8080/ejbTest"/>
<property name="target.module.id" value="testEjbs-cactified"/>
<!-- Libraries required for the ejb controls -->
<path id="controls.classpath">
<pathelement location="${ejbs.build.dir}"/>
<pathelement location="${beehive.home}/system-controls/build/jars/beehive-ejb-control.jar"/>
<path refid="controls.dependency.path"/>
<path refid="ejb.dependency.path"/>
<path refid="velocity.dependency.path"/>
<path refid="tools.dependency.path"/>
</path>
<!-- Libraries required for the Cactus tests (runtime) -->
<path id="cactus.classpath">
<pathelement location="${cactus.home}/lib/aspectjrt-1.2.1.jar"/>
<pathelement location="${cactus.home}/lib/cactus-1.7.1.jar"/>
<pathelement location="${cactus.home}/lib/cactus-ant-1.7.1.jar"/>
<pathelement location="${cactus.home}/lib/cargo-0.5.jar"/>
<pathelement location="${cactus.home}/lib/commons-httpclient-2.0.2.jar"/>
<pathelement location="${cactus.home}/lib/commons-logging-1.0.4.jar"/>
<pathelement location="${cactus.home}/lib/junit-3.8.1.jar"/>
</path>
<!-- Libraries required for the Cactus tests (build time) -->
<path id="cactus.build.classpath">
<pathelement location="${jars.dir}/testEjbs.jar"/>
<pathelement location="${jars.dir}/ejbControls.jar"/>
<path refid="controls.classpath"/>
<path refid="ejb.dependency.path"/>
<path refid="cactus.classpath"/>
</path>
<taskdef resource="cactus.tasks" classpathref="cactus.classpath"/>
<taskdef name="assemble.ejb.controls"
classname="org.apache.beehive.controls.runtime.assembly.AssembleTask"
classpathref="controls.classpath"
onerror="report"/>
<!-- create the directories necessary for the cactus build -->
<target name="init.dirs">
<mkdir dir="${ejbs.build.dir}"/>
<mkdir dir="${ejbs.build.dir}/META-INF"/>
<mkdir dir="${jars.dir}"/>
<mkdir dir="${controls.build.dir}"/>
<mkdir dir="${controls.gen.dir}"/>
<mkdir dir="${cactus.build.dir}"/>
<mkdir dir="${cactus.gen.dir}"/>
<mkdir dir="${cactus.log.dir}"/>
</target>
<!--
-->
<target name="compile.ejbs" description="Compile the ejbs for the cactus tests.">
<javac srcdir="${ejbs.src.dir}" destdir="${ejbs.build.dir}" classpathref="test.classpath" debug="true"/>
<copy todir="${ejbs.build.dir}/META-INF">
<fileset dir="${ejbs.src.dir}/META-INF">
<include name="**/*.xml"/>
</fileset>
</copy>
</target>
<!--
-->
<target name="build.controls" depends="compile.ejbs"
description="Build the ejb controls for the cactus tests.">
<build-controls srcdir="${controls.src.dir}"
destdir="${controls.build.dir}"
tempdir="${controls.gen.dir}"
classpathref="controls.classpath"/>
<control-jar destfile="${jars.dir}/ejbControls.jar" basedir="${controls.build.dir}"/>
</target>
<!--
-->
<target name="build.tests" depends="build.controls" description="Build the cactus tests.">
<build-controls srcdir="${cactus.src.dir}"
destdir="${cactus.build.dir}"
tempdir="${cactus.gen.dir}"
classpathref="cactus.build.classpath"/>
</target>
<!--
-->
<target name="build.webapp" description="Assemble the webapp dir for the cactus tests">
<!-- copy the webapp config files to the build area -->
<copy todir="${webapp.build.dir}">
<fileset dir="${webapp.src.dir}">
<include name="**/*.xml"/>
</fileset>
</copy>
<mkdir dir="${webapp.build.dir}/WEB-INF/lib"/>
<deploy-controls destDir="${webapp.build.dir}/WEB-INF/lib"/>
<!-- copy the ejb system control jar to the webapp's lib dir -->
<copy file="${beehive.home}/system-controls/build/jars/beehive-ejb-control.jar"
todir="${webapp.build.dir}/WEB-INF/lib"/>
<copy file="${jars.dir}/ejbControls.jar" todir="${webapp.build.dir}/WEB-INF/lib"/>
</target>
<!--
Build the cactified ear for testing. Steps necessary:
1) Run the ejb control assembler.
2) Build a war file for the webapp
3) Cactify the webapp war file
4) Build a cactified ear file, which includes the ejbs and cactus tests
-->
<target name="build.cactus.ear" depends="build.tests, build.webapp"
description="Create the ear file that will hold the cactus tests.">
<!-- run the ejb control assembler -->
<assemble.ejb.controls moduleDir="${ejbs.build.dir}"
srcOutputDir="${cactus.gen.dir}"
contextFactoryClassname="org.apache.beehive.controls.runtime.assembly.EJBAssemblyContext$Factory">
<classpath>
<path refid="controls.classpath"/>
<pathelement location="${jars.dir}/ejbControls.jar"/>
</classpath>
<fileset dir="${cactus.build.dir}">
<include name="**/*.controls.properties"/>
</fileset>
</assemble.ejb.controls>
<!-- now that assemble has been completed jar the ejbs -->
<jar jarfile="${jars.dir}/testEjbs.jar">
<fileset dir="${ejbs.build.dir}"/>
</jar>
<!-- ear the ejbs -->
<ear earfile="${jars.dir}/testEjbs.ear" appxml="${ejbs.src.dir}/application.xml">
<fileset file="${jars.dir}/testEjbs.jar"/>
</ear>
<!-- war the webapp -->
<war warfile="${jars.dir}/cactusTests.war" webxml="${webapp.build.dir}/WEB-INF/web.xml">
<lib dir="${webapp.build.dir}/WEB-INF/lib"/>
</war>
<!-- cactify the webapp war -->
<cactifywar srcfile="${jars.dir}/cactusTests.war" destfile="${jars.dir}/cactusTests-cactified.war"
mergewebxml="${webapp.build.dir}/WEB-INF/cactus-web.xml">
<classes dir="${cactus.build.dir}"/>
<lib file="${clover.jar}"/>
</cactifywar>
<!-- cactify the application ear -->
<ear earfile="${jars.dir}/testEjbs-cactified.ear" appxml="${webapp.build.dir}/application.xml">
<zipfileset excludes="META-INF/application.xml" src="${jars.dir}/testEjbs.ear"/>
<fileset file="${jars.dir}/cactusTests-cactified.war"/>
</ear>
</target>
<!--
-->
<target name="test.prepare" depends="clean, init.dirs, build.cactus.ear"/>
<!--
-->
<target name="cactus.tests" depends="check.cactus, check.geronimo, test.prepare"
description="Run the cactus tests.">
<!-- start geronimo -->
<antcall target="start.geronimo"/>
<!-- <antcall target="deploy-webapp"/> -->
<antcall target="deploy.ear">
<param name="ear.to.deploy" value="${jars.dir}/testEjbs-cactified.ear"/>
</antcall>
<!-- run the tests -->
<cactus earfile="build/jars/testEjbs-cactified.ear" fork="yes" failureproperty="tests.failed">
<classpath>
<pathelement location="${ejbs.build.dir}"/>
<pathelement location="${cactus.build.dir}"/>
<pathelement location="${cactus.home}/lib/aspectjrt-1.2.1.jar"/>
<path refid="controls.classpath"/>
<pathelement location="${geronimo.home}/repository/openejb/jars/openejb-core-2.0.jar"/>
</classpath>
<containerset>
<generic name="Geronimo_1.0" port="8080"/>
</containerset>
<formatter type="brief" usefile="false"/>
<formatter type="xml"/>
<batchtest todir="${cactus.log.dir}">
<fileset dir="${cactus.src.dir}">
<include name="**/Test*.java"/>
<!-- BMP test disabled to to deployment issues in g1.0 when using jdk 1.5 GERONIMO-1454. -->
<exclude name="**/TestBMP*.java"/>
</fileset>
</batchtest>
</cactus>
<!-- Generate the JUnit reports -->
<junitreport todir="${cactus.log.dir}">
<fileset dir="${cactus.log.dir}" includes="TEST-*.xml"/>
<report todir="${cactus.log.dir}" format="frames"/>
</junitreport>
<antcall target="stop.geronimo"/>
<fail if="tests.failed">At least one test failed!</fail>
</target>
</project>