forked from liferay/liferay-portal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-test-db-upgrade-client.xml
210 lines (167 loc) · 5.61 KB
/
build-test-db-upgrade-client.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
<?xml version="1.0"?>
<project basedir="." name="portal-test-db-upgrade-client" xmlns:antelope="antlib:ise.antelope.tasks">
<import file="build-test.xml" />
<macrodef name="clean-database-upgrade-client">
<sequential>
<stop-one-java-process process.name="LocalProcess" />
<stop-one-java-process process.name="DBUpgrader" />
<delete file="${db.upgrade.client.log}" />
</sequential>
</macrodef>
<macrodef name="get-database-upgrade-client-paths">
<sequential>
<property name="db.upgrade.client.home" value="${liferay.home}/tools/portal-tools-db-upgrade-client" />
<property name="db.upgrade.client.jar" value="${db.upgrade.client.home}/com.liferay.portal.tools.db.upgrade.client.jar" />
<property name="db.upgrade.client.log" value="${db.upgrade.client.home}/upgrade.log" />
</sequential>
</macrodef>
<target name="check-upgrade-client-additional-settings">
<get-database-upgrade-client-paths />
<parallel failonany="true">
<execute dir="${db.upgrade.client.home}" failonerror="true">
db_upgrade${file.suffix.bat} -j "-Dfile.encoding=UTF8 -Duser.country=US -Duser.language=en -Duser.timezone=GMT -Xmx4096m"
</execute>
<sequential>
<waitfor maxwait="60000">
<available file="${db.upgrade.client.log}" />
</waitfor>
<sleep seconds="5" />
<get-jinfo-output process.name="DBUpgrader" />
<echo>${jinfo.output}</echo>
<if>
<contains string="${jinfo.output}" substring="MaxHeapSize=4294967296" />
<then>
<echo message="Java memory was successfully set to 4GB during the upgrade process." />
</then>
<else>
<fail message="Could not verify that Java memory was set to 4GB" />
</else>
</if>
</sequential>
</parallel>
<clean-database-upgrade-client />
</target>
<target name="check-upgrade-client-custom-log">
<get-database-upgrade-client-paths />
<execute dir="${db.upgrade.client.home}" failonerror="true">
db_upgrade${file.suffix.bat} -l log_file.txt
</execute>
<if>
<not>
<available file="${db.upgrade.client.home}/log_file.txt" />
</not>
<then>
<fail message="The upgrade client custom log file was not created successfully." />
</then>
</if>
<local name="custom.log.file.output" />
<loadfile
property="custom.log.file.output"
srcfile="${db.upgrade.client.home}/log_file.txt"
/>
<if>
<not>
<contains string="${custom.log.file.output}" substring="com.liferay.portal.tools.db.upgrade.client.jar" />
</not>
<then>
<fail message="The upgrade client custom log file is missing some data." />
</then>
</if>
<echo message="The upgrade client custom log file was created successfully." />
<delete file="${db.upgrade.client.home}/log_file.txt" />
<clean-database-upgrade-client />
</target>
<target name="check-upgrade-client-gogoshell">
<get-database-upgrade-client-paths />
<parallel failonany="true">
<java
dir="${db.upgrade.client.home}"
fork="true"
jar="${db.upgrade.client.jar}"
timeout="900000"
>
<arg value="-s" />
</java>
<sequential>
<waitfor maxwait="900000" timeoutproperty="gogoshell.not.started">
<resourcecontains
resource="${db.upgrade.client.log}"
substring="Connecting to Gogo shell"
/>
</waitfor>
<sleep seconds="20" />
<if>
<isset property="gogoshell.not.started" />
<then>
<fail message="The Gogo shell failed to open before the test timed out." />
</then>
<elseif>
<resourcecontains
resource="${db.upgrade.client.log}"
substring="Unable to open Gogo shell"
/>
<then>
<fail message="The Gogo shell connection failed" />
</then>
</elseif>
</if>
<echo message="A Gogo shell opened successfully." />
<stop-one-java-process process.name="jar" />
</sequential>
</parallel>
<clean-database-upgrade-client />
</target>
<target name="check-upgrade-client-help">
<get-database-upgrade-client-paths />
<local name="upgrade.help.output" />
<execute dir="${db.upgrade.client.home}" failonerror="true">
db_upgrade${file.suffix.bat} -h > help.output
</execute>
<loadfile
property="upgrade.help.output"
srcFile="help.output"
/>
<echo>${upgrade.help.output}</echo>
<if>
<contains string="${upgrade.help.output}" substring="-h,--help" />
<then>
<echo message="The upgrade client help screen appeared successfully" />
</then>
<else>
<fail message="The upgrade client help screen failed to appear." />
</else>
</if>
<delete file="help.output" />
<clean-database-upgrade-client />
</target>
<target name="check-upgrade-client-java-version">
<get-database-upgrade-client-paths />
<parallel failonany="true">
<execute dir="${db.upgrade.client.home}" failonerror="true">
JAVA_HOME=${java.jdk.7.x64.home} echo JAVA_HOME=${JAVA_HOME}
db_upgrade${file.suffix.bat}
</execute>
<sequential>
<local name="java.error.available" />
<waitfor maxwait="15000" timeoutproperty="java.error.available">
<resourcecontains
resource="${db.upgrade.client.log}"
substring="Unsupported major.minor version"
/>
</waitfor>
<if>
<isset property="java.error.available" />
<then>
<clean-database-upgrade-client />
<echo message="The upgrade client correctly failed to run on a version older than Java SE 8." />
</then>
<else>
<fail message="The upgrade client should not be able to run on versions older than Java SE 8." />
</else>
</if>
<echo message="${java.error.available}: Unsupported major.minor version" />
</sequential>
</parallel>
<clean-database-upgrade-client />
</target>
</project>