forked from liferay/liferay-portal
-
Notifications
You must be signed in to change notification settings - Fork 28
/
build-test-keycloak.xml
71 lines (62 loc) · 2.44 KB
/
build-test-keycloak.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
<?xml version="1.0"?>
<project basedir="." name="portal-test-keycloak" xmlns:antelope="antlib:ise.antelope.tasks">
<import file="build-test.xml" />
<macrodef name="start-keycloak-server">
<sequential>
<property name="liferay.dependency.dir" value="${project.dir}/portal-web/test/functional/com/liferay/portalweb/dependencies" />
<property name="keycloak.dependency.dir" value="${project.dir}/portal-web/test/functional/com/liferay/portalweb/tests/coreinfrastructure/security/openidconnect/dependencies" />
<mirrors-get
dest="${liferay.dependency.dir}"
src="https://github.com/keycloak/keycloak/releases/download/16.1.0/keycloak-16.1.0.tar.gz"
/>
<decompress
dest="${liferay.dependency.dir}"
src="${liferay.dependency.dir}/keycloak-16.1.0.tar.gz"
/>
<parallel>
<daemons>
<exec dir="${liferay.dependency.dir}/keycloak-16.1.0/bin" executable="/bin/bash">
<arg value="./standalone.sh" />
<arg value="-Djboss.socket.binding.port-offset=10000" />
<arg value="-Dkeycloak.migration.action=import" />
<arg value="-Dkeycloak.migration.provider=singleFile" />
<arg value="-Dkeycloak.migration.file=${keycloak.dependency.dir}/keycloak-liferay-export.json" />
<arg value="-Dkeycloak.migration.strategy=OVERWRITE_EXISTING" />
<arg value="-b" />
<arg value="0.0.0.0" />
</exec>
</daemons>
</parallel>
<waitfor maxwait="120" maxwaitunit="second">
<http url="http://127.0.0.1:18080/" />
</waitfor>
<exec executable="curl" outputproperty="curl.output">
<arg line="-s -o /dev/null -w "%{http_code}" http://127.0.0.1:18080" />
</exec>
<echo>${curl.output}</echo>
<if>
<contains string="${curl.output}" substring="200" />
<then>
<echo>Keycloak started succesfully.</echo>
</then>
<else>
<fail>Keycloak startup failed.</fail>
</else>
</if>
</sequential>
</macrodef>
<macrodef name="stop-keycloak-server">
<sequential>
<property name="liferay.dependency.dir" value="${project.dir}/portal-web/test/functional/com/liferay/portalweb/dependencies" />
<exec dir="${liferay.dependency.dir}/keycloak-16.1.0/bin" executable="/bin/bash">
<arg value="./jboss-cli.sh" />
<arg value="--connect" />
<arg value="--controller=localhost:19990" />
<arg value="command=:shutdown" />
</exec>
</sequential>
</macrodef>
<target name="prepare-selenium-keycloak-server">
<start-keycloak-server />
</target>
</project>