build.xml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. <?xml version="1.0"?>
  2. <!--
  3. Build file for running container integration tests.
  4. $Id$
  5. -->
  6. <project name="acegi-security-integration-tests" default="usage" basedir=".">
  7. <property file="build.properties"/>
  8. <property file="project.properties"/>
  9. <path id="qa-portalpath">
  10. <fileset dir="${dist.lib.dir}">
  11. <include name="acegi-security-spring.jar"/>
  12. </fileset>
  13. <fileset dir="${lib.dir}">
  14. <include name="**/*.jar"/>
  15. </fileset>
  16. <fileset dir="${httpunit.lib.dir}">
  17. <include name="**/*.jar"/>
  18. </fileset>
  19. </path>
  20. <path id="jalopy-classpath">
  21. <fileset dir="${lib.dir}/jalopy">
  22. <include name="**/*.jar"/>
  23. </fileset>
  24. </path>
  25. <target name="usage">
  26. <echo message=""/>
  27. <echo message="${name} build file"/>
  28. <echo message="------------------------------------------------------"/>
  29. <echo message=""/>
  30. <echo message="Among the available targets are:"/>
  31. <echo message=""/>
  32. <echo message="clean --> deletes output directories"/>
  33. <echo message="unzip --> unzips each container into file system"/>
  34. <echo message="tests --> unzips each container and runs all tests"/>
  35. <echo message="tests-jetty --> runs the integration tests with Jetty"/>
  36. <echo message="tests-jboss --> runs the integration tests with JBoss"/>
  37. <echo message="tests-catalina --> runs the integration tests with Catalina"/>
  38. <echo message=""/>
  39. <echo message="Each tests-xxxx target assumes the container is unzipped"/>
  40. <echo message=""/>
  41. <echo message="BE SURE TO CHECK REPORTS DIRECTORY FOR RESULTS OF TESTS!"/>
  42. <echo message=" *** The script does NOT halt if a test fails ***"/>
  43. <echo message=""/>
  44. </target>
  45. <target name="clean" description="Clean all output dirs">
  46. <delete dir="${build.dir}"/>
  47. <delete dir="${tmp.dir}"/>
  48. <delete dir="${reports.dir}"/>
  49. </target>
  50. <target name="buildtests" depends="" description="Compile test source tree Java files into class files">
  51. <mkdir dir="${build.dir}"/>
  52. <javac destdir="${build.dir}" target="1.3" debug="${debug}"
  53. deprecation="false" optimize="false" failonerror="true">
  54. <src path="${src.dir}"/>
  55. <classpath refid="qa-portalpath"/>
  56. </javac>
  57. </target>
  58. <target name="format" description="Formats all project source code">
  59. <taskdef name="jalopy" classname="de.hunsicker.jalopy.plugin.ant.AntPlugin">
  60. <classpath refid="jalopy-classpath"/>
  61. </taskdef>
  62. <jalopy fileformat="unix"
  63. convention="${jalopy.xml}"
  64. history="file"
  65. historymethod="adler32"
  66. loglevel="error"
  67. threads="2"
  68. classpathref="qa-portalpath">
  69. <fileset dir="${src.dir}">
  70. <include name="**/*.java"/>
  71. </fileset>
  72. </jalopy>
  73. </target>
  74. <target name="tests" depends="clean,unzip,tests-jetty,tests-catalina,tests-jboss" description="Run all integration tests">
  75. <echo message="BE SURE TO CHECK REPORTS DIRECTORY FOR RESULTS OF TESTS!"/>
  76. </target>
  77. <target name="tests-jetty" depends="buildtests" description="Runs Jetty integration tests">
  78. <copy file="${config.dir}/jetty-4.2.18/jetty.xml" todir="${tmp.dir}/jetty-4.2.18/etc" overwrite="true"/>
  79. <copy file="${acegisecurity.xml}" todir="${tmp.dir}/jetty-4.2.18/etc" overwrite="true"/>
  80. <copy file="${dist.lib.dir}/acegi-security-jetty-ext.jar" todir="${tmp.dir}/jetty-4.2.18/ext" overwrite="true"/>
  81. <copy file="${lib.dir}/aop-alliance/aopalliance.jar" todir="${tmp.dir}/jetty-4.2.18/ext" overwrite="true"/>
  82. <copy file="${lib.dir}/jakarta-commons/commons-logging.jar" todir="${tmp.dir}/jetty-4.2.18/ext" overwrite="true"/>
  83. <copy file="${lib.dir}/spring/spring.jar" todir="${tmp.dir}/jetty-4.2.18/ext" overwrite="true"/>
  84. <copy file="${contacts.war}" todir="${tmp.dir}/jetty-4.2.18/webapps" overwrite="true"/>
  85. <parallel>
  86. <java fork="true" dir="${tmp.dir}/jetty-4.2.18/" classpath="${tmp.dir}/jetty-4.2.18/start.jar" classname="org.mortbay.start.Main">
  87. </java>
  88. <sequential>
  89. <waitfor maxwait="60" maxwaitunit="second" checkevery="500" checkeveryunit="millisecond">
  90. <http url="http://localhost:8080/contacts" />
  91. </waitfor>
  92. <delete dir="${reports.dir}/jetty-4.2.18"/>
  93. <mkdir dir="${reports.dir}/jetty-4.2.18"/>
  94. <junit printsummary="yes" haltonfailure="no">
  95. <classpath location="${build.dir}"/>
  96. <classpath refid="qa-portalpath"/>
  97. <formatter type="plain"/>
  98. <batchtest fork="yes" todir="${reports.dir}/jetty-4.2.18">
  99. <fileset dir="${build.dir}" includes="${test.includes}" excludes="${test.excludes}"/>
  100. </batchtest>
  101. </junit>
  102. <java fork="true" dir="${tmp.dir}/jetty-4.2.18/" classpath="${tmp.dir}/jetty-4.2.18/stop.jar" classname="org.mortbay.stop.Main"/>
  103. </sequential>
  104. </parallel>
  105. </target>
  106. <target name="tests-catalina" depends="buildtests" description="Runs Catalina integration tests">
  107. <delete dir="${tmp.dir}/jakarta-tomcat-5.0.19/webapps/contacts"/>
  108. <copy file="${config.dir}/catalina-5.0.19/server.xml" todir="${tmp.dir}/jakarta-tomcat-5.0.19/conf" overwrite="true"/>
  109. <copy file="${acegisecurity.xml}" todir="${tmp.dir}/jakarta-tomcat-5.0.19/conf" overwrite="true"/>
  110. <copy file="${dist.lib.dir}/acegi-security-catalina-server.jar" todir="${tmp.dir}/jakarta-tomcat-5.0.19/server/lib" overwrite="true"/>
  111. <copy file="${dist.lib.dir}/acegi-security-catalina-common.jar" todir="${tmp.dir}/jakarta-tomcat-5.0.19/common/lib" overwrite="true"/>
  112. <copy file="${lib.dir}/aop-alliance/aopalliance.jar" todir="${tmp.dir}/jakarta-tomcat-5.0.19/common/lib" overwrite="true"/>
  113. <copy file="${lib.dir}/spring/spring.jar" todir="${tmp.dir}/jakarta-tomcat-5.0.19/common/lib" overwrite="true"/>
  114. <copy file="${contacts.war}" todir="${tmp.dir}/jakarta-tomcat-5.0.19/webapps" overwrite="true"/>
  115. <property name="tomcat.home" value="${tmp.dir}/jakarta-tomcat-5.0.19"/>
  116. <parallel>
  117. <java fork="true" classname="org.apache.catalina.startup.Bootstrap" dir="${tomcat.home}">
  118. <jvmarg value="-Dcatalina.home=${tomcat.home}"/>
  119. <arg value="start"/>
  120. <classpath>
  121. <pathelement path="${java.home}/../lib/tools.jar"/>
  122. <fileset dir="${tomcat.home}">
  123. <include name="bin/bootstrap.jar"/>
  124. </fileset>
  125. </classpath>
  126. </java>
  127. <sequential>
  128. <waitfor maxwait="60" maxwaitunit="second" checkevery="500" checkeveryunit="millisecond">
  129. <http url="http://localhost:8080/contacts" />
  130. </waitfor>
  131. <delete dir="${reports.dir}/jakarta-tomcat-5.0.19"/>
  132. <mkdir dir="${reports.dir}/jakarta-tomcat-5.0.19"/>
  133. <junit printsummary="yes" haltonfailure="no">
  134. <classpath location="${build.dir}"/>
  135. <classpath refid="qa-portalpath"/>
  136. <formatter type="plain"/>
  137. <batchtest fork="yes" todir="${reports.dir}/jakarta-tomcat-5.0.19">
  138. <fileset dir="${build.dir}" includes="${test.includes}" excludes="${test.excludes}"/>
  139. </batchtest>
  140. </junit>
  141. <java fork="true" classname="org.apache.catalina.startup.Bootstrap" dir="${tomcat.home}">
  142. <jvmarg value="-Dcatalina.home=${tomcat.home}"/>
  143. <arg value="stop"/>
  144. <classpath>
  145. <pathelement path="${java.home}/../lib/tools.jar"/>
  146. <fileset dir="${tomcat.home}">
  147. <include name="bin/bootstrap.jar"/>
  148. </fileset>
  149. </classpath>
  150. </java>
  151. </sequential>
  152. </parallel>
  153. </target>
  154. <target name="tests-jboss" depends="buildtests" description="Runs JBoss integration tests">
  155. <copy file="${config.dir}/jboss-3.2.3/login-config.xml" todir="${tmp.dir}/jboss-3.2.3/server/default/conf" overwrite="true"/>
  156. <copy file="${acegisecurity.xml}" todir="${tmp.dir}/jboss-3.2.3/server/default/conf" overwrite="true"/>
  157. <copy file="${dist.lib.dir}/acegi-security-jboss-lib.jar" todir="${tmp.dir}/jboss-3.2.3/server/default/lib" overwrite="true"/>
  158. <copy file="${lib.dir}/aop-alliance/aopalliance.jar" todir="${tmp.dir}/jboss-3.2.3/server/default/lib" overwrite="true"/>
  159. <copy file="${lib.dir}/spring/spring.jar" todir="${tmp.dir}/jboss-3.2.3/server/default/lib" overwrite="true"/>
  160. <copy file="${contacts.war}" todir="${tmp.dir}/jboss-3.2.3/server/default/deploy" overwrite="true"/>
  161. <parallel>
  162. <java fork="yes" classname="org.jboss.Main" dir="${tmp.dir}/jboss-3.2.3">
  163. <classpath>
  164. <pathelement path="${java.home}/../lib/tools.jar"/>
  165. <pathelement path="${tmp.dir}/jboss-3.2.3/bin/run.jar"/>
  166. </classpath>
  167. </java>
  168. <sequential>
  169. <waitfor maxwait="60" maxwaitunit="second" checkevery="500" checkeveryunit="millisecond">
  170. <http url="http://localhost:8080/contacts" />
  171. </waitfor>
  172. <delete dir="${reports.dir}/jboss-3.2.3"/>
  173. <mkdir dir="${reports.dir}/jboss-3.2.3"/>
  174. <junit printsummary="yes" haltonfailure="no">
  175. <classpath location="${build.dir}"/>
  176. <classpath refid="qa-portalpath"/>
  177. <formatter type="plain"/>
  178. <batchtest fork="yes" todir="${reports.dir}/jboss-3.2.3">
  179. <fileset dir="${build.dir}" includes="${test.includes}" excludes="${test.excludes}"/>
  180. </batchtest>
  181. </junit>
  182. <java fork="yes" classname="org.jboss.Shutdown" dir="${tmp.dir}/jboss-3.2.3">
  183. <arg value="--shutdown"/>
  184. <classpath>
  185. <pathelement path="${tmp.dir}/jboss-3.2.3/bin/shutdown.jar"/>
  186. </classpath>
  187. </java>
  188. </sequential>
  189. </parallel>
  190. </target>
  191. <target name="unzip" depends="unzip-jetty,unzip-catalina,unzip-jboss" description="Unzip all containers"/>
  192. <target name="unzip-jetty" depends="" description="Unzip Jetty container">
  193. <delete dir="${tmp.dir}/Jetty-4.2.18"/>
  194. <mkdir dir="${tmp.dir}/Jetty-4.2.18"/>
  195. <unzip src="${containers.dir}/Jetty-4.2.18-all.zip" dest="${tmp.dir}"/>
  196. </target>
  197. <target name="unzip-catalina" depends="" description="Unzip Catalina container">
  198. <delete dir="${tmp.dir}/jakarta-tomcat-5.0.19"/>
  199. <mkdir dir="${tmp.dir}/jakarta-tomcat-5.0.19"/>
  200. <unzip src="${containers.dir}/jakarta-tomcat-5.0.19.zip" dest="${tmp.dir}"/>
  201. </target>
  202. <target name="unzip-jboss" depends="" description="Unzip JBoss container">
  203. <delete dir="${tmp.dir}/jboss-3.2.3"/>
  204. <mkdir dir="${tmp.dir}/jboss-3.2.3"/>
  205. <unzip src="${containers.dir}/jboss-3.2.3.zip" dest="${tmp.dir}"/>
  206. </target>
  207. </project>