362 lines
16 KiB
XML
362 lines
16 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/NetUI/Test/coreWeb" default="usage" basedir=".">
|
||
|
|
||
|
<property environment="os"/>
|
||
|
<property file="build.properties"/>
|
||
|
|
||
|
<property name="webapp.build.dir" location="build"/>
|
||
|
<property name="classes.dir" location="${webapp.build.dir}/WEB-INF/classes"/>
|
||
|
<property name="sourcegen.dir" location="${webapp.build.dir}/WEB-INF/.tmpbeansrc"/>
|
||
|
<property name="src.dir" location="src"/>
|
||
|
<property name="web.dir" location="web"/>
|
||
|
|
||
|
<property name="webapp.name" value="coreWeb"/>
|
||
|
<property name="server.root.url" value="http://localhost:8080"/>
|
||
|
<property name="webapp.waitfor.url" value="${server.root.url}/${webapp.name}"/>
|
||
|
|
||
|
<import file="${testrecorder.dir}/testRecorder.xml"/>
|
||
|
<import file="${struts-imports.dir}/struts-imports.xml"/>
|
||
|
<import file="${beehive.home}/beehive-imports.xml"/>
|
||
|
<import file="${beehive.home}/ant/beehive-tools.xml"/>
|
||
|
|
||
|
<path id="webapp.classpath">
|
||
|
<fileset dir="${webapp.build.dir}/WEB-INF/lib" includes="*.jar"/>
|
||
|
<pathelement location="${classes.dir}"/>
|
||
|
</path>
|
||
|
|
||
|
<!-- this is required for the beehive-tools.xml file's build-schema Ant task -->
|
||
|
<path id="xbean.dependency.path">
|
||
|
<pathelement location="${xbean.jar}"/>
|
||
|
<pathelement location="${jsr173.jar}"/>
|
||
|
</path>
|
||
|
|
||
|
<!-- ================================================================ -->
|
||
|
<!-- -->
|
||
|
<!-- Targets for building a webapp -->
|
||
|
<!-- -->
|
||
|
<!-- ================================================================ -->
|
||
|
|
||
|
<!--
|
||
|
Build this test webapp. This target both copies the Beehive runtime and
|
||
|
compiles Java / annotated Java sources.
|
||
|
|
||
|
Options:
|
||
|
- "nobuild" == this option will disable the application build and can be used when just
|
||
|
updating the Beehive webapp runtime.
|
||
|
-->
|
||
|
<target name="build" description="Build webapp" unless="nobuild">
|
||
|
<echo message="--------------------------------------------------"/>
|
||
|
<echo message=" NetUI ${webapp.name} webapp build starting "/>
|
||
|
<echo message="--------------------------------------------------"/>
|
||
|
|
||
|
<mkdir dir="${webapp.build.dir}"/>
|
||
|
<mkdir dir="${classes.dir}"/>
|
||
|
<mkdir dir="${webapp.build.dir}/WEB-INF/lib"/>
|
||
|
|
||
|
<!--
|
||
|
In order to have iterative development work correctly, the generated files need to be
|
||
|
removed in order to produce fresh codegen for each call to the "build" target.
|
||
|
-->
|
||
|
<delete dir="${sourcegen.dir}"/>
|
||
|
|
||
|
<antcall target="update.runtime"/>
|
||
|
|
||
|
<copy todir="${webapp.build.dir}" includeEmptyDirs="false">
|
||
|
<fileset dir="${web.dir}">
|
||
|
<exclude name="**/*.java"/>
|
||
|
</fileset>
|
||
|
</copy>
|
||
|
|
||
|
<echo>Copying .properties and .xml files from ${src.dir} to ${classes.dir}</echo>
|
||
|
<copy todir="${classes.dir}" includeEmptyDirs="false">
|
||
|
<fileset dir="${src.dir}" includes="**/*.properties,**/*.xml,META-INF/**"/>
|
||
|
</copy>
|
||
|
|
||
|
<path id="build.classpath">
|
||
|
<path refid="webapp.classpath"/>
|
||
|
<path refid="velocity.dependency.path"/>
|
||
|
<path refid="netui-compiler.dependency.path"/>
|
||
|
|
||
|
<pathelement location="${servlet-api.jar}"/>
|
||
|
<pathelement location="${jsp-api.jar}"/>
|
||
|
</path>
|
||
|
|
||
|
<build-schemas srcdir="${webapp.build.dir}/WEB-INF/schemas"
|
||
|
destdir="${classes.dir}"/>
|
||
|
|
||
|
<taskdef name="apt"
|
||
|
classname="org.apache.beehive.controls.runtime.generator.AptTask"
|
||
|
classpathref="build.classpath"
|
||
|
onerror="fail"/>
|
||
|
|
||
|
<apt srcdir="${src.dir}:${web.dir}"
|
||
|
destdir="${classes.dir}"
|
||
|
gendir="${sourcegen.dir}"
|
||
|
classpathref="build.classpath"
|
||
|
debug="true"
|
||
|
processorOptions="web.content.root=${web.dir}"
|
||
|
nocompile="false"/>
|
||
|
|
||
|
<echo message="--------------------------------------------------"/>
|
||
|
<echo message=" NetUI ${webapp.name} webapp build ending "/>
|
||
|
<echo message="--------------------------------------------------"/>
|
||
|
</target>
|
||
|
|
||
|
<!--
|
||
|
Update the Beehive runtime used in the webapp.
|
||
|
|
||
|
Options:
|
||
|
- "struts.version" == configure the Struts version used to run tests. The default value is 1.2. Supported
|
||
|
values include "1.1" and "1.2".
|
||
|
-->
|
||
|
<target name="update.runtime" description="Update the NetUI runtime in the webapp without building the resources">
|
||
|
<property name="struts.version" value="12"/>
|
||
|
|
||
|
<echo>Struts version: ${struts.version}</echo>
|
||
|
|
||
|
<deploy-netui webappdir="${webapp.build.dir}"/>
|
||
|
|
||
|
<!-- adjust the runtime if building against Struts 1.1 -->
|
||
|
<antcall target="use.struts11"/>
|
||
|
|
||
|
<testrecorder-config testfile="${basedir}/testRecorder/config/testRecorder-tests.xml"
|
||
|
configfile="testRecorder/config/testRecorder-config.xml"
|
||
|
webappfile="testRecorder/config/testRecorder-webapp.xml"
|
||
|
appdir="${basedir}"
|
||
|
outputdir="${classes.dir}"/>
|
||
|
|
||
|
<testrecorder-deploy webappdir="${webapp.build.dir}"/>
|
||
|
|
||
|
<!-- deploy XMLBeans which isn't included in the default webapp template -->
|
||
|
<copy todir="${webapp.build.dir}/WEB-INF/lib">
|
||
|
<fileset file="${xbean.jar}"/>
|
||
|
<fileset file="${jsr173.jar}"/>
|
||
|
</copy>
|
||
|
</target>
|
||
|
|
||
|
<target name="use.struts11" if="struts11">
|
||
|
<undeploy-struts12 webappdir="${webapp.build.dir}"/>
|
||
|
<deploy-struts11 webappdir="${webapp.build.dir}" strutsdir="${struts11.dir}"/>
|
||
|
</target>
|
||
|
|
||
|
<target name="clean" description="Clean webapp" unless="nobuild">
|
||
|
<echo message="--------------------------------------------------"/>
|
||
|
<echo message=" NetUI ${webapp.name} webapp clean starting "/>
|
||
|
<echo message="--------------------------------------------------"/>
|
||
|
|
||
|
<delete dir="${webapp.build.dir}"/>
|
||
|
<delete dir="tmpbeansrc"/>
|
||
|
|
||
|
<echo message="--------------------------------------------------"/>
|
||
|
<echo message=" NetUI ${webapp.name} webapp clean ending "/>
|
||
|
<echo message="--------------------------------------------------"/>
|
||
|
</target>
|
||
|
|
||
|
<target name="update.web" description="Update the deployed web application from the web/ directory">
|
||
|
<copy todir="${webapp.build.dir}">
|
||
|
<fileset dir="web/"/>
|
||
|
</copy>
|
||
|
</target>
|
||
|
|
||
|
<!-- ================================================================ -->
|
||
|
<!-- -->
|
||
|
<!-- Targets for running test recorder test suites -->
|
||
|
<!-- -->
|
||
|
<!-- ================================================================ -->
|
||
|
<target name="playback" description="Playback a specified list of test recorder tests">
|
||
|
<ant dir="${test.dir}/ant" antfile="testRecorder.xml" target="playback" inheritAll="false">
|
||
|
<property name="playback.webapps" value="${webapp.name}"/>
|
||
|
</ant>
|
||
|
</target>
|
||
|
|
||
|
<target name="drt.running" description="Playback the 'drt' category to a running server">
|
||
|
<ant dir="${test.dir}/ant" antfile="testRecorder.xml" target="suite.callback" inheritAll="false">
|
||
|
<property name="suite.name" value="drt"/>
|
||
|
<property name="playback.webapps" value="${webapp.name}"/>
|
||
|
<property name="waitfor.url" value="${webapp.waitfor.url}"/>
|
||
|
<property name="report.name" value="${report.name}"/>
|
||
|
</ant>
|
||
|
</target>
|
||
|
|
||
|
<target name="bvt.running" description="Playback the 'bvt' category to a running server">
|
||
|
<ant dir="${test.dir}/ant" antfile="testRecorder.xml" target="suite.callback" inheritAll="false">
|
||
|
<property name="suite.name" value="bvt"/>
|
||
|
<property name="playback.webapps" value="${webapp.name}"/>
|
||
|
<property name="waitfor.url" value="${webapp.waitfor.url}"/>
|
||
|
<property name="report.name" value="${report.name}"/>
|
||
|
</ant>
|
||
|
</target>
|
||
|
|
||
|
<target name="drt" description="Run the drt suite with full server start / stop support.">
|
||
|
<antcall target="clean"/>
|
||
|
<antcall target="build"/>
|
||
|
<ant dir="${testrecorder.dir}" antfile="testRecorder.xml" inheritAll="false" target="server.test">
|
||
|
<property name="app.build.dir" location="${basedir}"/>
|
||
|
<property name="app.build.file" value="build.xml"/>
|
||
|
<property name="waitfor.url" value="${server.root.url}"/>
|
||
|
<property name="suite.name" value="drt"/>
|
||
|
<property name="playback.webapps" value="${webapp.name}"/>
|
||
|
<property name="drt.mode" value="true"/>
|
||
|
<property name="formatter.type" value="xml"/>
|
||
|
<property name="formatter.usefile" value="true"/>
|
||
|
<property name="report.name" value="${report.name}"/>
|
||
|
</ant>
|
||
|
</target>
|
||
|
|
||
|
<target name="bvt" description="Run the bvt suite with full server start / stop support.">
|
||
|
<antcall target="clean"/>
|
||
|
<antcall target="build"/>
|
||
|
<ant dir="${testrecorder.dir}" antfile="testRecorder.xml" inheritAll="false" target="server.test">
|
||
|
<property name="app.build.dir" location="${basedir}"/>
|
||
|
<property name="waitfor.url" value="${server.root.url}"/>
|
||
|
<property name="suite.name" value="bvt"/>
|
||
|
<property name="playback.webapps" value="${webapp.name}"/>
|
||
|
<property name="drt.mode" value="true"/>
|
||
|
<property name="formatter.type" value="xml"/>
|
||
|
<property name="formatter.usefile" value="true"/>
|
||
|
<property name="report.name" value="${report.name}"/>
|
||
|
</ant>
|
||
|
</target>
|
||
|
|
||
|
<target name="bvt.struts11" description="Run the bvt suite using Struts 1.1 libraries with full server start / stop support">
|
||
|
<property name="struts11" value="true"/>
|
||
|
<antcall target="clean"/>
|
||
|
<antcall target="build"/>
|
||
|
|
||
|
<!--
|
||
|
This is the documented workaround for using declarative validation with Struts 1.1.
|
||
|
We need to copy the resources so they can be loaded from **ServletContext** as
|
||
|
/_pageflow/pageflow-validation-*.xml.
|
||
|
-->
|
||
|
<delete dir="${webapp.build.dir}/_pageflow"/>
|
||
|
<mkdir dir="${webapp.build.dir}/_pageflow"/>
|
||
|
<copy todir="${webapp.build.dir}/_pageflow">
|
||
|
<fileset dir="${classes.dir}/_pageflow" includes="*-validation*.xml"/>
|
||
|
</copy>
|
||
|
|
||
|
<ant dir="${testrecorder.dir}" antfile="testRecorder.xml" inheritAll="false" target="server.test">
|
||
|
<property name="app.build.dir" location="${basedir}"/>
|
||
|
<property name="waitfor.url" value="${server.root.url}"/>
|
||
|
<property name="suite.name" value="bvt.struts11"/>
|
||
|
<property name="playback.webapps" value="${webapp.name}"/>
|
||
|
<property name="drt.mode" value="true"/>
|
||
|
<property name="formatter.type" value="xml"/>
|
||
|
<property name="formatter.usefile" value="true"/>
|
||
|
<property name="report.name" value="${report.name}"/>
|
||
|
</ant>
|
||
|
<delete dir="${webapp.build.dir}/_pageflow"/>
|
||
|
</target>
|
||
|
|
||
|
<target name="suite.running" description="Playback a test recorder test suite against a running server">
|
||
|
<ant dir="${testrecorder.dir}" antfile="testRecorder.xml" target="suite.callback" inheritAll="false">
|
||
|
<property name="suite.name" value="${suite.name}"/>
|
||
|
<property name="waitfor.url" value="${webapp.waitfor.url}"/>
|
||
|
<property name="playback.webapps" value="${webapp.name}"/>
|
||
|
</ant>
|
||
|
</target>
|
||
|
|
||
|
<!-- ================================================================ -->
|
||
|
<!-- -->
|
||
|
<!-- Targets for deploying the webapp on a server -->
|
||
|
<!-- -->
|
||
|
<!-- ================================================================ -->
|
||
|
<target name="deploy" description="Deploy webapp">
|
||
|
<deploy-webapp webappDir="${webapp.build.dir}" contextPath="${webapp.name}"/>
|
||
|
</target>
|
||
|
|
||
|
<target name="undeploy" description="Undeploy webapp">
|
||
|
<undeploy-webapp contextPath="${webapp.name}"/>
|
||
|
</target>
|
||
|
|
||
|
<target name="redeploy" description="Redeploy webapp">
|
||
|
<redeploy-webapp contextPath="${webapp.name}"/>
|
||
|
</target>
|
||
|
|
||
|
<!-- ================================================================ -->
|
||
|
<!-- -->
|
||
|
<!-- Targets for starting / stopping a server -->
|
||
|
<!-- -->
|
||
|
<!-- ================================================================ -->
|
||
|
<target name="start.without.asserts" description="Start server without asserts enabled for org.apache.beehive.netui">
|
||
|
<start-server shmem="false" javaOptions=""/>
|
||
|
</target>
|
||
|
|
||
|
<target name="start.with.shmem" description="Start server">
|
||
|
<start-server shmem="true" javaOptions="-ea:org.apache.beehive.netui..."/>
|
||
|
</target>
|
||
|
|
||
|
<target name="start" description="Start server with asserts enabled for org.apache.beehive.netui">
|
||
|
<start-server shmem="false" javaOptions="-ea:org.apache.beehive.netui..."/>
|
||
|
</target>
|
||
|
|
||
|
<target name="start.with.shmem.asserts" description="Start server with asserts enabled for org.apache.beehive.netui">
|
||
|
<start-server shmem="true" javaOptions="-ea:org.apache.beehive.netui..."/>
|
||
|
</target>
|
||
|
|
||
|
<target name="start.with.shmem.asserts.i18n"
|
||
|
description="Start server with asserts enabled for org.apache.beehive.netui, with debugging enabled, and in a non-US locale for i18n / l10n testing.">
|
||
|
<start-server shmem="true" javaOptions="-ea:org.apache.beehive.netui... -Duser.language=NL -Duser.country=BE"/>
|
||
|
</target>
|
||
|
|
||
|
<target name="stop" description="Stop server">
|
||
|
<stop-server/>
|
||
|
</target>
|
||
|
|
||
|
<target name="ensure.deployed" description="Deploy webapp for the test recorder">
|
||
|
<echo>Ensuring that the webapp ${webapp.name} is deployed on a running server at the url ${webapp.waitfor.url}</echo>
|
||
|
|
||
|
<waitfor maxwait="5" maxwaitunit="second" timeoutproperty="unavailable">
|
||
|
<http url="${webapp.waitfor.url}"/>
|
||
|
</waitfor>
|
||
|
<antcall target="do.deploy"/>
|
||
|
<antcall target="do.redeploy"/>
|
||
|
<fail if="still.unavailable" message="Couldn't find webapp with path ${webapp.waitfor.url}"/>
|
||
|
</target>
|
||
|
|
||
|
<target name="do.deploy" if="unavailable">
|
||
|
<echo>Webapp is not deployed; deploying</echo>
|
||
|
|
||
|
<antcall target="deploy"/>
|
||
|
<echo>...deploy complete</echo>
|
||
|
|
||
|
<waitfor maxwait="120" maxwaitunit="second" timeoutproperty="still.unavailable">
|
||
|
<http url="${webapp.waitfor.url}"/>
|
||
|
</waitfor>
|
||
|
</target>
|
||
|
|
||
|
<target name="do.redeploy" unless="unavailable">
|
||
|
<echo>Webapp is deployed; undeploy and redeploy</echo>
|
||
|
|
||
|
<antcall target="undeploy"/>
|
||
|
<echo>...undeploy complete</echo>
|
||
|
|
||
|
<antcall target="deploy"/>
|
||
|
<echo>...deploy complete</echo>
|
||
|
|
||
|
<waitfor maxwait="120" maxwaitunit="second" timeoutproperty="still.unavailable">
|
||
|
<http url="${webapp.waitfor.url}"/>
|
||
|
</waitfor>
|
||
|
</target>
|
||
|
</project>
|
||
|
|