| <?xml version="1.0" encoding="UTF-8"?> |
| <!-- |
| Licensed to the Apache Software Foundation (ASF) under one or more |
| contributor license agreements. See the NOTICE file distributed with |
| this work for additional information regarding copyright ownership. |
| The ASF licenses this file to You under the Apache License, Version 2.0 |
| (the "License"); you may not use this file except in compliance with |
| the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
| --> |
| |
| |
| <project name="Cloud Stack Tests" default="help" basedir="."> |
| <description> |
| Cloud Stack ant build file |
| </description> |
| |
| <!-- |
| Always use this variable to refer to the base directory because this |
| variable is changeable |
| --> |
| <dirname property="base.dir" file="${ant.file.Cloud Stack Tests}/.." /> |
| <property name="build.dir" location="${base.dir}/build" /> |
| |
| <import file="${build.dir}/build-cloud.xml" optional="false" /> |
| |
| <property name="server.test.dir" location="${server.dir}/test" /> |
| <property name="core.test.dir" location="${core.dir}/test/" /> |
| <property name="agent.test.dir" location="${utils.dir}/test/" /> |
| <!-- directories for agent simulator code compilation--> |
| <property name="agent-simulator.dir" location="${base.dir}/agent-simulator" /> |
| <property name="agent-simulator.dist.dir" location="${dist.dir}/agent-simulator" /> |
| |
| <!-- directories for the test client code compilation--> |
| <property name="testclient.dir" location="${base.dir}/test" /> |
| <property name="testclient.dist.dir" location="${dist.dir}/test" /> |
| <property name="tools.dist.dir" location="${dist.dir}/cloudapitools" /> |
| |
| <property name="test.target.dir" location="${target.dir}/test" /> |
| <property name="test.classes.dir" location="${test.target.dir}/classes"/> |
| |
| <property name="agent-simulator.jar" value="cloud-agent-simulator.jar" /> |
| <property name="testclient.jar" value="cloud-test.jar" /> |
| |
| <property name="simulator.setup.dir" value="${base.dir}/setup/db/" /> |
| <property name="marvin.sandbox.dir" value="${base.dir}/tools/marvin/marvin/sandbox/" /> |
| <property name="marvin.config" value="${base.dir}/tools/marvin/marvin/sandbox/demo/simulator/simulator.cfg" /> |
| <property name="marvin.config.abspath" location="${marvin.config}" /> |
| |
| <!-- =================== Agent Simulator ==================== --> |
| <path id="agent-simulator.classpath"> |
| <path refid="deps.classpath" /> |
| <path refid="dist.classpath" /> |
| </path> |
| <target name="compile-agent-simulator" depends="-init, compile-api, compile-utils, compile-core, compile-agent, compile-server" description="Compile the agent simulator."> |
| <compile-java jar.name="${agent-simulator.jar}" top.dir="${agent-simulator.dir}" classpath="agent-simulator.classpath" /> |
| <copy overwrite="true" todir="${server.dist.dir}/conf"> |
| <fileset dir="${agent-simulator.dir}/tomcatconf"> |
| <include name="*.in" /> |
| </fileset> |
| <globmapper from="*.in" to="*" /> |
| </copy> |
| </target> |
| |
| <target name="build-agent-simulator" depends="-init, compile-agent-simulator"> |
| <mkdir dir="${agent-simulator.dist.dir}" /> |
| <mkdir dir="${agent-simulator.dist.dir}/conf" /> |
| <mkdir dir="${agent-simulator.dist.dir}/logs" /> |
| |
| <copy todir="${agent-simulator.dist.dir}"> |
| <fileset dir="${jar.dir}"> |
| <include name="${agent-simulator.jar}" /> |
| <include name="${agent.jar}" /> |
| <include name="${utils.jar}" /> |
| <include name="${core.jar}" /> |
| <include name="${api.jar}" /> |
| </fileset> |
| <fileset dir="${deps.dir}"> |
| <include name="log4j-1.2.15.jar" /> |
| <include name="gson-1.3.jar" /> |
| <include name="commons-logging-1.1.1.jar" /> |
| <include name="commons-collections-3.2.1.jar" /> |
| </fileset> |
| </copy> |
| <copy overwrite="true" todir="${server.dist.dir}/conf"> |
| <fileset dir="${agent-simulator.dir}/tomcatconf"> |
| <include name="*.in" /> |
| </fileset> |
| <globmapper from="*.in" to="*" /> |
| </copy> |
| <copy todir="${agent-simulator.dist.dir}/conf"> |
| <fileset dir="${agent.dir}/conf"> |
| <include name="log4j-cloud.xml" /> |
| </fileset> |
| </copy> |
| </target> |
| <!-- =================== Agent Simulator ==================== --> |
| |
| <!-- Run Simulator Tests --> |
| <target name="setup-simulator" depends="clean-all"> |
| <mkdir dir="${simulator.setup.dir}/override"> |
| </mkdir> |
| <copy overwrite="true" file="${simulator.setup.dir}/templates.simulator.sql" tofile="${simulator.setup.dir}/override/templates.sql" /> |
| |
| <mkdir dir="${build.dir}/override"> |
| </mkdir> |
| <copy overwrite="true" file="${build.dir}/replace.properties" tofile="${build.dir}/override/replace.properties" /> |
| <!-- Replace the COMPONENT-SPEC for components-simulator.xml --> |
| <copy overwrite="true" file="${build.dir}/simulator.properties" tofile="${build.dir}/override/replace.properties" /> |
| </target> |
| |
| <target name="run-simulator" depends="setup-simulator, build-all-with-simulator, deploy-server, deploydb-simulator, debug"> |
| </target> |
| |
| <target name="run-marvin" depends="install-marvin"> |
| <exec dir="${marvin.sandbox.dir}/" executable="bash"> |
| <arg line="run-marvin.sh -d localhost -m localhost -c ${marvin.config.abspath}" /> |
| </exec> |
| </target> |
| <!-- --> |
| |
| <!-- =================== QA Testing Client ==================== --> |
| <target name="-init-test" depends="-init"> |
| <mkdir dir="${test.target.dir}" /> |
| <mkdir dir="${test.classes.dir}" /> |
| </target> |
| |
| <path id="testclient.classpath"> |
| <path refid="deps.classpath" /> |
| <path refid="dist.classpath" /> |
| </path> |
| <target name="compile-testclient" depends="-init-test, compile-utils" description="Compile the test client."> |
| <echo message="src is ${testclient.dir}"/> |
| <compile-java jar.name="${testclient.jar}" top.dir="${testclient.dir}" classpath="testclient.classpath" /> |
| </target> |
| |
| <target name="build-testclient" depends="-init-test, compile-testclient"> |
| <mkdir dir="${testclient.dist.dir}/src" /> |
| <mkdir dir="${testclient.dist.dir}/conf" /> |
| <mkdir dir="${testclient.dist.dir}/metadata" /> |
| <mkdir dir="${testclient.dist.dir}/usage" /> |
| |
| <copy todir="${testclient.dist.dir}/src"> |
| <fileset dir="${jar.dir}"> |
| <include name="${testclient.jar}" /> |
| <include name="${utils.jar}" /> |
| </fileset> |
| <fileset dir="${deps.dir}"> |
| <include name="commons-httpclient-3.1.jar" /> |
| <include name="commons-logging-1.1.1.jar" /> |
| <include name="commons-codec-1.4.jar" /> |
| <include name="log4j.jar" /> |
| <include name="log4j-extras.jar" /> |
| <include name="trilead-ssh2-build213.jar" /> |
| <include name="mysql-connector-java-5.1.7-bin.jar" /> |
| </fileset> |
| </copy> |
| <copy overwrite="true" todir="${testclient.dist.dir}/conf"> |
| <fileset dir="${testclient.dir}/conf"> |
| <include name="log4j.properties" /> |
| <include name="templates.sql" /> |
| <include name="deploy.xml" /> |
| <include name="config.xml" /> |
| <include name="tool.properties" /> |
| </fileset> |
| </copy> |
| |
| <copy overwrite="true" todir="${testclient.dist.dir}/scripts"> |
| <fileset dir="${testclient.dir}/scripts" /> |
| </copy> |
| |
| <copy overwrite="true" todir="${testclient.dist.dir}/metadata"> |
| <fileset dir="${testclient.dir}/metadata" /> |
| </copy> |
| |
| <copy todir="${testclient.dist.dir}/usage" overwrite="true"> |
| <fileset dir="${testclient.dir}/scripts/usage" /> |
| </copy> |
| |
| <copy overwrite="true" todir="${testclient.dist.dir}"> |
| <fileset dir="${testclient.dir}/conf/"> |
| <include name="deploy.properties" /> |
| </fileset> |
| </copy> |
| |
| <chmod file="${testclient.dist.dir}/scripts/deploy.sh" perm="uog+xr" /> |
| <chmod file="${testclient.dist.dir}/scripts/cleanup.sh" perm="uog+xr" /> |
| <chmod file="${testclient.dist.dir}/scripts/cleanparallel.sh" perm="uog+xr" /> |
| <chmod file="${testclient.dist.dir}/scripts/deploycluster.sh" perm="uog+xr" /> |
| |
| </target> |
| |
| |
| <target name="build-tools" depends="-init-test, compile-testclient"> |
| <mkdir dir="${tools.dist.dir}/src" /> |
| <mkdir dir="${tools.dist.dir}/conf" /> |
| |
| |
| <copy todir="${tools.dist.dir}/src"> |
| <fileset dir="${jar.dir}"> |
| <include name="${testclient.jar}" /> |
| <include name="${utils.jar}" /> |
| </fileset> |
| <fileset dir="${deps.dir}"> |
| <include name="commons-httpclient-3.1.jar" /> |
| <include name="commons-logging-1.1.1.jar" /> |
| <include name="commons-codec-1.4.jar" /> |
| <include name="log4j-1.2.15.jar" /> |
| <include name="apache-log4j-extras-1.0.jar" /> |
| <include name="trilead-ssh2-build213.jar" /> |
| <include name="mysql-connector-java-5.1.7-bin.jar" /> |
| </fileset> |
| </copy> |
| |
| <copy overwrite="true" todir="${tools.dist.dir}/conf"> |
| <fileset dir="${testclient.dir}/conf"> |
| <include name="tool.properties" /> |
| <include name="log4j.properties" /> |
| </fileset> |
| </copy> |
| |
| <copy overwrite="true" todir="${tools.dist.dir}"> |
| <fileset dir="${testclient.dir}/scripts" > |
| <include name="certSubmitEC2.sh" /> |
| <include name="certDeleteEC2.sh" /> |
| <include name="sign.sh" /> |
| </fileset> |
| <fileset dir="${testclient.dir}/conf"> |
| <include name="README" /> |
| </fileset> |
| </copy> |
| |
| <chmod file="${tools.dist.dir}/certSubmitEC2.sh" perm="a+xr" /> |
| <chmod file="${tools.dist.dir}/certDeleteEC2.sh" perm="a+xr" /> |
| <chmod file="${tools.dist.dir}/sign.sh" perm="a+xr" /> |
| </target> |
| |
| <target name="-clean-test"> |
| <delete dir="${test.classes.dir}" /> |
| <delete dir="${test.target.dir}" /> |
| </target> |
| <!-- =================== QA Testing Client ==================== --> |
| |
| <!-- ============== Server Testing =============== --> |
| <target name="compile-server-test" depends="-init-test, compile-server" description="Compile all the source code in the server directory"> |
| <property name="server.test.target.dir" location="${test.classes.dir}/server" /> |
| <property name="jarname" value="server-test.jar" /> |
| |
| <mkdir dir="${server.test.target.dir}" /> |
| |
| <depend srcdir="${server.test.dir}" destdir="${server.test.target.dir}" cache="${dep.cache.dir}"> |
| </depend> |
| <javac srcdir="${server.test.dir}" debug="${debug}" debuglevel="${debuglevel}" deprecation="${deprecation}" source="1.5" target="1.5" destdir="${server.test.target.dir}" includeantruntime="false"> |
| <classpath refid="deps.classpath" /> |
| <classpath refid="test.classpath" /> |
| <compilerarg value="-Xlint:all" /> |
| </javac> |
| <jar jarfile="${test.target.dir}/${jarname}" basedir="${server.test.target.dir}"> |
| <metainf dir="${server.dir}/metadata"> |
| <include name="**/*.xml" /> |
| </metainf> |
| <manifest> |
| <attribute name="Class-Path" value="" /> |
| <attribute name="Built-By" value="${built.by}" /> |
| <section name="com/cloud/"> |
| <attribute name="Specification-Title" value="Cloud Stack" /> |
| <attribute name="Specification-Version" value="${version}" /> |
| <attribute name="Specification-Vendor" value="${company.name}" /> |
| <attribute name="Implementation-Title" value="Server" /> |
| <attribute name="Implementation-Version" value="${impl.version}" /> |
| <attribute name="Implementation-Vendor" value="${company.name}" /> |
| </section> |
| </manifest> |
| </jar> |
| </target> |
| |
| <!-- ====================== XMLTEST Python Based testing ================== --> |
| <target name="xmltest-translate" description="Translate an XML test file into Python"> |
| <echo message="Translating: ${xmltest}"/> |
| <exec dir="tools/testClient" executable="python"> |
| <arg line="translator.py -i ${xmltest}"/> |
| </exec> |
| </target> |
| |
| <target name="xmltest-execute" description="Specify XML test file with -Dxmltest=filename" depends="xmltest-translate"> |
| <echo message="Executing: ${xmltest}.py"/> |
| <exec dir="tools/testClient" executable="python"> |
| <arg line="${xmltest}.py"/> |
| </exec> |
| </target> |
| |
| <target name="xmltest-automated" description="Used to run the daily tests using tools/testClient/automated.xml as the source of tests"> |
| <property name="xmltest" value="automated/automated.xml"/> |
| <echo message="Running daily test run with ${xmltest}.py"/> |
| <antcall target="xmltest-execute"/> |
| </target> |
| |
| <target name="automated-test-run" description="Run the automated tests in tools/testClient/testcases/automated.xml using the debug server"> |
| <antcall target="build-all"/> |
| <antcall target="deploy-server"/> |
| <antcall target="deploydb"/> |
| <antcall target="start-tomcat"/> |
| <echo message="running tests..."/> |
| <antcall target="xmltest-automated"/> |
| <antcall target="stop-tomcat"/> |
| <antcall target="clean-tomcat"/> |
| </target> |
| <!-- ====================== XMLTEST Python Based testing ================== --> |
| |
| </project> |
| |
| |