This is contributed by Zach Smith.

Good job!

-James

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Thursday, January 27, 2005 11:57 AM
To: [EMAIL PROTECTED]
Subject: svn commit: r128417 - in incubator/beehive/trunk/controls/test:
. infra/milton
src/controls/org/apache/beehive/controls/test/controls/database
src/drivers/org/apache/beehive/controls/test/driver/database
src/drivers/org/apache/beehive/controls/test/driver

Author: jsong
Date: Thu Jan 27 11:56:46 2005
New Revision: 128417

URL: http://svn.apache.org/viewcvs?view=rev&rev=128417
Log:
* Bug Fix:  SOAPReportTestCase was not correctly formatting URLs 
  when a protocol prefix was not included (http/s://).  This has
  been fixed

* Webapps are now staged in controls/test/build along with most
  other build artifacts.  This makes cleaning more straight forward
  and enables the following

* Added feature to Milton to code generate clients from drivers.
  Given a driver annototated with annotations found in
  org.apache.beehive.test.tools.milton.annotations.Milton the 
  necessary clients for the test can be generated.  (jpf,jws,junit)

* Removing dbControl tests.  The tests are no longer part of the 
  beehive test run.  Targets to build the dbControl still exist
  in controls/test/build.xml but those targets are no longer
  called as port of the build process

* Updated some controls instantiation tests to use new Milton cod-gen
  features.


Added:
 
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehiv
e/test/tools/milton/annotations/
 
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehiv
e/test/tools/milton/annotations/Milton.java
 
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehiv
e/test/tools/milton/mantis/
 
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehiv
e/test/tools/milton/mantis/MiltonProcessor.java
 
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehiv
e/test/tools/milton/mantis/MiltonTestControl.java
 
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehiv
e/test/tools/milton/mantis/MiltonTestMethod.java
 
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehiv
e/test/tools/milton/mantis/MiltonTestSuite.java
 
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehiv
e/test/tools/milton/mantis/generator/
 
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehiv
e/test/tools/milton/mantis/generator/JpfAccesser.java
 
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehiv
e/test/tools/milton/mantis/generator/JpfClient.java
 
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehiv
e/test/tools/milton/mantis/generator/JwsAccesser.java
 
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehiv
e/test/tools/milton/mantis/generator/JwsClient.java
 
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehiv
e/test/tools/milton/mantis/generator/MiltonClientGenerator.java
 
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehiv
e/test/tools/milton/mantis/generator/MiltonJpf.vm
 
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehiv
e/test/tools/milton/mantis/generator/MiltonJpfAccesser.vm
 
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehiv
e/test/tools/milton/mantis/generator/MiltonJws.vm
 
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehiv
e/test/tools/milton/mantis/generator/MiltonJwsAccesser.vm
 
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehiv
e/test/tools/milton/mantis/generator/MiltonTestClient.java
 
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehiv
e/test/tools/milton/mantis/generator/VelocityGenerator.java
Removed:
 
incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/co
ntrols/test/controls/database/
 
incubator/beehive/trunk/controls/test/src/drivers/org/apache/beehive/con
trols/test/driver/database/
 
incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/contr
ols/test/java/database/
 
incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/contr
ols/test/jpf/database/
   incubator/beehive/trunk/controls/test/webapps/controlsWeb/database/
 
incubator/beehive/trunk/controls/test/webapps/controlsWeb/instantiate/de
clarative/Controller.jpf
 
incubator/beehive/trunk/controls/test/webapps/controlsWeb/instantiate/pr
ogrammatic/Controller.jpf
Modified:
   incubator/beehive/trunk/controls/test/build.xml
   incubator/beehive/trunk/controls/test/infra/milton/milton.jar
 
incubator/beehive/trunk/controls/test/src/drivers/org/apache/beehive/con
trols/test/driver/instantiate/DriveHelloControl.java
 
incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/contr
ols/test/java/instantiate/TestInstantiate.java
 
incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/contr
ols/test/jpf/instantiate/TestInstantiate.java
 
incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/contr
ols/test/jws/instantiate/TestInstantiate.java
   incubator/beehive/trunk/controls/test/tools/milton/build.xml
 
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehiv
e/test/tools/milton/junit/SOAPReportTestCase.java
   incubator/beehive/trunk/controls/test/webapps/build.xml
 
incubator/beehive/trunk/controls/test/webapps/controlsWeb/WEB-INF/src/jw
s/Instantiate.jws
 
incubator/beehive/trunk/controls/test/webapps/controlsWeb/app.properties

Modified: incubator/beehive/trunk/controls/test/build.xml
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/buil
d.xml?view=diff&rev=128417&p1=incubator/beehive/trunk/controls/test/buil
d.xml&r1=128416&p2=incubator/beehive/trunk/controls/test/build.xml&r2=12
8417
========================================================================
======
--- incubator/beehive/trunk/controls/test/build.xml     (original)
+++ incubator/beehive/trunk/controls/test/build.xml     Thu Jan 27
11:56:46 2005
@@ -16,7 +16,9 @@
     <taskdef name="control-jar" 
 
classname="org.apache.beehive.controls.runtime.packaging.ControlJarTask"

              classpathref="controls.dependency.path" onerror="report"
/>             
-
+    <taskdef name="mantis"
+
classname="org.apache.beehive.test.tools.mantis.MantisTask"
+                classpathref="mantis.classpath"/>
     <!-- BeeHive test specific properties -->
     <property name="controls.test.root" location="${basedir}"/>
     <property name="controls.test.src"
location="${controls.test.root}/src"/>
@@ -35,8 +37,35 @@
     <property name="controlstestbeans.jar"
location="${build.dir}/controlstestbeans.jar"/>
     <property name="controlstestdrivers.jar"
location="${build.dir}/controlstestdrivers.jar"/>
     <property name="test.logs" location="${basedir}/logs"/>
-    <property name="mantis.cases" location="${basedir}/mantis-cases"/>
-    <property name="mantis.logs" location="${basedir}/mantis-logs"/>
+
+    <property name="mantis.milton.srcgen.dir" location="${build.dir}"/>
+    <property name="mantis.milton.bingen.dir" location="${build.dir}"/>
+    <property name="mantis.milton.control.test.units"
location="${mantis.milton.srcgen.dir}/testsrcgen"/>
+    <property name="mantis.tch.srcgendir"
location="${basedir}/mantis.tch.cases"/>
+    <property name="mantis.tch.bingendir"
location="${basedir}/mantis.bingen.dir"/>
+
+    <property name="mantis.srcgen.dir"
location="${basedir}/mantis.tch.cases"/>
+    <property name="mantis.bingen.dir"
location="${basedir}/mantis-bingen"/>
+    <property name="mantis.log.dir"
location="${basedir}/mantis.tch.logs"/>
+
+    <path id="mantis.classpath">
+        <pathelement path="${mantis.jar}"/>
+       <path refid="ant-jar.dependency.path"/>
+       <path refid="junit.dependency.path"/>
+       <path refid="servlet.dependency.path"/>
+       <pathelement path="${milton.jar}"/>
+       <pathelement path="${tch.schema.jar}"/>
+       <pathelement path="${mantis.jar}"/>
+       <fileset refid="xbean.fileset"/>
+       <fileset refid="jsr173.fileset"/>
+       <pathelement path="../build/jars/controls.jar"/>
+       <pathelement path="${build.beans}"/>
+               <pathelement path="${build.drivers}"/>
+        <fileset refid="velocity.fileset"/>
+    </path>
+
+    <property name="mantis.run.classpath" refid="mantis.classpath"/>
+
     <property name="derby.data" location="${basedir}/test"/>
     <property name="db.control.dir"
location="../../samples/controls-db"/>
     <property name="db.control.jar"
location="${db.control.dir}/build/dbControl.jar"/>
@@ -97,7 +126,7 @@
 
     <pathelement location="${db.control.jar}"/>
     <pathelement path="${build.beans}"/>
-       
+    <pathelement path="${mantis.milton.srcgen.dir}"/>
     <pathelement path="${build.drivers}"/>
        <pathelement location="${build.tests}" />
 
@@ -126,11 +155,11 @@
         <echo
message="---------------------------------------------------------------
-"/>
     </target>
 
-    <target name="clean" depends="dbControl-clean" >
+    <target name="clean" >
         <delete dir="${build.dir}"/>
         <delete dir="${test.logs}"/>
-        <delete dir="${mantis.logs}"/>
-        <delete dir="${mantis.cases}"/>
+        <delete dir="${mantis.tch.logs}"/>
+        <delete dir="${mantis.tch.cases}"/>
         <delete dir="${derby.data}"/>
         <delete file="derby.log"/>
         <delete file="velocity.log"/>
@@ -145,9 +174,10 @@
     <target name="build" depends="dirs">
         <ant target="build-test-auxilaries"/>
         <ant target="build-test-beans" />
+       <ant target="mantis.milton" />
         <ant target="build-test-drivers" />
         <ant target="build-test-units" />
-        <ant target="mantis" />
+        <ant target="mantis.tch" />
     </target>
 
     <target name="dirs">
@@ -172,7 +202,6 @@
              target="build"
              inheritall="false"/>
     </target>
-
     <target name="dbControl-clean">
         <ant 
           dir="${db.control.dir}" 
@@ -181,7 +210,7 @@
           inheritall="false"/>
     </target>
 
-    <target name="build-test-beans"
depends="dirs,build-test-auxilaries,dbControl">
+    <target name="build-test-beans"
depends="dirs,build-test-auxilaries">
 
         <!-- Build the InnerControl controls used by composition tests.
This is only
              necessary because the bean types are needed to compile a
public interface -->
@@ -286,6 +315,25 @@
             </classpath>
         </apt>
 
+       <!-- compile junits generated by mantis-drivers -->
+        <apt srcdir="${mantis.milton.srcgen.dir}"
+            destdir="${build.tests}"
+            gendir="${build.beansrc}"
+            classpathref="test.classpath"
+            compileByExtension="true"
+            srcExtensions="*.java"
+            debug="on"
+            optimize="on"
+            verbose="false"
+            failonerror="true">
+            <classpath>
+               <pathelement location="${milton.jar}"/>
+               <pathelement location="${mantis.jar}"/>
+               <pathelement location="${httpunit.jar}"/>
+               <pathelement path="${build.drivers}"/>
+            </classpath>
+       </apt>
+
        <echo message="Assembling Tests"/>
 
         <!-- in the assemble phase, any clients processed above which
use controls requiring
@@ -450,43 +498,37 @@
   <!-- =========================================================== -->
   <!-- Mantis settings -->
   <!-- =========================================================== -->
-  <property name="mantis.srcgen.dir"
location="${basedir}/mantis-cases"/>
-  <property name="mantis.bingen.dir"
location="${basedir}/mantis-bingen"/>
-  <property name="mantis.log.dir" location="${basedir}/mantis-logs"/>
-  <path id="mantis.classpath">
-        <path refid="tools.dependency.path"/>
-        <path refid="junit.dependency.path"/>
-        <path refid="servlet.dependency.path"/>
-        <path refid="controls.dependency.path"/>
-        <path refid="xbean.dependency.path"/>
-        <path refid="ant-jar.dependency.path"/>
-       <pathelement path="${milton.jar}"/>
-       <pathelement path="${tch.schema.jar}"/>
-       <pathelement path="${mantis.jar}"/>
-       <pathelement path="${build.beans}"/>
-               <pathelement path="${build.drivers}"/>
-  </path>
-  <property name="mantis.run.classpath" refid="mantis.classpath"/>
 
-
-  <target name="mantis" 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.srcgen.dir}"/>
                <delete dir="${mantis.bingen.dir}"/>
                <delete dir="${mantis.log.dir}"/>
-    <taskdef name="mantis"
-
classname="org.apache.beehive.test.tools.mantis.MantisTask"
-                classpathref="mantis.classpath"/>
-  
-    <mantis srcdir="${junit.src.dir}"
+
+    <mantis srcdir="${controls.test.root}"
+               srcgen="${mantis.srcgen.dir}"
+               bingen="${mantis.bingen.dir}"
+               classpath="${mantis.run.classpath}"
+               logdir="${mantis.log.dir}"
+               config="${mantis.config}"
+               timeout="10000"
+               aptcommand="${os.JAVA_HOME}/bin/apt">
+       <include name="build/testsrcgen/**/*.java"/>
+       <include name="src/units/**/*.java"/>
+    </mantis>
+  </target>
+
+  <target name="mantis.milton" description="autogen client code for
controls drivers">
+        <mantis srcdir="${controls.test.drivers}"
                includes="**/*.java"
-               srcgen="${mantis.srcgen.dir}"
-                       bingen="${mantis.bingen.dir}"
+               srcgen="${mantis.milton.srcgen.dir}"
+                       bingen="${mantis.milton.bingen.dir}"
                classpath="${mantis.run.classpath}"
                logdir="${mantis.log.dir}"
                config="${mantis.config}"
                timeout="10000"
-               aptcommand="${os.JAVA_HOME}/bin/apt"
-    />
+
processor="org.apache.beehive.test.tools.milton.mantis.MiltonProcessor"
+               aptcommand="${os.JAVA_HOME}/bin/apt">
+       </mantis> 
   </target>
- 
+
 </project>

Modified: incubator/beehive/trunk/controls/test/infra/milton/milton.jar
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/infr
a/milton/milton.jar?view=diff&rev=128417&p1=incubator/beehive/trunk/cont
rols/test/infra/milton/milton.jar&r1=128416&p2=incubator/beehive/trunk/c
ontrols/test/infra/milton/milton.jar&r2=128417
========================================================================
======
Binary files. No diff available.

Modified:
incubator/beehive/trunk/controls/test/src/drivers/org/apache/beehive/con
trols/test/driver/instantiate/DriveHelloControl.java
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/src/
drivers/org/apache/beehive/controls/test/driver/instantiate/DriveHelloCo
ntrol.java?view=diff&rev=128417&p1=incubator/beehive/trunk/controls/test
/src/drivers/org/apache/beehive/controls/test/driver/instantiate/DriveHe
lloControl.java&r1=128416&p2=incubator/beehive/trunk/controls/test/src/d
rivers/org/apache/beehive/controls/test/driver/instantiate/DriveHelloCon
trol.java&r2=128417
========================================================================
======
---
incubator/beehive/trunk/controls/test/src/drivers/org/apache/beehive/con
trols/test/driver/instantiate/DriveHelloControl.java    (original)
+++
incubator/beehive/trunk/controls/test/src/drivers/org/apache/beehive/con
trols/test/driver/instantiate/DriveHelloControl.java    Thu Jan 27
11:56:46 2005
@@ -3,33 +3,33 @@
 import org.apache.beehive.test.tools.milton.common.Report;
 import
org.apache.beehive.controls.test.controls.instantiate.HelloControlBean;
 
+import org.apache.beehive.test.tools.milton.annotations.Milton;
+
 /* This class contains the logic to test HelloControlBean
        It will exercise the control in a certain way and generate a
        test result report
  */
 
[EMAIL PROTECTED]
 public class DriveHelloControl
 {
-       private HelloControlBean myControl;
-
-       public void setControl(HelloControlBean bean){
-
-               myControl=bean;
-       }
+       @Milton.Test
+       public Report testInstantiation(HelloControlBean hcb){
 
-       public Report doTest(){
+               Report report = new Report();
 
-               Report report=new Report();
-
-               if (myControl==null)
+               if (hcb == null) {
                        report.setStatus(Report.FAIL);
+                       report.addMessage("HelloControlBean hcb is
Null!");
+               }
                else
                {
-                       if
(myControl.hello(Report.PASS).equals(Report.PASS))
+                       if (hcb.hello(Report.PASS).equals(Report.PASS))
                                report.setStatus(Report.PASS);
-                       else
+                       else {
                                report.setStatus(Report.FAIL);
-
+                               report.addMessage("hcb.hello: " +
hcb.hello(Report.PASS));
+                       }
                }
                return report;
        }

Modified:
incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/contr
ols/test/java/instantiate/TestInstantiate.java
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/src/
units/org/apache/beehive/controls/test/java/instantiate/TestInstantiate.
java?view=diff&rev=128417&p1=incubator/beehive/trunk/controls/test/src/u
nits/org/apache/beehive/controls/test/java/instantiate/TestInstantiate.j
ava&r1=128416&p2=incubator/beehive/trunk/controls/test/src/units/org/apa
che/beehive/controls/test/java/instantiate/TestInstantiate.java&r2=12841
7
========================================================================
======
---
incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/contr
ols/test/java/instantiate/TestInstantiate.java  (original)
+++
incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/contr
ols/test/java/instantiate/TestInstantiate.java  Thu Jan 27 11:56:46 2005
@@ -81,8 +81,7 @@
                        Thread.currentThread().getContextClassLoader() ,
 
"org.apache.beehive.controls.test.controls.instantiate.HelloControlBean"
);
                DriveHelloControl driver=new DriveHelloControl();
-               driver.setControl(hc);
-               report=driver.doTest();
+               report=driver.testInstantiation(hc);
                String result=report.getStatus();
                if (!result.equals(Report.PASS))
                        fail(report.getMessage());
@@ -97,8 +96,7 @@
     {
                Report report=new Report();
                DriveHelloControl driver=new DriveHelloControl();
-               driver.setControl(myHelloBean);
-               report=driver.doTest();
+               report=driver.testInstantiation(myHelloBean);
                String result=report.getStatus();
                if (!result.equals(Report.PASS))
                        fail(report.getMessage());

Modified:
incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/contr
ols/test/jpf/instantiate/TestInstantiate.java
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/src/
units/org/apache/beehive/controls/test/jpf/instantiate/TestInstantiate.j
ava?view=diff&rev=128417&p1=incubator/beehive/trunk/controls/test/src/un
its/org/apache/beehive/controls/test/jpf/instantiate/TestInstantiate.jav
a&r1=128416&p2=incubator/beehive/trunk/controls/test/src/units/org/apach
e/beehive/controls/test/jpf/instantiate/TestInstantiate.java&r2=128417
========================================================================
======
---
incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/contr
ols/test/jpf/instantiate/TestInstantiate.java   (original)
+++
incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/contr
ols/test/jpf/instantiate/TestInstantiate.java   Thu Jan 27 11:56:46 2005
@@ -11,42 +11,21 @@
  */

 public class TestInstantiate extends HtmlReportTestCase

 {

-       public TestInstantiate(String s){super(s);}

-    /**

-     * Tests instantiating a custom control programmatically

-     */

-       @Freq("checkin")

-    public void testProgrammaticInstantiation() throws Exception

-    {

-
assertReport("/controlsWeb/instantiate/programmatic/Controller.jpf");

-    }

+    public TestInstantiate(String s){super(s);}

 

-    /**

-     * Tests instantiating a custom control declaratively

-     */

-       @Freq("checkin")

-    public void testDeclarativeInstantiation() throws Exception

+    @Freq("checkin")

+    public void testDeclareWithProperty() throws Exception

     {

-
assertReport("/controlsWeb/instantiate/declarative/Controller.jpf");

+
assertReport("/controlsWeb/instantiate/declarewithproperty/Controller.jp
f");

     }

 

     /**

-     * Tests declaratively instantiating a custom control with
propertySet

+     * Tests programmically instantiating a custom control with
propertySet

      */

-

-       @Freq("checkin")

-    public void testDeclareWithProperty() throws Exception

-    {

-
assertReport("/controlsWeb/instantiate/declarewithproperty/Controller.jp
f");

-       }

-

-       /**

-        * Tests programmically instantiating a custom control with
propertySet

-        */

-       @Freq("detailed")

-       @Status("active")

+    @Freq("detailed")

+    @Status("active")

     public void testProgrammWithProperty() throws Exception

     {

-
assertReport("/controlsWeb/instantiate/programwithproperty/Controller.jp
f");

+
assertReport("/controlsWeb/instantiate/programwithproperty/Controller.jp
f");

     }

 }


Modified:
incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/contr
ols/test/jws/instantiate/TestInstantiate.java
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/src/
units/org/apache/beehive/controls/test/jws/instantiate/TestInstantiate.j
ava?view=diff&rev=128417&p1=incubator/beehive/trunk/controls/test/src/un
its/org/apache/beehive/controls/test/jws/instantiate/TestInstantiate.jav
a&r1=128416&p2=incubator/beehive/trunk/controls/test/src/units/org/apach
e/beehive/controls/test/jws/instantiate/TestInstantiate.java&r2=128417
========================================================================
======
---
incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/contr
ols/test/jws/instantiate/TestInstantiate.java   (original)
+++
incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/contr
ols/test/jws/instantiate/TestInstantiate.java   Thu Jan 27 11:56:46 2005
@@ -11,41 +11,23 @@
  */
 public class TestInstantiate extends SOAPReportTestCase
 {
-       public TestInstantiate(String s){super(s);}
+   public TestInstantiate(String s){super(s);}
 
-    /**
-     * Tests instantiating a custom control declaratively
-     */
-       @Freq("checkin")
-    public void testDeclarativeInstantiate() throws Exception
-    {
-
assertReport("http://localhost:8080/controlsWeb/jws/Instantiate.jws","te
stDeclarativeInstantiate");
-    }
+   /**
+    * Tests instantiating a custom control declaratively with
properties
+    */
+   @Freq("checkin")
+   public void testDeclarativeInstantiateWithProperty() throws
Exception
+   {
+
assertReport("http://localhost:8080/controlsWeb/jws/Instantiate.jws","te
stDeclarativeInstantiateWithProperty");
+   }
 
-    /**
-     * Tests instantiating a custom control declaratively with
properties
-     */
-       @Freq("checkin")
-    public void testDeclarativeInstantiateWithProperty() throws
Exception
-    {
-
assertReport("http://localhost:8080/controlsWeb/jws/Instantiate.jws","te
stDeclarativeInstantiateWithProperty");
-    }
-
-    /**
-     * Tests instantiating a custom control programmatically
-     */
-       @Freq("checkin")
-    public void testProgrammaticInstantiate() throws Exception
-    {
-
assertReport("http://localhost:8080/controlsWeb/jws/Instantiate.jws","te
stProgrammaticInstantiate");
-    }
-
-    /**
-     * Tests instantiating a custom control programmatically with
properties
-     */
-       @Freq("detailed")
-    public void testProgrammaticInstantiateWithProperty() throws
Exception
-    {
-
assertReport("http://localhost:8080/controlsWeb/jws/Instantiate.jws","te
stProgrammaticInstantiateWithProperty");
-    }
+   /**
+    * Tests instantiating a custom control programmatically with
properties
+    */
+   @Freq("detailed")
+   public void testProgrammaticInstantiateWithProperty() throws
Exception
+   {
+
assertReport("http://localhost:8080/controlsWeb/jws/Instantiate.jws","te
stProgrammaticInstantiateWithProperty");
+   }
 }

Modified: incubator/beehive/trunk/controls/test/tools/milton/build.xml
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/tool
s/milton/build.xml?view=diff&rev=128417&p1=incubator/beehive/trunk/contr
ols/test/tools/milton/build.xml&r1=128416&p2=incubator/beehive/trunk/con
trols/test/tools/milton/build.xml&r2=128417
========================================================================
======
--- incubator/beehive/trunk/controls/test/tools/milton/build.xml
(original)
+++ incubator/beehive/trunk/controls/test/tools/milton/build.xml
Thu Jan 27 11:56:46 2005
@@ -1,7 +1,7 @@
 <project name="beehive-tools-milton" default="deploy" basedir=".">
 
-  <import file="../../beehive-imports.xml"/>
-  <import file="../../ant/axis-import.xml"/>
+  <import file="../../../../beehive-imports.xml"/>
+  <import file="../../../../ant/axis-import.xml"/>
   
   <property name="src.dir" value="${basedir}/src"/>
   <property name="build.dir" value="${basedir}/build"/>
@@ -11,7 +11,10 @@
   <path id="milton.build.classpath">
      <path refid="junit.dependency.path"/>
      <pathelement location="${httpunit.jar}"/>
-     <path refid="webservice.jars"/>
+     <pathelement location="../../../../wsm/external/axis.jar"/>
+     <pathelement location="${mantis.jar}"/>     
+     <path refid="controls.dependency.path"/>     
+     <fileset refid="velocity.fileset"/>
   </path>
 
   <target name="usage">
@@ -29,11 +32,16 @@
   <!-- ========================= -->
   <target name="deploy">
     <mkdir dir="${build.dir}"/>
+    <!-- Copy template files into the build -->
+    <copy todir="${build.dir}" overwrite="true">
+       <fileset dir="${src.dir}" includes="**/*.vm"/>
+    </copy>
     <javac srcdir="${src.dir}"
             destdir="${build.dir}"
             failonerror="true"
             verbose="false"
             deprecation="true"
+           debug="true"
             classpathref="milton.build.classpath"
             />
      <jar basedir="${build.dir}" destfile="${milton.jar}"/>

Added:
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehiv
e/test/tools/milton/annotations/Milton.java
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/tool
s/milton/src/org/apache/beehive/test/tools/milton/annotations/Milton.jav
a?view=auto&rev=128417
========================================================================
======
--- (empty file)
+++
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehiv
e/test/tools/milton/annotations/Milton.java     Thu Jan 27 11:56:46 2005
@@ -0,0 +1,142 @@
+package org.apache.beehive.test.tools.milton.annotations;

+

+import java.lang.annotation.Retention;

+import java.lang.annotation.RetentionPolicy;

+import java.lang.annotation.Target;

+import java.lang.annotation.ElementType;

+

+/***

+ * Wapping interface for all @Milton. annotations.

+ */

+public interface Milton

+{

+       public static final String DEFAULT_CONTROL_NAME = "";

+       public static final String[] DEFAULT_CONTROL_ANNOTATIONS = {};

+       public static final String DEFAULT_CONTROL_MODIFIER = "public";

+       public static final Instantiate DEFAULT_CONTROL_INSTANTIATE =
Instantiate.DECLARATIVE;

+       

+       public static final String DEFAULT_TEST_FREQUENCY = "checkin";

+       public static final String DEFAULT_TEST_STATUS = "active";

+       public static final String DEFAULT_TEST_DESCRIPTION = "";

+       public static final String DEFAULT_TEST_MISC = "";

+       

+       public static final boolean DEFAULT_SUITE_JUNIT = true;

+

+       /*

+        * Supported client types

+        */

+       public enum ClientType {

+               JWS,

+               JPF

+       };

+       

+       /*

+        * Enumeration to represent Control instantiation options

+        */

+       public enum Instantiate

+       {

+               DECLARATIVE,

+               PROGRAMATIC

+       };

+       

+       /**

+        * TYPE level annotation to signify a Milton TestSuite

+        */

+       @Target(ElementType.TYPE)

+       @Retention(RetentionPolicy.SOURCE)

+       public @interface TestSuite

+       {

+               /*

+                * Comma separated list of client types to generate.
Available options include 'jws' and 'jpf'

+                */

+               ClientType[] clients() default {ClientType.JWS,
ClientType.JPF};

+               

+               /*

+                * A Junit accessor can be generated for each of the
client types created.  This is true by default. 

+                */

+               boolean junit() default DEFAULT_SUITE_JUNIT;

+       }

+       

+       /*

+        * PARAMETER level annotation to pass additional information
about your control for declaration.

+        * This annotation is optional if you do not need to override
any of the default declaration values. 

+        */

+       @Target(ElementType.PARAMETER)

+       @Retention(RetentionPolicy.SOURCE)

+       public @interface TestControl

+       {

+               /*

+                * By default the control name is blank and Milton will
generate a name based upon the test method name and the

+                * parameter name: testMethod_parameter.  If you wish to
set your own name please ensure that it does not collide with other
controls.

+                */

+               String name() default DEFAULT_CONTROL_NAME;

+               

+               /*

+                * An array of String which contain additional
annotations for your control.  You must be sure to

+                * escape all quotation marks.  Each element of the
array will be placed under the @Control

+                * annotation and before the control is declared.

+                */

+               String[] annotations() default {};

+               

+               /*

+                * Controls can be instantiated Declaritively with
@Control or Programatically using the Java Bean API.

+                * Defaults to Instantiate.DECLARATIVE.  

+                * 

+                * @see java.beans.Bean

+                * @see #Instantiate

+                */

+               Instantiate instantiate() default
Instantiate.DECLARATIVE;

+

+               /*

+                * When using Declarative instantiation you may override
the default access m odifier for your control.

+                * Defaults to 'private'.  Setting to "" will yield
Java's default package level access. 

+                * 

+                * @see #Instantiate

+                */

+               String modifier() default DEFAULT_CONTROL_MODIFIER;
//public,private,protected,""

+       }

+       

+       /*

+        * Each test method within a type annotated by a TestSuite
annotation should be annotated

+        * with @Milton.Test.  This is used in combination with TCH
(insert useful link here)

+        */

+       @Target(ElementType.METHOD)

+       @Retention(RetentionPolicy.SOURCE)

+       public @interface Test

+       {

+               /*

+                * Tests can be arranged by how often they should run.
Options include

+                * 'checkin' and 'detailed'.  'checkin' tests should be
run before a 

+                * developer checks in his or her changes.

+                * 

+                * @see TCH

+                * @see Mantis

+                */

+               String frequency() default DEFAULT_TEST_FREQUENCY;

+               

+               /*

+                * Sets wether or not a particular test is active.  A
test may be set to

+                * 'active' or 'inactive'.  Tests which are inactive
will still have client code

+                * generated for them but will not be run by TCH

+                * 

+                * @see TCH

+                */

+               String status() default DEFAULT_TEST_STATUS;

+               

+               /*

+                * Description for your test.  Information placed here
will be placed in TCH xml

+                * files generated by Mantis.

+                * 

+                * @see TCH

+                * @see Mantis

+                */

+               String description() default DEFAULT_TEST_DESCRIPTION;

+               

+               /*

+                * Comman separated list of miscilaneous information for
your test.  This is not used by default TCH run

+                * configurations but can be used for filtering or
place-holding.  Most commonly

+                * used with key=value pairs.

+                */

+               String misc() default DEFAULT_TEST_MISC;

+       }

+}
\ No newline at end of file

Modified:
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehiv
e/test/tools/milton/junit/SOAPReportTestCase.java
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/tool
s/milton/src/org/apache/beehive/test/tools/milton/junit/SOAPReportTestCa
se.java?view=diff&rev=128417&p1=incubator/beehive/trunk/controls/test/to
ols/milton/src/org/apache/beehive/test/tools/milton/junit/SOAPReportTest
Case.java&r1=128416&p2=incubator/beehive/trunk/controls/test/tools/milto
n/src/org/apache/beehive/test/tools/milton/junit/SOAPReportTestCase.java
&r2=128417
========================================================================
======
---
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehiv
e/test/tools/milton/junit/SOAPReportTestCase.java       (original)
+++
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehiv
e/test/tools/milton/junit/SOAPReportTestCase.java       Thu Jan 27
11:56:46 2005
@@ -2,7 +2,6 @@
 
 import org.apache.beehive.test.tools.milton.junit.ReportTestCase;
 import org.apache.beehive.test.tools.milton.junit.AbortTestException;
-import org.apache.beehive.test.tools.milton.junit.FailTestError;
 import org.apache.beehive.test.tools.milton.common.Report;
 
 import org.apache.axis.client.Call;
@@ -19,11 +18,9 @@
         super(name);
     }
 
-    private Call createCall(String p_uri, String p_method) throws
java.net.MalformedURLException {
-
-        String l_url = createUrl(p_uri);
-
-        Call l_call = new Call(p_uri);
+    private Call createCall(String p_uri, String p_method) throws
java.net.MalformedURLException 
+    {
+        Call l_call = new Call(createUrl(p_uri));
         QName l_qname = new
QName("http://common.milton.tools.test.beehive.apache.org";, "Report");
 
         l_call.setOperationName(new
javax.xml.namespace.QName(p_method));
@@ -40,7 +37,7 @@
             throw new IllegalArgumentException("URI and Method cannot
be Null");
 
         Object l_resp = createCall(p_uri, p_method).invoke(new Object[]
{});
-
+        
         if (l_resp instanceof java.rmi.RemoteException)
             throw (java.rmi.RemoteException)l_resp;
 

Added:
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehiv
e/test/tools/milton/mantis/MiltonProcessor.java
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/tool
s/milton/src/org/apache/beehive/test/tools/milton/mantis/MiltonProcessor
.java?view=auto&rev=128417
========================================================================
======
--- (empty file)
+++
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehiv
e/test/tools/milton/mantis/MiltonProcessor.java Thu Jan 27 11:56:46 2005
@@ -0,0 +1,215 @@
+package org.apache.beehive.test.tools.milton.mantis;

+

+import java.util.ArrayList;

+import java.util.Collection;

+import java.util.HashMap;

+import java.util.HashSet;

+import java.util.Set;

+

+import org.apache.beehive.test.tools.mantis.AbstractMantisProcessor;

+import org.apache.beehive.test.tools.milton.annotations.Milton;

+import org.apache.beehive.test.tools.milton.mantis.generator.JpfClient;

+import
org.apache.beehive.test.tools.milton.mantis.generator.JpfAccesser;

+import
org.apache.beehive.test.tools.milton.mantis.generator.JwsAccesser;

+import org.apache.beehive.test.tools.milton.mantis.generator.JwsClient;

+import
org.apache.beehive.test.tools.milton.mantis.generator.MiltonClientGenera
tor;

+import
org.apache.beehive.test.tools.milton.mantis.generator.VelocityGenerator;

+

+import com.sun.mirror.apt.AnnotationProcessorEnvironment;

+import com.sun.mirror.declaration.AnnotationTypeDeclaration;

+import com.sun.mirror.declaration.ClassDeclaration;

+import com.sun.mirror.declaration.MethodDeclaration;

+import com.sun.mirror.declaration.PackageDeclaration;

+import com.sun.mirror.declaration.ParameterDeclaration;

+import com.sun.mirror.declaration.TypeDeclaration;

+import com.sun.mirror.type.ClassType;

+

+/*

+ * 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>();

+       

+               for (ClassDeclaration cd : p_testClasses)

+               {

+                       Milton.TestSuite a_mts =
(Milton.TestSuite)cd.getAnnotation(Milton.TestSuite.class);

+                       

+                       if (null == a_mts)

+                               continue;

+                       

+                       MiltonTestSuite mts = new
MiltonTestSuite(cd.getPackage().getQualifiedName(),

+
cd.getSimpleName(), a_mts.clients(),

+
a_mts.junit());

+                       

+                       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.milt
on.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>();

+                       

+                       //all parameters to a milton test method must be
control beans

+                       for (ParameterDeclaration p : pd) {

+                               boolean isControlBean = false;

+                               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.Control
Bean")) {

+                                               isControlBean = true;   

+                                               break;

+                                       }

+                                       

+                                       sct =
(ClassType)sct.getSuperclass();

+                               }

+                               

+                               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 controlType =
((ClassType)p.getType()).toString();

+                               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;

+                               

+                               // 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();

+                               } 

+                               

+                               controls.add(new
MiltonTestControl(controlName, 

+
controlType,controlAnnotations,

+
controlInstantiate,

+
controlModifier));

+                       }

+

+                       MiltonTestMethod mtm = new
MiltonTestMethod(testName, controls, attributes);

+                                               

+                       tests.add(mtm);

+               }

+               

+               return tests;

+       }

+}
\ No newline at end of file

Added:
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehiv
e/test/tools/milton/mantis/MiltonTestControl.java
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/tool
s/milton/src/org/apache/beehive/test/tools/milton/mantis/MiltonTestContr
ol.java?view=auto&rev=128417
========================================================================
======
--- (empty file)
+++
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehiv
e/test/tools/milton/mantis/MiltonTestControl.java       Thu Jan 27
11:56:46 2005
@@ -0,0 +1,94 @@
+package org.apache.beehive.test.tools.milton.mantis;

+

+import org.apache.beehive.test.tools.milton.annotations.Milton;

+

+/*

+ * A MiltonTestControl represents a Control passed to a test method
where

+ * the information about the control is derived from APT metadata.

+ */

+public class MiltonTestControl

+{

+       String _name;

+       String _type;

+       String[] _annotations = Milton.DEFAULT_CONTROL_ANNOTATIONS;

+       Milton.Instantiate _instantiate =
Milton.DEFAULT_CONTROL_INSTANTIATE;

+       String _modifier = Milton.DEFAULT_CONTROL_MODIFIER;

+       

+       /*

+        * Constructs a new MiltonTestControl

+        * 

+        * @param p_name The name of the control as it would be declared
in src

+        * @param p_type The name of the type of the control represented

+        * @param p_annotations Array containing additional annotations
for declaration time for this control

+        * @param p_instantiate Milton.Instantiate representing how this
control should be instantiated

+        * @param p_modifier Access modifier for this control

+        */

+       public MiltonTestControl(String p_name, String p_type, 

+                        String[] p_annotations,

+                        Milton.Instantiate p_instantiate,

+                        String p_modifier)

+       {

+               if (p_name == null) {

+                       throw new IllegalArgumentException("Control Name
cannot be null");

+               }

+               

+               if (p_type == null) {

+                       throw new IllegalArgumentException("Control Type
cannot be null");

+               }

+               

+               if (p_annotations != null)

+                       this._annotations = p_annotations;

+               

+               if (p_instantiate != null)

+                       this._instantiate = p_instantiate;

+               

+               if (p_modifier != null)

+                       this._modifier = p_modifier;

+               

+               this._name = p_name;

+               this._type = p_type;

+       }

+       

+       /*

+        * Returns the name of this Control

+        */

+       public String getName()

+       {

+               return this._name;

+       }

+       

+       /*

+        * Returns array of annatations for this Control

+        */

+       public String[] getAnnotations()

+       {

+               return this._annotations;

+       }

+       

+       /*

+        * Returns modifier for this Control

+        */

+       public String getModifier()

+       {

+               return this._modifier;

+       }

+       

+       /*

+        * Returns the fully qualified name of the type of this Control

+        */

+       public String getType()

+       {

+               return this._type;

+       }

+       

+       /*

+        * Returns boolean representing wether or not this control will
be

+        * declared Declaratively.

+        */

+       public boolean isDeclaritive()

+       {

+               if (this._instantiate == Milton.Instantiate.DECLARATIVE)

+                       return true;

+               return false;

+       }

+}


Added:
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehiv
e/test/tools/milton/mantis/MiltonTestMethod.java
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/tool
s/milton/src/org/apache/beehive/test/tools/milton/mantis/MiltonTestMetho
d.java?view=auto&rev=128417
========================================================================
======
--- (empty file)
+++
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehiv
e/test/tools/milton/mantis/MiltonTestMethod.java        Thu Jan 27
11:56:46 2005
@@ -0,0 +1,127 @@
+package org.apache.beehive.test.tools.milton.mantis;

+

+import java.util.ArrayList;

+import java.util.Collection;

+import java.util.HashMap;

+

+/*

+ * A MiltonTestMethod represents a test method where the information
about the

+ * test method is represented in APT metadata and Java reflection.

+ */

+public class MiltonTestMethod

+{

+       private String _name;

+       private String _frequency;

+       private String _misc;

+       private String _status;

+       private String _description;

+       private Collection<MiltonTestControl> _controls = 

+
new ArrayList<MiltonTestControl>();

+       private HashMap<String, String> _attributes;

+       

+       /*

+        *  Construct MiltonTestMethod

+        * 

+        *  @param p_testName Name of the test method

+        *  @param p_mtc A Collection of MiltonTestControl for controls
associated with this method

+        */

+       public MiltonTestMethod(String p_testName,
Collection<MiltonTestControl> p_mtc)

+       {

+               this(p_testName, p_mtc, new HashMap<String, String>());

+       }

+       

+       /*

+        * Construct MiltonTestMethod

+        * 

+        * @param p_testName Name of the test method

+        * @param p_mtc Collection of MiltonTestControl for controls
associated with this method

+        * @param p_attributes HashMap<String, String> containing
additional metadata from Milton.TestControl annotation

+        */

+       public MiltonTestMethod(String p_testName, 

+                               Collection<MiltonTestControl> p_mtc,

+                               HashMap<String, String> p_attributes)

+       {

+               if (p_testName == null)

+                       throw new IllegalArgumentException("Test Name
cannot be null");

+               

+               if (p_mtc == null || p_mtc.size() <= 0)

+                       throw new IllegalArgumentException("Milton Tests
require at least one MiltonTestControl");

+               

+               this._name = p_testName;

+               this._controls = p_mtc;

+               this._attributes = p_attributes;

+       }

+       

+       /*

+        * Returns Collection of MiltonTestControl associated with the
method.

+        */

+       public Collection<MiltonTestControl> getControls()

+       {

+               return this._controls;

+       }

+       

+       /*

+        * Returns the name of the method

+        */

+       public String getName() 

+       { 

+               return this._name; 

+       }

+       

+       /*

+        * Returns a list comma separated String of parameters to be
passed to the method.

+        */

+       public String getParameters()

+       {

+               String parameters = "";

+               

+               Object[] mtc = this._controls.toArray();

+       

+               for (int i = 0; i < mtc.length; ++i) {

+                       parameters +=
((MiltonTestControl)mtc[i]).getName();

+                       if (i < mtc.length -1) {

+                               parameters += ",";

+                       }

+               }

+               

+               return parameters;

+       }

+

+       /*

+        * Returns a HashMap of name=value attributes.  This is useful
to call from a Velocity template

+        */

+       public HashMap<String, String> getAttributes()

+       {

+               return this._attributes;

+       }

+       

+       /*

+        * Returns Collection on MiltonTestControl which are to be
instantiated Declaratively

+        */

+       public Collection<MiltonTestControl> getDeclarativeControls()

+       {

+               Collection<MiltonTestControl> decControls =

+
new ArrayList<MiltonTestControl>();

+               for (MiltonTestControl mtc : _controls) {

+                       if (mtc.isDeclaritive())

+                               decControls.add(mtc);

+               }

+               

+               return decControls;

+       }

+       

+       /*

+        * Returns Collection of MiltonTestControl which are to be
instantiated Programatically

+        */

+       public Collection<MiltonTestControl> getProgramaticControls()

+       {

+               Collection<MiltonTestControl> progControls =

+
new ArrayList<MiltonTestControl>();

+               for (MiltonTestControl mtc : _controls) {

+                       if (! mtc.isDeclaritive())

+                               progControls.add(mtc);

+               }

+               

+               return progControls;

+       }

+}


Added:
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehiv
e/test/tools/milton/mantis/MiltonTestSuite.java
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/tool
s/milton/src/org/apache/beehive/test/tools/milton/mantis/MiltonTestSuite
.java?view=auto&rev=128417
========================================================================
======
--- (empty file)
+++
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehiv
e/test/tools/milton/mantis/MiltonTestSuite.java Thu Jan 27 11:56:46 2005
@@ -0,0 +1,96 @@
+package org.apache.beehive.test.tools.milton.mantis;

+

+import java.util.Collection;

+import java.util.ArrayList;

+

+import org.apache.beehive.test.tools.milton.annotations.Milton;

+import
org.apache.beehive.test.tools.milton.mantis.generator.MiltonTestClient;

+

+/*

+ * A MiltonTestSuite represents a Test Driver

+ */

+public class MiltonTestSuite

+{

+       private String _name;

+       private String _packageName;

+       private Collection<MiltonTestMethod> _tests = 

+
new ArrayList<MiltonTestMethod>();

+       

+       private boolean _jpfClient = false;

+       private boolean _jwsClient = false;

+       private boolean _junitClient = false;

+

+       /*

+        * Construct a MiltonTestSuite

+        * 

+        * @param p_pn Package Name (org.foo.bar)

+        * @param p_sn Suite Name (TestSomething)

+        * @param p_clients Comma separated String of clients this suite
needs generated ("jws,jpf")

+        * @param p_junit set to true if clients should have junit
accessers generated for them

+        */

+       public MiltonTestSuite(String p_pn, String p_sn,
Milton.ClientType[] p_clients, boolean p_junit)

+       {

+               if (null == p_pn || null == p_sn || null == p_clients)

+                       throw new IllegalArgumentException("Package
Name, Suite Name, and Clients must not be null");

+               this._name = p_sn;

+               this._packageName = p_pn;

+               this._junitClient = p_junit;

+       

+               for (int i = 0; i < p_clients.length; ++i) {

+                       if (p_clients[i] == Milton.ClientType.JWS)

+                               this._jwsClient = true;

+                       else if (p_clients[i] == Milton.ClientType.JPF)

+                               this._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

+        */

+       public boolean isJpfClient() 

+       {

+               return _jpfClient;

+       }

+       

+       /*

+        * Returns true if MiltonTestSuite will have JUnit clients
generated

+        */

+       public boolean isJunitClient() 

+       {

+               return _junitClient;

+       }

+       

+       /*

+        * Returns true if MiltonTestSuite will have JWS clients
generated

+        */

+       public boolean isJwsClient() 

+       {

+               return _jwsClient;

+       }

+       

+       public void addTest(MiltonTestMethod p_mtm)

+       {

+               this._tests.add(p_mtm);

+       }

+

+       public void addAllTests(Collection<MiltonTestMethod> p_mtm)

+       {

+               this._tests.addAll(p_mtm);

+       }

+       

+       public String getName() {

+               return _name;

+       }

+       

+       public Collection<MiltonTestMethod> getTests()

+       {

+               return this._tests;

+       }

+       

+       public String getPackageName() {

+               return _packageName;

+       }

+}


Added:
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehiv
e/test/tools/milton/mantis/generator/JpfAccesser.java
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/tool
s/milton/src/org/apache/beehive/test/tools/milton/mantis/generator/JpfAc
cesser.java?view=auto&rev=128417
========================================================================
======
--- (empty file)
+++
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehiv
e/test/tools/milton/mantis/generator/JpfAccesser.java   Thu Jan 27
11:56:46 2005
@@ -0,0 +1,74 @@
+package org.apache.beehive.test.tools.milton.mantis.generator;

+

+import org.apache.beehive.controls.runtime.generator.IndentingWriter;

+import org.apache.beehive.test.tools.milton.mantis.MiltonTestSuite;

+

+import com.sun.mirror.apt.AnnotationProcessorEnvironment;

+import com.sun.mirror.apt.Filer;

+

+import java.io.File;

+import java.io.IOException;

+import java.io.Writer;

+import java.util.regex.Matcher;

+import java.util.regex.Pattern;

+

+/*

+ * A JpfAccesser is will generate a Junit test suite to access the
methods in the generated JPF

+ */

+public class JpfAccesser extends JpfClient

+{

+       protected final String JPF_ACCESSER_TEMPLATE_NAME =
"org/apache/beehive/test/tools/milton/mantis/generator/MiltonJpfAccesser
.vm";

+       protected final String JPF_ACCESSER_DIR = "testsrcgen"; // this
should be dynamic!

+       

+       protected String _jpfAccesserPackage = "tests.jpf.";

+       protected String _jpfAccesserLocation = JPF_ACCESSER_DIR;

+       protected String _jpfAccesserName = "";

+       

+       /*

+        * Construct a JpfAccesser

+        * 

+        * @param p_mts the MiltonTestSuite to represent a JPF client
for

+        * @param p_env APT environment.  Needed for accessing the
Filer.

+        */

+       public JpfAccesser(MiltonTestSuite p_mts,
AnnotationProcessorEnvironment p_env)

+       {

+               super(p_mts, p_env);

+               

+               this._templateName = JPF_ACCESSER_TEMPLATE_NAME;

+               

+               // Create a client accessor package

+               String packageReWriter = "(.*)\\.(.+)$";

+               Pattern packagePattern =
Pattern.compile(packageReWriter);

+               

+               Matcher m =
packagePattern.matcher(p_mts.getPackageName());

+               

+               //TODO: consider rethinking how i handle package
mangling here

+               if (m.matches())

+                       this._jpfAccesserPackage = "test.milton.jpf." +
m.group(2);

+               else

+                       this._jpfAccesserPackage = "test.milton.jpf." +
p_mts.getPackageName();

+       

+               this._jpfAccesserName =
p_mts.getName().startsWith("Test") ? 

+                                                       p_mts.getName()
: "Test" + p_mts.getName();

+               

+               this._jpfAccesserLocation += "/" +
this._jpfAccesserPackage.replace(".", "/") +

+                                                       "/" +
_jpfAccesserName + ".java";

+               

+               this._context.put("jpf_webapp_name", super.WEBAPP_NAME);

+               this._context.put("jpf_accesser_package",
this._jpfAccesserPackage);

+               this._context.put("jpf_accesser_name",
_jpfAccesserName);

+               this._context.put("jpf_action_call_prefix",
super._jpfActionPath);

+       }

+       

+       /*

+        * Overriding the getWriter() in the parent class to return a
Writer with

+        * for the correct JPF Accesser file.

+        */

+       public Writer getWriter()

+               throws IOException

+       {               

+               this._writer = new
IndentingWriter(this._filer.createTextFile(Filer.Location.SOURCE_TREE,

+                                                               "", new
File(this._jpfAccesserLocation), null));

+               return this._writer;

+       }

+}


Added:
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehiv
e/test/tools/milton/mantis/generator/JpfClient.java
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/tool
s/milton/src/org/apache/beehive/test/tools/milton/mantis/generator/JpfCl
ient.java?view=auto&rev=128417
========================================================================
======
--- (empty file)
+++
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehiv
e/test/tools/milton/mantis/generator/JpfClient.java     Thu Jan 27
11:56:46 2005
@@ -0,0 +1,63 @@
+package org.apache.beehive.test.tools.milton.mantis.generator;

+

+import java.io.File;

+import java.io.IOException;

+import java.io.Writer;

+

+import org.apache.beehive.controls.runtime.generator.IndentingWriter;

+import org.apache.beehive.test.tools.milton.mantis.MiltonTestSuite;

+

+import com.sun.mirror.apt.AnnotationProcessorEnvironment;

+import com.sun.mirror.apt.Filer;

+

+/*

+ * A JpfClient extends MiltonTestClient and represents the information 

+ * necessary to generate a JPF client for a given MiltonTestSuite.

+ * 

+ * @see MiltonTestClient

+ */

+public class JpfClient extends MiltonTestClient

+{

+       protected final String JPF_TEMPLATE_NAME =
"org/apache/beehive/test/tools/milton/mantis/generator/MiltonJpf.vm";

+       protected final String WEBAPP_NAME = "controlsWeb"; //TODO:
should be dynamic

+       protected final String WEBAPP_DIR = "webapps/" + WEBAPP_NAME;
//TODO: this should be dynamic - waiting for Mantis support for -A

+               

+       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 = this.WEBAPP_NAME + "/" +
this._jpfPackage.replace(".", "/");

+               this._jpfLocation = WEBAPP_DIR + "/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;

+       }

+}


Added:
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehiv
e/test/tools/milton/mantis/generator/JwsAccesser.java
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/tool
s/milton/src/org/apache/beehive/test/tools/milton/mantis/generator/JwsAc
cesser.java?view=auto&rev=128417
========================================================================
======
--- (empty file)
+++
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehiv
e/test/tools/milton/mantis/generator/JwsAccesser.java   Thu Jan 27
11:56:46 2005
@@ -0,0 +1,73 @@
+package org.apache.beehive.test.tools.milton.mantis.generator;

+

+import java.io.File;

+import java.io.IOException;

+import java.io.Writer;

+import java.util.regex.Matcher;

+import java.util.regex.Pattern;

+

+import org.apache.beehive.controls.runtime.generator.IndentingWriter;

+import org.apache.beehive.test.tools.milton.mantis.MiltonTestSuite;

+

+import com.sun.mirror.apt.AnnotationProcessorEnvironment;

+import com.sun.mirror.apt.Filer;

+

+/*

+ * A JwsAccesser is will generate a Junit test suite to access the
methods in the generated JWS

+ */

+public class JwsAccesser extends JwsClient

+{

+       protected final String JWS_ACCESSER_TEMPLATE_NAME =
"org/apache/beehive/test/tools/milton/mantis/generator/MiltonJwsAccesser
.vm";

+       protected final String JWS_ACCESSER_DIR = "testsrcgen"; // this
should be dynamic - waiting on Mantis support for -A!

+       

+       protected String _jwsAccesserPackage = "tests.jws.";

+       protected String _jwsAccesserLocation = JWS_ACCESSER_DIR;

+       protected String _jwsAccesserName = "";

+

+       /*

+        * Construct a JwsAccesser

+        * 

+        * @param p_mts the MiltonTestSuite to represent a JWS client
for

+        * @param p_env APT environment.  Needed for accessing the
Filer.

+        */

+       public JwsAccesser(MiltonTestSuite p_mts,
AnnotationProcessorEnvironment p_env)

+       {

+               super(p_mts, p_env);

+               this._templateName = JWS_ACCESSER_TEMPLATE_NAME;

+               

+               // Create a client accessor package

+               String packageReWriter = "(.*)\\.(.+)$";

+               Pattern packagePattern =
Pattern.compile(packageReWriter);

+               

+               Matcher m =
packagePattern.matcher(p_mts.getPackageName());

+               

+               //TODO: consider rethinking how i handle package
mangling here

+               //      my intension is to make it clear which code has
been gen'ed

+               if (m.matches())

+                       this._jwsAccesserPackage = "test.milton.jws." +
m.group(2);

+               else

+                       this._jwsAccesserPackage = "test.milton.jws." +
p_mts.getPackageName();

+       

+               this._jwsAccesserName =
p_mts.getName().startsWith("Test") ? 

+                                                       p_mts.getName()
: "Test" + p_mts.getName();

+               

+               this._jwsAccesserLocation += "/" +
this._jwsAccesserPackage.replace(".", "/") +

+                                                       "/" +
_jwsAccesserName + ".java";

+               

+               this._context.put("jws_accesser_package",
this._jwsAccesserPackage);

+               this._context.put("jws_accesser_name",
_jwsAccesserName);

+               this._context.put("jws_accesser_call_path",
super._jwsCallPath);

+       }

+

+       /*

+        * Overriding the getWriter() in the parent class to return a
Writer with

+        * for the correct JWS Accesser file.

+        */

+       public Writer getWriter()

+               throws IOException

+    {  

+               this._writer = new
IndentingWriter(this._filer.createTextFile(Filer.Location.SOURCE_TREE,

+                                                       "", new
File(this._jwsAccesserLocation), null));

+               return this._writer;

+    }

+}


Added:
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehiv
e/test/tools/milton/mantis/generator/JwsClient.java
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/tool
s/milton/src/org/apache/beehive/test/tools/milton/mantis/generator/JwsCl
ient.java?view=auto&rev=128417
========================================================================
======
--- (empty file)
+++
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehiv
e/test/tools/milton/mantis/generator/JwsClient.java     Thu Jan 27
11:56:46 2005
@@ -0,0 +1,65 @@
+package org.apache.beehive.test.tools.milton.mantis.generator;

+

+import java.io.File;

+import java.io.IOException;

+import java.io.Writer;

+

+import org.apache.beehive.controls.runtime.generator.IndentingWriter;

+import org.apache.beehive.test.tools.milton.mantis.MiltonTestSuite;

+

+import com.sun.mirror.apt.AnnotationProcessorEnvironment;

+import com.sun.mirror.apt.Filer;

+

+/*

+ * A JwsClient extends MiltonTestClient and represents the information 

+ * necessary to generate a JWS client for a given MiltonTestSuite.

+ * 

+ * @see MiltonTestClient

+ */

+public class JwsClient extends MiltonTestClient

+{

+       protected final String TEMPLATE_NAME =
"org/apache/beehive/test/tools/milton/mantis/generator/MiltonJws.vm";

+       protected final String WEBAPP_NAME = "controlsWeb"; //TODO:
should be dynamic

+       protected final String WEBAPP_DIR = "webapps/" + WEBAPP_NAME;
//TODO: this should be dynamic - waiting for Mantis support for -A

+       protected final String PKGPREFIX = "milton.webservices.";

+               

+       protected String _jwsPackage = PKGPREFIX;

+       protected String _jwsLocation;

+       protected String _jwsCallPath;

+       protected String _jwsPath;

+

+       /*

+        * Construct a JwsClient

+        * 

+        * @param p_mts the MiltonTestSuite to represent a JPF client
for

+        * @param p_env APT environment.  Needed for accessing the
Filer.

+        */

+       public JwsClient(MiltonTestSuite p_mts,
AnnotationProcessorEnvironment p_env)

+       {

+               super(p_mts, p_env);

+               this._templateName = TEMPLATE_NAME;

+                       

+               String[] pkg = p_mts.getPackageName().split("\\.");

+               

+               //TODO: should i handle the 'noPackage' case or error
out?

+               this._jwsPackage += pkg.length >= 1 ? pkg[pkg.length-1]
: "noPackage";

+               this._jwsPath = this._jwsPackage.replace(".", "/") + 

+                                                               "/" +
p_mts.getName()+"WebService.jws";

+               this._jwsCallPath = "/" + this.WEBAPP_NAME + "/" +
this._jwsPath;

+               this._jwsLocation = WEBAPP_DIR + "/WEB-INF/src/" +
this._jwsPath; 

+                                                                  

+               this._context.put("jws_package", this._jwsPackage);

+       }

+       

+       /*

+        * 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._jwsLocation), null));

+               return this._writer;

+       }

+}


Added:
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehiv
e/test/tools/milton/mantis/generator/MiltonClientGenerator.java
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/tool
s/milton/src/org/apache/beehive/test/tools/milton/mantis/generator/Milto
nClientGenerator.java?view=auto&rev=128417
========================================================================
======
--- (empty file)
+++
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehiv
e/test/tools/milton/mantis/generator/MiltonClientGenerator.java Thu Jan
27 11:56:46 2005
@@ -0,0 +1,14 @@
+package org.apache.beehive.test.tools.milton.mantis.generator;

+

+/*

+ * Inteface to describe a generater

+ */

+public interface MiltonClientGenerator 

+{

+       /*

+        * Given a MiltonTestClient this method must generate the
appropriate files

+        * 

+        * @see MiltonTestClient

+        */

+       public void generate(MiltonTestClient p_mtc);

+}


Added:
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehiv
e/test/tools/milton/mantis/generator/MiltonJpf.vm
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/tool
s/milton/src/org/apache/beehive/test/tools/milton/mantis/generator/Milto
nJpf.vm?view=auto&rev=128417
========================================================================
======
--- (empty file)
+++
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehiv
e/test/tools/milton/mantis/generator/MiltonJpf.vm       Thu Jan 27
11:56:46 2005
@@ -0,0 +1,80 @@
+##

+## The Velocity code generation template for the Milton JPF
controllerfor

+## generated as a control client for testing beehive-controls.

+##

+## 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:$

+##

+#macro (defineActions)

+   #foreach ($test in $suite.tests)

+   @Jpf.Action

+   public Forward ${test.name}()

+   {

+      #programaticControls($test)

+

+      ${suite.packageName}.${suite.name} driver = new
${suite.packageName}.${suite.name}();

+      return new Forward(Report.RESULTS, Report.KEY,
driver.${test.name}(${test.parameters}));

+   }

+

+   #end

+#end

+##

+#macro (declarativeControls $test)

+   #foreach ($control in $test.getDeclarativeControls())

+   @Control

+   #foreach ($annotation in $control.getAnnotations())

+   $annotation

+   #end

+   $control.modifier $control.type $control.name;

+

+   #end

+#end

+##

+#macro (programaticControls $test)

+   #foreach ($control in $test.getProgramaticControls())

+      $control.type $control.name = ($control.type)
java.beans.Beans.instantiate(Thread.currentThread().getContextClassLoade
r(), "$control.type");

+

+   #end

+#end

+##

+package $client.jpf_package;

+

+import org.apache.beehive.netui.pageflow.PageFlowController;

+import org.apache.beehive.netui.pageflow.Forward;

+import org.apache.beehive.netui.pageflow.annotations.Jpf;

+

+import org.apache.beehive.controls.api.bean.Control;

+

+import org.apache.beehive.test.tools.milton.common.Report;

+

[EMAIL PROTECTED](

+    forwards = { @Jpf.Forward(name=Report.RESULTS,path =
Report.RESULTSJSP) } 

+)

+public class Controller extends PageFlowController

+{

+    #foreach ($test in $suite.tests)

+    #declarativeControls($test)

+    #end

+

+    @Jpf.Action

+    protected Forward begin()

+    {

+       return new Forward(Report.RESULTS, Report.KEY, new 

+                          Report(Report.ABORT,"begin() is not a test
method!"));

+    }

+

+    #defineActions()

+}


Added:
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehiv
e/test/tools/milton/mantis/generator/MiltonJpfAccesser.vm
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/tool
s/milton/src/org/apache/beehive/test/tools/milton/mantis/generator/Milto
nJpfAccesser.vm?view=auto&rev=128417
========================================================================
======
--- (empty file)
+++
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehiv
e/test/tools/milton/mantis/generator/MiltonJpfAccesser.vm       Thu Jan
27 11:56:46 2005
@@ -0,0 +1,29 @@
+#macro (defineJpfTestMethods)

+   #set( $velocimacro.context.localscope = true )

+   #foreach ($test in $suite.tests)

+   #set( $attributes = ${test.attributes} )

+

+   @Freq("$attributes.frequency")

+   @Status("$attributes.status")

+   @Misc("$attributes.misc")

+   @Desc("$attributes.description")

+   public void ${test.name}() throws Exception

+   {

+      assertReport("${client.jpf_action_call_prefix}/${test.name}.do");

+   }

+

+   #end

+#end

+###

+package $client.jpf_accesser_package;

+

+import org.apache.beehive.test.tools.milton.junit.HtmlReportTestCase;

+

+import org.apache.beehive.test.tools.mantis.annotations.tch.*;

+

+public class $client.jpf_accesser_name extends HtmlReportTestCase

+{

+   public ${client.jpf_accesser_name}(String s){super(s);}

+

+   #defineJpfTestMethods()

+}


Added:
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehiv
e/test/tools/milton/mantis/generator/MiltonJws.vm
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/tool
s/milton/src/org/apache/beehive/test/tools/milton/mantis/generator/Milto
nJws.vm?view=auto&rev=128417
========================================================================
======
--- (empty file)
+++
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehiv
e/test/tools/milton/mantis/generator/MiltonJws.vm       Thu Jan 27
11:56:46 2005
@@ -0,0 +1,68 @@
+##

+## The Velocity code generation template for the Milton JPF
controllerfor

+## generated as a control client for testing beehive-controls.

+##

+## 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:$

+##

+#macro (defineWebMethods)

+   #foreach ($test in $suite.tests)

+   @WebMethod

+   public Report ${test.name}() throws Exception

+   {

+      #programaticControls($test)

+      ${suite.packageName}.${suite.name} driver = new
${suite.packageName}.${suite.name}();

+      return driver.${test.name}(${test.parameters});

+   }

+

+   #end

+#end

+##

+#macro (declarativeControls $test)

+   #foreach ($control in $test.getDeclarativeControls())

+   @Control

+   #foreach ($annotation in $control.getAnnotations())

+   $annotation

+   #end

+   $control.modifier $control.type $control.name;

+

+   #end

+#end

+##

+#macro (programaticControls $test)

+   #foreach ($control in $test.getProgramaticControls())

+      $control.type $control.name = ($control.type)
java.beans.Beans.instantiate(Thread.currentThread().getContextClassLoade
r(), "$control.type");

+   #end

+#end

+##

+package $client.jws_package;

+

+import javax.jws.WebMethod;

+import javax.jws.WebService;

+

+import org.apache.beehive.test.tools.milton.common.Report;

+

+import org.apache.beehive.controls.api.bean.Control;

+

[EMAIL PROTECTED]

+public class ${suite.name}WebService

+{

+    #foreach ($test in $suite.tests)

+    #declarativeControls($test)

+    #end

+

+    #defineWebMethods()

+}


Added:
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehiv
e/test/tools/milton/mantis/generator/MiltonJwsAccesser.vm
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/tool
s/milton/src/org/apache/beehive/test/tools/milton/mantis/generator/Milto
nJwsAccesser.vm?view=auto&rev=128417
========================================================================
======
--- (empty file)
+++
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehiv
e/test/tools/milton/mantis/generator/MiltonJwsAccesser.vm       Thu Jan
27 11:56:46 2005
@@ -0,0 +1,29 @@
+#macro (defineJwsTestMethods)

+   #set( $velocimacro.context.localscope = true )

+   #foreach ($test in $suite.tests)

+   #set( $attributes = ${test.attributes} )

+

+   @Freq("$attributes.frequency")

+   @Status("$attributes.status")

+   @Misc("$attributes.misc")

+   @Desc("$attributes.description")

+   public void ${test.name}() throws Exception

+   {

+      assertReport("${client.jws_accesser_call_path}", "${test.name}");

+   }

+

+   #end

+#end

+###

+package $client.jws_accesser_package;

+

+import org.apache.beehive.test.tools.milton.junit.SOAPReportTestCase;

+

+import org.apache.beehive.test.tools.mantis.annotations.tch.*;

+

+public class $client.jws_accesser_name extends SOAPReportTestCase

+{

+   public ${client.jws_accesser_name}(String s){super(s);}

+

+   #defineJwsTestMethods()

+}


Added:
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehiv
e/test/tools/milton/mantis/generator/MiltonTestClient.java
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/tool
s/milton/src/org/apache/beehive/test/tools/milton/mantis/generator/Milto
nTestClient.java?view=auto&rev=128417
========================================================================
======
--- (empty file)
+++
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehiv
e/test/tools/milton/mantis/generator/MiltonTestClient.java      Thu Jan
27 11:56:46 2005
@@ -0,0 +1,74 @@
+package org.apache.beehive.test.tools.milton.mantis.generator;

+

+import java.io.IOException;

+import java.io.Writer;

+import java.util.HashMap;

+

+import org.apache.beehive.test.tools.milton.mantis.MiltonTestSuite;

+

+import com.sun.mirror.apt.AnnotationProcessorEnvironment;

+import com.sun.mirror.apt.Filer;

+

+/*

+ * Abstract class describing a MiltonTestClient which is used by
MiltonClientGenerator

+ * to create the corresponding client files from a MiltonTestSuite.

+ */

+public abstract class MiltonTestClient

+{

+       protected String _templateName = null;

+       protected Writer _writer = null;

+       protected Filer _filer = null;

+       protected MiltonTestSuite _mts = null;

+       protected HashMap<String, Object> _context = new
HashMap<String, Object>();

+       

+       /*

+        * Construct a MiltonTestClient

+        * 

+        * @param p_mts The MiltonTestSuite to represent

+        * @param p_evn APT environment used for accessing the Filer

+        * 

+        * @see MiltonTestSuite

+        * @see MiltonClientGenerator

+        */

+       public MiltonTestClient(MiltonTestSuite p_mts,
AnnotationProcessorEnvironment p_env)

+       {

+               this._mts = p_mts;

+               this._filer = p_env.getFiler();

+       }

+       

+       /*

+        * Return a String which represents the path to the Template
used for generation

+        */

+       public String getTemplateName()

+       {

+               return this._templateName;

+       }

+       

+       /*

+        * Return a Writer for the file to generate.

+        */

+       public Writer getWriter()

+               throws IOException

+       {

+               return this._writer;

+       }

+       

+       /*

+        * Return the MiltonTestSuite this client will generate files
for.

+        */

+       public MiltonTestSuite getSuite()

+       {

+               return this._mts;

+       }

+       

+       /*

+        * Return the context for this MiltonTestClient.  A
MiltonTestClient may

+        * need to add additional information or provide slightly
modified versions

+        * of the data held by the MiltonTestSuite.  This can be put in
the Context

+        * and then accessed by the generator.

+        */

+       public HashMap getContext()

+       {

+               return this._context;

+       }

+}


Added:
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehiv
e/test/tools/milton/mantis/generator/VelocityGenerator.java
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/tool
s/milton/src/org/apache/beehive/test/tools/milton/mantis/generator/Veloc
ityGenerator.java?view=auto&rev=128417
========================================================================
======
--- (empty file)
+++
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehiv
e/test/tools/milton/mantis/generator/VelocityGenerator.java     Thu Jan
27 11:56:46 2005
@@ -0,0 +1,76 @@
+package org.apache.beehive.test.tools.milton.mantis.generator;

+

+import java.util.HashMap;

+import java.util.Properties;

+

+import org.apache.velocity.Template;

+import org.apache.velocity.VelocityContext;

+import org.apache.velocity.app.VelocityEngine;

+import
org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader;

+

+/*

+ * Implementation of the MiltonClientGenerator.  This generator uses
Apache 

+ * Velocity templates to generate client files for the MiltonTestClient

+ * passed to it.

+ * 

+ * @see MiltonClientGenerator

+ * @see MiltonTestClient

+ */

+public class VelocityGenerator implements MiltonClientGenerator

+{

+       protected VelocityEngine _ve;

+       

+       private HashMap<String, Template> _templateMap = new
HashMap<String, Template>();

+       

+       /* 

+        * Constructs a VelocityGenerator

+        */

+       public VelocityGenerator() throws Exception

+       {   

+               this._ve = new VelocityEngine();

+               

+               Properties p = new Properties();

+        p.setProperty(VelocityEngine.RESOURCE_LOADER, "class");

+        p.setProperty("class." + VelocityEngine.RESOURCE_LOADER +
".class", 

+                       ClasspathResourceLoader.class.getName());

+

+               this._ve.init(p);

+       }

+       

+       /*

+        * Given a MiltonTestClient generate the corresponding files.

+        */

+       public void generate(MiltonTestClient p_mtc) 

+       {

+               VelocityContext vc = new VelocityContext();

+

+               vc.put("suite", p_mtc.getSuite());

+               vc.put("client", p_mtc.getContext());

+               

+               try {

+                       Template t =
getTemplate(p_mtc.getTemplateName());

+                       t.merge(vc, p_mtc.getWriter());

+               }

+               //TODO: throw meaningful exception

+               catch (Exception e) {

+                       throw new RuntimeException(e);

+               }               

+       }

+       

+       /*

+        * Returns the the Velocity Template given a path.  If the
Template

+        * has already been requested it will cache the template
information in

+        * a map and return from the map on subsequent requests.

+        */

+       protected Template getTemplate(String p_templateName)

+               throws Exception

+       {

+        if (_templateMap.containsKey(p_templateName))

+            return _templateMap.get(p_templateName);

+

+        Template t = _ve.getTemplate(p_templateName);

+        _templateMap.put(p_templateName, t);

+

+        return t;

+       }

+}


Modified: incubator/beehive/trunk/controls/test/webapps/build.xml
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/weba
pps/build.xml?view=diff&rev=128417&p1=incubator/beehive/trunk/controls/t
est/webapps/build.xml&r1=128416&p2=incubator/beehive/trunk/controls/test
/webapps/build.xml&r2=128417
========================================================================
======
--- incubator/beehive/trunk/controls/test/webapps/build.xml
(original)
+++ incubator/beehive/trunk/controls/test/webapps/build.xml     Thu Jan
27 11:56:46 2005
@@ -42,12 +42,12 @@
 
     <target name="-init">
 
-        <property name="staging.dir" location="stage"/>
-        <property name="webapp.dir"
location="${staging.dir}/${webapp.name}"/>
+        <property name="webapp.build.dir" location="../build/webapps"/>
+        <property name="webapp.dir"
location="${webapp.build.dir}/${webapp.name}"/>
        
         <available file="${webapp.dir}" property="webapp.dir.present"/>
 
-        <mkdir dir="${staging.dir}"/>
+        <mkdir dir="${webapp.build.dir}"/>
 
         <property file="${webapp.name}/app.properties"/>
 
@@ -60,12 +60,6 @@
         <condition property="do.inject.milton">
            <istrue value="${app.inject.milton}"/>
         </condition>
-        <condition property="do.inject.derby">
-           <istrue value="${app.inject.derby}"/>
-        </condition>        
-        <condition property="do.inject.dbControl">
-           <istrue value="${app.inject.dbControl}"/>
-        </condition>        
         <condition property="do.inject.test.controls">
            <isset property="app.inject.test.controls"/>
         </condition>
@@ -86,6 +80,13 @@
         </condition>
     </target>
 
+    <!-- webapps are copied into a staging directory where additional
build steps can be performed -->
+    <target name="stage.webapp" depends="-init">
+        <copy todir="${webapp.dir}" overwrite="true">
+           <fileset dir="${webapp.name}"/>
+        </copy>
+    </target>
+
     <!--
================================================================ -->
     <!--
-->
     <!-- Targets for building a webapp
-->
@@ -96,12 +97,7 @@
         <echo message="|    Beehive Controls controlsWeb build starting
|"/>
         <echo
message="-----------------------------------------------------"/>
 
-        <!-- webapps are copied into a staging directory where
additional build steps 
-             can be performed -->
-        <copy todir="${staging.dir}/${webapp.name}" overwrite="true">
-           <fileset dir="${webapp.name}"/>
-        </copy>
-
+       <antcall target="stage.webapp"/>
         <antcall target="-inject.netui"/>
         <antcall target="-inject.wsm"/>
         <antcall target="-inject.milton"/>

Modified:
incubator/beehive/trunk/controls/test/webapps/controlsWeb/WEB-INF/src/jw
s/Instantiate.jws
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/weba
pps/controlsWeb/WEB-INF/src/jws/Instantiate.jws?view=diff&rev=128417&p1=
incubator/beehive/trunk/controls/test/webapps/controlsWeb/WEB-INF/src/jw
s/Instantiate.jws&r1=128416&p2=incubator/beehive/trunk/controls/test/web
apps/controlsWeb/WEB-INF/src/jws/Instantiate.jws&r2=128417
========================================================================
======
---
incubator/beehive/trunk/controls/test/webapps/controlsWeb/WEB-INF/src/jw
s/Instantiate.jws       (original)
+++
incubator/beehive/trunk/controls/test/webapps/controlsWeb/WEB-INF/src/jw
s/Instantiate.jws       Thu Jan 27 11:56:46 2005
@@ -30,7 +30,6 @@
 import
org.apache.beehive.controls.test.controls.instantiate.HelloControlBean;

 import
org.apache.beehive.controls.test.controls.property.SingleProperty;

 import
org.apache.beehive.controls.test.controls.property.SinglePropertyBean;

-import
org.apache.beehive.controls.test.driver.instantiate.DriveHelloControl;

 import
org.apache.beehive.controls.test.driver.instantiate.DriveSingleProperty;

 import org.apache.beehive.test.tools.milton.common.Report;

 

@@ -47,40 +46,11 @@
     public SinglePropertyBean myPropertyBean;

 

     @WebMethod

-    public Report testDeclarativeInstantiate()

-    {        

-       DriveHelloControl driver=new DriveHelloControl();

-       driver.setControl(hellobean);

-       Report report=driver.doTest();

-       return report;

-    }

-

-    @WebMethod

     public Report testDeclarativeInstantiateWithProperty()

     {        

        DriveSingleProperty driver=new DriveSingleProperty();

        driver.setControl(myPropertyBean);

        Report report=driver.doTest();

-       return report;

-    }

-

-    @WebMethod

-    public Report testProgrammaticInstantiate()

-    {        

-       Report report=new Report();

-       DriveHelloControl driver=new DriveHelloControl();

-       try{

-               HelloControlBean
hellobean=(HelloControlBean)java.beans.Beans.instantiate(

-                       Thread.currentThread().getContextClassLoader() ,

-
"org.apache.beehive.controls.test.controls.instantiate.HelloControlBean"
);

-               driver.setControl(hellobean);

-               report=driver.doTest();

-        }

-        catch(Exception e){

-               

-               report.setStatus(Report.FAIL);

-               report.setExceptionStack(e);

-        }

        return report;

     }

 


Modified:
incubator/beehive/trunk/controls/test/webapps/controlsWeb/app.properties
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/weba
pps/controlsWeb/app.properties?view=diff&rev=128417&p1=incubator/beehive
/trunk/controls/test/webapps/controlsWeb/app.properties&r1=128416&p2=inc
ubator/beehive/trunk/controls/test/webapps/controlsWeb/app.properties&r2
=128417
========================================================================
======
---
incubator/beehive/trunk/controls/test/webapps/controlsWeb/app.properties
(original)
+++
incubator/beehive/trunk/controls/test/webapps/controlsWeb/app.properties
Thu Jan 27 11:56:46 2005
@@ -1,8 +1,6 @@
 app.inject.netui: true

 app.inject.wsm: true

 app.inject.milton: true

-app.inject.derby: true

-app.inject.dbControl: true

 ### these two can be set to 'jar' or 'src' ###

 app.inject.test.drivers: jar

 app.inject.test.controls: jar


Deleted:
/incubator/beehive/trunk/controls/test/webapps/controlsWeb/instantiate/d
eclarative/Controller.jpf
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/weba
pps/controlsWeb/instantiate/declarative/Controller.jpf?view=auto&rev=128
416
========================================================================
======

Deleted:
/incubator/beehive/trunk/controls/test/webapps/controlsWeb/instantiate/p
rogrammatic/Controller.jpf
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/weba
pps/controlsWeb/instantiate/programmatic/Controller.jpf?view=auto&rev=12
8416
========================================================================
======

Reply via email to