You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by mm...@apache.org on 2005/05/18 01:54:07 UTC

svn commit: r170688 - /incubator/beehive/trunk/system-controls/test/src/webservice/build.xml

Author: mmerz
Date: Tue May 17 16:54:05 2005
New Revision: 170688

URL: http://svn.apache.org/viewcvs?rev=170688&view=rev
Log:
Made the deployment of the drt application robust.

Daryoush Mehrtash

Modified:
    incubator/beehive/trunk/system-controls/test/src/webservice/build.xml

Modified: incubator/beehive/trunk/system-controls/test/src/webservice/build.xml
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/test/src/webservice/build.xml?rev=170688&r1=170687&r2=170688&view=diff
==============================================================================
--- incubator/beehive/trunk/system-controls/test/src/webservice/build.xml (original)
+++ incubator/beehive/trunk/system-controls/test/src/webservice/build.xml Tue May 17 16:54:05 2005
@@ -57,6 +57,7 @@
     <!-- misc properties -->
     <property name="context.path" value="ServiceControlDRT"/>
     <property name="waitfor.url" value="http://localhost:8080/index.jsp"/>
+    <property name="webapp.waitfor.url" value="http://localhost:8080/${context.path}"/>
     <property name="waitfor.timeout" value="100"/>
   
     <!-- paths -->
@@ -97,6 +98,62 @@
 
     <target name="build" depends="dirs,gen_jcx,build.gen-sc,build.sc,build.server"/>
 	
+	
+    <!-- ================================================================ -->
+    <!--                                                                  -->
+    <!-- Targets for deploying the webapp on a server                     -->
+    <!--                                                                  -->
+    <!-- ================================================================ -->
+    <target name="deploy" description="Deploy webapp">
+        <echo message="** deploying ${webapp.dir} to ${context.path} **"/>
+       <deploy-webapp webappDir="${webapp.dir}" contextPath="${context.path}"/>
+    </target>
+
+    <target name="undeploy" description="Undeploy webapp">
+        <undeploy-webapp contextPath="${context.path}"/>
+    </target>
+
+    <target name="redeploy" description="Redeploy webapp">
+        <redeploy-webapp contextPath="${context.path}"/>
+    </target>
+
+
+    <target name="ensure.deployed" description="Deploy webapp for the test recorder">
+        <echo>Ensuring that the webapp ${context.path} is deployed on a running server at the url ${webapp.waitfor.url}</echo>
+
+        <waitfor maxwait="5" maxwaitunit="second" timeoutproperty="unavailable">
+            <http url="${webapp.waitfor.url}"/>
+        </waitfor>
+        <antcall target="do.deploy"/>
+        <antcall target="do.redeploy"/>
+        <fail if="still.unavailable" message="Couldn't find webapp with path ${webapp.waitfor.url}"/>
+    </target>
+
+    <target name="do.deploy" if="unavailable">
+        <echo>Webapp is not deployed; deploying</echo>
+
+        <antcall target="deploy"/>
+        <echo>...deploy complete</echo>
+
+        <waitfor maxwait="120" maxwaitunit="second" timeoutproperty="still.unavailable">
+            <http url="${webapp.waitfor.url}"/>
+        </waitfor>
+    </target>
+
+    <target name="do.redeploy" unless="unavailable">
+        <echo>Webapp is deployed; undeploy and redeploy</echo>
+
+        <antcall target="undeploy"/>
+        <echo>...undeploy complete</echo>
+
+        <antcall target="deploy"/>
+        <echo>...deploy complete</echo>
+
+        <waitfor maxwait="120" maxwaitunit="second" timeoutproperty="still.unavailable">
+            <http url="${webapp.waitfor.url}"/>
+        </waitfor>
+    </target>
+        	
     <!-- start server -->
     <target name="start-tomcat" >
         <start-server shmem="false" javaOptions=""/>
@@ -104,8 +161,7 @@
 	
     <!-- deploy webapp -->
     <target name="deploy-webapps" >
-        <echo message="** deploying ${webapp.dir} to ${context.path} **"/>
-        <deploy-webapp webappDir="${webapp.dir}" contextPath="${context.path}"/>
+    	<antcall target="ensure.deployed" />
     </target>
 
     <!-- undeploy webapp -->
@@ -135,8 +191,11 @@
            <antcall target="deploy-webapps"/>
 
            <!-- run test cases -->
-           <antcall target="run.tests"/>
-                    
+       	   <property name="drtfailed" value="true"/>  <!-- assume tests have failed -->
+           <antcall target="run.tests" >
+       			<reference refid="drtfailed" />  <!-- oass test failure flag to the run.test to get result -->
+           	</antcall>
+                
            <!-- undeploy webapp -->
            <antcall target="undeploy-webapps"/>
         
@@ -148,6 +207,7 @@
         
        </sequential>
        </parallel>
+		 <fail if="drtfailed" message="One or more tests in the ServiceControl DRT failed."/>
     </target>
 
     <!-- ========================================= -->
@@ -170,7 +230,6 @@
                 </fileset>
             </batchtest>
         </junit>
-        <fail if="drtfailed" message="One or more tests in the ServiceControl DRT failed."/>
     </target>
   
     <!-- ========================================= -->