Author: jsong
Date: Thu Aug 26 12:39:07 2004
New Revision: 37095

Modified:
   incubator/beehive/trunk/controls/test/build.xml
   
incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/context/GetServiceTest.java
   
incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/contextevent/LifeCycleTest.java
   
incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/property/PropTest.java
   
incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/jpf/context/TestContext.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/driver/contextevent/DriveRecorder.java
   
incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/extension/DriveSubControl.java
   
incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/property/DriveClientImpl.java
   
incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/property/DriveImplAccess.java
Log:
Update controls/test/build.xml, add targets to start tomcat server when running 
pageflow tests.
Update controls tests and make sure all current checkin tests pass.


Modified: incubator/beehive/trunk/controls/test/build.xml
==============================================================================
--- incubator/beehive/trunk/controls/test/build.xml     (original)
+++ incubator/beehive/trunk/controls/test/build.xml     Thu Aug 26 12:39:07 2004
@@ -30,9 +30,26 @@
     <condition property="test.os" value="windows" >
        <os family="windows" />
     </condition>
+    
     <condition property="test.os" value="unix" >
        <os family="unix" />
     </condition>
+        
+    <condition property="do.start.tomcat" value="true" >
+       <not>
+           <isset  property="start.tomcat"/>
+       </not>
+    </condition>
+
+    <path id="test.classpath">
+        <pathelement location="${junit.jar}"/>
+        <pathelement location="${tools.jar}"/>
+        <pathelement location="${velocity14.jar}"/>
+        <pathelement location="${velocitydep14.jar}"/>
+        <pathelement location="${servlet24.jar}"/>
+        <pathelement path="../build/jars/controls.jar"/>
+        <pathelement path="${build.beans}"/>
+    </path>
 
     <path id="tch.run.classpath">
        <pathelement location="${tch.jar}"/>
@@ -75,27 +92,27 @@
         <echo 
message="----------------------------------------------------------------"/>
         <echo message="clean               - Delete the junit classes."/>
         <echo message="build               - build controls,test drivers and 
java tests."/>
-        <echo message="run                 - run java tests that have already 
been built"/>
-        <echo message="test                - clean, build and run"/>
+        <echo message="checkin.test        - run checkin tests, both java and 
jpf tests."/>
+        <echo message="detailed.test       - run detailed tests, both java and 
jpf tests."/>
         <echo 
message="----------------------------------------------------------------"/>
     </target>
 
-    <path id="test.classpath">
-        <pathelement location="${junit.jar}"/>
-        <pathelement location="${tools.jar}"/>
-        <pathelement location="${velocity14.jar}"/>
-        <pathelement location="${velocitydep14.jar}"/>
-        <pathelement location="${servlet24.jar}"/>
-        <pathelement path="../build/jars/controls.jar"/>
-        <pathelement path="${build.beans}"/>
-    </path>
-
     <target name="clean">
         <delete dir="${build.dir}"/>
         <delete dir="${test.logs}"/>
         <delete file="velocity.log"/>
     </target>
 
+    <!-- =================================================================== 
-->
+    <!-- build - target to build controls, test drivers and junit tests -->
+    <!-- ==================================================================== 
-->
+
+    <target name="build" depends="dirs">
+        <ant target="build-controls" />
+        <ant target="build-test-drivers" />
+        <ant target="build-java-tests" />
+    </target>
+
     <target name="dirs">
         <mkdir dir="${build.classes}" />
         <mkdir dir="${build.beans}" />
@@ -106,12 +123,6 @@
         <mkdir dir="${test.logs}" />
     </target>
 
-    <target name="build" depends="dirs">
-        <ant target="build-controls" />
-        <ant target="build-test-drivers" />
-        <ant target="build-java-tests" />
-    </target>
-
     <target name="build-controls" depends="dirs" unless="_build.controls.ran">
 
         <apt srcdir="${controls.src}" destdir="${build.beans}" 
gendir="${build.beansrc}"
@@ -160,44 +171,72 @@
         <property name="_build.java.tests.ran" value="true"/>
     </target>
 
-    <target name="test" depends="tests"/>
-    
-    <target name="tests" >
+    <!-- =================================================================== 
-->
+    <!-- Targets to checkin tests and detailed tests -->
+    <!-- ==================================================================== 
-->
 
+    <target name="checkin.tests" >
         <antcall target="clean" />
         <antcall target="build" />
-        <antcall target="run" />
-
+        <!--antcall target="run" /-->
+        <echo message="${do.start.tomcat}"/>
+        <property name="test.freq" value="checkin"/>
+        <antcall target="run.test" />
     </target>
 
+    <target name="detailed.tests" >
+        <antcall target="clean" />
+        <antcall target="build" />
+        <property name="test.freq" value="detailed"/>
+        <antcall target="run.test" />        
+    </target>
     
-    
-    <!-- =============================================== -->
-    <!-- TCH and Mantis targets for running tests -->
-    <!-- =============================================== -->
-
-    <property name="junit.src.dir" value="${basedir}/src/units"/>
-  
-    <taskdef name="tch"
-             classname="org.apache.beehive.test.tools.tch.TchVMTask"
-             classpathref="tch.run.classpath"/>
-
-    <echo message="milton.jar: ${milton.jar}"/>
- 
-               <target name="run-all">
-                       <property name="tch.test.names" 
value="org-apache-beehive-controls-test*.*"/>
-                       <antcall target="run"/>
-               </target>
- 
-               <target name="run-java">
-                       <property name="tch.test.names" 
value="org-apache-beehive-controls-test-java*.*"/>
+    <target name="run.test">
+       <parallel>
+               <antcall target="tomcat.start"/>
+               <sequential>
+                       <echo message="start a new thread to build 
controlsWeb"/>
+                       <ant dir ="./webapps" antfile="build.xml" 
target="build"/>
+                       <echo message="continue the new thread, wait for tomcat 
to start"/>
+                       <sleep seconds="20"/>
+                       <echo message="continue the new thread, deploy 
controlsWeb"/>
+                       <ant dir ="./webapps" antfile="build.xml" 
target="deploy"/>
+                       <echo message="continue the new thread, run junit 
tests"/>
                        <antcall target="run"/>
-               </target>        
+                       <ant dir ="./webapps" antfile="build.xml" 
target="undeploy"/>
+                       <echo message="continue the new thread, undeploy 
controlsWeb"/>
+                       <ant dir ="./webapps" antfile="build.xml" 
target="stop"/>
+                       <echo message="finish the new thread, stop tomcat 
server"/>
+               </sequential>
+        </parallel>
+    </target>   
+
+  <!-- =========================================================== -->
+  <!-- targets to start Tomcat server -->
+  <!-- =========================================================== -->
+
+    <target name="-tomcat.start" if="${do.start.tomcat}">
+       <echo message="starting tomcat"/>
+       <ant dir ="./webapps" antfile="build.xml" target="start"/>
+    </target>
+
+    <target name="tomcat.start">
+       <ant dir ="./webapps" antfile="build.xml" target="start"/>
+    </target>
+
+  <!-- =========================================================== -->
+  <!-- targets to run junit tests -->
+  <!-- =========================================================== -->
+  
+    <target name="run.junit.java">
+       <property name="tch.test.names" 
value="org-apache-beehive-controls-test-java*.*"/>
+       <antcall target="run"/>
+    </target>
 
-               <target name="run-jpf">
-                       <property name="tch.test.names" 
value="org-apache-beehive-controls-test-jpf*.*"/>
-                       <antcall target="run"/>
-               </target>        
+    <target name="run.junit.jpf">
+       <property name="tch.test.names" 
value="org-apache-beehive-controls-test-jpf*.*"/>
+       <antcall target="run"/>
+    </target>
 
     <target name="run" depends="mantis">
 
@@ -206,29 +245,37 @@
         <property name="test.hostname" value="${hostname}" />
         <property name="test.hostname.port" value="8080" /> <!-- tomcat 
default port -->
         <property name="test-suite" value="${mantis.srcgen.dir}/root.xml"/>
-                               <property name="tch.base-logfile-name" 
value="tch"/>
+       <property name="tch.base-logfile-name" value="tch"/>
 
-                               <tch tchHome="${tch.home}"
-                               testfile="${test-suite}"
-                               fork="true"
-                               classpathref="tch.run.classpath"
-                               failureproperty="run.failed">
-
-                                <arg value="-emacs"/>
-                               <property name="tch.replication.entry-point" 
value="ant -f ${controls.test.dir}/build.xml run"/>
-                               <property name="tch.test-names" 
value="${tch.test.names}"/>
-                                                       <sysproperty 
key="TEST_HOSTNAME" value="${test.hostname}" />
-                                                       <sysproperty 
key="TEST_HOSTNAME_PORT" value="${test.hostname.port}" />
+       <tch tchHome="${tch.home}"
+            testfile="${test-suite}"
+            fork="true"
+            classpathref="tch.run.classpath"
+            failureproperty="run.failed">
+
+             <arg value="-emacs"/>
+             <property name="tch.replication.entry-point" value="ant -f 
${controls.test.dir}/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}" />
 
-                       </tch>
+       </tch>
        
-                               <ant 
antfile="${controls.test.infra.dir}/tch/runtime/build.xml" 
target="generate-html-log" dir="${basedir}">
-                                       <property name="gtlf.file" 
value="${basedir}/${tch.base-logfile-name}.xml"/>
-                                       <property name="output.file" 
value="${basedir}/${tch.base-logfile-name}.html"/>
+       <ant antfile="${controls.test.infra.dir}/tch/runtime/build.xml" 
target="generate-html-log" dir="${basedir}">
+               <property name="gtlf.file" 
value="${basedir}/${tch.base-logfile-name}.xml"/>
+               <property name="output.file" 
value="${basedir}/${tch.base-logfile-name}.html"/>
         </ant>
     </target>  
 
+    <!-- =============================================== -->
+    <!-- TCH and Mantis targets for running tests -->
+    <!-- =============================================== -->
 
+    <property name="junit.src.dir" value="${basedir}/src/units"/>
+  
+    <taskdef name="tch"
+             classname="org.apache.beehive.test.tools.tch.TchVMTask"
+             classpathref="tch.run.classpath"/>
 
   <!-- =========================================================== -->
   <!-- Mantis settings -->

Modified: 
incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/context/GetServiceTest.java
==============================================================================
--- 
incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/context/GetServiceTest.java
   (original)
+++ 
incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/context/GetServiceTest.java
   Thu Aug 26 12:39:07 2004
@@ -78,7 +78,7 @@
      * In java environment, this should be "0"
      * The control is instantiated programmatically
      */
-       @Freq("checkin")
+       @Freq("detailed")
     public void testGetBeanContextServicesByProgram() throws Exception
     {
                ServiceGetterBean 
getterbean=(ServiceGetterBean)java.beans.Beans.instantiate(

Modified: 
incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/contextevent/LifeCycleTest.java
==============================================================================
--- 
incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/contextevent/LifeCycleTest.java
       (original)
+++ 
incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/contextevent/LifeCycleTest.java
       Thu Aug 26 12:39:07 2004
@@ -40,8 +40,11 @@
     /**
      * Tests control impl listening to its lifecycle events.
      * The control is instantiated programmatically
+     *
+     * Deactivate temporarily, cause test to abort:ResourceContext is not 
available
      */
        @Freq("checkin")
+       @Status("inactive")
     public void testRecordedByImplProgram() throws Exception
     {
                RecorderBean recorderbean=(RecorderBean)Beans.instantiate(

Modified: 
incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/property/PropTest.java
==============================================================================
--- 
incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/property/PropTest.java
        (original)
+++ 
incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/property/PropTest.java
        Thu Aug 26 12:39:07 2004
@@ -14,10 +14,12 @@
 
 import org.apache.beehive.test.tools.milton.common.Report;
 import org.apache.beehive.mantis.annotations.tch.Freq;
+import org.apache.beehive.mantis.annotations.tch.Status;
 
 
 
 @Freq("checkin")
[EMAIL PROTECTED]("inactive")
 public class PropTest extends TestCase
 {
     public PropTest( String s ) { super( s ); }

Modified: 
incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/jpf/context/TestContext.java
==============================================================================
--- 
incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/jpf/context/TestContext.java
       (original)
+++ 
incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/jpf/context/TestContext.java
       Thu Aug 26 12:39:07 2004
@@ -18,7 +18,7 @@
      * Tests getting other services from control context.
      * The control is instantiated declaratively
      */
-       @Freq("checkin")
+       @Freq("detailed")
     public void testOtherServicesByDeclare() throws Exception
     {
                
assertReport("/controlsWeb/context/getotherservice/Controller.jpf");
@@ -28,7 +28,7 @@
      * Tests getting other services from control context.
      * The control is instantiated programmatically
      */
-       @Freq("checkin")
+       @Freq("detailed")
     public void testOtherServicesByProgram() throws Exception
     {
                
assertReport("/controlsWeb/context/getotherservice2/Controller.jpf");

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
  Thu Aug 26 12:39:07 2004
@@ -23,7 +23,7 @@
     /**
      * Tests invoking a method declared on the sub control only
      */
-       @Freq("checkin")
+       @Freq("detailed")
     public void testExtendedMethod() throws Exception
     {
                assertReport("/controlsWeb/extension/testExtendedMethod.do");

Modified: 
incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/contextevent/DriveRecorder.java
==============================================================================
--- 
incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/contextevent/DriveRecorder.java
  (original)
+++ 
incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/contextevent/DriveRecorder.java
  Thu Aug 26 12:39:07 2004
@@ -31,7 +31,7 @@
 
                        String record=myControl.getRecord();
 
-                       if (record.equals("onCreateonInstantiate"))
+                       if (record.equals("initonCreateonAcquire"))
                                report.setStatus(Report.PASS);
                        else{
                                report.setStatus(Report.FAIL);

Modified: 
incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/extension/DriveSubControl.java
==============================================================================
--- 
incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/extension/DriveSubControl.java
   (original)
+++ 
incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/extension/DriveSubControl.java
   Thu Aug 26 12:39:07 2004
@@ -48,7 +48,11 @@
                }
                else {
                        String s=myControl.hello2();
-                       if (s.equals("Hello from subcontrol"))
+                       if (s==null){
+                                       report.setStatus(Report.FAIL);
+                                       report.setMessage("the invoked method 
returns NULL");
+                       }
+                       else if (s.equals("Hello from subcontrol"))
                                report.setStatus(Report.PASS);
                        else{
                                report.setStatus(Report.FAIL);
@@ -68,7 +72,11 @@
                }
                else {
                        String s=myControl.accessInheritedProperty();
-                       if (s.equals("In_ExtensibleControl_Interface"))
+                       if (s==null){
+                               report.setStatus(Report.FAIL);
+                               report.setMessage("the retrieved property is 
NULL");
+                               }
+                       else if (s.equals("In_ExtensibleControl_Interface"))
                                report.setStatus(Report.PASS);
                        else{
                                report.setStatus(Report.FAIL);

Modified: 
incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/property/DriveClientImpl.java
==============================================================================
--- 
incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/property/DriveClientImpl.java
    (original)
+++ 
incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/property/DriveClientImpl.java
    Thu Aug 26 12:39:07 2004
@@ -10,7 +10,7 @@
 
 public class DriveClientImpl
 {
-       public static String EXPECTED_GREETING="Hello";
+       public static String EXPECTED_GREETING="Good morning!";
        private SinglePropertyBean myControl;
 
        public void setControl(SinglePropertyBean aControl){
@@ -28,10 +28,19 @@
                }
                else
                {
-                       if (myControl.sayHello().equals(EXPECTED_GREETING))
+                       /*
+                       Before control bean getter/setter is fix, just fail 
this test
+
+                       myControl.setGreetingGreetWord(EXPECTED_GREETING);
+                       String s=myControl.sayHello();
+
+                       if (s.equals(EXPECTED_GREETING))
                                report.setStatus(Report.PASS);
                        else
                                report.setStatus(Report.FAIL);
+                       */
+                       report.setStatus(Report.FAIL);
+                       report.setMessage("control bean getter/setter is 
broken. Check the latest dev status.");
 
                }
                return report;

Modified: 
incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/property/DriveImplAccess.java
==============================================================================
--- 
incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/property/DriveImplAccess.java
    (original)
+++ 
incubator/beehive/trunk/controls/test/webapps/controlsWeb/controls/org/apache/beehive/controls/test/driver/property/DriveImplAccess.java
    Thu Aug 26 12:39:07 2004
@@ -10,7 +10,7 @@
 
 public class DriveImplAccess
 {
-       public static String EXPECTED_GREETING="Good morning!";
+       public static String EXPECTED_GREETING="Hello";
        private SinglePropertyBean myControl;
 
        public void setControl(SinglePropertyBean aControl){
@@ -28,19 +28,12 @@
                }
                else
                {
-                       /*
-                       Before control bean getter/setter is fix, just fail 
this test
 
-                       myControl.setGreetingGreetWord(EXPECTED_GREETING);
-                       String s=myControl.sayHello();
-
-                       if (s.equals(EXPECTED_GREETING))
+                       if (myControl.sayHello().equals(EXPECTED_GREETING))
                                report.setStatus(Report.PASS);
                        else
                                report.setStatus(Report.FAIL);
-                       */
-                       report.setStatus(Report.FAIL);
-                       report.setMessage("control bean getter/setter is 
broken. Check the latest dev status.");
+
                }
                return report;
        }

Reply via email to