Line 0
Link Here
|
|
|
1 |
<!--/******************************************************************************* |
2 |
* This program and the accompanying materials are made available under the |
3 |
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 |
4 |
* which accompanies this distribution. |
5 |
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html |
6 |
* and the Eclipse Distribution License is available at |
7 |
* http://www.eclipse.org/org/documents/edl-v10.php. |
8 |
* |
9 |
* Ant naming conventions: |
10 |
* - regardless of the actual OS platform,'/' is the directory separator |
11 |
* (Ant will convert as appropriate). |
12 |
* - multi-word properties use periods '.' |
13 |
* - multi-word targets use hyphens '-' |
14 |
* - multi-word macros use underscores '_' |
15 |
* - multi-word macro attributes are concatinated |
16 |
* e.g. 'runpathref' |
17 |
* - multi-word tasks (taskdef) names are concatinated |
18 |
* e.g. 'validateconnection' |
19 |
* - OS environment variables are in ALLCAPS and have 'env' as a prefix |
20 |
* e.g. ${env.XXX}. |
21 |
* - Ant properties are lower case. |
22 |
* |
23 |
* Contributors: |
24 |
* ??? - initial implementation |
25 |
#******************************************************************************/--> |
26 |
|
27 |
<!-- This ant project includes the following tasks: |
28 |
- netweaver-setup : packs an application containing eclipselink.jar and other required libraries and deploys it to the server |
29 |
- netweaver-reset : undeploys the application containing eclipselink.jar |
30 |
- netweaver-deploy : adds NetWeaver specific resources and deploys ear |
31 |
- netweaver-undeploy : undeploys ear |
32 |
--> |
33 |
|
34 |
<project name="Eclipse Persistence Services JPA NetWeaver Testing" basedir="."> |
35 |
|
36 |
<!-- Allows a user to overide certain user specific properties. --> |
37 |
<property file="${user.home}/netweaver.properties"/> |
38 |
<property file="./netweaver.properties"/> |
39 |
|
40 |
<property name="cpath" value="${netweaver.deployment.ant.dir}/tc~je~dc_ant.jar: |
41 |
${netweaver.clientlib.dir}/sap.com~tc~exception~impl.jar: |
42 |
${netweaver.clientlib.dir}/sap.com~tc~je~clientlib~impl.jar: |
43 |
${netweaver.clientlib.dir}/sap.com~tc~logging~java~impl.jar: |
44 |
${netweaver.deployment.dir}/lib/sap.com~tc~je~deployment14~impl.jar"/> |
45 |
|
46 |
<taskdef name="sapdeploy" classname="com.sap.engine.services.dc.ant.deploy.SAPDeploy" classpath="${cpath}"/> |
47 |
<taskdef name="sapundeploy" classname="com.sap.engine.services.dc.ant.undeploy.SAPUndeploy" classpath="${cpath}"/> |
48 |
|
49 |
<condition property="netweaver.deployment.script.suffix" value="csh" else="${suffix}"> |
50 |
<and> |
51 |
<isset property="is.unix"/> |
52 |
<available file="${netweaver.deployment.dir}/scripts/make_SDA.csh"/> |
53 |
</and> |
54 |
</condition> |
55 |
|
56 |
<macrodef name="make_sda"> |
57 |
<attribute name="source" /> |
58 |
<attribute name="target" /> |
59 |
<sequential> |
60 |
<exec executable="${netweaver.deployment.dir}/scripts/make_SDA.${netweaver.deployment.script.suffix}" dir="${netweaver.deployment.dir}/scripts" failonerror="true"> |
61 |
<arg value="@{source}"/> |
62 |
<arg value="-d"/> |
63 |
<arg value="@{target}"/> |
64 |
</exec> |
65 |
</sequential> |
66 |
</macrodef> |
67 |
|
68 |
|
69 |
|
70 |
<target name="netweaver-install"> |
71 |
<echo message="*** build target netweaver-install - nothing done ***"/> |
72 |
</target> |
73 |
|
74 |
|
75 |
<target name="netweaver-start"> |
76 |
<echo message="*** build target netweaver-start - nothing done ***"/> |
77 |
</target> |
78 |
|
79 |
|
80 |
<target name="netweaver-setup"> |
81 |
<mkdir dir="${eclipselink.jpa.test}/${build.dir}"/> |
82 |
<dirname property="basedir" file="${eclipselink.jpa.test}"/> |
83 |
|
84 |
<!-- pack EAR file containing eclipselink.jar and other required libraries and convert it to SDA --> |
85 |
<zip destfile="${eclipselink.jpa.test}/${build.dir}/${netweaver.eclipselink.app}.ear"> |
86 |
<fileset dir="${eclipselink.home}" includes="eclipselink.jar"/> |
87 |
<fileset dir="${extensions.home}/org.eclipse.persistence.platform.server.netweaver" includes="*.jar"/> |
88 |
<fileset file="${junit.lib}"/> |
89 |
</zip> |
90 |
<make_sda source="${basedir}/${build.dir}/${netweaver.eclipselink.app}.ear" target="${basedir}/${build.dir}/${netweaver.eclipselink.app}.sda" /> |
91 |
|
92 |
<!-- pack EAR file containing the test datasource and convert it to SDA --> |
93 |
<copy overwrite="true" todir="${eclipselink.jpa.test}/resource/${server.name}/setup/META-INF"> |
94 |
<fileset dir="${eclipselink.jpa.test}/resource/${server.name}/templates/setup/META-INF" includes="*.*"/> |
95 |
</copy> |
96 |
<replace file="${eclipselink.jpa.test}/resource/${server.name}/setup/META-INF/data-sources.xml" token='%%data-source-name%%' value="${netweaver.datasource.name}"/> |
97 |
<replace file="${eclipselink.jpa.test}/resource/${server.name}/setup/META-INF/data-sources.xml" token='%%driver-name%%' value="${netweaver.datasource.driver.deployname}"/> |
98 |
<replace file="${eclipselink.jpa.test}/resource/${server.name}/setup/META-INF/data-sources.xml" token='%%driver-class-name%%' value="${netweaver.datasource.driver.class}"/> |
99 |
<replace file="${eclipselink.jpa.test}/resource/${server.name}/setup/META-INF/data-sources.xml" token='%%url%%' value="${netweaver.datasource.url}"/> |
100 |
<replace file="${eclipselink.jpa.test}/resource/${server.name}/setup/META-INF/data-sources.xml" token='%%user-name%%' value="${netweaver.datasource.user}"/> |
101 |
<replace file="${eclipselink.jpa.test}/resource/${server.name}/setup/META-INF/data-sources.xml" token='%%password%%' value="${netweaver.datasource.password}"/> |
102 |
<zip destfile="${eclipselink.jpa.test}/${build.dir}/${netweaver.datasource.app}.ear"> |
103 |
<fileset dir="${eclipselink.jpa.test}/resource/${server.name}/setup"/> |
104 |
</zip> |
105 |
<make_sda source="${basedir}/${build.dir}/${netweaver.datasource.app}.ear" target="${basedir}/${build.dir}/${netweaver.datasource.app}.sda" /> |
106 |
|
107 |
<!-- deploy the SDA --> |
108 |
<sapdeploy versionrule="all"> |
109 |
<saperrorhandling erroraction="prerequisites" errorstrategy="stop"/> |
110 |
<saperrorhandling erroraction="deploy" errorstrategy="stop"/> |
111 |
<fileset dir="${build.dir}" includes="${netweaver.eclipselink.app}.sda,${netweaver.datasource.app}.sda"/> |
112 |
<sapj2eeengine serverhost="${netweaver.host}" serverport="${netweaver.port}" username="${server.user}" userpassword="${server.pwd}"/> |
113 |
</sapdeploy> |
114 |
</target> |
115 |
|
116 |
|
117 |
<target name="netweaver-reset"> |
118 |
<!-- undeploy the application containing eclipselink.jar --> |
119 |
<copy overwrite="true" todir="${eclipselink.jpa.test}/resource/${server.name}"> |
120 |
<fileset dir="${eclipselink.jpa.test}/resource/${server.name}/templates/" includes="undeploy_eclipselink.txt"/> |
121 |
</copy> |
122 |
<replace file="${eclipselink.jpa.test}/resource/${server.name}/undeploy_eclipselink.txt" token='%%eclipselink_app%%' value="${netweaver.eclipselink.app}"/> |
123 |
<replace file="${eclipselink.jpa.test}/resource/${server.name}/undeploy_eclipselink.txt" token='%%datasource_app%%' value="${netweaver.datasource.app}"/> |
124 |
<sapundeploy undeploystrategy="IfDependingStop"> |
125 |
<saperrorhandling erroraction="prerequisites" errorstrategy="stop"/> |
126 |
<saperrorhandling erroraction="undeploy" errorstrategy="stop"/> |
127 |
<sapundeploylist listfilepath="${eclipselink.jpa.test}/resource/${server.name}/undeploy_eclipselink.txt"/> |
128 |
<sapj2eeengine serverhost="${netweaver.host}" serverport="${netweaver.port}" username="${server.user}" userpassword="${server.pwd}"/> |
129 |
</sapundeploy> |
130 |
</target> |
131 |
|
132 |
|
133 |
<target name="netweaver-stop"> |
134 |
<echo message="*** build target netweaver-stop - nothing done ***"/> |
135 |
</target> |
136 |
|
137 |
|
138 |
<!-- add NetWeaver specific resources to the test application ear and deploy it to the server --> |
139 |
<target name="netweaver-deploy"> |
140 |
<!-- add NetWeaver specific resources to the application EAR and convert it to SDA --> |
141 |
<copy overwrite="true" todir="${eclipselink.jpa.test}/resource/${server.name}/META-INF"> |
142 |
<fileset dir="${eclipselink.jpa.test}/resource/${server.name}/templates/META-INF" includes="*.*"/> |
143 |
</copy> |
144 |
<replace dir="${eclipselink.jpa.test}/resource/${server.name}/META-INF" token='%%eclipselinklib%%' value="${netweaver.eclipselink.app}"/> |
145 |
<replace dir="${eclipselink.jpa.test}/resource/${server.name}/META-INF" token='%%datasourcename%%' value="${netweaver.datasource.name}"/> |
146 |
<ear destfile="${eclipselink.jpa.test}/${ear.name}" update="true"> |
147 |
<fileset dir="${eclipselink.jpa.test}/resource/${server.name}" includes="META-INF/*.*"/> |
148 |
</ear> |
149 |
<dirname property="basedir" file="${eclipselink.jpa.test}"/> |
150 |
<echo message="ear.name=${ear.name}"/> |
151 |
<echo message="application.name=${application.name}"/> |
152 |
<make_sda source="${basedir}/${ear.name}" target="${basedir}/${build.dir}/${application.name}.sda"/> |
153 |
|
154 |
<!-- deploy the SDA --> |
155 |
<sapdeploy versionrule="all"> |
156 |
<saperrorhandling erroraction="prerequisites" errorstrategy="stop"/> |
157 |
<saperrorhandling erroraction="deploy" errorstrategy="stop"/> |
158 |
<fileset dir="${build.dir}" includes ="${application.name}.sda"/> |
159 |
<sapj2eeengine serverhost="${netweaver.host}" serverport="${netweaver.port}" username="${server.user}" userpassword="${server.pwd}"/> |
160 |
</sapdeploy> |
161 |
</target> |
162 |
|
163 |
|
164 |
<!-- undeploy the test application from the server --> |
165 |
<target name="netweaver-undeploy"> |
166 |
<sapundeploy undeploystrategy="IfDependingStop"> |
167 |
<saperrorhandling erroraction="prerequisites" errorstrategy="stop"/> |
168 |
<saperrorhandling erroraction="undeploy" errorstrategy="stop"/> |
169 |
<sapundeploylist listfilepath="${eclipselink.jpa.test}/resource/${server.name}/undeploy.txt"/> |
170 |
<sapj2eeengine serverhost="${netweaver.host}" serverport="${netweaver.port}" username="${server.user}" userpassword="${server.pwd}"/> |
171 |
</sapundeploy> |
172 |
</target> |
173 |
|
174 |
</project> |