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 |
<pathelement path="${sdotest.2.common.plugins.dir}/${unsigned.persistence10.jar}"/> |
58 |
<fileset |
59 |
dir="${sdotest.2.common.plugins.dir}" |
60 |
includes=" |
61 |
${eclipselink.core.depend}, |
62 |
"/> |
63 |
<pathelement path="${junit.lib}"/> |
64 |
<pathelement path="${sdotest.plugins.dir}/${commonj.sdo.jar}"/> |
65 |
<pathelement path="${sdotest.2.common.plugins.dir}/${jaxb-api.lib}"/> |
66 |
</path> |
67 |
<!-- Run path without product components --> |
68 |
<path id="sdotest.thirdparty.run.path"> |
69 |
<fileset dir="${server.lib}" includes="${server.depend}"/> |
70 |
<pathelement path="${sdotest.2.common.plugins.dir}/${asm}"/> |
71 |
</path> |
72 |
<path id="sdotest.compile.against.jar.path"> |
73 |
<pathelement path="${sdotest.2.base.dir}/${eclipselink.jar}"/> |
74 |
<path refid="sdotest.thirdparty.compile.path"/> |
75 |
</path> |
76 |
<path id="sdotest.run.against.jar.path"> |
77 |
<pathelement path="${tmp.dir}/deptApp.jar"/> |
78 |
<path refid="sdotest.compile.against.jar.path"/> |
79 |
<path refid="sdotest.thirdparty.run.path"/> |
80 |
</path> |
81 |
|
82 |
<target name="clean" description="clean the build"> |
83 |
<delete includeEmptyDirs="true" failonerror="false"> |
84 |
<fileset dir="${classes.dir}"/> |
85 |
</delete> |
86 |
<mkdir dir="${classes.dir}"/> |
87 |
<mkdir dir="${tmp.dir}"/> |
88 |
<mkdir dir="${report.dir}"/> |
89 |
</target> |
90 |
|
91 |
<target name="compile" depends="clean"> |
92 |
<javac |
93 |
srcdir="${src.dir}" |
94 |
destdir="${classes.dir}" |
95 |
debug="${javac.debug}" |
96 |
debuglevel="${javac.debuglevel}" |
97 |
optimize="${javac.optimize}" |
98 |
source="${javac.version}" |
99 |
target="${javac.version}" |
100 |
deprecation="${javac.deprecation}" |
101 |
failonerror="true" |
102 |
includes="org/eclipse/persistence/testing/sdo/**/*.java"> |
103 |
<classpath> |
104 |
<path refid="sdotest.compile.against.jar.path"/> |
105 |
</classpath> |
106 |
</javac> |
107 |
</target> |
108 |
|
109 |
<target name="build-ejb-jar" depends="compile"> |
110 |
<copy todir="${classes.dir}"> |
111 |
<fileset dir="${resource.dir}"/> |
112 |
</copy> |
113 |
<zip |
114 |
destfile="${tmp.dir}/deptApp.jar" |
115 |
basedir="${classes.dir}" |
116 |
excludes="org/eclipse/persistence/testing/sdo/server/server/DeptServiceClient*.class" /> |
117 |
</target> |
118 |
|
119 |
<target name="build-app-ear" depends="build-ejb-jar"> |
120 |
<zip |
121 |
destfile="./deptApp.ear" |
122 |
basedir="${tmp.dir}" /> |
123 |
</target> |
124 |
|
125 |
<target name="detect-server"> |
126 |
<condition property="session.bean" value="DeptServiceBean#org.eclipse.persistence.testing.sdo.server.DeptService"> |
127 |
<contains string="${server.name}" substring="weblogic"/> |
128 |
</condition> |
129 |
<condition property="session.bean" value="ejb/deptApp/deptApp.jar/org.eclipse.persistence.testing.sdo.server.DeptServiceBean#org.eclipse.persistence.testing.sdo.server.DeptService"> |
130 |
<contains string="${server.name}" substring="websphere"/> |
131 |
</condition> |
132 |
<condition property="is.websphere" value="true"> |
133 |
<contains string="${server.name}" substring="websphere"/> |
134 |
</condition> |
135 |
<condition property="session.bean" value="deptApp/org.eclipse.persistence.testing.sdo.server.DeptServiceBean/remote-org.eclipse.persistence.testing.sdo.server.DeptService"> |
136 |
<contains string="${server.name}" substring="jboss"/> |
137 |
</condition> |
138 |
</target> |
139 |
|
140 |
<target name="create-ejb-stubs" depends="detect-server" if="is.websphere"> |
141 |
<condition property="suffix" value="sh"> |
142 |
<os family="unix"/> |
143 |
</condition> |
144 |
<condition property="suffix" value="bat"> |
145 |
<os family="windows"/> |
146 |
</condition> |
147 |
<exec executable="${was.home}/bin/createEJBStubs.${suffix}"> |
148 |
<arg line="${tmp.dir}/deptApp.jar"/> |
149 |
</exec> |
150 |
</target> |
151 |
|
152 |
<target name="server-deploy"> |
153 |
<ant antfile="${sdotest.2.base.dir}/jpa/eclipselink.jpa.test/${server.name}.xml" target="${server.name}-deploy" inheritRefs="true"> |
154 |
<property name="ear.name" value="${ear.name}"/> |
155 |
<property name="application.name" value="${application.name}"/> |
156 |
</ant> |
157 |
</target> |
158 |
|
159 |
<target name="server-undeploy"> |
160 |
<ant antfile="${sdotest.2.base.dir}/jpa/eclipselink.jpa.test/${server.name}.xml" target="${server.name}-undeploy" inheritRefs="true"> |
161 |
<property name="application.name" value="${application.name}"/> |
162 |
</ant> |
163 |
</target> |
164 |
|
165 |
<target name="generate-report"> |
166 |
<junitreport todir="${report.dir}"> |
167 |
<fileset dir="${report.dir}"> |
168 |
<include name="**/*.xml"/> |
169 |
</fileset> |
170 |
<report format="noframes" todir="${report.dir}"/> |
171 |
</junitreport> |
172 |
</target> |
173 |
|
174 |
<target name="test" depends="build-app-ear,create-ejb-stubs"> |
175 |
<antcall target="server-deploy" inheritRefs="true"> |
176 |
<param name="ear.name" value="deptApp.ear"/> |
177 |
<param name="application.name" value="deptApp"/> |
178 |
</antcall> |
179 |
<junit printsummary="yes" haltonfailure="no" failureproperty="junit.failed" fork="yes" showoutput="true" maxmemory="256m" tempdir="${tmp.dir}" dir="${classes.dir}"> |
180 |
<sysproperty key="initialCtxFactory" value="${server.factory}"/> |
181 |
<sysproperty key="securityPrincipal" value="${server.user}"/> |
182 |
<sysproperty key="securityCredentials" value="${server.pwd}"/> |
183 |
<sysproperty key="providerUrl" value="${server.url}"/> |
184 |
<sysproperty key="sessionBean" value="${session.bean}"/> |
185 |
<classpath refid="sdotest.run.against.jar.path"/> |
186 |
<formatter type="xml"/> |
187 |
<test name="org.eclipse.persistence.testing.sdo.server.DeptServiceClientTestSuite" haltonfailure="no" todir="${report.dir}"/> |
188 |
</junit> |
189 |
<antcall target="server-undeploy" inheritRefs="true"> |
190 |
<param name="application.name" value="deptApp.ear"/> |
191 |
</antcall> |
192 |
<antcall target="generate-report" inheritRefs="true"/> |
193 |
</target> |
194 |
</project> |