You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by ek...@apache.org on 2006/04/20 17:28:22 UTC
svn commit: r395619 [1/2] - in /beehive/trunk: controls/test/
controls/test/common/ controls/test/dist-test/
controls/test/dist-test/files/ controls/test/infra/mantis/
controls/test/infra/milton/ controls/test/tools/mantis/
controls/test/tools/mantis/s...
Author: ekoneil
Date: Thu Apr 20 08:28:13 2006
New Revision: 395619
URL: http://svn.apache.org/viewcvs?rev=395619&view=rev
Log:
Re-organize the Controls test web application to make it easier to build / debug with an IDE. This makes several major changes:
- reorg the controls/test/webapps/ directory to represent a single webapp with the web/ + src/ structure
- change the way Milton / Mantis code generate Page Flows and JUnit tests that drive Page Flows. The Milton tool was writing JPFs into a hard coded directory; now, the source files it writes are put into a "srcgen" directory and then copied into the appropriate places. There are only 6 code generated files, AFAICT, so it should be easy to decouple from Milton and remove it entirely.
- fixup the way that the controlsWeb webapp is built for distribution testing. Because of the dependencies of controlsWeb, the builds are different between the distribution tests and SVN. This should be easy to fix, but I've not done it here.
- move all .java source files from web/ to src/
BB: self
Test: Controls and distribution tests pass
Added:
beehive/trunk/controls/test/webapps/build.properties
beehive/trunk/controls/test/webapps/src/
beehive/trunk/controls/test/webapps/src/binding/
beehive/trunk/controls/test/webapps/src/binding/BindingTests.java
- copied unchanged from r395347, beehive/trunk/controls/test/webapps/controlsWeb/binding/BindingTests.java
beehive/trunk/controls/test/webapps/src/composition/
beehive/trunk/controls/test/webapps/src/composition/Controller.java
- copied unchanged from r395347, beehive/trunk/controls/test/webapps/controlsWeb/composition/Controller.java
beehive/trunk/controls/test/webapps/src/context/
beehive/trunk/controls/test/webapps/src/context/getotherservice/
beehive/trunk/controls/test/webapps/src/context/getotherservice/Controller.java
- copied unchanged from r395347, beehive/trunk/controls/test/webapps/controlsWeb/context/getotherservice/Controller.java
beehive/trunk/controls/test/webapps/src/context/getotherservice2/
beehive/trunk/controls/test/webapps/src/context/getotherservice2/Controller.java
- copied unchanged from r395347, beehive/trunk/controls/test/webapps/controlsWeb/context/getotherservice2/Controller.java
beehive/trunk/controls/test/webapps/src/contextevent/
beehive/trunk/controls/test/webapps/src/contextevent/beanrecord/
beehive/trunk/controls/test/webapps/src/contextevent/beanrecord/Controller.java
- copied unchanged from r395347, beehive/trunk/controls/test/webapps/controlsWeb/contextevent/beanrecord/Controller.java
beehive/trunk/controls/test/webapps/src/contextevent/implrecord/
beehive/trunk/controls/test/webapps/src/contextevent/implrecord/Controller.java
- copied unchanged from r395347, beehive/trunk/controls/test/webapps/controlsWeb/contextevent/implrecord/Controller.java
beehive/trunk/controls/test/webapps/src/contextevent/implrecord2/
beehive/trunk/controls/test/webapps/src/contextevent/implrecord2/Controller.java
- copied unchanged from r395347, beehive/trunk/controls/test/webapps/controlsWeb/contextevent/implrecord2/Controller.java
beehive/trunk/controls/test/webapps/src/event/
beehive/trunk/controls/test/webapps/src/event/eventhandler/
beehive/trunk/controls/test/webapps/src/event/eventhandler/Controller.java
- copied unchanged from r395347, beehive/trunk/controls/test/webapps/controlsWeb/event/eventhandler/Controller.java
beehive/trunk/controls/test/webapps/src/event/listener/
beehive/trunk/controls/test/webapps/src/event/listener/Controller.java
- copied unchanged from r395347, beehive/trunk/controls/test/webapps/controlsWeb/event/listener/Controller.java
beehive/trunk/controls/test/webapps/src/extension/
beehive/trunk/controls/test/webapps/src/extension/Controller.java
- copied unchanged from r395347, beehive/trunk/controls/test/webapps/controlsWeb/extension/Controller.java
beehive/trunk/controls/test/webapps/src/instantiate/
beehive/trunk/controls/test/webapps/src/instantiate/declarewithproperty/
beehive/trunk/controls/test/webapps/src/instantiate/declarewithproperty/Controller.java
- copied unchanged from r395347, beehive/trunk/controls/test/webapps/controlsWeb/instantiate/declarewithproperty/Controller.java
beehive/trunk/controls/test/webapps/src/instantiate/programwithproperty/
beehive/trunk/controls/test/webapps/src/instantiate/programwithproperty/Controller.java
- copied unchanged from r395347, beehive/trunk/controls/test/webapps/controlsWeb/instantiate/programwithproperty/Controller.java
beehive/trunk/controls/test/webapps/src/property/
beehive/trunk/controls/test/webapps/src/property/client_access/
beehive/trunk/controls/test/webapps/src/property/client_access/Controller.java
- copied unchanged from r395347, beehive/trunk/controls/test/webapps/controlsWeb/property/client_access/Controller.java
beehive/trunk/controls/test/webapps/src/property/client_access2/
beehive/trunk/controls/test/webapps/src/property/client_access2/Controller.java
- copied unchanged from r395347, beehive/trunk/controls/test/webapps/controlsWeb/property/client_access2/Controller.java
beehive/trunk/controls/test/webapps/src/property/client_impl/
beehive/trunk/controls/test/webapps/src/property/client_impl/Controller.java
- copied unchanged from r395347, beehive/trunk/controls/test/webapps/controlsWeb/property/client_impl/Controller.java
beehive/trunk/controls/test/webapps/src/property/client_impl2/
beehive/trunk/controls/test/webapps/src/property/client_impl2/Controller.java
- copied unchanged from r395347, beehive/trunk/controls/test/webapps/controlsWeb/property/client_impl2/Controller.java
beehive/trunk/controls/test/webapps/src/property/impl_access/
beehive/trunk/controls/test/webapps/src/property/impl_access/Controller.java
- copied unchanged from r395347, beehive/trunk/controls/test/webapps/controlsWeb/property/impl_access/Controller.java
beehive/trunk/controls/test/webapps/src/property/impl_access2/
beehive/trunk/controls/test/webapps/src/property/impl_access2/Controller.java
- copied unchanged from r395347, beehive/trunk/controls/test/webapps/controlsWeb/property/impl_access2/Controller.java
beehive/trunk/controls/test/webapps/src/property/membership/
beehive/trunk/controls/test/webapps/src/property/membership/Controller.java
- copied unchanged from r395347, beehive/trunk/controls/test/webapps/controlsWeb/property/membership/Controller.java
beehive/trunk/controls/test/webapps/src/property/property_constraints/
beehive/trunk/controls/test/webapps/src/property/property_constraints/Controller.java
- copied unchanged from r395347, beehive/trunk/controls/test/webapps/controlsWeb/property/property_constraints/Controller.java
beehive/trunk/controls/test/webapps/src/property/veto/
beehive/trunk/controls/test/webapps/src/property/veto/Controller.java
- copied unchanged from r395347, beehive/trunk/controls/test/webapps/controlsWeb/property/veto/Controller.java
beehive/trunk/controls/test/webapps/src/results/
beehive/trunk/controls/test/webapps/src/results/Controller.java
- copied unchanged from r395347, beehive/trunk/controls/test/webapps/controlsWeb/results/Controller.java
beehive/trunk/controls/test/webapps/web/
- copied from r395347, beehive/trunk/controls/test/webapps/controlsWeb/
Removed:
beehive/trunk/controls/test/webapps/controlsWeb/
beehive/trunk/controls/test/webapps/web/binding/BindingTests.java
beehive/trunk/controls/test/webapps/web/composition/Controller.java
beehive/trunk/controls/test/webapps/web/context/getotherservice/Controller.java
beehive/trunk/controls/test/webapps/web/context/getotherservice2/Controller.java
beehive/trunk/controls/test/webapps/web/contextevent/beanrecord/Controller.java
beehive/trunk/controls/test/webapps/web/contextevent/implrecord/Controller.java
beehive/trunk/controls/test/webapps/web/contextevent/implrecord2/Controller.java
beehive/trunk/controls/test/webapps/web/event/eventhandler/Controller.java
beehive/trunk/controls/test/webapps/web/event/listener/Controller.java
beehive/trunk/controls/test/webapps/web/extension/Controller.java
beehive/trunk/controls/test/webapps/web/instantiate/declarewithproperty/Controller.java
beehive/trunk/controls/test/webapps/web/instantiate/programwithproperty/Controller.java
beehive/trunk/controls/test/webapps/web/property/client_access/Controller.java
beehive/trunk/controls/test/webapps/web/property/client_access2/Controller.java
beehive/trunk/controls/test/webapps/web/property/client_impl/Controller.java
beehive/trunk/controls/test/webapps/web/property/client_impl2/Controller.java
beehive/trunk/controls/test/webapps/web/property/impl_access/Controller.java
beehive/trunk/controls/test/webapps/web/property/impl_access2/Controller.java
beehive/trunk/controls/test/webapps/web/property/membership/Controller.java
beehive/trunk/controls/test/webapps/web/property/property_constraints/Controller.java
beehive/trunk/controls/test/webapps/web/property/veto/Controller.java
beehive/trunk/controls/test/webapps/web/results/Controller.java
Modified:
beehive/trunk/controls/test/build.xml
beehive/trunk/controls/test/common/path.properties
beehive/trunk/controls/test/dist-test/build.xml
beehive/trunk/controls/test/dist-test/files/build.xml
beehive/trunk/controls/test/infra/mantis/mantis.jar
beehive/trunk/controls/test/infra/milton/milton.jar
beehive/trunk/controls/test/tools/mantis/build.xml
beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/MantisFactory.java
beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/MantisTask.java
beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/annotations/Milton.java
beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/MiltonProcessor.java
beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/MiltonTestSuite.java
beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/generator/JpfClient.java
beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/generator/MiltonTestClient.java
beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/generator/VelocityGenerator.java
beehive/trunk/controls/test/webapps/build.xml
beehive/trunk/test/dist-test/build.xml
Modified: beehive/trunk/controls/test/build.xml
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/build.xml?rev=395619&r1=395618&r2=395619&view=diff
==============================================================================
--- beehive/trunk/controls/test/build.xml (original)
+++ beehive/trunk/controls/test/build.xml Thu Apr 20 08:28:13 2006
@@ -140,6 +140,8 @@
<property name="test.freq" value="checkin"/>
<antcall target="test.server"/>
+
+ <delete dir="webapps/src/milton"/>
</target>
<target name="bvt" description="Run the entire Controls test suite">
@@ -243,12 +245,12 @@
<echo>== Build helper class for testing controls</echo>
<!-- Build the test source directory -->
<javac srcdir="${controls.test.drivers}"
- destdir="${build.drivers}"
- classpathref="test.classpath"
- debug="on"
- optimize="on"
- verbose="false"
- failonerror="true">
+ destdir="${build.drivers}"
+ classpathref="test.classpath"
+ debug="on"
+ optimize="on"
+ verbose="false"
+ failonerror="true">
<classpath>
<pathelement location="${milton.jar}"/>
</classpath>
@@ -268,14 +270,14 @@
<!-- First APT process Unit files. There should be a lot of files in here needing processing. -->
<apt srcdir="${controls.test.units}"
- destdir="${build.tests}"
- gendir="${build.beansrc}"
- classpathref="test.classpath"
- srcExtensions="*.java"
- debug="on"
- optimize="on"
- verbose="false"
- failonerror="true">
+ destdir="${build.tests}"
+ gendir="${build.beansrc}"
+ classpathref="test.classpath"
+ srcExtensions="*.java"
+ debug="on"
+ optimize="on"
+ verbose="false"
+ failonerror="true">
<classpath>
<pathelement location="${milton.jar}"/>
<pathelement location="${mantis.jar}"/>
@@ -287,14 +289,14 @@
<!-- compile junits generated by mantis-drivers -->
<apt srcdir="${mantis.milton.control.test.accessers}"
- destdir="${build.tests}"
- gendir="${build.beansrc}"
- classpathref="test.classpath"
- srcExtensions="*.java"
- debug="on"
- optimize="on"
- verbose="false"
- failonerror="true">
+ destdir="${build.tests}"
+ gendir="${build.beansrc}"
+ classpathref="test.classpath"
+ srcExtensions="*.java"
+ debug="on"
+ optimize="on"
+ verbose="false"
+ failonerror="true">
<classpath>
<pathelement location="${milton.jar}"/>
<pathelement location="${mantis.jar}"/>
@@ -305,8 +307,7 @@
<echo message="== Assembling Tests"/>
- <!-- in the assemble phase, any clients processed above which use controls requiring
- assembly will be dealt with here -->
+ <!-- in the assemble phase, any clients processed above which use controls requiring assembly will be dealt with here -->
<assemble moduleDir="${build.tests}"
srcOutputDir="${build.testsrc}"
contextFactoryClassname="org.apache.beehive.controls.runtime.assembly.EJBAssemblyContext$Factory">
@@ -352,14 +353,6 @@
<!-- -->
<!-- ==================================================================== -->
- <!-- ==================================================================== -->
- <!-- -->
- <!-- -->
- <!-- Targets for Milton/Mantis/TCH tests -->
- <!-- -->
- <!-- -->
- <!-- ==================================================================== -->
-
<target name="test.server">
<antcall target="build-test-webapp"/>
<parallel>
@@ -397,7 +390,7 @@
<property name="gtlf.dtd.local" value="infra/gtlf/gtlf-config-2.0.dtd"/>
<property name="test.hostname" value="${hostname}"/>
- <property name="test.hostname.port" value="8080"/> <!-- app server default port -->
+ <property name="test.hostname.port" value="8080"/>
<property name="test-suite" value="${mantis.tch.srcgen.dir}/root.xml"/>
<property name="tch.base-logfile-name" value="tch"/>
@@ -434,7 +427,7 @@
<!-- =========================================================== -->
<!-- Mantis settings -->
<!-- =========================================================== -->
- <target name="mantis.tch" description="autogen TCH xml based on test source annotations">
+ <target name="mantis.tch" description="Autogen TCH xml based on test source annotations">
<delete dir="${mantis.tch.srcgen.dir}"/>
<delete dir="${mantis.tch.bingen.dir}"/>
<delete dir="${mantis.tch.log.dir}"/>
@@ -448,14 +441,17 @@
timeout="10000"
aptcommand="${os.JAVA_HOME}/bin/apt"
failonerror="true">
- <include name="${mantis.milton.control.test.accessers.relative}/**/*.java"/>
+ <include name="build/mantis.srcgen/testsrcgen/**/*.java"/>
<include name="src/units/**/*.java"/>
</mantis>
</target>
- <target name="mantis.milton" description="autogen client code for controls drivers">
+ <target name="mantis.milton" description="Generate Page Flow Controllers to drive Control tests">
<delete dir="${mantis.milton.log.dir}"/>
+
<mkdir dir="${mantis.milton.control.test.accessers}"/>
+
+ <echo>===== mantis.config: ${mantis.config}</echo>
<mantis srcdir="${controls.test.drivers}"
includes="**/*.java"
srcgen="${mantis.milton.srcgen.dir}"
@@ -468,6 +464,16 @@
processorArgs="webapp.name=${controls.test.webapp.name},accesser.src.gendir=${milton.accesser.src.gendir},webapp.gen.dir=${controls.webapp.dir.name}"
aptcommand="${os.JAVA_HOME}/bin/apt"
failonerror="true"/>
+
+ <!--
+ Apparently, the mantis task above generates both Page Flows to host control tests and
+ the JUnit tests to execute them from a client. This step copies the files needed
+ in the web application to the webapp. This is _bad_, but it's better than the
+ magic that was happening before...
+ -->
+ <copy todir="webapps/src/">
+ <fileset dir="${mantis.milton.srcgen.dir}" includes="milton/**"/>
+ </copy>
</target>
<target name="update.beaninfo" description="Refresh the .beaninfo files used to test BeanInfo creation during Controls testing.">
Modified: beehive/trunk/controls/test/common/path.properties
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/common/path.properties?rev=395619&r1=395618&r2=395619&view=diff
==============================================================================
--- beehive/trunk/controls/test/common/path.properties (original)
+++ beehive/trunk/controls/test/common/path.properties Thu Apr 20 08:28:13 2006
@@ -7,7 +7,7 @@
controls.test.root=${controls.dir}/test
controls.test.infra.dir=${controls.dir}/test/infra
-!-- BeeHive test specific properties -->
+!-- Beehive test specific properties -->
controls.test.src=${controls.test.root}/src
controls.test.units=${controls.test.src}/units
controls.test.drivers=${controls.test.src}/drivers
@@ -59,11 +59,11 @@
mantis.runtime.basedir=${controls.test.root}
milton.accesser.src.gendir=testsrcgen
-mantis.milton.srcgen.dir=${build.dir}
+mantis.milton.srcgen.dir=${build.dir}/mantis.srcgen
mantis.milton.bingen.dir=${build.dir}
mantis.milton.log.dir=${build.dir}/mantis.milton.logs
-mantis.milton.control.test.accessers=${build.dir}/${milton.accesser.src.gendir}
-mantis.milton.control.test.accessers.relative=${build.dir.name}/${milton.accesser.src.gendir}
+mantis.milton.control.test.accessers=${mantis.milton.srcgen.dir}/testsrcgen
+# mantis.milton.control.test.accessers.relative=${build.dir.name}/${milton.accesser.src.gendir}
mantis.tch.srcgen.dir=${build.dir}/mantis.tch.cases
mantis.tch.bingen.dir=${build.dir}/mantis.tch.bingen
Modified: beehive/trunk/controls/test/dist-test/build.xml
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/dist-test/build.xml?rev=395619&r1=395618&r2=395619&view=diff
==============================================================================
--- beehive/trunk/controls/test/dist-test/build.xml (original)
+++ beehive/trunk/controls/test/dist-test/build.xml Thu Apr 20 08:28:13 2006
@@ -1,5 +1,22 @@
<?xml version="1.0"?>
+<!--
+ Copyright 2004 The Apache Software Foundation.
+
+ Licensed 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/Controls/TestDistBuild" default="usage" basedir=".">
<property environment="os"/>
@@ -11,7 +28,6 @@
<target name="assemble.tests" description="Assemble all components for controls test distribution">
<!-- Copy external jars required by controls tests to beehive-test-dist/controls/external -->
-
<copy todir="${test.dist.base.dir}/beehive-test-dist/controls/external">
<fileset dir="../../../external/httpunit" includes="*.jar"/>
<fileset dir="../../../external/jakarta" includes="*.jar"/>
@@ -31,10 +47,6 @@
<copy todir="${test.dist.base.dir}/beehive-test-dist/controls/test/infra">
<fileset dir="../infra" />
</copy>
-
- <copy todir="${test.dist.base.dir}/beehive-test-dist/controls/test">
- <fileset dir="files"/>
- </copy>
<!-- Copy test jars -->
<copy file="../build/controlstestbeans.jar"
@@ -50,27 +62,21 @@
</copy>
<!-- Copy the web application to beehive-test-dist/controls/test/webapps-->
- <copy todir="${test.dist.base.dir}/beehive-test-dist/controls/test/webapps/controlsWeb">
- <fileset dir="../webapps/controlsWeb">
- <include name="**"/>
- <exclude name="**/*.jws"/>
- </fileset>
+ <copy todir="${test.dist.base.dir}/beehive-test-dist/controls/test/webapps">
+ <fileset dir="../webapps" includes="**"/>
</copy>
<!-- Inject milton into controlsWeb-->
- <copy todir="${test.dist.base.dir}/beehive-test-dist/controls/test/webapps/controlsWeb/WEB-INF" overwrite="true">
+ <copy todir="${test.dist.base.dir}/beehive-test-dist/controls/test/webapps/src" overwrite="true">
<fileset dir="../webapps/common/milton" includes="src/**"/>
</copy>
- <copy todir="${test.dist.base.dir}/beehive-test-dist/controls/test/webapps/controlsWeb" verbose="true" overwrite="true">
+ <copy todir="${test.dist.base.dir}/beehive-test-dist/controls/test/webapps/web" verbose="true" overwrite="true">
<fileset dir="../webapps/common/milton" includes="resources/**"/>
</copy>
- <!--Copy mantis generated tests-->
- <copy todir="${test.dist.base.dir}/beehive-test-dist/controls/test/webapps/controlsWeb/WEB-INF/src/milton" verbose="true" overwrite="true">
- <fileset dir="../build/webapps/controlsWeb/WEB-INF/src/milton">
- <exclude name="**/*.jws"/>
- </fileset>
+ <copy todir="${test.dist.base.dir}/beehive-test-dist/controls/test" overwrite="true">
+ <fileset dir="files"/>
</copy>
</target>
Modified: beehive/trunk/controls/test/dist-test/files/build.xml
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/dist-test/files/build.xml?rev=395619&r1=395618&r2=395619&view=diff
==============================================================================
--- beehive/trunk/controls/test/dist-test/files/build.xml (original)
+++ beehive/trunk/controls/test/dist-test/files/build.xml Thu Apr 20 08:28:13 2006
@@ -7,6 +7,7 @@
================================================================ -->
<project name="Beehive/Controls/distribution-test" default="usage" basedir=".">
+ <import file="${dist.home}/beehive-imports.xml"/>
<import file="../../test-imports.xml"/>
<import file="common/controls-test-imports.xml"/>
<property file="common/path.properties"/>
@@ -48,20 +49,16 @@
classname="org.apache.beehive.test.tools.tch.TchVMTask"
classpathref="tch.run.classpath"/>
- <condition property="controls.dir.exist">
- <available file="${build.dir}/testResults/controls"/>
- </condition>
-
<!-- ================================================================ -->
<!-- -->
- <!-- Target to run all checkin/detailed tests -->
+ <!-- Target to run all checkin/detailed tests -->
<!-- -->
<!-- ================================================================ -->
<target name="run.tests" description="Run all tests">
<antcall target="clean.controlsWeb"/>
<mkdir dir="${build.dir}/testResults/controls"/>
- <antcall target="prepare.controlsWeb"/>
+
<antcall target="build.controlsWeb"/>
<antcall target="checkin.tests"/>
@@ -74,23 +71,11 @@
<!-- Target to build controlsWeb -->
<!-- -->
<!-- ================================================================ -->
- <target name="prepare.controlsWeb" description="Prepare controlsWeb in build area">
- <copy todir="${build.dir}/webapps/controlsWeb">
- <fileset dir="${controls.test.home}/test/webapps/controlsWeb"/>
- </copy>
- </target>
-
<target name="build.controlsWeb" description="Build controlsWeb to test controls">
- <antcall target="update.runtime"/>
-
- <copy todir="${webapp.dir}/WEB-INF/lib/" file="${basedir}/jars/controlstestbeans.jar"/>
- <copy todir="${webapp.dir}/WEB-INF/lib/" file="${basedir}/jars/controlstestdrivers.jar"/>
- <copy todir="${webapp.dir}/WEB-INF/lib/" file="${basedir}/infra/milton/milton.jar"/>
-
- <build-webapp webappDir="${webapp.dir}"/>
- </target>
+ <copy todir="${webapp.dir}">
+ <fileset dir="${controls.test.home}/test/webapps/web"/>
+ </copy>
- <target name="update.runtime" description="Update NetUI runtime in controlsWeb without compiling">
<deploy-netui webappDir="${webapp.dir}"/>
<copy todir="${webapp.dir}/WEB-INF/lib" file="../../external/apache-xbean.jar"/>
@@ -100,6 +85,44 @@
<copy todir="${webapp.dir}/WEB-INF/lib">
<fileset dir="../external/axis" includes="*.jar"/>
</copy>
+
+ <copy todir="${webapp.dir}/WEB-INF/lib/" file="${basedir}/jars/controlstestbeans.jar"/>
+ <copy todir="${webapp.dir}/WEB-INF/lib/" file="${basedir}/jars/controlstestdrivers.jar"/>
+ <copy todir="${webapp.dir}/WEB-INF/lib/" file="${basedir}/infra/milton/milton.jar"/>
+
+ <property name="_webapp.dir" location="webapps"/>
+ <property name="src.dir" location="${_webapp.dir}/src"/>
+ <property name="web.dir" location="${_webapp.dir}/web"/>
+
+ <property name="webapp.build.dir" location="${webapp.dir}"/>
+ <property name="classes.dir" location="${webapp.build.dir}/WEB-INF/classes"/>
+ <property name="sourcegen.dir" location="${webapp.build.dir}/WEB-INF/.tmpbeansrc"/>
+
+ <path id="build.classpath">
+ <pathelement location="${classes.dir}"/>
+ <fileset dir="${webapp.build.dir}/WEB-INF/lib" includes="*.jar"/>
+
+ <path refid="velocity.dependency.path"/>
+ <path refid="netui-compiler.dependency.path"/>
+
+ <pathelement location="${os.CATALINA_HOME}/common/lib/servlet-api.jar"/>
+ <pathelement location="${os.CATALINA_HOME}/common/lib/jsp-api.jar"/>
+ </path>
+
+ <taskdef name="apt"
+ classname="org.apache.beehive.controls.runtime.generator.AptTask"
+ classpathref="build.classpath"
+ onerror="fail"/>
+
+ <mkdir dir="${classes.dir}"/>
+
+ <apt srcdir="${src.dir}"
+ destdir="${classes.dir}"
+ gendir="${sourcegen.dir}"
+ classpathref="build.classpath"
+ debug="true"
+ processorOptions="web.content.root=${web.dir}"
+ nocompile="false"/>
</target>
<target name="checkin.tests">
@@ -107,8 +130,6 @@
<delete dir="${build.dir}/testResults/controls/${test.freq}"/>
<mkdir dir="${build.dir}/testResults/controls/${test.freq}"/>
- <echo message="${do.start.tomcat}"/>
-
<antcall target="run.test"/>
</target>
@@ -121,24 +142,24 @@
</target>
<target name="run.test">
- <parallel>
- <antcall target="tomcat.start"/>
- <sequential>
- <echo message="start a second thread, wait for Tomcat to start."/>
- <sleep seconds="20"/>
- <echo message="continue the second thread, deploy controlsWeb."/>
- <ant dir="webapps" antfile="build.xml" target="ensure.deployed">
- <property name="build.dir" value="${build.dir}"/>
- </ant>
- <echo message="continue the second thread, run junit tests."/>
-
- <antcall target="run"/>
-
- <echo message="continue the second thread, undeploy controlsWeb."/>
- <ant dir ="webapps" antfile="build.xml" target="undeploy"/>
- <echo message="stop tomcat server, finish all the threads."/>
- <antcall target="tomcat.stop"/>
- </sequential>
+ <parallel>
+ <antcall target="tomcat.start"/>
+ <sequential>
+ <echo message="start a second thread, wait for Tomcat to start."/>
+ <sleep seconds="20"/>
+ <echo message="continue the second thread, deploy controlsWeb."/>
+ <ant dir="webapps" antfile="build.xml" target="ensure.deployed">
+ <property name="build.dir" value="${build.dir}"/>
+ </ant>
+ <echo message="continue the second thread, run junit tests."/>
+
+ <antcall target="run"/>
+
+ <echo message="continue the second thread, undeploy controlsWeb."/>
+ <ant dir ="webapps" antfile="build.xml" target="undeploy"/>
+ <echo message="stop tomcat server, finish all the threads."/>
+ <antcall target="tomcat.stop"/>
+ </sequential>
</parallel>
</target>
Modified: beehive/trunk/controls/test/infra/mantis/mantis.jar
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/infra/mantis/mantis.jar?rev=395619&r1=395618&r2=395619&view=diff
==============================================================================
Binary files - no diff available.
Modified: beehive/trunk/controls/test/infra/milton/milton.jar
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/infra/milton/milton.jar?rev=395619&r1=395618&r2=395619&view=diff
==============================================================================
Binary files - no diff available.
Modified: beehive/trunk/controls/test/tools/mantis/build.xml
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/mantis/build.xml?rev=395619&r1=395618&r2=395619&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/mantis/build.xml (original)
+++ beehive/trunk/controls/test/tools/mantis/build.xml Thu Apr 20 08:28:13 2006
@@ -17,7 +17,7 @@
$Header:$
-->
-<project name="mantis-build" default="usage">
+<project name="mantis-build" default="usage" basedir=".">
<property environment="os"/>
<import file="../../../../beehive-imports.xml"/>
@@ -25,14 +25,14 @@
<property file="${beehive.home}/controls/test/common/path.properties"/>
<!-- mantis properties -->
- <property name="mantis.root" value="${basedir}"/>
- <property name="src.dir" value="${mantis.root}/src"/>
- <property name="mantis.build.dir" value="${mantis.root}/build"/>
- <property name="deploy.dir" value="${mantis.root}/deploy"/>
- <property name="doc.dir" value="${mantis.root}/build/doc"/>
- <property name="temp.dir" value="${mantis.root}/temp"/>
- <property name="lib.dir" value="${mantis.root}/lib"/>
- <property name="mantis.local.deploy.jar" value="${deploy.dir}/mantis.jar"/>
+ <property name="mantis.root" location="${basedir}"/>
+ <property name="src.dir" location="${mantis.root}/src"/>
+ <property name="mantis.build.dir" location="${mantis.root}/build"/>
+ <property name="deploy.dir" location="${mantis.root}/deploy"/>
+ <property name="doc.dir" location="${mantis.root}/build/doc"/>
+ <property name="temp.dir" location="${mantis.root}/temp"/>
+ <property name="lib.dir" location="${mantis.root}/lib"/>
+ <property name="mantis.local.deploy.jar" location="${deploy.dir}/mantis.jar"/>
<!--************-->
<!-- CLASSPATHS -->
@@ -76,7 +76,7 @@
</javac>
</target>
- <target name="deploy">
+ <target name="deploy" depends="build">
<delete dir="${deploy.dir}"/>
<mkdir dir="${deploy.dir}"/>
<jar destfile="${mantis.local.deploy.jar}" basedir="${mantis.build.dir}" excludes="**/mantis/test/**"/>
Modified: beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/MantisFactory.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/MantisFactory.java?rev=395619&r1=395618&r2=395619&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/MantisFactory.java (original)
+++ beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/MantisFactory.java Thu Apr 20 08:28:13 2006
@@ -2,8 +2,6 @@
import com.sun.mirror.apt.*;
import com.sun.mirror.declaration.*;
-import com.sun.mirror.type.*;
-import com.sun.mirror.util.*;
import java.io.FileReader;
import java.io.FileNotFoundException;
@@ -19,193 +17,171 @@
import java.util.Map;
import java.util.Set;
import java.util.Iterator;
-import static java.util.Collections.*;
+import java.util.Collections;
+public class MantisFactory implements AnnotationProcessorFactory {
-public class MantisFactory implements AnnotationProcessorFactory
-{
- // map of annotation package to processor name
- private HashMap<String,String> _processorMap;
-
- // claim that all annotations are handled by this factory
- // at runtime the mantis config is loaded in getProcessorFor()
- private static final Collection<String> _supportedAnnotations
- = unmodifiableCollection(Arrays.asList("*"));
-
- // options passed to apt at runtime
- private Map<String,String> _options;
-
- // options that are supported
- private final Collection<String> _supportedOptions;
-
-
- public MantisFactory()
- {
- this._supportedOptions = initSupportedOptions();
- }
-
-
- public Collection<String> supportedAnnotationTypes(){return _supportedAnnotations;}
-
- public Collection<String> supportedOptions(){return _supportedOptions;}
-
- public AnnotationProcessor getProcessorFor(Set<AnnotationTypeDeclaration> p_atds,
- AnnotationProcessorEnvironment p_env)
- {
- // parse the command line args
- // TODO: when apt gives proper key=value pairs, chage to fit.
- // TODO: for now, everything is in the key
- String configurl = null;
- String processorName = null;
- Set<String> keys = p_env.getOptions().keySet();
- Iterator it = keys.iterator();
- while(it.hasNext())
- {
- String curr = (String) it.next();
- String[] val = curr.split("=");
- if(val[0].equalsIgnoreCase("-Aprocessor"))
- processorName = val[1];
- else if(val[0].equalsIgnoreCase("-Aconfig"))
- configurl = val[1];
- }
- it = null;
-
- // initiialize the configuration
- initProcessorMap(configurl);
-
- // initialize the processor(s)
- // if no command line override - return a composite
- // of all processors that map the the annotations present
- HashSet<AnnotationProcessor> processors = new HashSet<AnnotationProcessor>();
- if(null == processorName)
- {
-
- // first loop through the annotation types and collect the
- // set of unique annotation package names
- it = p_atds.iterator();
- HashSet<String> annotationPackages = new HashSet<String>();
- while(it.hasNext())
- {
- AnnotationTypeDeclaration atd = (AnnotationTypeDeclaration)it.next();
- annotationPackages.add(atd.getPackage().getQualifiedName());
- }
- it = null;
-
- // loop through the unique annotation package names
- // and initialize a uniqe set of processor names
- // (processors may register for more than one annotation pkg)
- HashSet<String> activeProcessors = new HashSet<String>();
- for(String pkg : annotationPackages)
- {
- if(_processorMap.containsKey(pkg))
- {
- activeProcessors.add(_processorMap.get(pkg));
+ // map of annotation package to processor name
+ private HashMap<String, String> _processorMap;
+
+ // claim that all annotations are handled by this factory
+ // at runtime the mantis config is loaded in getProcessorFor()
+ private static final Collection<String> _supportedAnnotations = Collections.unmodifiableCollection(Arrays.asList("*"));
+
+ // options passed to apt at runtime
+ private Map<String, String> _options;
+
+ // options that are supported
+ private final Collection<String> _supportedOptions;
+
+
+ public MantisFactory() {
+ _supportedOptions = initSupportedOptions();
+ }
+
+
+ public Collection<String> supportedAnnotationTypes() {
+ return _supportedAnnotations;
+ }
+
+ public Collection<String> supportedOptions() {
+ return _supportedOptions;
+ }
+
+ public AnnotationProcessor getProcessorFor(Set<AnnotationTypeDeclaration> p_atds, AnnotationProcessorEnvironment p_env) {
+
+ // parse the command line args
+ // TODO: when apt gives proper key=value pairs, chage to fit.
+ // TODO: for now, everything is in the key
+ String configurl = null;
+ String processorName = null;
+ Set<String> keys = p_env.getOptions().keySet();
+ Iterator it = keys.iterator();
+ while (it.hasNext()) {
+ String curr = (String) it.next();
+ String[] val = curr.split("=");
+ if (val[0].equalsIgnoreCase("-Aprocessor"))
+ processorName = val[1];
+ else if (val[0].equalsIgnoreCase("-Aconfig"))
+ configurl = val[1];
}
+ it = null;
+
+ // initiialize the configuration
+ initProcessorMap(configurl);
+
+ // initialize the processor(s)
+ // if no command line override - return a composite
+ // of all processors that map the the annotations present
+ HashSet<AnnotationProcessor> processors = new HashSet<AnnotationProcessor>();
+ if (null == processorName) {
+
+ // first loop through the annotation types and collect the
+ // set of unique annotation package names
+ it = p_atds.iterator();
+ HashSet<String> annotationPackages = new HashSet<String>();
+ while (it.hasNext()) {
+ AnnotationTypeDeclaration atd = (AnnotationTypeDeclaration) it.next();
+ annotationPackages.add(atd.getPackage().getQualifiedName());
+ }
+ it = null;
+
+ // loop through the unique annotation package names
+ // and initialize a uniqe set of processor names
+ // (processors may register for more than one annotation pkg)
+ HashSet<String> activeProcessors = new HashSet<String>();
+ for (String pkg : annotationPackages) {
+ if (_processorMap.containsKey(pkg)) {
+ activeProcessors.add(_processorMap.get(pkg));
+ } else
+ System.out.println("WARNING: no processor for annotation package " + pkg);
+ }
+
+ // loop through the unique processor names
+ // and instantiate them
+ for (String procname : activeProcessors) {
+ // reflectivly new up the processor
+ processors.add(instantiateProcessor(procname, p_atds, p_env));
+ }
+ } else {
+ // processor override provided - just new up this one
+ processors.add(instantiateProcessor(processorName, p_atds, p_env));
+ }
+
+ System.out.println("config=" + configurl);
+ if (processors.contains(null))
+ System.out.println("ERROR: unable to instantiate and initialize processor(s)");
else
- System.out.println("WARNING: no processor for annotation package "+pkg);
- }
+ System.out.println("num processor(s) initialized=" + processors.size());
- // loop through the unique processor names
- // and instantiate them
- for(String procname : activeProcessors)
- {
- // reflectivly new up the processor
- processors.add(instantiateProcessor(procname,p_atds,p_env));
- }
- }
- else
- {
- // processor override provided - just new up this one
- processors.add(instantiateProcessor(processorName,p_atds,p_env));
- }
-
- System.out.println("config="+configurl);
- if(processors.contains(null))
- System.out.println("ERROR: unable to instantiate and initialize processor(s)");
- else
- System.out.println("num processor(s) initialized="+processors.size());
-
- // create a composite of processors to return
- AnnotationProcessors util = new AnnotationProcessors();
- return util.getCompositeAnnotationProcessor(processors);
- }
-
- private Collection<String> initSupportedOptions()
- {
- HashSet<String> supportedOpts = new HashSet<String>();
- supportedOpts.add("-Aconfig");
- supportedOpts.add("-Aprocessor");
- return supportedOpts;
- }
-
- private void initProcessorMap(String configurl)
- {
-
- try
- {
- FileReader reader = new FileReader(configurl);
- int c;
- StringBuffer buff = new StringBuffer();
- while( (c=reader.read()) != -1)
- {
- buff.append((char)c);
- }
- String[] values = buff.toString().split(System.getProperty("line.separator"));
-
- _processorMap = new HashMap<String,String>();
- for(int i=0; i<values.length; i++)
- {
- // if the line is commented out - skip it
- if(values[i].startsWith("#"))
- continue;
- String[] val = values[i].split("=");
- if(_processorMap.containsKey(val[0]))
- System.out.println("WARNING: duplicate mappings for annotation package: "+val[0]);
- _processorMap.put(val[0],val[1]);
- }
- }
- catch(FileNotFoundException fnfe)
- {
- fnfe.printStackTrace();
- }
- catch(IOException ioe)
- {
- ioe.printStackTrace();
- }
- }
-
- private AnnotationProcessor instantiateProcessor(String p_procname,
- Set<AnnotationTypeDeclaration> p_atds,
- AnnotationProcessorEnvironment p_env)
- {
- // instantiate the specified processors
- try
- {
- System.out.println("INFO: ready to instantiate processor class: "+p_procname);
- // FIX: in win32 a ClassNotFoundException would be thrown w/out a call to trim()
- Class definition = Class.forName(p_procname.trim());
- AbstractMantisProcessor proc = (AbstractMantisProcessor) definition.newInstance();
- //System.out.println("INFO: successfully instantiated processor class: "+p_procname);
- //System.out.println("INFO: ready to initialize processor class: "+p_procname);
- proc.init(p_atds,p_env);
- System.out.println("INFO: successfully instantiated and initialized processor class: "+p_procname);
- return (AnnotationProcessor) proc;
- }
- catch(ClassNotFoundException cnfe)
- {
- cnfe.printStackTrace();
- return null;
- }
- catch(InstantiationException ie)
- {
- ie.printStackTrace();
- return null;
- }
- catch(IllegalAccessException iae)
- {
- iae.printStackTrace();
- return null;
+ // create a composite of processors to return
+ AnnotationProcessors util = new AnnotationProcessors();
+ return util.getCompositeAnnotationProcessor(processors);
+ }
+
+ private Collection<String> initSupportedOptions() {
+ HashSet<String> supportedOpts = new HashSet<String>();
+ supportedOpts.add("-Aconfig");
+ supportedOpts.add("-Aprocessor");
+ return supportedOpts;
+ }
+
+ private void initProcessorMap(String configurl) {
+
+ try {
+ FileReader reader = new FileReader(configurl);
+ int c;
+ StringBuffer buff = new StringBuffer();
+ while ((c = reader.read()) != -1) {
+ buff.append((char) c);
+ }
+ String[] values = buff.toString().split(System.getProperty("line.separator"));
+
+ _processorMap = new HashMap<String, String>();
+ for (int i = 0; i < values.length; i++) {
+ // if the line is commented out - skip it
+ if (values[i].startsWith("#"))
+ continue;
+ String[] val = values[i].split("=");
+ if (_processorMap.containsKey(val[0]))
+ System.out.println("WARNING: duplicate mappings for annotation package: " + val[0]);
+ _processorMap.put(val[0], val[1]);
+ }
+ }
+ catch (FileNotFoundException fnfe) {
+ fnfe.printStackTrace();
+ }
+ catch (IOException ioe) {
+ ioe.printStackTrace();
+ }
}
- }
-
+
+ private AnnotationProcessor instantiateProcessor(String p_procname,
+ Set<AnnotationTypeDeclaration> p_atds,
+ AnnotationProcessorEnvironment p_env) {
+ // instantiate the specified processors
+ try {
+ System.out.println("INFO: ready to instantiate processor class: " + p_procname);
+
+ // FIX: in win32 a ClassNotFoundException would be thrown w/out a call to trim()
+ Class definition = Class.forName(p_procname.trim());
+ AbstractMantisProcessor proc = (AbstractMantisProcessor) definition.newInstance();
+ proc.init(p_atds, p_env);
+ System.out.println("INFO: successfully instantiated and initialized processor class: " + p_procname);
+ return (AnnotationProcessor) proc;
+ }
+ catch (ClassNotFoundException cnfe) {
+ cnfe.printStackTrace();
+ return null;
+ }
+ catch (InstantiationException ie) {
+ ie.printStackTrace();
+ return null;
+ }
+ catch (IllegalAccessException iae) {
+ iae.printStackTrace();
+ return null;
+ }
+ }
+
}
Modified: beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/MantisTask.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/MantisTask.java?rev=395619&r1=395618&r2=395619&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/MantisTask.java (original)
+++ beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/MantisTask.java Thu Apr 20 08:28:13 2006
@@ -2,7 +2,6 @@
import java.io.File;
import java.io.FileWriter;
-import java.io.InputStream;
import java.io.IOException;
import java.util.StringTokenizer;
@@ -12,196 +11,173 @@
import org.apache.beehive.test.tools.mantis.utils.StreamCapture;
-public class MantisTask extends MatchingTask
-{
- private final String P = System.getProperty("file.separator");
-
- // required attributes
- private String _srcdir = null;
- private String _srcgen = null;
- private String _bingen = null;
- private String _classpath = null;
- private String _config = null;
- private String _aptcommand = null;
- // optional attributes
- private boolean _compile = false;
- private String _processor = null;
- private String _processorArgs = null;
- private int _timeout = 60000;
- // use _srcgen if not provided
- private String _logdir = null;
-
- // Default value for failonerror
- private boolean _failonerror = true;
-
- // setters for attributes
- public void setSrcdir(String p_srcdir)
- {
- _srcdir = p_srcdir;
- fileset.setDir(new File(_srcdir));
- }
-
- public void setSrcgen(String p_srcgen)
- {
- _srcgen = p_srcgen;
- }
-
- public void setBingen(String p_bingen)
- {
- _bingen = p_bingen;
- }
-
- public void setClasspath(String p_classpath)
- {
- _classpath = p_classpath;
- }
-
- public void setConfig(String p_config)
- {
- _config = p_config;
- }
-
- public void setAptcommand(String p_aptcommand)
- {
- _aptcommand = p_aptcommand;
- }
-
- public void setCompile(boolean p_compile)
- {
- _compile = p_compile;
- }
-
- public void setProcessor(String p_processor)
- {
- _processor = p_processor; }
-
- public void setProcessorArgs(String p_procargs)
- {
- _processorArgs = p_procargs;
- }
-
- public void setLogdir(String p_logdir)
- {
- _logdir = p_logdir;
- }
-
- public void setTimeout(int p_timeout)
- {
- _timeout = p_timeout;
- }
-
- public void setFailonerror(boolean p_failonerror)
- {
- _failonerror = p_failonerror;
- }
-
- public void execute() throws BuildException
- {
- // create the file of all files to process
- // this will allow processing on win32 given it's
- // limitation on command-line length
- File fSrcgen = new File(_srcgen);
- fSrcgen.mkdirs();
- DirectoryScanner scanner = getDirectoryScanner(new File(_srcdir));
- String[] files = scanner.getIncludedFiles();
- String filename = _srcgen+P+"files.txt";
- int returnCode = 0;
- try
- {
- FileWriter writer = new FileWriter(new File(filename));
- for(int i=0; i<files.length; i++)
- {
- writer.write(_srcdir+P+files[i]);
- if(i != files.length)
- writer.write("\n");
- }
- writer.flush();
- writer.close();
- }
- catch(IOException ioe)
- {
- ioe.printStackTrace();
- System.out.println("ERROR: IOException caught trying to create file listing file");
- return;
- }
-
- // create the command line to call
- StringBuffer cmd = new StringBuffer();
- cmd.append(_aptcommand+" ");
- if(!_compile)
- cmd.append(" -nocompile ");
-
- // if on windows, put classpath in quotes in case there's a space
- // on unix, quotes cause a problem when run via ant so don't add them
- if(System.getProperty("os.name").indexOf("Windows") != -1)
- cmd.append("-classpath \""+_classpath+"\" ");
- else
- cmd.append("-classpath "+_classpath+" ");
-
- cmd.append("-s "+_srcgen+" ");
- if(null != _bingen)
- cmd.append("-d "+_bingen+" ");
- // TODO: add task parameter to specify the factory for dev/debug purposes
- cmd.append("-factory org.apache.beehive.test.tools.mantis.MantisFactory ");
- cmd.append("-Aconfig="+_config+" ");
- if(null != _processor)
- cmd.append("-Aprocessor="+_processor+" ");
-
- if(null != _processorArgs)
- {
- StringTokenizer st = new StringTokenizer(_processorArgs,",");
- while(st.hasMoreTokens())
- {
- cmd.append("-A"+st.nextToken()+" ");
- }
- }
- cmd.append("@"+filename+" ");
-
- System.out.println("running command:\n"+cmd.toString());
-
- // capture mantis stderr/stdout to log file
- // while executing the command line apt call
- try
- {
- Process p = Runtime.getRuntime().exec(cmd.toString());
- logStreams(p);
- returnCode = p.waitFor();
- System.out.println("RETURN: "+returnCode);
- }
- catch(IOException ioe)
- {
- ioe.printStackTrace();
- System.out.println("ERROR: IOException during apt execution");
- }
- catch(InterruptedException ie)
- {
- ie.printStackTrace();
- System.out.println("ERROR: InterruptedException during apt execution");
- }
- if (_failonerror && returnCode != 0)
- throw new BuildException("Mantis returned exit code: " + returnCode);
- }
-
- private void logStreams(Process p_proc) throws IOException,InterruptedException
- {
- // ensure log dir exists
- if(null == _logdir)
- _logdir = _srcgen;
- else
- {
- File fLogdir = new File(_logdir);
- fLogdir.mkdirs();
- }
-
- // capture stderr and stdout to log files
- StreamCapture stderr = new StreamCapture(p_proc.getErrorStream(),"file", _logdir+P+"mantis.err");
- StreamCapture stdout = new StreamCapture(p_proc.getInputStream(),"file", _logdir+P+"mantis.out");
- stderr.start();
- stdout.start();
-
- // wait up to 5 seconds for proc to finish
- stderr.join(_timeout);
- stdout.join(_timeout);
- }
+public class MantisTask extends MatchingTask {
+ private final String P = System.getProperty("file.separator");
+
+ // required attributes
+ private String _srcdir = null;
+ private String _srcgen = null;
+ private String _bingen = null;
+ private String _classpath = null;
+ private String _config = null;
+ private String _aptcommand = null;
+ // optional attributes
+ private boolean _compile = false;
+ private String _processor = null;
+ private String _processorArgs = null;
+ private int _timeout = 60000;
+ // use _srcgen if not provided
+ private String _logdir = null;
+
+ // Default value for failonerror
+ private boolean _failonerror = true;
+
+ // setters for attributes
+ public void setSrcdir(String p_srcdir) {
+ _srcdir = p_srcdir;
+ fileset.setDir(new File(_srcdir));
+ }
+
+ public void setSrcgen(String p_srcgen) {
+ _srcgen = p_srcgen;
+ }
+
+ public void setBingen(String p_bingen) {
+ _bingen = p_bingen;
+ }
+
+ public void setClasspath(String p_classpath) {
+ _classpath = p_classpath;
+ }
+
+ public void setConfig(String p_config) {
+ _config = p_config;
+ }
+
+ public void setAptcommand(String p_aptcommand) {
+ _aptcommand = p_aptcommand;
+ }
+
+ public void setCompile(boolean p_compile) {
+ _compile = p_compile;
+ }
+
+ public void setProcessor(String p_processor) {
+ _processor = p_processor;
+ }
+
+ public void setProcessorArgs(String p_procargs) {
+ _processorArgs = p_procargs;
+ }
+
+ public void setLogdir(String p_logdir) {
+ _logdir = p_logdir;
+ }
+
+ public void setTimeout(int p_timeout) {
+ _timeout = p_timeout;
+ }
+
+ public void setFailonerror(boolean p_failonerror) {
+ _failonerror = p_failonerror;
+ }
+
+ public void execute() throws BuildException {
+ // create the file of all files to process
+ // this will allow processing on win32 given it's
+ // limitation on command-line length
+ File fSrcgen = new File(_srcgen);
+ fSrcgen.mkdirs();
+ DirectoryScanner scanner = getDirectoryScanner(new File(_srcdir));
+ String[] files = scanner.getIncludedFiles();
+ String filename = _srcgen + P + "files.txt";
+ int returnCode = 0;
+ try {
+ FileWriter writer = new FileWriter(new File(filename));
+ for (int i = 0; i < files.length; i++) {
+ writer.write(_srcdir + P + files[i]);
+ if (i != files.length)
+ writer.write("\n");
+ }
+ writer.flush();
+ writer.close();
+ }
+ catch (IOException ioe) {
+ ioe.printStackTrace();
+ System.out.println("ERROR: IOException caught trying to create file listing file");
+ return;
+ }
+
+ // create the command line to call
+ StringBuffer cmd = new StringBuffer();
+ cmd.append(_aptcommand + " ");
+ if (!_compile)
+ cmd.append(" -nocompile ");
+
+ // if on windows, put classpath in quotes in case there's a space
+ // on unix, quotes cause a problem when run via ant so don't add them
+ if (System.getProperty("os.name").indexOf("Windows") != -1)
+ cmd.append("-classpath \"" + _classpath + "\" ");
+ else
+ cmd.append("-classpath " + _classpath + " ");
+
+ cmd.append("-s " + _srcgen + " ");
+ if (null != _bingen)
+ cmd.append("-d " + _bingen + " ");
+ // TODO: add task parameter to specify the factory for dev/debug purposes
+ cmd.append("-factory org.apache.beehive.test.tools.mantis.MantisFactory ");
+ cmd.append("-Aconfig=" + _config + " ");
+ if (null != _processor)
+ cmd.append("-Aprocessor=" + _processor + " ");
+
+ if (null != _processorArgs) {
+ StringTokenizer st = new StringTokenizer(_processorArgs, ",");
+ while (st.hasMoreTokens()) {
+ cmd.append("-A" + st.nextToken() + " ");
+ }
+ }
+ cmd.append("@" + filename + " ");
+
+ System.out.println("running command:\n" + cmd.toString());
+
+ // capture mantis stderr/stdout to log file
+ // while executing the command line apt call
+ try {
+ Process p = Runtime.getRuntime().exec(cmd.toString());
+ logStreams(p);
+ returnCode = p.waitFor();
+ System.out.println("RETURN: " + returnCode);
+ }
+ catch (IOException ioe) {
+ ioe.printStackTrace();
+ System.out.println("ERROR: IOException during apt execution");
+ }
+ catch (InterruptedException ie) {
+ ie.printStackTrace();
+ System.out.println("ERROR: InterruptedException during apt execution");
+ }
+ if (_failonerror && returnCode != 0)
+ throw new BuildException("Mantis returned exit code: " + returnCode);
+ }
+
+ private void logStreams(Process p_proc) throws IOException, InterruptedException {
+ // ensure log dir exists
+ if (null == _logdir)
+ _logdir = _srcgen;
+ else {
+ File fLogdir = new File(_logdir);
+ fLogdir.mkdirs();
+ }
+
+ // capture stderr and stdout to log files
+ StreamCapture stderr = new StreamCapture(p_proc.getErrorStream(), "file", _logdir + P + "mantis.err");
+ StreamCapture stdout = new StreamCapture(p_proc.getInputStream(), "file", _logdir + P + "mantis.out");
+ stderr.start();
+ stdout.start();
+
+ // wait up to 5 seconds for proc to finish
+ stderr.join(_timeout);
+ stdout.join(_timeout);
+ }
}
Modified: beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/annotations/Milton.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/annotations/Milton.java?rev=395619&r1=395618&r2=395619&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/annotations/Milton.java (original)
+++ beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/annotations/Milton.java Thu Apr 20 08:28:13 2006
@@ -29,16 +29,16 @@
public enum ClientType {
JWS,
JPF
- };
-
- /*
+ }
+
+ /*
* Enumeration to represent Control instantiation options
*/
public enum Instantiate
{
DECLARATIVE,
PROGRAMATIC
- };
+ }
/**
* TYPE level annotation to signify a Milton TestSuite
Modified: beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/MiltonProcessor.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/MiltonProcessor.java?rev=395619&r1=395618&r2=395619&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/MiltonProcessor.java (original)
+++ beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/MiltonProcessor.java Thu Apr 20 08:28:13 2006
@@ -28,224 +28,215 @@
/*
* A Mantis processor for generating Control Test clients (jpf, jws, etc)
- *
- * @see Mantis
*/
-public class MiltonProcessor extends AbstractMantisProcessor
-{
- protected HashSet<PackageDeclaration> _pkgdecls;
- protected MiltonClientGenerator _generator;
-
- /*
- * Mantis initialization method. Called after Factory based construction.
- * @param p_atds AnnotationTypeDeclaration passed from Mantis Factory @param
- * p_env AnnotationProcessorEnvironment passed from Mantis Factory
- *
- * @see Mantis
- */
- public void init(Set<AnnotationTypeDeclaration> p_atds,
- AnnotationProcessorEnvironment p_env)
- {
- super.init(p_atds,p_env);
- this._pkgdecls = new HashSet<PackageDeclaration>();
-
- // init the package list
- Collection<TypeDeclaration> tdecls =
- _env.getSpecifiedTypeDeclarations();
- for(TypeDeclaration tdecl : tdecls)
- {
- _pkgdecls.add(tdecl.getPackage());
- }
-
- try {
- //TODO: decide if there is a need to have this be dynamic
- this._generator = new VelocityGenerator();
- }
- catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- /*
- * Implementation of Mantis process method.
- */
- public void process()
- {
- Collection<MiltonTestSuite> miltonSuites = new ArrayList<MiltonTestSuite>();
-
- // Loop over packages and process the classes in each
- for (PackageDeclaration pd : _pkgdecls) {
- miltonSuites.addAll(processClasses(pd.getClasses()));
- }
-
- // Loop over suites and generate clients and client accessers for each
- for (MiltonTestSuite mts : miltonSuites) {
- try {
- if (mts.isJpfClient()) {
- this._generator.generate(new JpfClient(mts, this._env));
- if (mts.isJunitClient())
- this._generator.generate(new JpfAccesser(mts, this._env));
- }
- if (mts.isJwsClient()) {
- this._generator.generate(new JwsClient(mts, this._env));
- if (mts.isJunitClient())
- this._generator.generate(new JwsAccesser(mts, this._env));
- }
- }
- catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
- }
-
- /*
- * process() generatates a Collection of ClassDeclaration and passes them to
- * processClasses which process annotations on the Class and generates a
- * Collection of MiltonTestSuite.
- */
- protected Collection<MiltonTestSuite> processClasses(Collection<ClassDeclaration> p_testClasses)
- {
- Collection<MiltonTestSuite> miltonTests = new ArrayList<MiltonTestSuite>();
- Map<String, String> options = _env.getOptions();
- String[] webappOptions;
- int i;
-
- for (ClassDeclaration cd : p_testClasses)
- {
- Milton.TestSuite a_mts = (Milton.TestSuite)cd.getAnnotation(Milton.TestSuite.class);
-
- if (null == a_mts)
- continue;
-
- webappOptions = a_mts.webapps().split("[\\s,]+");
- for (i=0; i<webappOptions.length; i++)
- {
- if (webappOptions[i].equals(MiltonUtil.getOption(options, "webapp.name")))
- break;
- }
- if (i==webappOptions.length)
- continue;
-
- MiltonTestSuite mts = new MiltonTestSuite(cd.getPackage().getQualifiedName(),
- cd.getSimpleName(), a_mts.clients(),
- a_mts.junit(),
- a_mts.webapps());
-
- Collection<MiltonTestMethod> mtm = processMethods(cd.getMethods());
- mts.addAllTests(mtm);
- miltonTests.add(mts);
- }
-
- return miltonTests;
- }
-
- /*
- * processClasses generates a Collection of MethodDeclarations and passes it
- * to processMethods which inspects the methods for meaningful annotations.
- */
- protected Collection<MiltonTestMethod> processMethods(Collection<MethodDeclaration> p_testMethods)
- {
- Collection<MiltonTestMethod> tests = new ArrayList<MiltonTestMethod>();
-
- for (MethodDeclaration md : p_testMethods)
- {
- //only look at 'test' methods
- String testName = md.getSimpleName();
- HashMap<String, String> attributes = new HashMap<String, String>();
-
- if (! testName.startsWith("test"))
- continue;
-
- Milton.Test a_miltonTest = (Milton.Test)md.getAnnotation(Milton.Test.class);
-
- attributes.put("frequency", a_miltonTest.frequency());
- attributes.put("status", a_miltonTest.status());
- attributes.put("description", a_miltonTest.description());
- attributes.put("misc", a_miltonTest.description());
-
- if (null == a_miltonTest)
- throw new IllegalStateException("All methods in a @Milton.TestSuite beginning with 'test' must have a @Milton.Test annotation");
-
- //only look at 'test' methods which return Report
- if (! md.getReturnType().toString().equals("org.apache.beehive.test.tools.milton.common.Report"))
- throw new IllegalStateException("All methods with @Milton.Test must return Report: " + md.getReturnType().toString());
-
- //get collection of parameters to this test - there must be at
- // least 1 and it must be a control bean
- Collection<ParameterDeclaration> pd = md.getParameters();
-
- // must have some parameters
- if (pd.size() <= 0)
- throw new IllegalStateException("All Milton test methods must accept at least one ControlBean parameter");
-
- Collection<MiltonTestControl> controls = new ArrayList<MiltonTestControl>();
-
- //Will store the name of the Control type
- String controlType = null;
-
- //all parameters to a milton test method must be control beans
- for (ParameterDeclaration p : pd) {
- boolean isControlBean = false;
- try {
- ClassType sct = ((ClassType)p.getType()).getSuperclass();
-
- // Make sure that the parameter is a ControlBean
- while (! sct.toString().equals("java.lang.Object")) {
-
- if (sct.toString().equals(
- "org.apache.beehive.controls.runtime.bean.ControlBean"
- )
- )
- {
- isControlBean = true;
- controlType = ((ClassType)p.getType()).toString();
- break;
- }
- sct = (ClassType)sct.getSuperclass();
- }
- }
- catch (ClassCastException cce) {
- InterfaceType sct = (InterfaceType)p.getType();
- //if we have an interface instead of a ControlBean subclass
- //we assume that its a control interface
- isControlBean = true;
- controlType = ((InterfaceType)p.getType()).toString();
- }
-
- if (! isControlBean)
- throw new IllegalStateException("All parameters to a Milton test must be instances of ControlBean");
-
- //get @Milton.TestControl annotations off parameters
- Milton.TestControl a_mtc = (Milton.TestControl)p.getAnnotation(Milton.TestControl.class);
-
- String controlName = md.getSimpleName() + "_" + p.getSimpleName();
- String[] controlAnnotations = Milton.DEFAULT_CONTROL_ANNOTATIONS;
- String controlModifier = Milton.DEFAULT_CONTROL_MODIFIER;
- Milton.Instantiate controlInstantiate = Milton.DEFAULT_CONTROL_INSTANTIATE;
- String controlGenericType = Milton.DEFAULT_CONTROL_GENERIC_TYPE;
-
- // if there is a @Milton.TestControl get values from it
- if (a_mtc != null) {
- if (! a_mtc.name().equals(Milton.DEFAULT_CONTROL_NAME))
- controlName = a_mtc.name();
-
- controlAnnotations = a_mtc.annotations();
- controlModifier = a_mtc.modifier();
- controlInstantiate = a_mtc.instantiate();
- controlGenericType = a_mtc.genericType();
- }
-
- controls.add(new MiltonTestControl(controlName,
- controlType,controlAnnotations,
- controlInstantiate,
- controlModifier, controlGenericType));
- }
-
- MiltonTestMethod mtm = new MiltonTestMethod(testName, controls, attributes);
-
- tests.add(mtm);
- }
-
- return tests;
- }
+
+public class MiltonProcessor extends AbstractMantisProcessor {
+ protected HashSet<PackageDeclaration> _pkgdecls;
+ protected MiltonClientGenerator _generator;
+
+ /*
+ * Mantis initialization method. Called after Factory based construction.
+ * @param p_atds AnnotationTypeDeclaration passed from Mantis Factory @param
+ * p_env AnnotationProcessorEnvironment passed from Mantis Factory
+ */
+ public void init(Set<AnnotationTypeDeclaration> p_atds, AnnotationProcessorEnvironment p_env) {
+ super.init(p_atds, p_env);
+ _pkgdecls = new HashSet<PackageDeclaration>();
+
+ // init the package list
+ Collection<TypeDeclaration> tdecls = _env.getSpecifiedTypeDeclarations();
+ for (TypeDeclaration tdecl : tdecls) {
+ _pkgdecls.add(tdecl.getPackage());
+ }
+
+ try {
+ //TODO: decide if there is a need to have this be dynamic
+ _generator = new VelocityGenerator();
+ }
+ catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /*
+ * Implementation of Mantis process method.
+ */
+ public void process() {
+
+ Collection<MiltonTestSuite> miltonSuites = new ArrayList<MiltonTestSuite>();
+
+ // Loop over packages and process the classes in each
+ for (PackageDeclaration pd : _pkgdecls) {
+ miltonSuites.addAll(processClasses(pd.getClasses()));
+ }
+
+ // Loop over suites and generate clients and client accessers for each
+ for (MiltonTestSuite mts : miltonSuites) {
+ try {
+
+ if (mts.isJpfClient()) {
+ _generator.generate(new JpfClient(mts, _env));
+ if (mts.isJunitClient())
+ _generator.generate(new JpfAccesser(mts, _env));
+ }
+/*
+ if (mts.isJwsClient()) {
+ _generator.generate(new JwsClient(mts, _env));
+ if (mts.isJunitClient())
+ _generator.generate(new JwsAccesser(mts, _env));
+ }
+*/
+ }
+ catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+
+ /*
+ * process() generatates a Collection of ClassDeclaration and passes them to
+ * processClasses which process annotations on the Class and generates a
+ * Collection of MiltonTestSuite.
+ */
+ protected Collection<MiltonTestSuite> processClasses(Collection<ClassDeclaration> p_testClasses) {
+ Collection<MiltonTestSuite> miltonTests = new ArrayList<MiltonTestSuite>();
+ Map<String, String> options = _env.getOptions();
+ String[] webappOptions;
+ int i;
+
+ for (ClassDeclaration cd : p_testClasses) {
+ Milton.TestSuite a_mts = cd.getAnnotation(Milton.TestSuite.class);
+
+ if (null == a_mts)
+ continue;
+
+ webappOptions = a_mts.webapps().split("[\\s,]+");
+ for (i = 0; i < webappOptions.length; i++) {
+ if (webappOptions[i].equals(MiltonUtil.getOption(options, "webapp.name")))
+ break;
+ }
+ if (i == webappOptions.length)
+ continue;
+
+ MiltonTestSuite mts = new MiltonTestSuite(
+ cd.getPackage().getQualifiedName(),
+ cd.getSimpleName(),
+ a_mts.clients(),
+ a_mts.junit(),
+ a_mts.webapps());
+
+ Collection<MiltonTestMethod> mtm = processMethods(cd.getMethods());
+ mts.addAllTests(mtm);
+ miltonTests.add(mts);
+ }
+
+ return miltonTests;
+ }
+
+ /*
+ * processClasses generates a Collection of MethodDeclarations and passes it
+ * to processMethods which inspects the methods for meaningful annotations.
+ */
+ protected Collection<MiltonTestMethod> processMethods(Collection<MethodDeclaration> p_testMethods) {
+ Collection<MiltonTestMethod> tests = new ArrayList<MiltonTestMethod>();
+
+ for (MethodDeclaration md : p_testMethods) {
+ //only look at 'test' methods
+ String testName = md.getSimpleName();
+ HashMap<String, String> attributes = new HashMap<String, String>();
+
+ if (! testName.startsWith("test"))
+ continue;
+
+ Milton.Test a_miltonTest = (Milton.Test) md.getAnnotation(Milton.Test.class);
+
+ attributes.put("frequency", a_miltonTest.frequency());
+ attributes.put("status", a_miltonTest.status());
+ attributes.put("description", a_miltonTest.description());
+ attributes.put("misc", a_miltonTest.description());
+
+ if (null == a_miltonTest)
+ throw new IllegalStateException("All methods in a @Milton.TestSuite beginning with 'test' must have a @Milton.Test annotation");
+
+ //only look at 'test' methods which return Report
+ if (! md.getReturnType().toString().equals("org.apache.beehive.test.tools.milton.common.Report"))
+ throw new IllegalStateException("All methods with @Milton.Test must return Report: " + md.getReturnType().toString());
+
+ //get collection of parameters to this test - there must be at
+ // least 1 and it must be a control bean
+ Collection<ParameterDeclaration> pd = md.getParameters();
+
+ // must have some parameters
+ if (pd.size() <= 0)
+ throw new IllegalStateException("All Milton test methods must accept at least one ControlBean parameter");
+
+ Collection<MiltonTestControl> controls = new ArrayList<MiltonTestControl>();
+
+ //Will store the name of the Control type
+ String controlType = null;
+
+ //all parameters to a milton test method must be control beans
+ for (ParameterDeclaration p : pd) {
+ boolean isControlBean = false;
+ try {
+ ClassType sct = ((ClassType) p.getType()).getSuperclass();
+
+ // Make sure that the parameter is a ControlBean
+ while (! sct.toString().equals("java.lang.Object")) {
+
+ if (sct.toString().equals(
+ "org.apache.beehive.controls.runtime.bean.ControlBean"
+ )
+ ) {
+ isControlBean = true;
+ controlType = ((ClassType) p.getType()).toString();
+ break;
+ }
+ sct = (ClassType) sct.getSuperclass();
+ }
+ }
+ catch (ClassCastException cce) {
+ InterfaceType sct = (InterfaceType) p.getType();
+ //if we have an interface instead of a ControlBean subclass
+ //we assume that its a control interface
+ isControlBean = true;
+ controlType = ((InterfaceType) p.getType()).toString();
+ }
+
+ if (! isControlBean)
+ throw new IllegalStateException("All parameters to a Milton test must be instances of ControlBean");
+
+ //get @Milton.TestControl annotations off parameters
+ Milton.TestControl a_mtc = (Milton.TestControl) p.getAnnotation(Milton.TestControl.class);
+
+ String controlName = md.getSimpleName() + "_" + p.getSimpleName();
+ String[] controlAnnotations = Milton.DEFAULT_CONTROL_ANNOTATIONS;
+ String controlModifier = Milton.DEFAULT_CONTROL_MODIFIER;
+ Milton.Instantiate controlInstantiate = Milton.DEFAULT_CONTROL_INSTANTIATE;
+ String controlGenericType = Milton.DEFAULT_CONTROL_GENERIC_TYPE;
+
+ // if there is a @Milton.TestControl get values from it
+ if (a_mtc != null) {
+ if (! a_mtc.name().equals(Milton.DEFAULT_CONTROL_NAME))
+ controlName = a_mtc.name();
+
+ controlAnnotations = a_mtc.annotations();
+ controlModifier = a_mtc.modifier();
+ controlInstantiate = a_mtc.instantiate();
+ controlGenericType = a_mtc.genericType();
+ }
+
+ controls.add(new MiltonTestControl(controlName,
+ controlType, controlAnnotations,
+ controlInstantiate,
+ controlModifier, controlGenericType));
+ }
+
+ MiltonTestMethod mtm = new MiltonTestMethod(testName, controls, attributes);
+
+ tests.add(mtm);
+ }
+
+ return tests;
+ }
}
Modified: beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/MiltonTestSuite.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/MiltonTestSuite.java?rev=395619&r1=395618&r2=395619&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/MiltonTestSuite.java (original)
+++ beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/MiltonTestSuite.java Thu Apr 20 08:28:13 2006
@@ -30,26 +30,31 @@
* should have junit accessers generated for them @param p_webapps Space
* separated list of webapps this suite is applicable to
*/
- public MiltonTestSuite(String p_pn, String p_sn, Milton.ClientType[] p_clients, boolean p_junit, String p_webapps)
+ public MiltonTestSuite(String p_pn,
+ String p_sn,
+ Milton.ClientType[] p_clients,
+ boolean p_junit,
+ String p_webapps)
{
System.out.println("Adding webapps: " + p_webapps);
- if (null == p_pn || null == p_sn || null == p_clients || null == p_webapps)
+
+ if (null == p_pn || null == p_sn || null == p_clients || null == p_webapps)
throw new IllegalArgumentException("Package Name, Suite Name, Clients and Webapps must not be null");
- this._name = p_sn;
- this._packageName = p_pn;
- this._junitClient = p_junit;
- this._webapps = p_webapps;
+ _name = p_sn;
+ _packageName = p_pn;
+ _junitClient = p_junit;
+ _webapps = p_webapps;
for (int i = 0; i < p_clients.length; ++i) {
if (p_clients[i] == Milton.ClientType.JWS)
- this._jwsClient = true;
+ _jwsClient = true;
else if (p_clients[i] == Milton.ClientType.JPF)
- this._jpfClient = true;
+ _jpfClient = true;
else
System.out.println("Found " + p_clients[i] + " which appears to be supported " +
"in the ClientType enumeration but there is no handling code");
}
- }
+ }
/*
* Returns true if MiltonTestSuite will have JPF clients generated
@@ -77,12 +82,12 @@
public void addTest(MiltonTestMethod p_mtm)
{
- this._tests.add(p_mtm);
+ _tests.add(p_mtm);
}
public void addAllTests(Collection<MiltonTestMethod> p_mtm)
{
- this._tests.addAll(p_mtm);
+ _tests.addAll(p_mtm);
}
public String getName() {
@@ -91,7 +96,7 @@
public Collection<MiltonTestMethod> getTests()
{
- return this._tests;
+ return _tests;
}
public String getPackageName() {
Modified: beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/generator/JpfClient.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/generator/JpfClient.java?rev=395619&r1=395618&r2=395619&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/generator/JpfClient.java (original)
+++ beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/generator/JpfClient.java Thu Apr 20 08:28:13 2006
@@ -16,46 +16,49 @@
*
* @see MiltonTestClient
*/
-public class JpfClient extends MiltonTestClient
-{
- protected final String JPF_TEMPLATE_NAME = "org/apache/beehive/test/tools/milton/mantis/generator/MiltonJpf.vm";
-
- protected String _jpfPackage;
- protected String _jpfLocation;
- protected String _jpfActionPath;
-
- /*
- * Construct a JpfClient
- *
- * @param p_mts the MiltonTestSuite to represent a JPF client for
- * @param p_env APT environment. Needed for accessing the Filer.
- */
- public JpfClient(MiltonTestSuite p_mts, AnnotationProcessorEnvironment p_env)
- {
- super(p_mts, p_env);
- this._templateName = JPF_TEMPLATE_NAME;
-
- String[] pkg = p_mts.getPackageName().split("\\.");
- //TODO: should i handle the 'noPackage' case or error out?
- this._jpfPackage = pkg.length >= 1 ? pkg[pkg.length-1] : "noPackage";
- //TODO: make some of these values into externally overridable properties
- this._jpfPackage = "milton.pageflows." + this._jpfPackage + "." + p_mts.getName();
- this._jpfActionPath = super._webappName + "/" + this._jpfPackage.replace(".", "/");
- this._jpfLocation = super._webappDir + super._webappName + "/WEB-INF/src/" + this._jpfPackage.replace(".", "/") +
- "/Controller.jpf";
-
- this._context.put("jpf_package", this._jpfPackage);
- }
-
- /*
- * Overriding the getWriter() in the parent class to return a Writer with
- * for the correct JPF file.
- */
- public Writer getWriter()
- throws IOException
- {
- this._writer = new IndentingWriter(this._filer.createTextFile(Filer.Location.SOURCE_TREE,
- "", new File(this._jpfLocation), null));
- return this._writer;
- }
+
+public class JpfClient extends MiltonTestClient {
+ protected final String JPF_TEMPLATE_NAME = "org/apache/beehive/test/tools/milton/mantis/generator/MiltonJpf.vm";
+
+ protected String _jpfPackage;
+ protected String _jpfLocation;
+ protected String _jpfActionPath;
+
+ /*
+ * Construct a JpfClient
+ *
+ * @param p_mts the MiltonTestSuite to represent a JPF client for
+ * @param p_env APT environment. Needed for accessing the Filer.
+ */
+ public JpfClient(MiltonTestSuite p_mts, AnnotationProcessorEnvironment p_env) {
+ super(p_mts, p_env);
+ _templateName = JPF_TEMPLATE_NAME;
+
+ String[] pkg = p_mts.getPackageName().split("\\.");
+ //TODO: should i handle the 'noPackage' case or error out?
+ _jpfPackage = pkg.length >= 1 ? pkg[pkg.length - 1] : "noPackage";
+ //TODO: make some of these values into externally overridable properties
+ _jpfPackage = "milton.pageflows." + _jpfPackage + "." + p_mts.getName();
+ _jpfActionPath = super._webappName + "/" + _jpfPackage.replace(".", "/");
+ _jpfLocation =
+ //super._webappDir + super._webappName + "/WEB-INF/src/" + _jpfPackage.replace(".", "/") + "/Controller.jpf";
+ _jpfPackage.replace(".", "/") + "/Controller.java";
+
+ _context.put("jpf_package", _jpfPackage);
+ }
+
+ /*
+ * Overriding the getWriter() in the parent class to return a Writer with
+ * for the correct JPF file.
+ */
+ public Writer getWriter()
+ throws IOException {
+ System.out.println("generate into location: " + _jpfLocation);
+ _writer = new IndentingWriter(_filer.createTextFile(Filer.Location.SOURCE_TREE,
+ "",
+ new File(_jpfLocation),
+ null));
+
+ return _writer;
+ }
}