build.xml 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388
  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 level="info">
  27. ${name} build file
  28. ------------------------------------------------------
  29. Among the available targets are:
  30. clean --> deletes output directories
  31. unzip --> unzips each container into file system
  32. tests --> unzips each container and runs all tests
  33. tests-jetty --> runs the integration tests with Jetty
  34. tests-jboss --> runs the integration tests with JBoss
  35. tests-catalina --> runs the integration tests with Catalina
  36. (both 4.1 and 5.0)
  37. tests-catalina-4.1--> runs the integration tests with Catalina 4.1
  38. tests-catalina-5 --> runs the integration tests with Catalina 5.0
  39. Each tests-xxxx target assumes the container is unzipped
  40. BE SURE TO CHECK REPORTS DIRECTORY FOR RESULTS OF TESTS!
  41. *** The script does NOT halt if a test errors or fails ***
  42. </echo>
  43. </target>
  44. <target name="clean" description="Clean all output dirs">
  45. <delete dir="${build.dir}"/>
  46. <delete dir="${tmp.dir}"/>
  47. <delete dir="${reports.dir}"/>
  48. </target>
  49. <target name="buildtests" depends="" description="Compile test source tree Java files into class files">
  50. <mkdir dir="${build.dir}"/>
  51. <javac destdir="${build.dir}" target="1.3" debug="${debug}"
  52. deprecation="false" optimize="false" failonerror="true">
  53. <src path="${src.dir}"/>
  54. <classpath refid="qa-portalpath"/>
  55. </javac>
  56. </target>
  57. <target name="format" description="Formats all project source code">
  58. <taskdef name="jalopy" classname="de.hunsicker.jalopy.plugin.ant.AntPlugin">
  59. <classpath refid="jalopy-classpath"/>
  60. </taskdef>
  61. <jalopy fileformat="unix"
  62. convention="${jalopy.xml}"
  63. history="file"
  64. historymethod="adler32"
  65. loglevel="error"
  66. threads="2"
  67. classpathref="qa-portalpath">
  68. <fileset dir="${src.dir}">
  69. <include name="**/*.java"/>
  70. </fileset>
  71. </jalopy>
  72. </target>
  73. <target name="tests" depends="clean,unzip,tests-jetty,tests-catalina,tests-jboss"
  74. description="Run all integration tests">
  75. <condition property="anyerrors" value="true">
  76. <or>
  77. <isset property="jetty-${jetty.version}.errored"/>
  78. <isset property="jboss-${jboss.version}.errored"/>
  79. <isset property="jakarta-tomcat-${tomcat-4.1.version}.errored"/>
  80. <isset property="jakarta-tomcat-${tomcat-5.version}.errored"/>
  81. </or>
  82. </condition>
  83. <condition property="anyfailures" value="true">
  84. <or>
  85. <isset property="jetty-${jetty.version}.failed"/>
  86. <isset property="jboss-${jboss.version}.failed"/>
  87. <isset property="jakarta-tomcat-${tomcat-4.1.version}.failed"/>
  88. <isset property="jakarta-tomcat-${tomcat-5.version}.failed"/>
  89. </or>
  90. </condition>
  91. <fileset id="availablereports" dir="${reports.dir}"
  92. includes="**/html/index.html"/>
  93. <condition property="is.windows">
  94. <os family="windows"/>
  95. </condition>
  96. <antcall target="-prepare.availablereports.unix"/>
  97. <antcall target="-prepare.availablereports.windows"/>
  98. <condition property="jetty.errored" value="YES !">
  99. <isset property="jetty-${jetty.version}.errored"/>
  100. </condition>
  101. <condition property="jboss.errored" value="YES !">
  102. <isset property="jboss-${jboss.version}.errored"/>
  103. </condition>
  104. <condition property="jakarta-tomcat-4.1.errored" value="YES !">
  105. <isset property="jakarta-tomcat-${tomcat-4.1.version}.errored"/>
  106. </condition>
  107. <condition property="jakarta-tomcat-5.errored" value="YES !">
  108. <isset property="jakarta-tomcat-${tomcat-5.version}.errored"/>
  109. </condition>
  110. <condition property="jetty.failed" value="YES !">
  111. <isset property="jetty-${jetty.version}.failed"/>
  112. </condition>
  113. <condition property="jboss.failed" value="YES !">
  114. <isset property="jboss-${jboss.version}.failed"/>
  115. </condition>
  116. <condition property="jakarta-tomcat-4.1.failed" value="YES !">
  117. <isset property="jakarta-tomcat-${tomcat-4.1.version}.failed"/>
  118. </condition>
  119. <condition property="jakarta-tomcat-5.failed" value="YES !">
  120. <isset property="jakarta-tomcat-${tomcat-5.version}.failed"/>
  121. </condition>
  122. <property name="jetty.errored" value="no "/>
  123. <property name="jboss.errored" value="no "/>
  124. <property name="jakarta-tomcat-4.1.errored" value="no "/>
  125. <property name="jakarta-tomcat-5.errored" value="no "/>
  126. <property name="jetty.failed" value="no "/>
  127. <property name="jboss.failed" value="no "/>
  128. <property name="jakarta-tomcat-4.1.failed" value="no "/>
  129. <property name="jakarta-tomcat-5.failed" value="no "/>
  130. <property name="jetty.run" value="no"/>
  131. <property name="jboss.run" value="no"/>
  132. <property name="jakarta-tomcat-4.1.run" value="no"/>
  133. <property name="jakarta-tomcat-5.run" value="no"/>
  134. <echo level="info">
  135. Jetty ${jetty.version}:&#9;Run: ${jetty.run}&#9;&#9;Errored: ${jetty.errored}&#9;Failed: ${jetty.failed}
  136. JBoss ${jboss.version}:&#9;Run: ${jboss.run}&#9;&#9;Errored: ${jboss.errored}&#9;Failed: ${jboss.failed}
  137. Tomcat ${tomcat-4.1.version}:&#9;Run: ${jakarta-tomcat-4.1.run}&#9;&#9;Errored: ${jakarta-tomcat-4.1.errored}&#9;Failed: ${jakarta-tomcat-4.1.failed}
  138. Tomcat ${tomcat-5.version}:&#9;Run: ${jakarta-tomcat-5.run}&#9;&#9;Errored: ${jakarta-tomcat-5.errored}&#9;Failed: ${jakarta-tomcat-5.failed}
  139. </echo>
  140. <fail if="anyerrors">ERRORS OCCURED DURING TESTING</fail>
  141. <fail if="anyfailures">Failures occured during testing</fail>
  142. </target>
  143. <target name="-prepare.availablereports.windows" if="is.windows">
  144. <pathconvert dirsep="\" pathsep="&#13;&#10;"
  145. property="availablereports.paths"
  146. refid="availablereports"/>
  147. <echo>${availablereports.paths}</echo>
  148. </target>
  149. <target name="-prepare.availablereports.unix" unless="is.windows">
  150. <echo>not is.windows: ${is.windows}</echo>
  151. <pathconvert dirsep="/" pathsep="&#10;"
  152. property="availablereports.paths"
  153. refid="availablereports"/>
  154. <echo>${availablereports.paths}</echo>
  155. </target>
  156. <target name="tests-jetty" depends="buildtests" description="Runs Jetty integration tests">
  157. <copy file="${config.dir}/jetty-${jetty.version}/jetty.xml" todir="${tmp.dir}/jetty-${jetty.version}/etc" overwrite="true"/>
  158. <copy file="${acegisecurity.xml}" todir="${tmp.dir}/jetty-${jetty.version}/etc" overwrite="true"/>
  159. <copy file="${dist.lib.dir}/acegi-security-jetty-ext.jar" todir="${tmp.dir}/jetty-${jetty.version}/ext" overwrite="true"/>
  160. <copy file="${lib.dir}/aop-alliance/aopalliance.jar" todir="${tmp.dir}/jetty-${jetty.version}/ext" overwrite="true"/>
  161. <copy file="${lib.dir}/jakarta-commons/commons-logging.jar" todir="${tmp.dir}/jetty-${jetty.version}/ext" overwrite="true"/>
  162. <copy file="${lib.dir}/spring/spring.jar" todir="${tmp.dir}/jetty-${jetty.version}/ext" overwrite="true"/>
  163. <copy file="${contacts.war}" todir="${tmp.dir}/jetty-${jetty.version}/webapps" overwrite="true"/>
  164. <parallel>
  165. <java fork="true" dir="${tmp.dir}/jetty-${jetty.version}/" classpath="${tmp.dir}/jetty-${jetty.version}/start.jar" classname="org.mortbay.start.Main">
  166. </java>
  167. <sequential>
  168. <waitfor maxwait="240" maxwaitunit="second" checkevery="500" checkeveryunit="millisecond">
  169. <http url="http://localhost:8080/contacts" />
  170. </waitfor>
  171. <antcall target="-runtests">
  172. <param name="product" value="jetty-${jetty.version}"/>
  173. </antcall>
  174. <java fork="true" dir="${tmp.dir}/jetty-${jetty.version}/" classpath="${tmp.dir}/jetty-${jetty.version}/stop.jar" classname="org.mortbay.stop.Main"/>
  175. </sequential>
  176. </parallel>
  177. <antcall target="-report">
  178. <param name="product" value="jetty-${jetty.version}"/>
  179. </antcall>
  180. <property name="jetty.run" value="yes"/>
  181. </target>
  182. <target name="tests-catalina" description="Runs Catalina integration tests">
  183. <antcall target="-tests-catalina">
  184. <param name="tomcat.version" value="${tomcat-4.1.version}"/>
  185. </antcall>
  186. <antcall target="-tests-catalina">
  187. <param name="tomcat.version" value="${tomcat-5.version}"/>
  188. </antcall>
  189. </target>
  190. <target name="tests-catalina-4.1" description="Runs Catalina 4.1 integration tests">
  191. <antcall target="-tests-catalina">
  192. <param name="tomcat.version" value="${tomcat-4.1.version}"/>
  193. </antcall>
  194. </target>
  195. <target name="tests-catalina-5" description="Runs Catalina 5 integration tests">
  196. <antcall target="-tests-catalina">
  197. <param name="tomcat.version" value="${tomcat-5.version}"/>
  198. </antcall>
  199. </target>
  200. <target name="-tests-catalina" depends="buildtests" description="Runs Catalina integration tests">
  201. <delete dir="${tmp.dir}/jakarta-tomcat-${tomcat.version}/webapps/contacts"/>
  202. <copy file="${config.dir}/catalina-${tomcat.version}/server.xml" todir="${tmp.dir}/jakarta-tomcat-${tomcat.version}/conf" overwrite="true"/>
  203. <copy file="${acegisecurity.xml}" todir="${tmp.dir}/jakarta-tomcat-${tomcat.version}/conf" overwrite="true"/>
  204. <copy file="${dist.lib.dir}/acegi-security-catalina-server.jar" todir="${tmp.dir}/jakarta-tomcat-${tomcat.version}/server/lib" overwrite="true"/>
  205. <copy file="${dist.lib.dir}/acegi-security-catalina-common.jar" todir="${tmp.dir}/jakarta-tomcat-${tomcat.version}/common/lib" overwrite="true"/>
  206. <copy file="${lib.dir}/aop-alliance/aopalliance.jar" todir="${tmp.dir}/jakarta-tomcat-${tomcat.version}/common/lib" overwrite="true"/>
  207. <copy file="${lib.dir}/spring/spring.jar" todir="${tmp.dir}/jakarta-tomcat-${tomcat.version}/common/lib" overwrite="true"/>
  208. <copy file="${contacts.war}" todir="${tmp.dir}/jakarta-tomcat-${tomcat.version}/webapps" overwrite="true"/>
  209. <property name="tomcat.home" value="${tmp.dir}/jakarta-tomcat-${tomcat.version}"/>
  210. <parallel>
  211. <java fork="true" classname="org.apache.catalina.startup.Bootstrap" dir="${tomcat.home}">
  212. <jvmarg value="-Dcatalina.home=${tomcat.home}"/>
  213. <arg value="start"/>
  214. <classpath>
  215. <pathelement path="${java.home}/../lib/tools.jar"/>
  216. <fileset dir="${tomcat.home}">
  217. <include name="bin/bootstrap.jar"/>
  218. </fileset>
  219. </classpath>
  220. </java>
  221. <sequential>
  222. <waitfor maxwait="240" maxwaitunit="second" checkevery="500" checkeveryunit="millisecond">
  223. <http url="http://localhost:8080/contacts" />
  224. </waitfor>
  225. <antcall target="-runtests">
  226. <param name="product" value="jakarta-tomcat-${tomcat.version}"/>
  227. </antcall>
  228. <java fork="true" classname="org.apache.catalina.startup.Bootstrap" dir="${tomcat.home}">
  229. <jvmarg value="-Dcatalina.home=${tomcat.home}"/>
  230. <arg value="stop"/>
  231. <classpath>
  232. <pathelement path="${java.home}/../lib/tools.jar"/>
  233. <fileset dir="${tomcat.home}">
  234. <include name="bin/bootstrap.jar"/>
  235. </fileset>
  236. </classpath>
  237. </java>
  238. </sequential>
  239. </parallel>
  240. <antcall target="-report">
  241. <param name="product" value="jakarta-tomcat-${tomcat.version}"/>
  242. </antcall>
  243. <property name="jakarta-tomcat-${tomcat.version}.run" value="yes"/>
  244. </target>
  245. <target name="tests-jboss" depends="buildtests" description="Runs JBoss integration tests">
  246. <copy file="${config.dir}/jboss-${jboss.version}/login-config.xml" todir="${tmp.dir}/jboss-${jboss.version}/server/default/conf" overwrite="true"/>
  247. <copy file="${acegisecurity.xml}" todir="${tmp.dir}/jboss-${jboss.version}/server/default/conf" overwrite="true"/>
  248. <copy file="${dist.lib.dir}/acegi-security-jboss-lib.jar" todir="${tmp.dir}/jboss-${jboss.version}/server/default/lib" overwrite="true"/>
  249. <copy file="${lib.dir}/aop-alliance/aopalliance.jar" todir="${tmp.dir}/jboss-${jboss.version}/server/default/lib" overwrite="true"/>
  250. <copy file="${lib.dir}/spring/spring.jar" todir="${tmp.dir}/jboss-${jboss.version}/server/default/lib" overwrite="true"/>
  251. <copy file="${contacts.war}" todir="${tmp.dir}/jboss-${jboss.version}/server/default/deploy" overwrite="true"/>
  252. <parallel>
  253. <java fork="yes" classname="org.jboss.Main" dir="${tmp.dir}/jboss-${jboss.version}">
  254. <classpath>
  255. <pathelement path="${java.home}/../lib/tools.jar"/>
  256. <pathelement path="${tmp.dir}/jboss-${jboss.version}/bin/run.jar"/>
  257. </classpath>
  258. </java>
  259. <sequential>
  260. <waitfor maxwait="240" maxwaitunit="second" checkevery="500" checkeveryunit="millisecond">
  261. <http url="http://localhost:8080/contacts" />
  262. </waitfor>
  263. <antcall target="-runtests">
  264. <param name="product" value="jboss-${jboss.version}"/>
  265. </antcall>
  266. <java fork="yes" classname="org.jboss.Shutdown" dir="${tmp.dir}/jboss-${jboss.version}">
  267. <arg value="--shutdown"/>
  268. <classpath>
  269. <pathelement path="${tmp.dir}/jboss-${jboss.version}/bin/shutdown.jar"/>
  270. </classpath>
  271. </java>
  272. </sequential>
  273. </parallel>
  274. <antcall target="-report">
  275. <param name="product" value="jboss-${jboss.version}"/>
  276. </antcall>
  277. <property name="jboss.run" value="yes"/>
  278. </target>
  279. <target name="unzip" depends="unzip-jetty,unzip-catalina,unzip-jboss" description="Unzip all containers"/>
  280. <target name="unzip-jetty" depends="" description="Unzip Jetty container">
  281. <delete dir="${tmp.dir}/Jetty-${jetty.version}"/>
  282. <mkdir dir="${tmp.dir}/Jetty-${jetty.version}"/>
  283. <unzip src="${containers.dir}/Jetty-${jetty.version}-all.zip" dest="${tmp.dir}"/>
  284. </target>
  285. <target name="unzip-catalina" depends="" description="Unzip Catalina container">
  286. <antcall target="-unzip-catalina">
  287. <param name="tomcat.version" value="${tomcat-4.1.version}"/>
  288. </antcall>
  289. <antcall target="-unzip-catalina">
  290. <param name="tomcat.version" value="${tomcat-5.version}"/>
  291. </antcall>
  292. </target>
  293. <target name="unzip-catalina-4.1" depends="" description="Unzip Catalina 4.1 container">
  294. <antcall target="-unzip-catalina">
  295. <param name="tomcat.version" value="${tomcat-4.1.version}"/>
  296. </antcall>
  297. </target>
  298. <target name="unzip-catalina-5" depends="" description="Unzip Catalina 5 container">
  299. <antcall target="-unzip-catalina">
  300. <param name="tomcat.version" value="${tomcat-4.1.version}"/>
  301. </antcall>
  302. </target>
  303. <target name="-unzip-catalina" depends="" description="Unzip Catalina container">
  304. <delete dir="${tmp.dir}/jakarta-tomcat-${tomcat.version}"/>
  305. <mkdir dir="${tmp.dir}/jakarta-tomcat-${tomcat.version}"/>
  306. <unzip src="${containers.dir}/jakarta-tomcat-${tomcat.version}.zip" dest="${tmp.dir}"/>
  307. </target>
  308. <target name="unzip-jboss" depends="" description="Unzip JBoss container">
  309. <delete dir="${tmp.dir}/jboss-${jboss.version}"/>
  310. <mkdir dir="${tmp.dir}/jboss-${jboss.version}"/>
  311. <unzip src="${containers.dir}/jboss-${jboss.version}.zip" dest="${tmp.dir}"/>
  312. </target>
  313. <target name="-report" description="Generates a browsable HTML report of the test run">
  314. <mkdir dir="${reports.dir}/${product}/html"/>
  315. <junitreport todir="${reports.dir}/${product}">
  316. <fileset dir="${reports.dir}/${product}" includes="**/TEST-*.xml"/>
  317. <report format="frames" todir="${reports.dir}/${product}/html"/>
  318. </junitreport>
  319. </target>
  320. <target name="-runtests" description="Runs the unit tests">
  321. <delete dir="${reports.dir}/${product}"/>
  322. <mkdir dir="${reports.dir}/${product}"/>
  323. <junit printsummary="yes" haltonfailure="no" haltonerror="no"
  324. failureproperty="${product}.failed"
  325. errorproperty="${product}.errored">
  326. <classpath location="${build.dir}"/>
  327. <classpath refid="qa-portalpath"/>
  328. <formatter type="xml"/>
  329. <batchtest fork="yes" todir="${reports.dir}/${product}">
  330. <fileset dir="${build.dir}" includes="${test.includes}" excludes="${test.excludes}"/>
  331. </batchtest>
  332. </junit>
  333. </target>
  334. </project>