Line 0
Link Here
|
|
|
1 |
<?xml version="1.0"?> |
2 |
<!--/******************************************************************************* |
3 |
* This program and the accompanying materials are made available under the |
4 |
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 |
5 |
* which accompanies this distribution. |
6 |
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html |
7 |
* and the Eclipse Distribution License is available at |
8 |
* http://www.eclipse.org/org/documents/edl-v10.php. |
9 |
* |
10 |
* Ant naming conventions: |
11 |
* - regardless of the actual OS platform,'/' is the directory separator |
12 |
* (Ant will convert as appropriate). |
13 |
* - multi-word properties use periods '.' |
14 |
* - properties ending in .jar define jarfile names only (no path) |
15 |
* - properties ending in .lib are fully qualified jars (path and filename) |
16 |
* - properties ending in .dir are directory paths |
17 |
* - properties ending in .path are path refid names (classpath fragments) |
18 |
* - multi-word targets use hyphens '-' |
19 |
* - targets beginning with test- are reserved for high level test targets, |
20 |
* and are used in test results parsing |
21 |
* - targets typically use the form <action>-<object>-<type> (ie. package-bundle-zip) |
22 |
* - multi-word macros use underscores '_' |
23 |
* - multi-word macro attributes are concatinated |
24 |
* e.g. 'runpathref' |
25 |
* - multi-word tasks (taskdef) names are concatinated |
26 |
* e.g. 'validateconnection' |
27 |
* - OS environment variables are in ALLCAPS and have 'env' as a prefix |
28 |
* e.g. ${env.XXX}. |
29 |
* - Ant properties are lower case. |
30 |
* |
31 |
* Contributors: |
32 |
* etang - initial API and implementation on May 10, 2010 |
33 |
#******************************************************************************/--> |
34 |
<project name="eclipselink.sdo.test.server" default="test" basedir="."> |
35 |
<property name="env" environment="env" value="env"/> |
36 |
|
37 |
<available file="../${ant.project.name}" type="dir" property="sdotest.is.local"/> |
38 |
<fail message="Not running from '${ant.project.name}' directory" unless="sdotest.is.local"/> |
39 |
|
40 |
<dirname property="sdotest.build.location" file="${ant.file.org.eclipse.persistence.core}"/> |
41 |
<echo message="sdotest.build.location = '${sdotest.build.location}'"/> |
42 |
|
43 |
<condition property="sdotest.2.base.dir" value="../.." else=".."> |
44 |
<contains string="${sdotest.build.location}" substring="sdo"/> |
45 |
</condition> |
46 |
<property name="sdotest.2.common.plugins.dir" value="${sdotest.2.base.dir}/plugins"/> |
47 |
<property name="sdotest.plugins.dir" value="../plugins"/> |
48 |
|
49 |
<property file="${user.home}/build.properties"/> |
50 |
<property file="./build.properties"/> |
51 |
<property file="./test.properties"/> |
52 |
<property file="${user.home}/${server.name}.properties"/> |
53 |
<property file="${sdotest.2.base.dir}/jpa/eclipselink.jpa.test/${server.name}.properties"/> |
54 |
|
55 |
<!-- compile path without product components --> |
56 |
<path id="sdotest.thirdparty.compile.path"> |
57 |
<fileset |
58 |
dir="${sdotest.2.common.plugins.dir}" |
59 |
includes=" |
60 |
${eclipselink.core.depend}, |
61 |
"/> |
62 |
<pathelement path="${junit.lib}"/> |
63 |
<pathelement path="${sdotest.plugins.dir}/${commonj.sdo.jar}"/> |
64 |
</path> |
65 |
<!-- Run path without product components --> |
66 |
<path id="sdotest.thirdparty.run.path"> |
67 |
<fileset dir="${server.lib}" includes="${server.depend}"/> |
68 |
</path> |
69 |
<path id="sdotest.compile.against.jar.path"> |
70 |
<pathelement path="${sdotest.2.base.dir}/${eclipselink.jar}"/> |
71 |
<path refid="sdotest.thirdparty.compile.path"/> |
72 |
</path> |
73 |
<path id="sdotest.run.against.jar.path"> |
74 |
<pathelement path="${tmp.dir}/deptApp.jar"/> |
75 |
<path refid="sdotest.compile.against.jar.path"/> |
76 |
<path refid="sdotest.thirdparty.run.path"/> |
77 |
</path> |
78 |
|
79 |
<target name="clean" description="clean the build"> |
80 |
<delete includeEmptyDirs="true" failonerror="false"> |
81 |
<fileset dir="${classes.dir}"/> |
82 |
</delete> |
83 |
<mkdir dir="${classes.dir}"/> |
84 |
<mkdir dir="${tmp.dir}"/> |
85 |
<mkdir dir="${report.dir}"/> |
86 |
</target> |
87 |
|
88 |
<target name="compile" depends="clean"> |
89 |
<javac |
90 |
srcdir="${src.dir}" |
91 |
destdir="${classes.dir}" |
92 |
debug="${javac.debug}" |
93 |
debuglevel="${javac.debuglevel}" |
94 |
optimize="${javac.optimize}" |
95 |
source="${javac.version}" |
96 |
target="${javac.version}" |
97 |
deprecation="${javac.deprecation}" |
98 |
failonerror="true" |
99 |
includes="org/eclipse/persistence/testing/sdo/**/*.java"> |
100 |
<classpath> |
101 |
<path refid="sdotest.compile.against.jar.path"/> |
102 |
</classpath> |
103 |
</javac> |
104 |
</target> |
105 |
|
106 |
<target name="build-ejb-jar" depends="compile"> |
107 |
<copy todir="${classes.dir}"> |
108 |
<fileset dir="${resource.dir}"/> |
109 |
</copy> |
110 |
<zip |
111 |
destfile="${tmp.dir}/deptApp.jar" |
112 |
basedir="${classes.dir}" |
113 |
excludes="org/eclipse/persistence/testing/sdo/server/server/DeptServiceClient*.class" /> |
114 |
</target> |
115 |
|
116 |
<target name="build-app-ear" depends="build-ejb-jar"> |
117 |
<zip |
118 |
destfile="./deptApp.ear" |
119 |
basedir="${tmp.dir}" /> |
120 |
</target> |
121 |
|
122 |
<target name="detect-server"> |
123 |
<condition property="session.bean" value="DeptServiceBean#org.eclipse.persistence.testing.sdo.server.DeptService"> |
124 |
<contains string="${server.name}" substring="weblogic"/> |
125 |
</condition> |
126 |
<condition property="session.bean" value="ejb/deptApp/deptApp.jar/org.eclipse.persistence.testing.sdo.server.DeptServiceBean#org.eclipse.persistence.testing.sdo.server.DeptService"> |
127 |
<contains string="${server.name}" substring="websphere"/> |
128 |
</condition> |
129 |
<condition property="is.websphere" value="true"> |
130 |
<contains string="${server.name}" substring="websphere"/> |
131 |
</condition> |
132 |
<condition property="session.bean" value="deptApp/org.eclipse.persistence.testing.sdo.server.DeptServiceBean/remote-org.eclipse.persistence.testing.sdo.server.DeptService"> |
133 |
<contains string="${server.name}" substring="jboss"/> |
134 |
</condition> |
135 |
</target> |
136 |
|
137 |
<target name="create-ejb-stubs" depends="detect-server" if="is.websphere"> |
138 |
<condition property="suffix" value="sh"> |
139 |
<os family="unix"/> |
140 |
</condition> |
141 |
<condition property="suffix" value="bat"> |
142 |
<os family="windows"/> |
143 |
</condition> |
144 |
<exec executable="${was.home}/bin/createEJBStubs.${suffix}"> |
145 |
<arg line="${tmp.dir}/deptApp.jar"/> |
146 |
</exec> |
147 |
</target> |
148 |
|
149 |
<target name="server-deploy"> |
150 |
<ant antfile="${sdotest.2.base.dir}/jpa/eclipselink.jpa.test/${server.name}.xml" target="${server.name}-deploy" inheritRefs="true"> |
151 |
<property name="ear.name" value="${ear.name}"/> |
152 |
<property name="application.name" value="${application.name}"/> |
153 |
</ant> |
154 |
</target> |
155 |
|
156 |
<target name="server-undeploy"> |
157 |
<ant antfile="${sdotest.2.base.dir}/jpa/eclipselink.jpa.test/${server.name}.xml" target="${server.name}-undeploy" inheritRefs="true"> |
158 |
<property name="application.name" value="${application.name}"/> |
159 |
</ant> |
160 |
</target> |
161 |
|
162 |
<target name="generate-report"> |
163 |
<junitreport todir="${report.dir}"> |
164 |
<fileset dir="${report.dir}"> |
165 |
<include name="**/*.xml"/> |
166 |
</fileset> |
167 |
<report format="noframes" todir="${report.dir}"/> |
168 |
</junitreport> |
169 |
</target> |
170 |
|
171 |
<target name="test" depends="build-app-ear,create-ejb-stubs"> |
172 |
<antcall target="server-deploy" inheritRefs="true"> |
173 |
<param name="ear.name" value="deptApp.ear"/> |
174 |
<param name="application.name" value="deptApp"/> |
175 |
</antcall> |
176 |
<junit printsummary="yes" haltonfailure="no" failureproperty="junit.failed" fork="yes" showoutput="true" maxmemory="256m" tempdir="${tmp.dir}" dir="${classes.dir}"> |
177 |
<sysproperty key="initialCtxFactory" value="${server.factory}"/> |
178 |
<sysproperty key="securityPrincipal" value="${server.user}"/> |
179 |
<sysproperty key="securityCredentials" value="${server.pwd}"/> |
180 |
<sysproperty key="providerUrl" value="${server.url}"/> |
181 |
<sysproperty key="sessionBean" value="${session.bean}"/> |
182 |
<classpath refid="sdotest.run.against.jar.path"/> |
183 |
<formatter type="xml"/> |
184 |
<test name="org.eclipse.persistence.testing.sdo.server.DeptServiceClientTestSuite" haltonfailure="no" todir="${report.dir}"/> |
185 |
</junit> |
186 |
<antcall target="server-undeploy" inheritRefs="true"> |
187 |
<param name="application.name" value="deptApp.ear"/> |
188 |
</antcall> |
189 |
<antcall target="generate-report" inheritRefs="true"/> |
190 |
</target> |
191 |
</project> |