forked from liferay/liferay-portal
-
Notifications
You must be signed in to change notification settings - Fork 3
/
build-test-httpd.xml
145 lines (123 loc) · 3.43 KB
/
build-test-httpd.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
<?xml version="1.0"?>
<project basedir="." name="portal-test-httpd" xmlns:antelope="antlib:ise.antelope.tasks">
<import file="build-test.xml" />
<target name="clean-up-httpd-server">
<replaceregexp
file="${apache.http.conf.file}"
flags="s"
match="(IncludeOptional.*conf)(.*)"
replace="\1"
/>
<print-file file.name="${apache.http.conf.file}" />
</target>
<target name="configure-httpd-server">
<if>
<not>
<resourcecontains
resource="${apache.http.conf.file}"
substring="Listen 88"
/>
</not>
<then>
<echo append="true" file="${apache.http.conf.file}"><![CDATA[
Listen 88]]></echo>
</then>
</if>
<if>
<not>
<resourcecontains
resource="${apache.http.conf.file}"
substring="VirtualHost *:88"
/>
</not>
<then>
<echo append="true" file="${apache.http.conf.file}"><![CDATA[
<VirtualHost *:88>
ServerName localhost
ProxyPreserveHost On
ProxyPass /${portal.proxy.path} http://localhost:8080
ProxyPassReverse /${portal.proxy.path} http://localhost:8080
</VirtualHost>]]></echo>
</then>
</if>
<get-testcase-property property.name="app.server.bundles.size" />
<if>
<isset property="app.server.bundles.size" />
<then>
<var name="app.server.bundle.index" value="1" />
<antelope:repeat count="${app.server.bundles.size}">
<set-app-server-properties
app.server.bundle.index="${app.server.bundle.index}"
/>
<if>
<not>
<resourcecontains
resource="${apache.http.conf.file}"
substring="Listen ${test.app.server.leading.port.number}8"
/>
</not>
<then>
<echo append="true" file="${apache.http.conf.file}"><![CDATA[
Listen ${test.app.server.leading.port.number}8]]></echo>
</then>
</if>
<if>
<not>
<resourcecontains
resource="${apache.http.conf.file}"
substring="VirtualHost *:${test.app.server.leading.port.number}0"
/>
</not>
<then>
<echo append="true" file="${apache.http.conf.file}"><![CDATA[
<VirtualHost *:${test.app.server.leading.port.number}8>
ServerName localhost
ProxyPreserveHost On
ProxyPass /${portal.proxy.path} http://localhost:${test.app.server.leading.port.number}080
ProxyPassReverse /${portal.proxy.path} http://localhost:${test.app.server.leading.port.number}080
</VirtualHost>]]></echo>
</then>
</if>
<math
datatype="int"
operand1="${app.server.bundle.index}"
operand2="1"
operation="+"
result="app.server.bundle.index"
/>
</antelope:repeat>
<var name="app.server.bundle.index" unset="true" />
</then>
</if>
<print-file file.name="${apache.http.conf.file}" />
</target>
<target name="start-httpd-server">
<trycatch>
<try>
<exec executable="systemctl" failonerror="true">
<arg line="start httpd.service" />
</exec>
</try>
<catch>
<echo>Unable to start httpd using systemctl. Starting httpd directly.</echo>
<exec executable="httpd" failonerror="true" />
<echo>httpd has started</echo>
</catch>
</trycatch>
</target>
<target name="stop-httpd-server">
<trycatch>
<try>
<exec executable="systemctl" failonerror="true">
<arg line="stop httpd.service" />
</exec>
</try>
<catch>
<echo>Unable to stop httpd using systemctl. httpd processes will be killed via pkill.</echo>
<exec executable="pkill">
<arg line="-f httpd" />
</exec>
</catch>
</trycatch>
</target>
</project>