| <?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. |
| --> |
| |
| <!-- $Id$ --> |
| |
| <project name="lenya-test"> |
| |
| <description> |
| Test Targets |
| </description> |
| |
| <!-- === Test targets =========================================================== --> |
| |
| <property name="debug" value="true"/> |
| <property name="test.pub.id" value="test"/> |
| <property name="test.pub.source.id" value="default"/> |
| <property name="junit.test.loglevel" value="2"/> |
| <property name="junit.dir" value="${build.root}/test/output" /> |
| |
| <target name="set-test-patch-property"> |
| <property name="patch.webapp" value="false"/> |
| </target> |
| |
| <!-- |
| DEBUG 0 |
| INFO 1 |
| WARN 2 |
| ERROR 3 |
| FATAL 4 |
| --> |
| |
| <path id="classpath.default"> |
| <path refid="classpath"/> |
| <pathelement location="${build.test}" /> |
| <pathelement path="${build.webapp}/WEB-INF/classes" /> |
| <fileset dir="${build.webapp}/WEB-INF/lib"> |
| <include name="**.jar"/> |
| </fileset> |
| </path> |
| |
| <!-- Runs all tests --> |
| <target name="test" |
| description="Runs all tests" |
| depends="modules.test, tests.junit"/> |
| <!-- |
| depends="tests.junit, tests.anteater, tests.webtest"/> |
| --> |
| |
| <!-- Prepares the test publication --> |
| <target name="test.pub.prepare"> |
| <property name="test.pub.dir" value="${build.webapp}/lenya/pubs/${test.pub.id}"/> |
| <echo>Creating test publication at ${test.pub.dir}</echo> |
| <delete dir="${test.pub.dir}"/> |
| <mkdir dir="${test.pub.dir}"/> |
| <copy todir="${test.pub.dir}"> |
| <fileset dir="${build.webapp}/lenya/pubs/${test.pub.source.id}"> |
| <exclude name="content/**"/> |
| </fileset> |
| </copy> |
| <replace encoding="utf-8" |
| file="${build.webapp}/lenya/pubs/${test.pub.id}/config/publication.xml" |
| token="Default Publication" value="Test Publication"/> |
| <replace encoding="utf-8" |
| file="${build.webapp}/lenya/pubs/${test.pub.id}/config/search/lucene_index.xml" |
| token="default" value="test"/> |
| </target> |
| |
| <!-- prepares the tests. --> |
| <target name="tests.prepare" depends="init, test.pub.prepare, set-test-patch-property"> |
| <mkdir dir="${build.test}"/> |
| <mkdir dir="${junit.dir}" /> |
| |
| <!-- Copy test files to build test dir --> |
| <copy todir="${build.java.test}" filtering="on"> |
| <fileset dir="${src.test.impl.dir}"/> |
| </copy> |
| |
| <copyJavaSources pubsrootdirs="${pubs.root.dirs}" javadir="java/test" builddir="${build.java.test}" /> |
| |
| <path id="classpath.test"> |
| <path refid="classpath"/> |
| <fileset dir="${build.webapp}/WEB-INF/lib" includes="lenya-*.jar"/> |
| </path> |
| |
| <!-- Compile tests --> |
| <javac srcdir="${build.java.test}" |
| destdir="${build.test}" |
| debug="true" |
| debuglevel="lines,vars,source" |
| optimize="{optimize}" |
| deprecation="{deprecation}" |
| target="${target.vm}" |
| fork="true" |
| source="${src.java.version}"> |
| <classpath refid="classpath.test"/> |
| </javac> |
| |
| <!-- Copy test resources --> |
| <copy todir="${build.test}" filtering="on"> |
| <fileset dir="${build.java.test}" excludes="**.java"/> |
| </copy> |
| |
| <!-- Generate the xtest file --> |
| |
| <copy todir="${build.temp}/test" filtering="on" overwrite="true"> |
| <fileset dir="${src.resource.dir}/test"> |
| <include name="*-template.xml"/> |
| </fileset> |
| </copy> |
| |
| <copy todir="${build.temp}/test" filtering="on" overwrite="true" |
| file="${src.java.impl.dir}/org/apache/lenya/lenya.roles"/> |
| |
| <xpatch file="${build.temp}/test/lenya.roles" |
| srcdir="${build.patch}" |
| includes="lenya-roles/**/*.xroles" |
| addComments="true"/> |
| |
| <xslt in="${build.temp}/test/lenya.roles" |
| out="${build.temp}/test/roles.xsl" |
| style="${src.resource.dir}/test/meta.xsl"> |
| <param name="element" expression="roles"/> |
| </xslt> |
| |
| <xpatch file="${build.temp}/test/xconf-template.xml" |
| srcdir="${build.patch}/cocoon-xconf" |
| includes="prepare/*.xconf" |
| addComments="true"/> |
| <xpatch file="${build.temp}/test/xconf-template.xml" |
| srcdir="${build.patch}/cocoon-xconf" |
| includes="**/*.xconf" |
| excludes="prepare/*.xconf" |
| addComments="true"/> |
| |
| <xslt in="${build.temp}/test/xconf-template.xml" |
| out="${build.temp}/test/components.xsl" |
| style="${src.resource.dir}/test/meta.xsl"> |
| <param name="element" expression="components"/> |
| </xslt> |
| |
| <xslt in="${src.resource.dir}/test/template-xtest.xml" |
| out="${build.temp}/test/roles.xtest" |
| style="${build.temp}/test/roles.xsl"/> |
| |
| <xslt in="${build.temp}/test/roles.xtest" |
| out="${build.test}/org/apache/lenya/cms/LenyaTestCase.xtest" |
| style="${build.temp}/test/components.xsl"/> |
| |
| <!-- --> |
| |
| </target> |
| |
| |
| <!-- Runs JUnit tests --> |
| <target name="tests.junit" depends="patch-modules-test"> |
| <junit printsummary="yes" showoutput="true" haltonerror="on" haltonfailure="on" fork="true"> |
| <jvmarg value="-Djava.endorsed.dirs=${build.webapp}/WEB-INF/lib/endorsed"/> |
| <jvmarg value="-Dorg.xml.sax.parser=org.apache.xerces.parsers.SAXParser"/> |
| <sysproperty key="junit.test.loglevel" value="${junit.test.loglevel}"/> |
| <sysproperty key="contextRoot" value="${basedir}/build/lenya/webapp"/> |
| <sysproperty key="tempDir" value="${basedir}/build/lenya/temp"/> |
| <formatter type="plain" usefile="false" /> |
| <formatter type="xml" /> |
| <classpath refid="classpath"/> |
| <classpath> |
| <pathelement location="${build.test}" /> |
| <pathelement path="${build.webapp}/WEB-INF/classes" /> |
| <fileset dir="${build.webapp}/WEB-INF/lib"> |
| <include name="*.jar"/> |
| <include name="endorsed/*.jar"/> |
| </fileset> |
| <pathelement path="${src.test.impl.dir}"/> |
| </classpath> |
| |
| <batchtest todir="${junit.dir}"> |
| <fileset dir="${build.test}" includes="**/*Test.class" excludes="**/Abstract*.class"/> |
| </batchtest> |
| |
| </junit> |
| </target> |
| |
| |
| <!-- ================================================ --> |
| <!-- Anteater tests --> |
| <!-- ================================================ --> |
| <target name="tests.anteater"> |
| <property name="anteater.home" value=""/> |
| <property name="anteater.buildfile" value="src/test/anteater/tests.xml"/> |
| <java classname="org.apache.tools.ant.Main" fork="true"> |
| <classpath> |
| <pathelement location="${anteater.home}/resources"/> |
| <fileset dir="${anteater.home}"> |
| <include name="lib/**/*.jar"/> |
| </fileset> |
| </classpath> |
| <jvmarg value="-Dant.home=${anteater.home}"/> |
| <jvmarg value="-Danteater.home=${anteater.home}" /> |
| <jvmarg value="-Danteater.report=${anteater.home}/resources/scripts/report.xml" /> |
| <jvmarg value="-Danteater.resources=${anteater.home}/resources" /> |
| <arg line="-f ${anteater.buildfile}"/> |
| <arg value="-propertyfile" /> |
| <arg value="${anteater.home}/resources/META-INF/Anteater.properties" /> |
| <!-- |
| <arg value="-Ddefault.debug=10"/> |
| --> |
| </java> |
| </target> |
| |
| <!-- The XSP compilation target --> |
| <target name="compile-xsp" depends="tests.prepare" |
| description="Compile the XSP sources"> |
| <mkdir dir="${build.dir}/work"/> |
| <property name="compile-xsp.failonerror" value="false"/> <!-- may be overridden with -D --> |
| <java classname="org.apache.cocoon.bean.XSPPrecompileWrapper" failonerror="${compile-xsp.failonerror}"> |
| <arg value="-c${build.webapp}"/> |
| <arg value="-w${build.dir}/work"/> |
| <classpath> |
| <pathelement path="${build.webapp}/WEB-INF/classes"/> |
| <fileset dir="${build.webapp}/WEB-INF/lib"> |
| <include name="**/*.jar"/> |
| </fileset> |
| <fileset dir="tools/jetty/lib"> |
| <include name="servlet-*.jar"/> |
| </fileset> |
| </classpath> |
| </java> |
| </target> |
| </project> |