| 9103 |
anupam.sin |
1 |
<?xml version="1.0"?>
|
|
|
2 |
|
|
|
3 |
|
|
|
4 |
<!-- ======================================================================
|
|
|
5 |
Date: June 2010
|
|
|
6 |
|
|
|
7 |
Project: MobileWebsiteApi
|
|
|
8 |
|
|
|
9 |
Author: Ashish Singh
|
|
|
10 |
====================================================================== -->
|
|
|
11 |
|
|
|
12 |
|
|
|
13 |
|
|
|
14 |
<project name="MobileWebsiteApi" default="archive" basedir=".">
|
|
|
15 |
|
|
|
16 |
<description>
|
|
|
17 |
Mobile Website API
|
|
|
18 |
</description>
|
|
|
19 |
|
|
|
20 |
<property file="build.properties"/>
|
|
|
21 |
<taskdef name="jmeter" classname="org.programmerplanet.ant.taskdefs.jmeter.JMeterTask"/>
|
|
|
22 |
|
|
|
23 |
<filelist id="apache.libs" dir="${basedir}/${thirdparty.location}/readonly/apache">
|
|
|
24 |
<file name="commons-codec-1.4/commons-codec-1.4.jar"/>
|
|
|
25 |
<file name="commons-collections-3.2.1/commons-collections-3.2.1.jar"/>
|
|
|
26 |
<file name="commons-digester-2.0/commons-digester-2.0.jar"/>
|
|
|
27 |
<file name="commons-fileupload-1.2.1/commons-fileupload-1.2.1.jar"/>
|
|
|
28 |
<file name="commons-io-1.3.2/commons-io-1.3.2.jar"/>
|
|
|
29 |
<file name="commons-lang-2.4/commons-lang-2.4.jar"/>
|
|
|
30 |
<file name="commons-logging-1.0.4/commons-logging-1.0.4.jar"/>
|
|
|
31 |
<file name="commons-logging-api-1.1/commons-logging-api-1.1.jar"/>
|
|
|
32 |
<file name="commons-validator-1.3.1/commons-validator-1.3.1.jar"/>
|
|
|
33 |
<file name="ezmorph/ezmorph-1.0.3.jar"/>
|
|
|
34 |
<file name="json/json-lib-2.1-jdk15.jar"/>
|
|
|
35 |
<file name="jsp-2.1/jsp-api.jar"/>
|
|
|
36 |
<file name="log4j/log4j-1.2.16.jar"/>
|
|
|
37 |
<file name="ognl/ognl-2.7.3.jar"/>
|
|
|
38 |
<file name="struts-2.1.8.1/struts2-convention-plugin-2.1.8.1.jar"/>
|
|
|
39 |
<file name="struts-2.1.8.1/struts2-core-2.1.8.1.jar"/>
|
|
|
40 |
<file name="struts-2.1.8.1/struts2-rest-plugin-2.1.8.1.jar"/>
|
|
|
41 |
<file name="struts-2.1.8.1/xstream-1.2.2.jar"/>
|
|
|
42 |
<file name="struts-2.1.8.1/xwork-core-2.1.6.jar"/>
|
|
|
43 |
<file name="thrift-0.2.0/libthrift.jar"/>
|
|
|
44 |
<file name="velocity-1.6.3/velocity-1.6.3.jar"/>
|
|
|
45 |
<file name="velocity-1.6.3/velocity-tools-1.4.jar"/>
|
|
|
46 |
<file name="xpp/xpp3_min-1.1.3.4.O.jar"/>
|
|
|
47 |
</filelist>
|
|
|
48 |
|
|
|
49 |
<filelist id="MobileWebsiteApi.libs" dir="${basedir}/${thirdparty.location}">
|
|
|
50 |
<file name="readonly/freemarker/freemarker-2.3.15.jar"/>
|
|
|
51 |
<file name="readonly/slf4j/slf4j-api-1.5.8.jar"/>
|
|
|
52 |
<file name="readonly/slf4j/slf4j-simple-1.5.8.jar"/>
|
|
|
53 |
<file name="readonly/payment/payments.jar"/>
|
|
|
54 |
<file name="readonly/yuicompressor-2.4.2/yuicompressor-2.4.2.jar"/>
|
|
|
55 |
<file name="readonly/UserAgentUtils/UserAgentUtils-1.2.3.jar"/>
|
|
|
56 |
<file name="Common.jar"/>
|
|
|
57 |
<file name="ThriftConfig.jar"/>
|
|
|
58 |
</filelist>
|
|
|
59 |
|
|
|
60 |
<path id="MobileWebsiteApi.classpath">
|
|
|
61 |
<pathelement location="${basedir}/build/classes"/>
|
|
|
62 |
<filelist refid="apache.libs"/>
|
|
|
63 |
<filelist refid="MobileWebsiteApi.libs"/>
|
|
|
64 |
<pathelement location="${basedir}/${thirdparty.location}/readonly/apache/sevlet-2.5/servlet-api.jar"/>
|
|
|
65 |
</path>
|
|
|
66 |
|
|
|
67 |
<!-- ==================== Clean Target ==================================== -->
|
|
|
68 |
|
|
|
69 |
<!--
|
|
|
70 |
The "clean" target deletes any previous "build" and "dist" directory,
|
|
|
71 |
so that you can be ensured the application can be built from scratch.
|
|
|
72 |
-->
|
|
|
73 |
<target name="clean" description="Delete old build and dist directories">
|
|
|
74 |
<delete dir="${dist.home}"/>
|
|
|
75 |
<delete dir="${build.home}"/>
|
|
|
76 |
</target>
|
|
|
77 |
|
|
|
78 |
<!-- ==================== Init Target ================================== -->
|
|
|
79 |
|
|
|
80 |
<!--
|
|
|
81 |
|
|
|
82 |
The "init" target is used to create the "build" destination directory,
|
|
|
83 |
Normally, this task is executed indirectly when needed.
|
|
|
84 |
|
|
|
85 |
-->
|
|
|
86 |
<target name="init" depends="clean" description="Create build directory">
|
|
|
87 |
|
|
|
88 |
<mkdir dir="${build.home}" />
|
|
|
89 |
<mkdir dir="${build.home}/WEB-INF/classes" />
|
|
|
90 |
<mkdir dir="${build.home}/WEB-INF/lib" />
|
|
|
91 |
<property name="yuic" location="${thirdparty.location}/readonly/yuicompressor-2.4.2/yuicompressor-2.4.2.jar"/>
|
|
|
92 |
|
|
|
93 |
</target>
|
|
|
94 |
|
|
|
95 |
<!-- ==================== Compile Target ================================== -->
|
|
|
96 |
|
|
|
97 |
<!--
|
|
|
98 |
|
|
|
99 |
The "compile" target transforms source files (from your "src" directory)
|
|
|
100 |
into class files in the appropriate location in the build directory.
|
|
|
101 |
This example assumes that you will be including your classes in an
|
|
|
102 |
unpacked directory hierarchy under "/WEB-INF/classes".
|
|
|
103 |
|
|
|
104 |
-->
|
|
|
105 |
<target name="compile" depends="init" description="Compile Java sources">
|
|
|
106 |
<javac srcdir="${source.home}"
|
|
|
107 |
destdir="${build.home}/WEB-INF/classes"
|
|
|
108 |
debug="${compile.debug}"
|
|
|
109 |
deprecation="${compile.deprecation}"
|
|
|
110 |
optimize="${compile.optimize}"
|
|
|
111 |
source="1.6" target="1.6">
|
|
|
112 |
<classpath refid="MobileWebsiteApi.classpath"/>
|
|
|
113 |
</javac>
|
|
|
114 |
<javac srcdir="${conf.home}"
|
|
|
115 |
destdir="${build.home}/WEB-INF/classes"
|
|
|
116 |
debug="${compile.debug}"
|
|
|
117 |
deprecation="${compile.deprecation}"
|
|
|
118 |
optimize="${compile.optimize}"
|
|
|
119 |
source="1.6" target="1.6">
|
|
|
120 |
<classpath refid="MobileWebsiteApi.classpath"/>
|
|
|
121 |
</javac>
|
|
|
122 |
|
|
|
123 |
</target>
|
|
|
124 |
|
|
|
125 |
<!-- ==================== Build Target ================================== -->
|
|
|
126 |
|
|
|
127 |
<!--
|
|
|
128 |
|
|
|
129 |
The "build" target copies all non class files to build directory
|
|
|
130 |
|
|
|
131 |
-->
|
|
|
132 |
|
|
|
133 |
<target name="build" depends="compile" description="Copies all non Java classes to build directoy">
|
|
|
134 |
<copy todir="${build.home}">
|
|
|
135 |
<fileset dir="${webapp.home}" excludes="CVS,**/*.class" />
|
|
|
136 |
</copy>
|
|
|
137 |
<copy todir="${build.home}/WEB-INF/classes">
|
|
|
138 |
<fileset dir="${conf.home}" excludes="CVS,**/*.java" />
|
|
|
139 |
</copy>
|
|
|
140 |
|
|
|
141 |
<copy todir="${build.home}/WEB-INF/lib">
|
|
|
142 |
<filelist refid="apache.libs"/>
|
|
|
143 |
<filelist refid="MobileWebsiteApi.libs"/>
|
|
|
144 |
<mapper type="flatten"/>
|
|
|
145 |
</copy>
|
|
|
146 |
|
|
|
147 |
</target>
|
|
|
148 |
|
|
|
149 |
<!-- ==================== Archive Target ================================== -->
|
|
|
150 |
|
|
|
151 |
<!--
|
|
|
152 |
|
|
|
153 |
The "archive" target create a binary archive of all files in build.home
|
|
|
154 |
|
|
|
155 |
-->
|
|
|
156 |
|
|
|
157 |
<target name="archive" depends="build" description="Create binary archive of all files in dist.home">
|
|
|
158 |
|
|
|
159 |
|
|
|
160 |
<!-- Create application WAR file -->
|
|
|
161 |
<jar jarfile="${lib.home}/${app.name}.war"
|
|
|
162 |
basedir="${build.home}" />
|
|
|
163 |
|
|
|
164 |
</target>
|
|
|
165 |
|
|
|
166 |
<macrodef name="run-test">
|
|
|
167 |
<attribute name="test"/>
|
|
|
168 |
<sequential>
|
|
|
169 |
<echo> ==========================</echo>
|
|
|
170 |
<echo> Running test "@{test}"</echo>
|
|
|
171 |
<echo> ==========================</echo>
|
|
|
172 |
<delete dir="${jmeter.home}/bin/samples/@{test}"/>
|
|
|
173 |
<mkdir dir="${jmeter.home}/bin/samples/@{test}"/>
|
|
|
174 |
<mkdir dir="/tmp/jmeter"/>
|
|
|
175 |
<jmeter jmeterhome="${jmeter.home}" resultlogdir="/tmp/jmeter">
|
|
|
176 |
<testplans dir="${test.home}/jmeter" includes="@{test}.jmx"/>
|
|
|
177 |
</jmeter>
|
|
|
178 |
<exec executable="diff" resultproperty="jmeter.failure.@{test}">
|
|
|
179 |
<arg line="-x .svn"/>
|
|
|
180 |
<arg line="-r"/>
|
|
|
181 |
<arg line="--brief"/>
|
|
|
182 |
<arg line="${jmeter.home}/bin/samples/@{test}"/>
|
|
|
183 |
<arg line="${test.home}/samples/@{test}"/>
|
|
|
184 |
</exec>
|
|
|
185 |
<touch file="jmeter-sample-diff-result-${jmeter.failure.@{test}}"/>
|
|
|
186 |
</sequential>
|
|
|
187 |
</macrodef>
|
|
|
188 |
|
|
|
189 |
<macrodef name="run-jmeter-test">
|
|
|
190 |
<attribute name="test"/>
|
|
|
191 |
<sequential>
|
|
|
192 |
<echo> ==========================</echo>
|
|
|
193 |
<echo> Running test "@{test}"</echo>
|
|
|
194 |
<echo> ==========================</echo>
|
|
|
195 |
<delete file="/tmp/jmeter/@{test}.jtl"/>
|
|
|
196 |
<jmeter jmeterhome="${jmeter.home}" resultlogdir="/tmp/jmeter" failureproperty="jmeter.test.failure.@{test}">
|
|
|
197 |
<testplans dir="${test.home}/jmeter" includes="@{test}.jmx"/>
|
|
|
198 |
</jmeter>
|
|
|
199 |
<antcall target="print-jmeter-test-failure">
|
|
|
200 |
<param name="current.test.name" value="@{test}"/>
|
|
|
201 |
</antcall>
|
|
|
202 |
</sequential>
|
|
|
203 |
</macrodef>
|
|
|
204 |
|
|
|
205 |
<target name="run-tests" >
|
|
|
206 |
<delete file="jmeter-sample-diff-result-0"/>
|
|
|
207 |
<delete file="jmeter-sample-diff-result-1"/>
|
|
|
208 |
<record name="src/test/log/run-tests.log" action="start"/>
|
|
|
209 |
<run-test test="home"/>
|
|
|
210 |
<run-test test="product"/>
|
|
|
211 |
|
|
|
212 |
<!--run-jmeter-test test="searching"/>
|
|
|
213 |
<run-jmeter-test test="register"/>
|
|
|
214 |
<run-jmeter-test test="payment"/>
|
|
|
215 |
<run-test test="categorypage"/>
|
|
|
216 |
<run-test test="accessories-category-page"/>
|
|
|
217 |
<run-test test="register"/>
|
|
|
218 |
<run-test test="cart"/>
|
|
|
219 |
<run-test test="myaccount"/>
|
|
|
220 |
<run-test test="forgotpass"/>
|
|
|
221 |
<run-jmeter-test test="payment"/>
|
|
|
222 |
<run-jmeter-test test="register"/-->
|
|
|
223 |
|
|
|
224 |
<antcall target="test-build-failure"/>
|
|
|
225 |
</target>
|
|
|
226 |
|
|
|
227 |
<target name="run-single-test">
|
|
|
228 |
<delete file="jmeter-sample-diff-result-0"/>
|
|
|
229 |
<delete file="jmeter-sample-diff-result-1"/>
|
|
|
230 |
<record name="src/test/log/run-test-${test.name}.log" action="start"/>
|
|
|
231 |
<run-test test="${test.name}"/>
|
|
|
232 |
<antcall target="test-build-failure"/>
|
|
|
233 |
</target>
|
|
|
234 |
|
|
|
235 |
<target name="test-build-failure">
|
|
|
236 |
<available property="jmeter.test.failure" file="jmeter-sample-diff-result-1" />
|
|
|
237 |
<delete file="jmeter-sample-diff-result-0"/>
|
|
|
238 |
<delete file="jmeter-sample-diff-result-1"/>
|
|
|
239 |
<fail message="JMeter tests failed" if="jmeter.test.failure"/>
|
|
|
240 |
</target>
|
|
|
241 |
|
|
|
242 |
<target name="print-jmeter-test-failure" if="jmeter.test.failure.${current.test.name}">
|
|
|
243 |
<echo>${current.test.name} Test failed. Please see /tmp/jmeter/${current.test.name}.jtl</echo>
|
|
|
244 |
<touch file="jmeter-sample-diff-result-1"/>
|
|
|
245 |
</target>
|
|
|
246 |
</project>
|