beehive/system-controls/test/jms/build.xml

230 lines
9.3 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/JMSControlDRT" 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>
<!-- ***************************************************************** -->
<!-- CACTUS SETTINGS -->
<!-- ***************************************************************** -->
<property name="cactus.home" location="${os.CACTUS_HOME}"/>
<property name="geronimo.home" location="${os.GERONIMO_HOME}"/>
<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="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="cactus.log.dir" location="build/logs"/>
<property name="jars.dir" location="build/jars"/>
<property name="webapp.src.dir" location="src/webapp"/>
<property name="webapp.build.dir" location="build/webapp"/>
<property name="waitfor.url" value="http://localhost:8080/jmsTest"/>
<property name="target.module.id" value="testJms-cactified"/>
<!-- Libraries required for the jms controls -->
<path id="controls.classpath">
<pathelement location="${beehive.home}/system-controls/build/jars/beehive-jms-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}/jmsControls.jar"/>
<path refid="controls.classpath"/>
<path refid="ejb.dependency.path"/>
<path refid="cactus.classpath"/>
</path>
<taskdef resource="cactus.tasks" classpathref="cactus.classpath"/>
<!-- create the directories necessary for the cactus build -->
<target name="init.dirs">
<mkdir dir="${controls.build.dir}"/>
<mkdir dir="${controls.gen.dir}"/>
<mkdir dir="${jars.dir}"/>
<mkdir dir="${cactus.build.dir}"/>
<mkdir dir="${cactus.gen.dir}"/>
<mkdir dir="${cactus.log.dir}"/>
<mkdir dir="${webapp.build.dir}"/>
<mkdir dir="${webapp.build.dir}/WEB-INF/lib"/>
</target>
<!--
-->
<target name="build.controls" depends="init.dirs"
description="Build the jms 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}/jmsControls.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 todir="${webapp.build.dir}">
<fileset dir="${webapp.src.dir}">
<include name="**/*.xml"/>
</fileset>
</copy>
<deploy-controls destDir="${webapp.build.dir}/WEB-INF/lib"/>
<copy file="${beehive.home}/system-controls/build/jars/beehive-jms-control.jar"
todir="${webapp.build.dir}/WEB-INF/lib"/>
<copy file="${jars.dir}/jmsControls.jar" todir="${webapp.build.dir}/WEB-INF/lib"/>
<!-- todo: mq -->
<copy file="/usr/local/apps/geronimo-1.0-M5/repository/activemq/jars/activemq-core-3.2-M1.jar"
todir="${webapp.build.dir}/WEB-INF/lib"/>
</target>
<!--
Build the cactified ear for testing. Steps necessary:
1) Build a war file for the webapp
2) Cactify the webapp war file
3) Build a cactified ear file
-->
<target name="build.cactus.ear" depends="build.tests, build.webapp"
description="Create the ear file that will hold the cactus tests.">
<war warfile="${jars.dir}/cactusTests.war" webxml="${webapp.build.dir}/WEB-INF/web.xml">
<lib dir="${webapp.build.dir}/WEB-INF/lib"/>
</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>
<ear earfile="${jars.dir}/testJms-cactified.ear" appxml="${webapp.build.dir}/application.xml">
<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"/>
<!-- configure the JMS broker for the tests -->
<antcall target="deploy.jms.configuration">
<param name="target.module.id" value="weather/Topics"/>
<param name="broker.config.file" value="src/test-activemq.xml"/>
<param name="broker.rar" value="${geronimo.home}/repository/activemq/rars/activemq-ra-3.2.1.rar"/>
<param name="geronimo.username" value="system"/>
<param name="geronimo.password" value="manager"/>
</antcall>
<antcall target="deploy.ear">
<param name="ear.to.deploy" value="${jars.dir}/testJms-cactified.ear"/>
</antcall>
<cactus earfile="build/jars/testJms-cactified.ear" fork="yes" failureproperty="tests.failed">
<classpath>
<pathelement location="${cactus.build.dir}"/>
<pathelement location="${cactus.home}/lib/aspectjrt-1.2.1.jar"/>
<pathelement location="${geronimo.home}/repository/activemq/jars/activemq-core-3.2.1.jar"/>
<pathelement location="${geronimo.home}/repository/concurrent/jars/concurrent-1.3.4.jar"/>
<path refid="controls.classpath"/>
<path refid="ejb.dependency.path"/>
</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"/>
<exclude name="**/TestContextInitializer.java"/>
</fileset>
</batchtest>
</cactus>
<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>