You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-dev@jakarta.apache.org by vm...@apache.org on 2002/09/08 19:43:20 UTC
cvs commit: jakarta-cactus/sample-jetty/conf/sample/build build.xml build.properties.sample
vmassol 2002/09/08 10:43:20
Added: sample-jetty/conf/sample/conf manifest web.xml
sample-jetty/conf/sample/conf/test log_client.properties
jetty.xml log_server.properties
sample-jetty .cvsignore build.xml build.properties.sample
sample-jetty/conf/sample/build build.xml
build.properties.sample
Log:
example that shows how to use the new Jetty initializer
Revision Changes Path
1.1 jakarta-cactus/sample-jetty/conf/sample/conf/manifest
Index: manifest
===================================================================
Manifest-Version: 1.0
Created-By: Ant
Name: cactus/sample/servlet
Specification-Title: @project.name.text@
Specification-Vendor: Apache Software Foundation
Implementation-Vendor: Apache Software Foundation
Specification-Version: @version@
Implementation-Version: @version@
Implementation-Title: @project.name.file@
1.1 jakarta-cactus/sample-jetty/conf/sample/conf/web.xml
Index: web.xml
===================================================================
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
"http://java.sun.com/j2ee/dtds/web-app_2.2.dtd">
<web-app>
</web-app>
1.1 jakarta-cactus/sample-jetty/conf/sample/conf/test/log_client.properties
Index: log_client.properties
===================================================================
# Properties for configuring Log4j
# This is the configuring for logging on the JUnit side (i.e. the client side)
log4j.appender.cactus = org.apache.log4j.FileAppender
log4j.appender.cactus.File = cactus_client.log
log4j.appender.cactus.Append = false
log4j.appender.cactus.layout = org.apache.log4j.PatternLayout
log4j.appender.cactus.layout.ConversionPattern = %d{ABSOLUTE} [%t] %-5p %-30.30c{2} %x - %m %n
# Any application log which uses Log4J will be logged to the Cactus log file
log4j.rootCategory=DEBUG, cactus
# By default we don't log at the DEBUG level for Cactus log, in order not to generate too
# many logs. However, should a problem arise and logs need to be sent to the Cactus dev team,
# then we will ask you to change this to DEBUG.
log4j.category.org.apache.cactus = WARN, cactus
log4j.additivity.org.apache.cactus=false
# Don't show debug logs for HttpClient
log4j.category.org.apache.commons.httpclient = WARN, cactus
log4j.additivity.org.apache.commons.httpclient=false
log4j.category.httpclient = WARN, cactus
log4j.additivity.httpclient=false
1.1 jakarta-cactus/sample-jetty/conf/sample/conf/test/jetty.xml
Index: jetty.xml
===================================================================
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure 1.1//EN" "http://jetty.mortbay.org/configure_1_2.dtd">
<Configure class="org.mortbay.jetty.Server">
<Call name="getContext">
<Arg>/test</Arg>
<Call name="getWebApplicationHandler">
<Call name="getServletHolder">
<Arg>ServletRedirector</Arg>
<Call name="setInitParameter">
<Arg>param1</Arg>
<Arg>value1 used for testing</Arg>
</Call>
</Call>
</Call>
<Call name="getWebApplicationHandler">
<Call name="getServletHolder">
<Arg>JspRedirector</Arg>
<Call name="setInitParameter">
<Arg>param1</Arg>
<Arg>value1 used for testing</Arg>
</Call>
</Call>
</Call>
<Call name="getServletHandler">
<Call name="newServletHolder">
<Arg>TestJsp</Arg>
<Arg>org.apache.jasper.servlet.JspServlet</Arg>
<Arg>/test/test.jsp</Arg>
</Call>
</Call>
<Call name="addServlet">
<Arg>/ServletRedirectorOverride</Arg>
<Arg>org.apache.cactus.server.ServletTestRedirector</Arg>
<Call name="setInitParameter">
<Arg>param2</Arg>
<Arg>value2 used for testing</Arg>
</Call>
</Call>
</Call>
</Configure>
1.1 jakarta-cactus/sample-jetty/conf/sample/conf/test/log_server.properties
Index: log_server.properties
===================================================================
# Properties for configuring Log4j
# This is the configuring for logging on the server side
log4j.appender.cactus = org.apache.log4j.FileAppender
log4j.appender.cactus.File = cactus_server.log
log4j.appender.cactus.Append = false
log4j.appender.cactus.layout = org.apache.log4j.PatternLayout
log4j.appender.cactus.layout.ConversionPattern = %d{ABSOLUTE} [%t] %-5p %-30.30c{2} %x - %m %n
# Any application log which uses Log4J will be logged to the Cactus log file
log4j.rootCategory=DEBUG, cactus
# By default we don't log at the DEBUG level for Cactus log, in order not to generate too
# many logs. However, should a problem arise and logs need to be sent to the Cactus dev team,
# then we will ask you to change this to DEBUG.
log4j.category.org.apache.cactus = WARN, cactus
log4j.additivity.org.apache.cactus=false
1.1 jakarta-cactus/sample-jetty/.cvsignore
Index: .cvsignore
===================================================================
build.properties
dist-12
dist-13
target-12
target-13
ant.bat
1.1 jakarta-cactus/sample-jetty/build.xml
Index: build.xml
===================================================================
<?xml version="1.0"?>
<!--
=============================================================================
Build file for the Cactus Jetty Sample subproject (it shows how to use
Cactus and Jelly in an integrated way for unit testing the Servlet API :
Servlets, Fitlers, Taglibs).
The following Ant tasks need to be available in your ant installation (i.e.
the Ant task themselves and their dependent jars need to be put in
ANT_HOME/lib) :
clover [OPTIONAL] Clover jar (only for test coverage)
The mandatory and optional Ant properties are defined in
build.properties.sample. Please read and edit that file.
This script should be started with the following command line :
ant <target>
Run "ant -projecthelp" to get a list of available targets. The default
target is "dist"
Note: basedir points to the main Cactus directory in order to have the same
base dir for all Cactus subprojects and thus be able to share
relative paths.
=============================================================================
-->
<project name="Cactus Jetty Sample" default="dist" basedir="..">
<!-- Give user a chance to override without editing this file
(and without typing -D each time it compiles it) -->
<property file="sample-jetty/build.properties" />
<property file="${user.home}/build.properties" />
<!-- Global project properties -->
<property name="project.name.text" value="Cactus Jetty Sample"/>
<property name="project.name.file" value="sample-jetty"/>
<property name="project.version" value="1.5dev"/>
<!-- Prefix to add to all distributable files -->
<property name="project.prefix" value="jakarta-"/>
<!--
========================================================================
Default values for properties not defined in build.properties or in
a higher level calling Ant script
========================================================================
-->
<property name="year" value="2000-2002"/>
<property name="debug" value="on"/>
<property name="optimize" value="off"/>
<property name="deprecation" value="off"/>
<!--
========================================================================
Base directory for all file related operations
========================================================================
-->
<property name="base.dir" value="sample-jetty"/>
<!--
========================================================================
Set the properties related to the source tree.
Note: These properties are defined in a target as some need the
j2ee.api property to be set
========================================================================
-->
<target name="properties.source">
<!-- Source locations for the build -->
<property name="src.dir" value="sample-servlet/src"/>
<property name="src.sample.dir" value="${src.dir}/sample"/>
<property name="src.unit.dir" value="${src.dir}/unit"/>
<property name="conf.dir" value="${base.dir}/conf"/>
<property name="conf.sample.dir" value="${conf.dir}/sample"/>
<property name="conf.sample.build.dir" value="${conf.sample.dir}/build"/>
<property name="conf.sample.conf.dir" value="${conf.sample.dir}/conf"/>
<property name="web.dir" value="sample-servlet/web"/>
<property name="web.sample.dir" value="${web.dir}/sample"/>
<!-- The location of the Cactus framework jar -->
<property name="cactus.framework.jar"
value="framework/dist-${j2ee.api}/lib/cactus.jar"/>
<!-- The location of the web files generated by the Cactus framework
(i.e. the JSP Redirector) -->
<property name="cactus.framework.web"
value="framework/dist-${j2ee.api}/web"/>
<!-- Location of the Clover(ed) Cactus framework -->
<property name="cactus.framework.clover.jar"
value="framework/dist-${j2ee.api}/lib/cactus-clover.jar"/>
<echo message="cactus.framework.clover.jar = ${cactus.framework.clover.jar}"/>
</target>
<!-- The location of the Cactus custom Ant tasks jar -->
<property name="cactus.ant.jar" value="anttasks/dist/lib/cactus-ant.jar"/>
<!--
========================================================================
Set the properties related to the target tree
Note: These properties are defined in a target as some need the
j2ee.api property to be set
========================================================================
-->
<target name="properties.target">
<property name="target.dir" value="${base.dir}/target-${j2ee.api}"/>
<!-- Destination locations for the sample application -->
<property name="target.sample.dir" value="${target.dir}/sample"/>
<property name="target.sample.build.dir" value="${target.sample.dir}/build"/>
<property name="target.sample.conf.dir" value="${target.sample.dir}/conf"/>
<property name="target.sample.src.dir" value="${target.sample.dir}/src"/>
<property name="target.sample.src.sample.dir"
value="${target.sample.src.dir}/sample"/>
<property name="target.sample.src.unit.dir"
value="${target.sample.src.dir}/unit"/>
<property name="target.sample.web.dir" value="${target.sample.dir}/web"/>
</target>
<!--
========================================================================
Set the properties related to the distribution tree
Note: These properties are defined in a target as some need the
j2ee.api property to be set
========================================================================
-->
<target name="properties.distribution">
<property name="dist.dir" value="${base.dir}/dist-${j2ee.api}"/>
<property name="dist.bin.dir" value="${dist.dir}/bin"/>
</target>
<!--
========================================================================
Names of deliverables
========================================================================
-->
<!-- The packaged Sample application -->
<property name="sample.zip.name" value="${project.name.file}"/>
<!--
========================================================================
Useful patterns for targets
========================================================================
-->
<path id="project.class.path">
<pathelement location="${j2ee.jar}"/>
<!-- Includes system classpath for jars that are in ANT_HOME/lib such
as aspectrt.jar, etc -->
<pathelement path="${java.class.path}"/>
</path>
<!--
========================================================================
Display configurable properties values
========================================================================
-->
<target name="display.properties">
<echo message="----- ${project.name.text} ${project.version} -----"/>
<echo message=""/>
<echo message="java.class.path = ${java.class.path}"/>
<echo message=""/>
<echo message="java.home = ${java.home}"/>
<echo message="user.home = ${user.home}"/>
<echo message="ant.home = ${ant.home}"/>
<echo message=""/>
<echo message="log4j.jar (optional) = ${log4j.jar}"/>
<echo message="clover.enable (optional) = ${clover.enable}"/>
<echo message="clover.jar (optional) = ${clover.jar}"/>
<echo message="test.port (optional) = ${test.port}"/>
</target>
<!--
========================================================================
Verify that all mandatory properties have been set
========================================================================
-->
<target name="check.properties.init">
<taskdef name="checkProperty" classname="org.apache.cactus.ant.CheckPropertiesTask">
<classpath>
<pathelement location="${cactus.ant.jar}"/>
</classpath>
</taskdef>
</target>
<target name="check.properties.external" depends="check.properties.init">
<checkProperty>
<property name="j2ee.jar" isfile="true"/>
<property name="aspectjrt.jar" isfile="true"/>
<property name="commons.logging.jar" isfile="true"/>
<property name="commons.httpclient.jar" isfile="true"/>
<property name="junit.jar" isfile="true"/>
<property name="httpunit.jar" isfile="true"/>
<property name="jetty.jar" isfile="true"/>
<property name="jasper.jar" isfile="true"/>
</checkProperty>
</target>
<target name="check.properties.cactus" depends="check.properties.init">
<checkProperty>
<property name="cactus.framework.jar" isfile="true"/>
<property name="cactus.framework.web" isfile="true"/>
</checkProperty>
</target>
<!--
========================================================================
Find out the J2EE API version
========================================================================
-->
<target name="check.j2ee.version">
<condition property="j2ee.api" value="13">
<available classname="javax.servlet.Filter"
classpathref="project.class.path"/>
</condition>
<condition property="j2ee.api" value="12">
<available classname="javax.servlet.Servlet"
classpathref="project.class.path"/>
</condition>
<fail message="Unsupported J2EE version" unless="j2ee.api"/>
<echo message="j2ee.api = ${j2ee.api}"/>
</target>
<!--
========================================================================
Load all dynamic properties
========================================================================
-->
<target name="load.properties"
depends="check.j2ee.version,properties.source,properties.target,properties.distribution"/>
<!--
========================================================================
Initialize the build. Must be called by all targets
========================================================================
-->
<target name="init"
depends="display.properties,check.properties.external,load.properties,check.properties.cactus">
<tstamp/>
<filter token="version" value="${project.version}"/>
<filter token="year" value="${year}"/>
<!-- Custom Ant task definition used in the test targets below.
It is used for computing the "-D" parameter list
for home directories of defined servlet engines. If a given
property is not defined, it won't be added to the list -->
<taskdef name="argsList" classname="org.apache.cactus.ant.ArgListTask">
<classpath>
<pathelement location="${cactus.ant.jar}"/>
</classpath>
</taskdef>
</target>
<!--
========================================================================
Generate the sample application
========================================================================
-->
<target name="sample" depends="init"
description="Generate the sample application">
<!-- Create output directory structure and copy sample files in it -->
<mkdir dir="${target.sample.dir}"/>
<mkdir dir="${target.sample.build.dir}"/>
<mkdir dir="${target.sample.conf.dir}/test"/>
<mkdir dir="${target.sample.src.sample.dir}"/>
<mkdir dir="${target.sample.src.unit.dir}"/>
<mkdir dir="${target.sample.web.dir}/test"/>
<!-- Copy build files -->
<copy todir="${target.sample.build.dir}" filtering="on">
<fileset dir="${conf.sample.build.dir}"/>
</copy>
<!-- Copy src files -->
<copy todir="${target.sample.src.sample.dir}">
<fileset dir="${src.sample.dir}/share"/>
<fileset dir="${src.sample.dir}/j2ee${j2ee.api}"/>
</copy>
<copy todir="${target.sample.src.unit.dir}">
<fileset dir="${src.unit.dir}/share"/>
<fileset dir="${src.unit.dir}/j2ee${j2ee.api}"/>
</copy>
<!-- Copy conf files -->
<copy todir="${target.sample.conf.dir}/test">
<fileset dir="${conf.sample.conf.dir}/test"/>
</copy>
<copy todir="${target.sample.conf.dir}">
<fileset dir="${conf.sample.conf.dir}">
<include name="web.xml"/>
<include name="manifest"/>
</fileset>
</copy>
<!-- Copy web files -->
<copy todir="${target.sample.web.dir}/test">
<fileset dir="${web.sample.dir}/test"/>
</copy>
<!-- Copy the Jsp Redirector -->
<copy todir="${target.sample.web.dir}">
<fileset dir="${cactus.framework.web}"/>
</copy>
<!-- Copy README file -->
<copy todir="${target.sample.dir}" file="${base.dir}/README"/>
</target>
<!--
========================================================================
Run the full suite of tests on all defined containers.
========================================================================
-->
<target name="test.choose.jar.clover" if="clover.enable">
<property name="cactus.framework.elected.jar"
value="${cactus.framework.clover.jar}"/>
</target>
<target name="test.choose.jar.main" unless="clover.enable">
<property name="cactus.framework.elected.jar"
value="${cactus.framework.jar}"/>
</target>
<target name="test.choose.jar"
depends="test.choose.jar.clover,test.choose.jar.main"/>
<target name="test" depends="sample,test.choose.jar"
description="Run the tests on all defined servers">
<argsList property="test.args.list">
<!-- Inherit the classpath behaviour from the main script for
Gump builds to work -->
<property name="build.sysclasspath"/>
<property name="test.port"/>
<property name="log4j.jar"/>
<property name="clover.jar"/>
</argsList>
<java classname="org.apache.tools.ant.Main" fork="yes"
failonerror="yes">
<!-- Pass all required properties -->
<arg value="-Dservlet.jar=${j2ee.jar}"/>
<arg value="-Dcactus.framework.jar=${cactus.framework.elected.jar}"/>
<arg value="-Djunit.jar=${junit.jar}"/>
<arg value="-Dcommons.logging.jar=${commons.logging.jar}"/>
<arg value="-Dcommons.httpclient.jar=${commons.httpclient.jar}"/>
<arg value="-Daspectjrt.jar=${aspectjrt.jar}"/>
<arg value="-Dhttpunit.jar=${httpunit.jar}"/>
<arg value="-Djetty.jar=${jetty.jar}"/>
<arg value="-Djasper.jar=${jasper.jar}"/>
<arg value="-Dbase.dir=${target.sample.dir}"/>
<arg value="-Dbasedir=${basedir}"/>
<!-- Pass all optional properties -->
<arg line="${test.args.list}"/>
<arg line="-buildfile ${target.sample.build.dir}/build.xml"/>
<arg value="test"/>
<classpath>
<pathelement path="${java.class.path}"/>
</classpath>
</java>
</target>
<!--
========================================================================
Generate the distributable files
========================================================================
-->
<!-- This target is there simply so that we can zip the sample application
before it is run, as this will generate temporary files that we do
not want in the zip -->
<target name="prepare.dist" depends="sample">
<mkdir dir="${dist.bin.dir}"/>
<zip zipfile="${dist.bin.dir}/${sample.zip.name}.zip">
<fileset dir="${target.sample.dir}"/>
</zip>
</target>
<target name="dist" depends="prepare.dist,test"
description="Generate the distributable files">
</target>
<!--
========================================================================
Clean generated files (including distributables)
Note: We don't depend on "init" as the only mandatory property that
we need is "j2ee.jar".
========================================================================
-->
<target name="clean" depends="load.properties"
description="Clean all generated files">
<delete dir="${target.dir}"/>
<delete dir="${dist.dir}"/>
</target>
<!--
========================================================================
Run the Clover swing report
========================================================================
-->
<target name="clover.result" depends="init" if="clover.enable">
<!-- Clover will read this file to generate the report -->
<property name="clover.initstring"
value="${basedir}/target-${j2ee.api}/clover-coverage.db"/>
<echo message="clover.initstring = ${clover.initstring}"/>
<java classname="com.cortexeb.tools.clover.reporters.jfc.Viewer"
fork="yes">
<arg line="${clover.initstring}"/>
<classpath>
<pathelement path="${java.class.path}"/>
</classpath>
</java>
</target>
<!--
========================================================================
Build all : builds the distribution for both J2EE API 1.2 and 1.3
========================================================================
-->
<target name="dist.all"
description="Generate the distributable files (for all J2EE APIs)">
<ant antfile="sample-jetty/build.xml" target="dist" inheritAll="false">
<property name="j2ee.jar" value="${j2ee.12.jar}"/>
</ant>
<ant antfile="sample-jetty/build.xml" target="dist" inheritAll="false">
<property name="j2ee.jar" value="${j2ee.13.jar}"/>
</ant>
</target>
<!--
========================================================================
Clean all, for all J2EE APIs
========================================================================
-->
<target name="clean.all"
description="Clean all generated files (for all J2EE APIs)">
<ant antfile="sample-jetty/build.xml" target="clean" inheritAll="false">
<property name="j2ee.jar" value="${j2ee.12.jar}"/>
</ant>
<ant antfile="sample-jetty/build.xml" target="clean" inheritAll="false">
<property name="j2ee.jar" value="${j2ee.13.jar}"/>
</ant>
</target>
</project>
1.1 jakarta-cactus/sample-jetty/build.properties.sample
Index: build.properties.sample
===================================================================
# -----------------------------------------------------------------------------
# build.properties.sample
#
# This is an example "build.properties" file, used to customize building the
# Cactus Servlet Sample for your local environment. Make any changes you need,
# and rename this file to "build.properties" in the same directory that
# contains the "build.xml" file.
#
# $Id: build.properties.sample,v 1.23 2002/08/30 20:25:07 vmassol Exp $
# -----------------------------------------------------------------------------
# WARNING: The relative paths below are relative to the directory where the
# build.xml file is located.
# -----------------------------------------------------------------------------
# Mandatory properties
# -----------------------------------------------------------------------------
# Location of all jars. Note: This is not a mandatory property. It is only
# used here so that it can be reused when defining the location of all the jars
# below. You do not have to put all the external jars in a single location.
lib.repo = c:/apps/maven/repository
# The location of the J2EE API jar. Depending on the version (1.2 or 1.3) of
# it, the corresponding Cactus Framework will be built. For example if you use
# J2EE 1.3 jar, then the Cactus jar will contain the Filter Redirector which is
# only available for Servlet 2.3 (part of J2EE 1.3).
j2ee.jar = ${lib.repo}/servletapi/jars/servletapi-2.3.jar
# The location of the AspectJ runtime jar
aspectjrt.jar = ${lib.repo}/aspectj/jars/aspectjrt-1.0.6.jar
# The location of the Commons Logging jar
commons.logging.jar = ${lib.repo}/commons-logging/jars/commons-logging-1.0.1.jar
# The location of the log4j jar
log4j.jar = ${lib.repo}/log4j/jars/log4j-1.2.6.jar
# The location of the Commons Httpclient jar
commons.httpclient.jar = ${lib.repo}/commons-httpclient/jars/commons-httpclient-2.0alpha1-20020829.jar
# The location of the Junit jar
junit.jar = ${lib.repo}/junit/jars/junit-3.8.1.jar
# The location of the Httpunit jar
httpunit.jar = ${lib.repo}/httpunit/jars/httpunit-1.4.5.jar
# The location of the Jetty jar
jetty.jar = ${lib.repo}/jetty/jars/org.mortbay.jetty-jdk1.2-4.1.0RC4.jar
# The location of the Jasper jar
jasper.jar = ${lib.repo}/jetty/jars/org.apache.jasper-4.1.0RC4.jar
# -----------------------------------------------------------------------------
# Optional properties
# -----------------------------------------------------------------------------
# Locations J2EE APIs for the "all" target (which builds the Cactus Servlet
# Sample for both APIs)
j2ee.12.jar = ${lib.repo}/j2ee/jars/j2ee-1.2.jar
j2ee.13.jar = ${lib.repo}/j2ee/jars/j2ee-1.3.jar
# The port to use for starting the servers during unit testing. If not
# specified, it defaults to port 8080.
#test.port = 8081
# Servlet engine locations for the tests
# Note: If you don't want to run the test on a given servlet engine, just
# comment it's home property. For example, if you don't want to run the
# tests on the Resin 1.2, comment the "resin.home.12" property.
#resin.home.12 = xxx
#tomcat.home.32 = c:/Apps/jakarta-tomcat-3.2.4
#weblogic.home.51 = xxx
#orion.home.15 = c:/Apps/orion-1.5.4
#orion.home.16 = c:/Apps/orion-1.6.0
#resin.home.20 = c:/Apps/resin-2.1.4
#tomcat.home.40 = c:/Apps/jakarta-tomcat-4.0.4
#resin.home.13 = xxx
#tomcat.home.33 = c:/Apps/jakarta-tomcat-3.3.1
# Note: Enhydra 3.3.1 does not seem to support BASIC authentication as defined
# in the Servlet spec. and thus the tests which involve security are failing.
# All other tests work fine. This is a limitation of Enhydra.
#enhydra.home.31 = c:/Apps/enhydra3.1.1b1
# Note: weblogic.home.61 is the location of BEA Home and NOT the location of
# wlserver6.1, inside the bea home directory.
#weblogic.home.61 = c:/Apps/bea
# Note: weblogic.home.70 is the location of BEA Home and NOT the location of
# wlserver7.0, inside the bea home directory.
#weblogic.home.70 = c:/bea
# Note: There seems to be a bug in Orion 1.4 preventing it to run correctly
# the testSendUserData() test. It runs fine in Orion 1.5 though.
#orion.home.14 = xxx
# Should we instrument our code with Clover (test coverage tool) ?
# Comment out to disable Clover (setting the property to false will have no
# effect).
#clover.enable = true
# Clover jar
clover.jar = ${lib.repo}/clover/jars/clover-0.6b.jar
1.1 jakarta-cactus/sample-jetty/conf/sample/build/build.xml
Index: build.xml
===================================================================
<?xml version="1.0"?>
<!--
=============================================================================
Build file for the Cactus Jetty Sample subproject (it shows how to use
Cactus and Jelly in an integrated way for unit testing the Servlet API :
Servlets, Fitlers, Taglibs).
The following Ant tasks need to be available in your ant installation (i.e.
the Ant task themselves and their dependent jars need to be put in
ANT_HOME/lib) :
junit [REQUIRED] JUnit Ant task
The mandatory and optional Ant properties are defined in
build.properties.sample. Please read and edit that file.
This script should be started with the following command line :
ant <target>
Run "ant -projecthelp" to get a list of available targets. The default
target is "dist"
=============================================================================
-->
<project name="Cactus Jetty Sample" default="dist" basedir="..">
<!-- Give user a chance to override without editing this file
(and without typing -D each time it compiles it) -->
<property file="build/build.properties" />
<property file="${user.home}/build.properties" />
<!-- Global project properties -->
<property name="project.name.text" value="Cactus Jetty Sample"/>
<property name="project.name.file" value="sample-jetty"/>
<property name="project.version" value="@version@"/>
<!-- Prefix to add to all distributable files -->
<property name="project.prefix" value="jakarta-"/>
<!-- Generic properties -->
<property name="year" value="@year@"/>
<property name="debug" value="on"/>
<property name="optimize" value="off"/>
<property name="deprecation" value="off"/>
<!--
========================================================================
Base directory for all file related operations
========================================================================
-->
<property name="base.dir" value="."/>
<!--
========================================================================
Set the properties related to the source tree.
========================================================================
-->
<property name="src.dir" value="${base.dir}/src"/>
<property name="src.sample.dir" value="${src.dir}/sample"/>
<property name="src.unit.dir" value="${src.dir}/unit"/>
<property name="build.dir" value="${base.dir}/build"/>
<property name="conf.dir" value="${base.dir}/conf"/>
<property name="conf.test.dir" value="${conf.dir}/test"/>
<property name="web.dir" value="${base.dir}/web"/>
<!--
========================================================================
Set the properties related to the target area
========================================================================
-->
<!-- Destination locations for the build -->
<property name="target.dir" value="${base.dir}/target"/>
<property name="target.classes.dir" value="${target.dir}/classes"/>
<property name="target.classes.sample.dir"
value="${target.classes.dir}/sample"/>
<property name="target.classes.unit.dir"
value="${target.classes.dir}/unit"/>
<property name="target.conf.dir" value="${target.dir}/conf"/>
<property name="target.conf.client.dir" value="${target.conf.dir}/client"/>
<property name="target.conf.server.dir" value="${target.conf.dir}/server"/>
<property name="target.doc.dir" value="${target.dir}/doc"/>
<property name="target.doc.api.dir" value="${target.doc.dir}/api"/>
<property name="target.test.dir" value="${target.dir}/test"/>
<property name="target.lib.dir" value="${target.dir}/lib"/>
<!-- Distribution directory, i.e. where the expanded distibutable files
are located -->
<property name="dist.dir" value="${base.dir}/dist"/>
<property name="dist.bin.dir" value="${dist.dir}/bin"/>
<property name="dist.doc.dir" value="${dist.dir}/doc"/>
<property name="dist.doc.api.dir" value="${dist.doc.dir}/api"/>
<!--
========================================================================
Default values that can be overidden
========================================================================
-->
<!-- The port that will be used to start the servers -->
<property name="test.port" value="8080"/>
<!--
========================================================================
Names of deliverables
========================================================================
-->
<!-- The Sample war -->
<property name="sample.war.name" value="${project.name.file}"/>
<!--
========================================================================
Useful patterns for targets
========================================================================
-->
<path id="project.class.path">
<pathelement location="${cactus.framework.jar}"/>
<pathelement location="${servlet.jar}"/>
<pathelement location="${log4j.jar}"/>
<pathelement location="${commons.logging.jar}"/>
<pathelement location="${commons.httpclient.jar}"/>
<pathelement location="${httpunit.jar}"/>
<pathelement location="${junit.jar}"/>
<pathelement location="${aspectjrt.jar}"/>
<pathelement location="${jetty.jar}"/>
<pathelement location="${jasper.jar}"/>
<!-- Includes system classpath for jars that are in ANT_HOME/lib such
as aspectrt.jar, etc -->
<pathelement path="${java.class.path}"/>
</path>
<!--
========================================================================
Display configurable properties values
========================================================================
-->
<target name="display.properties">
<echo message="----- ${project.name.text} ${project.version} -----"/>
<echo message=""/>
<echo message="java.class.path = ${java.class.path}"/>
<echo message=""/>
<echo message="java.home = ${java.home}"/>
<echo message="user.home = ${user.home}"/>
<echo message="ant.home = ${ant.home}"/>
<echo message=""/>
<echo message="cactus.framework.jar = ${cactus.framework.jar}"/>
<echo message="servlet.jar = ${servlet.jar}"/>
<echo message="aspectjrt.jar = ${aspectjrt.jar}"/>
<echo message="commons.logging.jar = ${commons.logging.jar}"/>
<echo message="commons.httpclient.jar = ${commons.httpclient.jar}"/>
<echo message="httpunit.jar = ${httpunit.jar}"/>
<echo message="junit.jar = ${junit.jar}"/>
<echo message="jetty.jar = ${jetty.jar}"/>
<echo message="jasper.jar = ${jasper.jar}"/>
<echo message=""/>
<echo message="log4j.jar (optional) = ${log4j.jar}"/>
<echo message="clover.jar (optional) = ${clover.jar}"/>
<echo message=""/>
<echo message="test.port = ${test.port}"/>
<echo message=""/>
</target>
<!--
========================================================================
Verify that all mandatory properties have been set
========================================================================
-->
<target name="check.properties"
depends="display.properties,check.properties.test,check.properties.warn"/>
<target name="check.properties.test">
<condition property="properties.ok">
<and>
<available file="${cactus.framework.jar}"/>
<available file="${servlet.jar}"/>
<available file="${aspectjrt.jar}"/>
<available file="${commons.logging.jar}"/>
<available file="${commons.httpclient.jar}"/>
<available file="${httpunit.jar}"/>
<available file="${junit.jar}"/>
<available file="${jetty.jar}"/>
<available file="${jasper.jar}"/>
</and>
</condition>
</target>
<target name="check.properties.warn" unless="properties.ok">
<fail message="Missing property or property pointing to an invalid file (check your build.properties file)"/>
</target>
<!--
========================================================================
Initialize the build. Must be called by all targets
========================================================================
-->
<target name="init" depends="check.properties">
<tstamp/>
<!-- Filters -->
<filter token="version" value="${project.version}"/>
<filter token="project.name.text" value="${project.name.text}"/>
<filter token="project.name.file" value="${project.name.file}"/>
<filter token="year" value="${year}"/>
<filter token="test.port" value="${test.port}"/>
</target>
<!--
========================================================================
Compiles the sources
========================================================================
-->
<!-- Compiles the sample sources -->
<target name="compile.sample" depends="init">
<mkdir dir="${target.classes.sample.dir}"/>
<javac destdir="${target.classes.sample.dir}"
deprecation="${deprecation}" optimize="${optimize}">
<src path="${src.sample.dir}"/>
<classpath>
<path refid="project.class.path"/>
</classpath>
</javac>
</target>
<!-- Compiles the unit sources -->
<target name="compile.unit" depends="init">
<mkdir dir="${target.classes.unit.dir}"/>
<javac destdir="${target.classes.unit.dir}"
deprecation="${deprecation}" optimize="${optimize}">
<src path="${src.unit.dir}"/>
<classpath>
<path refid="project.class.path"/>
</classpath>
</javac>
</target>
<target name="compile" depends="compile.sample,compile.unit"
description="Compile the sources">
</target>
<!--
========================================================================
Create the runtime war file
========================================================================
-->
<target name="war" depends="compile" description="Generate the runtime war">
<mkdir dir="${target.conf.client.dir}"/>
<!-- Copy the manifest in order to replace the version token filter -->
<copy todir="${target.conf.client.dir}" filtering="on">
<fileset dir="${conf.dir}" >
<include name="manifest"/>
</fileset>
</copy>
<war warfile="${target.dir}/${sample.war.name}.war"
webxml="${conf.dir}/web.xml"
manifest="${target.conf.client.dir}/manifest">
<classes dir="${target.classes.sample.dir}">
<!-- Do not include test files in the runtime war -->
<exclude name="**/Test*.*"/>
</classes>
<classes dir="${target.classes.unit.dir}">
<!-- Do not include test files in the runtime war -->
<exclude name="**/Test*.*"/>
</classes>
</war>
</target>
<!--
========================================================================
Generate the documentation (javadoc)
========================================================================
-->
<target name="doc" depends="init" description="Generate the documentation">
<mkdir dir="${target.doc.api.dir}"/>
<javadoc
packagenames="org.apache.cactus.sample.*,org.apache.cactus.unit.*"
destdir="${target.doc.api.dir}"
author="true"
public="true"
version="true"
use="true"
windowtitle="${project.name.text} ${project.version}"
doctitle="${project.name.text} ${project.version}"
bottom="Copyright &copy; ${year} Apache Software Foundation. All Rights Reserved.">
<sourcepath>
<pathelement location="${src.sample.dir}"/>
<pathelement location="${src.unit.dir}"/>
</sourcepath>
<classpath refid="project.class.path"/>
</javadoc>
</target>
<!--
========================================================================
Generate the distributable files
========================================================================
-->
<target name="dist" depends="clean,war,doc"
description="Generate the distributable files">
<mkdir dir="${dist.bin.dir}"/>
<mkdir dir="${dist.doc.api.dir}"/>
<copy todir="${dist.bin.dir}"
file="${target.dir}/${sample.war.name}.war"/>
<copy todir="${dist.doc.api.dir}">
<fileset dir="${target.doc.api.dir}"/>
</copy>
</target>
<!--
========================================================================
Clean generated files (including distributables)
========================================================================
-->
<target name="clean" depends="init" description="Clean all generated files">
<delete dir="${target.dir}"/>
<delete dir="${dist.dir}"/>
</target>
<!--
========================================================================
Run the Cactus test using the <junit> Ant task.
========================================================================
-->
<target name="prepare.test" depends="init">
<!-- Copy log_client.properties so that it is in the classpath -->
<copy tofile="${target.conf.client.dir}/log4j.properties"
file="${conf.test.dir}/log_client.properties"/>
</target>
<target name="test" depends="prepare.test,compile">
<junit printsummary="yes" haltonfailure="yes" haltonerror="yes"
fork="yes">
<jvmarg value="-Dcactus.contextURL=http://localhost:${test.port}/test"/>
<jvmarg value="-Dcactus.initializer=org.apache.cactus.extension.jetty.JettyInitializer"/>
<jvmarg value="-Dcactus.jetty.config=${conf.test.dir}/jetty.xml"/>
<jvmarg value="-Dcactus.jetty.resourceDir=${web.dir}"/>
<classpath>
<!-- Cactus.propertie and log_client.properties need to be in
the classpath -->
<pathelement location="${target.conf.client.dir}"/>
<pathelement location="${target.classes.sample.dir}"/>
<pathelement location="${target.classes.unit.dir}"/>
<path refid="project.class.path"/>
</classpath>
<formatter type="plain" usefile="false"/>
<!-- Note: The unit tests must be run first. See
org.apache.cactus.unit.TestAll for details -->
<test name="org.apache.cactus.unit.TestAll"/>
<test name="org.apache.cactus.sample.TestAll"/>
</junit>
</target>
</project>
1.1 jakarta-cactus/sample-jetty/conf/sample/build/build.properties.sample
Index: build.properties.sample
===================================================================
# -----------------------------------------------------------------------------
# build.properties.sample
#
# This is an example "build.properties" file, used to customize building the
# Cactus Servlet Sample for your local environment. Make any changes you need,
# and rename this file to "build.properties" in the same directory that
# contains the "build.xml" file.
#
# $Id: build.properties.sample,v 1.16 2002/08/30 20:46:40 vmassol Exp $
# -----------------------------------------------------------------------------
# WARNING: The relative paths below are relative to the directory where the
# build.xml file is located.
# -----------------------------------------------------------------------------
# Mandatory properties
# -----------------------------------------------------------------------------
# The location of the Cactus framework jar
cactus.framework.jar = ../lib/cactus-@version@.jar
# The location of the Servlet API 2.3 jar
servlet.jar = ../lib/servletapi-2.3.jar
# The location of the AspectJ runtime jar
aspectjrt.jar = ../lib/aspectjrt-1.0.6.jar
# The location of the Commons Logging jar
commons.logging.jar = ../lib/commons-logging-1.0.1jar
# The location of the log4j jar (optional). Only needed if you want Cactus to
# generate logs
log4j.jar = ../lib/log4j-1.2.6.jar
# The location of the Commons Httpclient jar
commons.httpclient.jar = ../lib/commons-httpclient-2.0alpha1-20020829.jar
# The location of the Junit jar
junit.jar = ../lib/junit-3.8.1.jar
# The location of the Httpunit jar
httpunit.jar = ../lib/httpunit-1.4.5.jar
# The location of the Jetty jar
jetty.jar = ../lib/org.mortbay.jetty-jdk1.2-4.1.0RC4.jar
# The location of the Jasper jar
jasper.jar = ../lib/org.apache.jasper-4.1.0RC4.jar
# -----------------------------------------------------------------------------
# Optional properties
# -----------------------------------------------------------------------------
# The port to use for starting the servers during unit testing. If not
# sepcified, it defaults to port 8080.
#test.port = 8081
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>