/
jaxrstck.sh
executable file
·110 lines (92 loc) · 5.08 KB
/
jaxrstck.sh
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
#!/bin/bash -xe
# Copyright (c) 2018, 2022 Oracle and/or its affiliates. All rights reserved.
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License v. 2.0, which is available at
# http://www.eclipse.org/legal/epl-2.0.
#
# This Source Code may also be made available under the following Secondary
# Licenses when the conditions for such availability set forth in the
# Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
# version 2 with the GNU Classpath Exception, which is available at
# https://www.gnu.org/software/classpath/license.html.
#
# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
export TCK_HOME=${WORKSPACE}
echo "TCK_HOME in jaxrstck.sh $TCK_HOME"
echo "ANT_HOME in jaxrstck.sh $ANT_HOME"
echo "PATH in jaxrstck.sh $PATH"
echo "ANT_OPTS in jaxrstck.sh $ANT_OPTS"
cd $TCK_HOME
if ls ${WORKSPACE}/standalone-bundles/*jaxrstck*.zip 1> /dev/null 2>&1; then
echo "Using stashed bundle for jaxrstck created during the build phase"
unzip -q ${WORKSPACE}/standalone-bundles/*jaxrstck*.zip -d ${TCK_HOME}
TCK_NAME=jaxrstck
elif ls ${WORKSPACE}/standalone-bundles/*restful-ws-tck*.zip 1> /dev/null 2>&1; then
echo "Using stashed bundle for restful-ws-tck created during the build phase"
unzip -q ${WORKSPACE}/standalone-bundles/*restful-ws-tck*.zip -d ${TCK_HOME}
TCK_NAME=restful-ws-tck
else
echo "[ERROR] TCK bundle not found"
exit 1
fi
if [ -z "$GF_TOPLEVEL_DIR" ]; then
export GF_TOPLEVEL_DIR=glassfish7
fi
##### installRI.sh starts here #####
echo "Download and install GlassFish 7.0.0 ..."
if [ -z "${GF_BUNDLE_URL}" ]; then
echo "[ERROR] GF_BUNDLE_URL not set"
exit 1
fi
wget --progress=bar:force --no-cache $GF_BUNDLE_URL -O latest-glassfish.zip
unzip -q ${TCK_HOME}/latest-glassfish.zip -d ${TCK_HOME}
TS_HOME=$TCK_HOME/$TCK_NAME
echo "TS_HOME $TS_HOME"
chmod -R 777 $TS_HOME
cd $TS_HOME/bin
if [[ "$JDK" == "JDK17" || "$JDK" == "jdk17" ]];then
export JAVA_HOME=${JDK17_HOME}
fi
export PATH=$JAVA_HOME/bin:$PATH
which java
java -version
sed -i "s#^web.home=.*#web.home=$TCK_HOME/$GF_TOPLEVEL_DIR/glassfish#g" ts.jte
sed -i "s#^report.dir=.*#report.dir=$TCK_HOME/${TCK_NAME}report/${TCK_NAME}#g" ts.jte
sed -i "s#^work.dir=.*#work.dir=$TCK_HOME/${TCK_NAME}work/${TCK_NAME}#g" ts.jte
sed -i "s#^impl.vi=.*#impl.vi=glassfish#g" ts.jte
sed -i 's#jaxrs_impl\.classes=.*#jaxrs_impl.classes=${web.home}/modules/jakarta.json.jar:${web.home}/modules/jakarta.json.bind-api.jar:${web.home}/modules/jakarta.json.jar:${web.home}/modules/jsonp-jaxrs.jar:${web.home}/modules/jersey-client.jar:${web.home}/modules/jersey-common.jar:${web.home}/modules/jersey-server.jar:${web.home}/modules/jersey-container-servlet.jar:${web.home}/modules/jersey-container-servlet-core.jar:${web.home}/modules/jersey-media-jaxb.jar:${web.home}/modules/jersey-media-sse.jar:${web.home}/modules/jersey-hk2.jar:${web.home}/modules/osgi-resource-locator.jar:${web.home}/modules/jakarta.inject-api.jar:${web.home}/modules/guava.jar:${web.home}/modules/hk2-api.jar:${web.home}/modules/hk2-locator.jar:${web.home}/modules/hk2-utils.jar:${web.home}/modules/javassist.jar:${web.home}/modules/cglib.jar:${web.home}/modules/jakarta.annotation-api.jar:${web.home}/modules/jakarta.xml.bind-api.jar:${web.home}/modules/jakarta.activation-api.jar#g' ts.jte
sed -i 's#jaxrs_impl_lib=.*#jaxrs_impl_lib=${web.home}/modules/jersey-container-servlet-core.jar#g' ts.jte
sed -i 's#jaxrs\.classes=.*#jaxrs.classes=${web.home}/modules/jakarta.ws.rs-api.jar#g' ts.jte
sed -i 's#servlet_adaptor=.*#servlet_adaptor=org\/glassfish\/jersey\/servlet\/ServletContainer.class#g' ts.jte
sed -i 's#servlet.classes=.*#servlet.classes=${web.home}/modules/jakarta.servlet-api.jar#g' ts.jte
sed -i 's#jaxrs_impl_name=.*#jaxrs_impl_name=jersey#g' ts.jte
sed -i 's#webServerHost=.*#webServerHost=localhost#g' ts.jte
sed -i 's#webServerPort=.*#webServerPort=8080#g' ts.jte
sed -i 's#impl\.vi\.deploy\.dir=.*#impl.vi.deploy.dir=${web.home}/domains/domain1/autodeploy#g' ts.jte
if [[ "$PROFILE" == "web" || "$PROFILE" == "WEB" ]]; then
echo "javaee.level=web" >> ts.jte
fi
mkdir -p $TCK_HOME/${TCK_NAME}report/${TCK_NAME}
mkdir -p $TCK_HOME/${TCK_NAME}work/${TCK_NAME}
if [ ! -z "$USER_KEYWORDS" ]; then
TCK_KEYWORDS="${USER_KEYWORDS}"
elif [ ! -z "$KEYWORDS" ]; then
TCK_KEYWORDS="${KEYWORDS}"
else
TCK_KEYWORDS="jaxrs"
fi
echo "KEYWORDS:${TCK_KEYWORDS}"
cd $TS_HOME/bin
ant config.vi
cd $TS_HOME/bin
ant deploy.all
cd $TS_HOME/src/com/sun/ts/tests/
ant runclient -Dkeywords=\"${TCK_KEYWORDS}\"
echo "Test run complete"
JT_REPORT_DIR=$TCK_HOME/${TCK_NAME}report
export HOST=`hostname -f`
echo "1 ${TCK_NAME} ${HOST}" > ${WORKSPACE}/args.txt
mkdir -p ${WORKSPACE}/results/junitreports/
${JAVA_HOME}/bin/java -Djunit.embed.sysout=true -jar ${WORKSPACE}/docker/JTReportParser/JTReportParser.jar ${WORKSPACE}/args.txt ${JT_REPORT_DIR} ${WORKSPACE}/results/junitreports/
tar zcvf ${WORKSPACE}/${TCK_NAME}-results.tar.gz ${TCK_HOME}/${TCK_NAME}report ${TCK_HOME}/${TCK_NAME}work ${WORKSPACE}/results/junitreports/ ${TCK_HOME}/$GF_TOPLEVEL_DIR/glassfish/domains/domain1 $TCK_HOME/$TCK_NAME/bin/ts.*