Author: jsong
Date: Mon Apr 11 11:48:30 2005
New Revision: 160933

URL: http://svn.apache.org/viewcvs?view=rev&rev=160933
Log:
Added support to TCH, Milton and Mantis for a new @webapps test annotation.  
Drivers and junit tests should use this annotation to specify which webapp(s) 
they belong to.

Contributed by Joe Pemberton.


Added:
    
incubator/beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/annotations/tch/Webapps.java
    
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/MiltonUtil.java
Modified:
    incubator/beehive/trunk/controls/test/build.xml
    incubator/beehive/trunk/controls/test/infra/mantis/mantis.jar
    incubator/beehive/trunk/controls/test/infra/milton/milton.jar
    incubator/beehive/trunk/controls/test/infra/tch/schema.jar
    incubator/beehive/trunk/controls/test/infra/tch/schema/everything-suite.xsd
    incubator/beehive/trunk/controls/test/infra/tch/tch-props.xml
    incubator/beehive/trunk/controls/test/infra/tch/tchx.jar
    
incubator/beehive/trunk/controls/test/src/drivers/org/apache/beehive/controls/test/driver/generic/DriveSimpleControl.java
    
incubator/beehive/trunk/controls/test/src/drivers/org/apache/beehive/controls/test/driver/instantiate/DriveHelloControl.java
    
incubator/beehive/trunk/controls/test/src/drivers/org/apache/beehive/controls/test/driver/property/DrivePropertyConstraint2.java
    
incubator/beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/TchProcessor.java
    
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/annotations/Milton.java
    
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/MiltonProcessor.java
    
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/MiltonTestSuite.java
    
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/generator/MiltonJpfAccesser.vm
    
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/generator/MiltonJwsAccesser.vm
    
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/generator/MiltonTestClient.java

Modified: incubator/beehive/trunk/controls/test/build.xml
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/build.xml?view=diff&r1=160932&r2=160933
==============================================================================
--- incubator/beehive/trunk/controls/test/build.xml (original)
+++ incubator/beehive/trunk/controls/test/build.xml Mon Apr 11 11:48:30 2005
@@ -418,6 +418,8 @@
     </target>
 
     <target name="run">
+        <property name="tch.filter.frequencies" value="${test.freq}"/>
+        <echoproperties prefix="tch.filter"/>
         <gethostname/> <!-- set ${hostname} -->
         <property name="gtlf.dtd.use.remote" value="true"/>
         <property name="gtlf.dtd.remote" 
value="http://incubator.apache.org/beehive/dtd/gtlf/gtlf-config-2.0.dtd"/>
@@ -433,11 +435,11 @@
             fork="true"
             classpathref="tch.run.classpath"
             failureproperty="run.failed"
-            dir="${controls.test.root}">
+            dir="${controls.test.root}"
+       inheritall="true">
 
              <arg value="-emacs"/>
              <property name="tch.replication.entry-point" value="ant -f 
${controls.test.root}/build.xml run"/>
-             <property name="tch.filter.frequencies" value="${test.freq}"/>
             <sysproperty key="TEST_HOSTNAME" value="${test.hostname}" />
             <sysproperty key="TEST_HOSTNAME_PORT" 
value="${test.hostname.port}" />
 

Modified: incubator/beehive/trunk/controls/test/infra/mantis/mantis.jar
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/infra/mantis/mantis.jar?view=diff&r1=160932&r2=160933
==============================================================================
Binary files - no diff available.

Modified: incubator/beehive/trunk/controls/test/infra/milton/milton.jar
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/infra/milton/milton.jar?view=diff&r1=160932&r2=160933
==============================================================================
Binary files - no diff available.

Modified: incubator/beehive/trunk/controls/test/infra/tch/schema.jar
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/infra/tch/schema.jar?view=diff&r1=160932&r2=160933
==============================================================================
Binary files - no diff available.

Modified: 
incubator/beehive/trunk/controls/test/infra/tch/schema/everything-suite.xsd
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/infra/tch/schema/everything-suite.xsd?view=diff&r1=160932&r2=160933
==============================================================================
--- incubator/beehive/trunk/controls/test/infra/tch/schema/everything-suite.xsd 
(original)
+++ incubator/beehive/trunk/controls/test/infra/tch/schema/everything-suite.xsd 
Mon Apr 11 11:48:30 2005
@@ -1,4 +1,8 @@
 <xs:schema elementFormDefault="qualified" 
xmlns:xs="http://www.w3.org/2001/XMLSchema";>
+
+       <!-- performance test suite schema -->
+       <xs:include schemaLocation="performance/controls-perf.xsd"/>
+       
   <xs:complexType name="configuration-dependencyType">
     <xs:simpleContent>
       <xs:extension base="xs:string">
@@ -305,6 +309,11 @@
           name="junit"
           type="javatestType"
         />
+        <xs:element
+          maxOccurs="1"
+          name="controlsperf"
+          type="controlsPerfType"
+        />
         <xs:element name="wstest" type="webServerType"/>
         <xs:element name="tch-diff-test" type="tchtestType"/>
         <xs:element name="test-vehicle" type="test-vehicleType"/>
@@ -562,6 +571,11 @@
       />
       <xs:element
         minOccurs="0"
+        name="webapps"
+        type="webappsType"
+      />
+      <xs:element
+        minOccurs="0"
         name="misc"
         type="miscType"
       />
@@ -737,6 +751,23 @@
     </xs:restriction>
   </xs:simpleType>
    <!-- end frequency definition -->
+
+  <xs:simpleType name="webappsOptions">
+    <xs:restriction base="xs:string">
+      <xs:enumeration value="controlsWeb"/>
+      <xs:enumeration value="jmsControlWeb"/>
+      <xs:enumeration value="testWeb"/>
+    </xs:restriction>
+  </xs:simpleType>
+  <xs:simpleType name="webappsList">
+    <xs:list itemType="webappsOptions"/>
+  </xs:simpleType>
+  <xs:simpleType name="webappsType">
+    <xs:restriction base="webappsList">
+      <xs:minLength value="0"/>
+      <xs:maxLength value="3"/>
+    </xs:restriction>
+  </xs:simpleType>
 
   <xs:simpleType name="serverModeOptions">
     <xs:restriction base="xs:string">

Modified: incubator/beehive/trunk/controls/test/infra/tch/tch-props.xml
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/infra/tch/tch-props.xml?view=diff&r1=160932&r2=160933
==============================================================================
--- incubator/beehive/trunk/controls/test/infra/tch/tch-props.xml (original)
+++ incubator/beehive/trunk/controls/test/infra/tch/tch-props.xml Mon Apr 11 
11:48:30 2005
@@ -56,6 +56,7 @@
   <property name="filter.domains" excluded="true"/>
   <property name="filter.knownFailures" excluded="true"/>
   <property name="filter.frequencies" excluded="true"/>
+  <property name="filter.webapps" excluded="true"/>
   <property name="filter.owners" excluded="true"/>
   <property name="filter.misc" excluded="true"/>
   <property name="filter.security-type" excluded="true" default="security70"/>

Modified: incubator/beehive/trunk/controls/test/infra/tch/tchx.jar
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/infra/tch/tchx.jar?view=diff&r1=160932&r2=160933
==============================================================================
Binary files - no diff available.

Modified: 
incubator/beehive/trunk/controls/test/src/drivers/org/apache/beehive/controls/test/driver/generic/DriveSimpleControl.java
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/src/drivers/org/apache/beehive/controls/test/driver/generic/DriveSimpleControl.java?view=diff&r1=160932&r2=160933
==============================================================================
--- 
incubator/beehive/trunk/controls/test/src/drivers/org/apache/beehive/controls/test/driver/generic/DriveSimpleControl.java
 (original)
+++ 
incubator/beehive/trunk/controls/test/src/drivers/org/apache/beehive/controls/test/driver/generic/DriveSimpleControl.java
 Mon Apr 11 11:48:30 2005
@@ -10,7 +10,7 @@
 /**
  * Tests property constraint by exercising PersonControl
  */
[EMAIL PROTECTED]
[EMAIL PROTECTED](webapps="controlsWeb")
 public class DriveSimpleControl
 {
 

Modified: 
incubator/beehive/trunk/controls/test/src/drivers/org/apache/beehive/controls/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/DriveHelloControl.java?view=diff&r1=160932&r2=160933
==============================================================================
--- 
incubator/beehive/trunk/controls/test/src/drivers/org/apache/beehive/controls/test/driver/instantiate/DriveHelloControl.java
 (original)
+++ 
incubator/beehive/trunk/controls/test/src/drivers/org/apache/beehive/controls/test/driver/instantiate/DriveHelloControl.java
 Mon Apr 11 11:48:30 2005
@@ -10,7 +10,7 @@
        test result report
  */
 
[EMAIL PROTECTED]
[EMAIL PROTECTED](webapps="controlsWeb")
 public class DriveHelloControl
 {
        @Milton.Test(frequency="detailed")

Modified: 
incubator/beehive/trunk/controls/test/src/drivers/org/apache/beehive/controls/test/driver/property/DrivePropertyConstraint2.java
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/src/drivers/org/apache/beehive/controls/test/driver/property/DrivePropertyConstraint2.java?view=diff&r1=160932&r2=160933
==============================================================================
--- 
incubator/beehive/trunk/controls/test/src/drivers/org/apache/beehive/controls/test/driver/property/DrivePropertyConstraint2.java
 (original)
+++ 
incubator/beehive/trunk/controls/test/src/drivers/org/apache/beehive/controls/test/driver/property/DrivePropertyConstraint2.java
 Mon Apr 11 11:48:30 2005
@@ -8,7 +8,7 @@
 /**
  * Tests property constraint by exercising PersonControl
  */
[EMAIL PROTECTED]
[EMAIL PROTECTED](webapps="controlsWeb")
 public class DrivePropertyConstraint2
 {
 

Modified: 
incubator/beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/TchProcessor.java
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/TchProcessor.java?view=diff&r1=160932&r2=160933
==============================================================================
--- 
incubator/beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/TchProcessor.java
 (original)
+++ 
incubator/beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/TchProcessor.java
 Mon Apr 11 11:48:30 2005
@@ -153,6 +153,7 @@
     Status cstatus = (Status) p_cdecl.getAnnotation(Status.class);
     Desc cdesc = (Desc) p_cdecl.getAnnotation(Desc.class);
     Misc cmisc = (Misc) p_cdecl.getAnnotation(Misc.class);
+    Webapps cwebapps = (Webapps) p_cdecl.getAnnotation(Webapps.class);
 
     // loop through the methods
     Collection<? extends MethodDeclaration> methods = p_cdecl.getMethods();
@@ -160,7 +161,7 @@
     while(mit.hasNext())
     {
       MethodDeclaration methDecl = (MethodDeclaration) mit.next();
-      processMethod(methDecl, p_suite, cfreq, cstatus, cdesc, cmisc);
+      processMethod(methDecl, p_suite, cfreq, cstatus, cdesc, cmisc, cwebapps);
     }
 
   }
@@ -170,7 +171,8 @@
                              Freq p_cfreq,
                              Status p_cstatus,
                              Desc p_cdesc,
-                             Misc p_cmisc)
+                             Misc p_cmisc,
+                             Webapps p_cwebapps)
   {
     // only process methods that start with 'test' (junit)
     // TODO: may need to add more logic for different tch runners
@@ -189,12 +191,14 @@
     Status mstatus = (Status) p_methdecl.getAnnotation(Status.class);
     Desc mdesc = (Desc) p_methdecl.getAnnotation(Desc.class);
     Misc mmisc = (Misc) p_methdecl.getAnnotation(Misc.class);
+    Webapps mwebapps = (Webapps) p_methdecl.getAnnotation(Webapps.class);
 
     // if not present on the method use the class-level value
     if(null == mfreq) mfreq = p_cfreq;
     if(null == mstatus) mstatus = p_cstatus;
     if(null == mdesc) mdesc = p_cdesc;
     if(null == mmisc) mmisc = p_cmisc;
+    if(null == mwebapps) mwebapps = p_cwebapps;
 
     // add metadata to the test
     // leave out if null
@@ -214,6 +218,11 @@
 
     if(null != mmisc)
       sMeta.setMisc(mmisc.value());
+
+    if(null != mwebapps)
+    {
+      sMeta.setWebapps(createStringArrayList(mwebapps.value()));
+    }
   }
 
   private void createRootTCH()

Added: 
incubator/beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/annotations/tch/Webapps.java
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/annotations/tch/Webapps.java?view=auto&rev=160933
==============================================================================
--- 
incubator/beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/annotations/tch/Webapps.java
 (added)
+++ 
incubator/beehive/trunk/controls/test/tools/mantis/src/org/apache/beehive/test/tools/mantis/annotations/tch/Webapps.java
 Mon Apr 11 11:48:30 2005
@@ -0,0 +1,6 @@
+package org.apache.beehive.test.tools.mantis.annotations.tch;
+
+public @interface Webapps
+{
+  String value();
+}

Modified: 
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/annotations/Milton.java
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/annotations/Milton.java?view=diff&r1=160932&r2=160933
==============================================================================
--- 
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/annotations/Milton.java
 (original)
+++ 
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/annotations/Milton.java
 Mon Apr 11 11:48:30 2005
@@ -6,7 +6,7 @@
 import java.lang.annotation.ElementType;
 
 /***
- * Wapping interface for all @Milton. annotations.
+ * Wrapping interface for all @Milton. annotations.
  */
 public interface Milton
 {
@@ -56,6 +56,11 @@
                 * A Junit accessor can be generated for each of the client 
types created.  This is true by default. 
                 */
                boolean junit() default DEFAULT_SUITE_JUNIT;
+               
+               /*
+                * Space separated list of webapps that this test belongs to.
+                */
+               String webapps() default "";
        }
        
        /*
@@ -141,5 +146,6 @@
                 * used with key=value pairs.
                 */
                String misc() default DEFAULT_TEST_MISC;
+               
        }
 }

Modified: 
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/MiltonProcessor.java
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/MiltonProcessor.java?view=diff&r1=160932&r2=160933
==============================================================================
--- 
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/MiltonProcessor.java
 (original)
+++ 
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/MiltonProcessor.java
 Mon Apr 11 11:48:30 2005
@@ -3,6 +3,7 @@
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
+import java.util.Map;
 import java.util.HashSet;
 import java.util.Set;
 
@@ -35,9 +36,10 @@
        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
+        * 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,
@@ -96,13 +98,17 @@
        }
        
        /*
-        * process() generatates a Collection of ClassDeclaration and passes 
them to processClasses
-        * which process annotations on the Class and generates a Collection of 
MiltonTestSuite.
+        * process() generatates a Collection of ClassDeclaration and passes 
them to
+        * processClasses which process annotations on the Class and generates a
+        * Collection of MiltonTestSuite.
         */
        protected Collection<MiltonTestSuite> 
processClasses(Collection<ClassDeclaration> p_testClasses)
        {
                Collection<MiltonTestSuite> miltonTests = new 
ArrayList<MiltonTestSuite>();
-       
+               Map<String, String> options = _env.getOptions();
+    String[] webappOptions;
+    int i;
+               
                for (ClassDeclaration cd : p_testClasses)
                {
                        Milton.TestSuite a_mts = 
(Milton.TestSuite)cd.getAnnotation(Milton.TestSuite.class);
@@ -110,9 +116,19 @@
                        if (null == a_mts)
                                continue;
                        
+      webappOptions = a_mts.webapps().split("[\\s,]+");
+      for (i=0; i<webappOptions.length; i++)
+      {
+        if (webappOptions[i].equals(MiltonUtil.getOption(options, 
"webapp.name")))
+               break;
+      }
+      if (i==webappOptions.length)
+        continue;
+                       
                        MiltonTestSuite mts = new 
MiltonTestSuite(cd.getPackage().getQualifiedName(),
                                                                                
                          cd.getSimpleName(), a_mts.clients(),
-                                                                               
                          a_mts.junit());
+                                                                               
                          a_mts.junit(),
+                                                                               
                          a_mts.webapps());
                        
                        Collection<MiltonTestMethod> mtm = 
processMethods(cd.getMethods());
                        mts.addAllTests(mtm);
@@ -123,8 +139,8 @@
        }
        
        /*
-        * processClasses generates a Collection of MethodDeclarations and 
passes it to
-        * processMethods which inspects the methods for meaningful annotations.
+        * 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)
        {
@@ -153,7 +169,8 @@
                        if (! 
md.getReturnType().toString().equals("org.apache.beehive.test.tools.milton.common.Report"))
                                throw new IllegalStateException("All methods 
with @Milton.Test must return Report: " + md.getReturnType().toString());
                        
-                       //get collection of parameters to this test - there 
must be at least 1 and it must be a control bean
+                       //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
@@ -214,4 +231,4 @@
                
                return tests;
        }
-}
\ No newline at end of file
+}

Modified: 
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/MiltonTestSuite.java
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/MiltonTestSuite.java?view=diff&r1=160932&r2=160933
==============================================================================
--- 
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/MiltonTestSuite.java
 (original)
+++ 
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/MiltonTestSuite.java
 Mon Apr 11 11:48:30 2005
@@ -14,7 +14,8 @@
        private String _name;
        private String _packageName;
        private Collection<MiltonTestMethod> _tests = 
-                                                                               
new ArrayList<MiltonTestMethod>();
+    new ArrayList<MiltonTestMethod>();
+       private String _webapps;
        
        private boolean _jpfClient = false;
        private boolean _jwsClient = false;
@@ -23,18 +24,21 @@
        /*
         * 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
+        * @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 @param p_webapps Space
+        * separated list of webapps this suite is applicable to
         */
-       public MiltonTestSuite(String p_pn, String p_sn, Milton.ClientType[] 
p_clients, boolean p_junit)
+       public MiltonTestSuite(String p_pn, String p_sn, Milton.ClientType[] 
p_clients, boolean p_junit, String p_webapps)
        {
-               if (null == p_pn || null == p_sn || null == p_clients)
-                       throw new IllegalArgumentException("Package Name, Suite 
Name, and Clients must not be null");
+               System.out.println("Adding webapps: " + p_webapps);
+               if (null == p_pn || null == p_sn || null == p_clients || null 
== p_webapps)
+                       throw new IllegalArgumentException("Package Name, Suite 
Name, Clients and Webapps must not be null");
                this._name = p_sn;
                this._packageName = p_pn;
                this._junitClient = p_junit;
+               this._webapps = p_webapps;
        
                for (int i = 0; i < p_clients.length; ++i) {
                        if (p_clients[i] == Milton.ClientType.JWS)
@@ -92,5 +96,9 @@
        
        public String getPackageName() {
                return _packageName;
+       }
+       
+       public String getWebapps() {
+               return _webapps;
        }
 }

Added: 
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/MiltonUtil.java
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/MiltonUtil.java?view=auto&rev=160933
==============================================================================
--- 
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/MiltonUtil.java
 (added)
+++ 
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/MiltonUtil.java
 Mon Apr 11 11:48:30 2005
@@ -0,0 +1,29 @@
+package org.apache.beehive.test.tools.milton.mantis;
+
+import java.util.Set;
+import java.util.Map;
+
+public class MiltonUtil
+{
+        /* 
+         * there is a bug in apt AnnotationProcesserEnvironment.getOptions()
+         * in that the Map that is returned has the key and the value stored 
in the key.
+         * for example -Afoo=bar will actually have a key of: -Afoo=bar and no 
value.
+         */
+        public static String getOption(Map<String, String> p_options, String 
p_key) 
+        {
+           if (null == p_key)
+               throw new IllegalArgumentException("Key cannot be null");
+
+           Set<String> keys = p_options.keySet();
+           for (String key : keys) {
+               String[] option = key.split("=");
+               if (option.length != 2)
+                       continue;
+               if (option[0].equalsIgnoreCase("-A" + p_key))
+                   return option[1];
+           }
+
+           return null; // return null if no matches are found
+       }
+}
\ No newline at end of file

Modified: 
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/generator/MiltonJpfAccesser.vm
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/generator/MiltonJpfAccesser.vm?view=diff&r1=160932&r2=160933
==============================================================================
--- 
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/generator/MiltonJpfAccesser.vm
 (original)
+++ 
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/generator/MiltonJpfAccesser.vm
 Mon Apr 11 11:48:30 2005
@@ -21,6 +21,7 @@
 
 import org.apache.beehive.test.tools.mantis.annotations.tch.*;
 
[EMAIL PROTECTED]("$suite.webapps")
 public class $client.jpf_accesser_name extends HtmlReportTestCase
 {
    public ${client.jpf_accesser_name}(String s){super(s);}

Modified: 
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/generator/MiltonJwsAccesser.vm
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/generator/MiltonJwsAccesser.vm?view=diff&r1=160932&r2=160933
==============================================================================
--- 
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/generator/MiltonJwsAccesser.vm
 (original)
+++ 
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/generator/MiltonJwsAccesser.vm
 Mon Apr 11 11:48:30 2005
@@ -21,6 +21,7 @@
 
 import org.apache.beehive.test.tools.mantis.annotations.tch.*;
 
[EMAIL PROTECTED]("$suite.webapps")
 public class $client.jws_accesser_name extends SOAPReportTestCase
 {
    public ${client.jws_accesser_name}(String s){super(s);}

Modified: 
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/generator/MiltonTestClient.java
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/generator/MiltonTestClient.java?view=diff&r1=160932&r2=160933
==============================================================================
--- 
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/generator/MiltonTestClient.java
 (original)
+++ 
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/generator/MiltonTestClient.java
 Mon Apr 11 11:48:30 2005
@@ -7,6 +7,7 @@
 import java.util.Set;
 
 import org.apache.beehive.test.tools.milton.mantis.MiltonTestSuite;
+import org.apache.beehive.test.tools.milton.mantis.MiltonUtil;
 
 import com.sun.mirror.apt.AnnotationProcessorEnvironment;
 import com.sun.mirror.apt.Filer;
@@ -46,19 +47,19 @@
                this._options = p_env.getOptions();
 
                // Get settings from apt environment
-               _webappName = getOption("webapp.name");
+               _webappName = MiltonUtil.getOption(this._options, 
"webapp.name");
 
                if (null == _webappName)
                    throw new IllegalStateException("You must supply a 
-Awebapp.name to APT via Mantis");
 
-               _webappDir = getOption("webapp.gen.dir");
+               _webappDir = MiltonUtil.getOption(this._options, 
"webapp.gen.dir");
 
                if (null == _webappDir)
                    _webappDir = DEFAULT_WEBAPP_DIR;
                else if (! _webappDir.endsWith("/"))
                    _webappDir += "/";
 
-               _accesserDir = getOption("accesser.src.gendir");
+               _accesserDir = MiltonUtil.getOption(this._options, 
"accesser.src.gendir");
 
                if (null == _accesserDir)
                    _accesserDir = DEFAULT_ACCESSER_SRC_DIR;
@@ -102,26 +103,5 @@
                return this._context;
        }
 
-         
-        /* 
-         * there is a bug in apt AnnotationProcesserEnvironment.getOptions()
-         * in that the Map that is returned has the key and the value stored 
in the key.
-         * for example -Afoo=bar will actually have a key of: -Afoo=bar and no 
value.
-         */
-        protected String getOption(String p_key) 
-        {
-           if (null == p_key)
-               throw new IllegalArgumentException("Key cannot be null");
-
-           Set<String> keys = this._options.keySet();
-           for (String key : keys) {
-               String[] option = key.split("=");
-               if (option.length != 2)
-                   continue;
-               if (option[0].equalsIgnoreCase("-A" + p_key))
-                   return option[1];
-           }
 
-           return null; // return null if no matches are found
-       }
 }


Reply via email to