Author: jsong
Date: Mon Aug 30 11:34:45 2004
New Revision: 37214

Modified:
   incubator/beehive/trunk/controls/test/build.xml
   
incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/extension/SubControl.java
   
incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/extension/SubControlTest.java
   
incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/jpf/extension/TestSubControl.java
   
incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/controls/extension/SubControl.java
   
incubator/beehive/trunk/controls/test/webapps/controlsWeb/extension/Controller.jpf
Log:
Add more tests on control extensibility when invoked in java and servlet 
container.


Modified: incubator/beehive/trunk/controls/test/build.xml
==============================================================================
--- incubator/beehive/trunk/controls/test/build.xml     (original)
+++ incubator/beehive/trunk/controls/test/build.xml     Mon Aug 30 11:34:45 2004
@@ -193,7 +193,7 @@
     
     <target name="run.test">
        <parallel>
-               <antcall target="tomcat.start"/>
+               <antcall target="-tomcat.start"/>
                <sequential>
                        <echo message="start a new thread to build 
controlsWeb"/>
                        <ant dir ="./webapps" antfile="build.xml" 
target="build"/>
@@ -215,7 +215,7 @@
   <!-- targets to start Tomcat server -->
   <!-- =========================================================== -->
 
-    <target name="-tomcat.start" if="${do.start.tomcat}">
+    <target name="-tomcat.start" if="do.start.tomcat">
        <echo message="starting tomcat"/>
        <ant dir ="./webapps" antfile="build.xml" target="start"/>
     </target>

Modified: 
incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/extension/SubControl.java
==============================================================================
--- 
incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/extension/SubControl.java
      (original)
+++ 
incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/extension/SubControl.java
      Mon Aug 30 11:34:45 2004
@@ -2,7 +2,8 @@
 
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
-import org.apache.beehive.controls.api.bean.ControlExtension;
+//import org.apache.beehive.controls.api.bean.ControlExtension;
+import org.apache.beehive.controls.api.bean.ControlInterface;
 import org.apache.beehive.controls.api.properties.PropertySet;
 
 /**
@@ -12,7 +13,7 @@
  *
  * It will access another property inherited from ExtensibleControl in its 
impl.
  */
[EMAIL PROTECTED]
[EMAIL PROTECTED]
 @ExtensibleControl.WhereAbout(Layer="On_SubControl_Interface_Layer")
 public interface SubControl extends ExtensibleControl
 {

Modified: 
incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/extension/SubControlTest.java
==============================================================================
--- 
incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/extension/SubControlTest.java
 (original)
+++ 
incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/extension/SubControlTest.java
 Mon Aug 30 11:34:45 2004
@@ -72,7 +72,7 @@
      * Tests invoking a method declared on the subcontrol
      * The subcontrol is instantiated programmically
      */
-       @Freq("detailed")
+       @Freq("checkin")
     public void testExtendedMethod2() throws Exception
     {
                SubControlBean 
sub=(SubControlBean)java.beans.Beans.instantiate( 
Thread.currentThread().getContextClassLoader() ,

Modified: 
incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/jpf/extension/TestSubControl.java
==============================================================================
--- 
incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/jpf/extension/TestSubControl.java
  (original)
+++ 
incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/jpf/extension/TestSubControl.java
  Mon Aug 30 11:34:45 2004
@@ -13,20 +13,42 @@
        public TestSubControl(String s){super(s);}
     /**
      * Tests invoking a method inherited from the super control
+     * The sub control is instantiated declaratively
      */
        @Freq("checkin")
-    public void testInheritedMethod() throws Exception
+    public void testInheritedMethodByDeclare() throws Exception
     {
                assertReport("/controlsWeb/extension/testInheritedMethod.do");
     }
 
     /**
      * Tests invoking a method declared on the sub control only
+     * The sub control is instantiated declaratively
      */
-       @Freq("detailed")
-    public void testExtendedMethod() throws Exception
+       @Freq("checkin")
+    public void testExtendedMethodByDeclare() throws Exception
     {
                assertReport("/controlsWeb/extension/testExtendedMethod.do");
+    }
+
+    /**
+     * Tests invoking a method inherited from the super control
+     * The sub control is instantiated programmatically
+     */
+       @Freq("checkin")
+    public void testInheritedMethodByProgram() throws Exception
+    {
+               assertReport("/controlsWeb/extension/testInheritedMethodP.do");
+    }
+
+    /**
+     * Tests invoking a method declared on the sub control only
+     * The sub control is instantiated programmatically
+     */
+       @Freq("checkin")
+    public void testExtendedMethodByProgram() throws Exception
+    {
+               assertReport("/controlsWeb/extension/testExtendedMethodP.do");
     }
 
     /**

Modified: 
incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/controls/extension/SubControl.java
==============================================================================
--- 
incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/controls/extension/SubControl.java
      (original)
+++ 
incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/controls/extension/SubControl.java
      Mon Aug 30 11:34:45 2004
@@ -2,7 +2,8 @@
 
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
-import org.apache.beehive.controls.api.bean.ControlExtension;
+//import org.apache.beehive.controls.api.bean.ControlExtension;
+import org.apache.beehive.controls.api.bean.ControlInterface;
 import org.apache.beehive.controls.api.properties.PropertySet;
 
 /**
@@ -12,7 +13,8 @@
  *
  * It will access another property inherited from ExtensibleControl in its 
impl.
  */
[EMAIL PROTECTED]
+//@ControlExtension
[EMAIL PROTECTED]
 @ExtensibleControl.WhereAbout(Layer="On_SubControl_Interface_Layer")
 public interface SubControl extends ExtensibleControl
 {

Modified: 
incubator/beehive/trunk/controls/test/webapps/controlsWeb/extension/Controller.jpf
==============================================================================
--- 
incubator/beehive/trunk/controls/test/webapps/controlsWeb/extension/Controller.jpf
  (original)
+++ 
incubator/beehive/trunk/controls/test/webapps/controlsWeb/extension/Controller.jpf
  Mon Aug 30 11:34:45 2004
@@ -56,7 +56,9 @@
        
         return new Forward(Report.RESULTS, Report.KEY, report);
     }
-
+    /*
+     * Invokes an inherited method on a subcontrol instantiated declaratively
+     */
     @Jpf.Action(
         )
     protected Forward testInheritedMethod(){
@@ -68,6 +70,34 @@
         return new Forward(Report.RESULTS, Report.KEY, report);
     }    
 
+    /*
+     * Invokes an inherited method on a subcontrol instantiated 
programmatically
+     */
+    @Jpf.Action(
+        )
+    protected Forward testInheritedMethodP(){
+
+       DriveSubControl driver=new DriveSubControl();
+       Report report=new Report();
+       try{
+               SubControlBean 
subbean=(SubControlBean)java.beans.Beans.instantiate(
+                       Thread.currentThread().getContextClassLoader() ,
+                       
"org.apache.beehive.controls.test.controls.extension.SubControlBean");
+               driver.setControl(subbean);
+               report=driver.doInvokeInheritedMethod();
+        }
+        catch(Exception e){
+               
+               report.setStatus(Report.FAIL);
+               report.setExceptionStack(e);
+        }
+       
+        return new Forward(Report.RESULTS, Report.KEY, report);
+    }
+
+    /*
+     * Invokes an extended method on a subcontrol instantiated declaratively
+     */
     @Jpf.Action(
         )
     protected Forward testExtendedMethod(){
@@ -78,6 +108,32 @@
        
         return new Forward(Report.RESULTS, Report.KEY, report);
     } 
+
+    /*
+     * Invokes an extended method on a subcontrol instantiated programmatically
+     */
+    @Jpf.Action(
+        )
+    protected Forward testExtendedMethodP(){
+
+       DriveSubControl driver=new DriveSubControl();
+       Report report=new Report();
+       try{
+               SubControlBean 
subbean=(SubControlBean)java.beans.Beans.instantiate(
+                       Thread.currentThread().getContextClassLoader() ,
+                       
"org.apache.beehive.controls.test.controls.extension.SubControlBean");
+               driver.setControl(subbean);
+               report=driver.doInvokeExtendedMethod();
+        }
+        catch(Exception e){
+               
+               report.setStatus(Report.FAIL);
+               report.setExceptionStack(e);
+        }
+       
+        return new Forward(Report.RESULTS, Report.KEY, report);
+    }
+
 
     @Jpf.Action(
         )

Reply via email to