Skip to content

Commit

Permalink
Add Payara mp metrics tck to external test build
Browse files Browse the repository at this point in the history
Signed-off-by: Mesbah <[email protected]>
  • Loading branch information
Mesbah-Alam committed Aug 27, 2018
1 parent 5300437 commit ea132cf
Show file tree
Hide file tree
Showing 4 changed files with 221 additions and 0 deletions.
38 changes: 38 additions & 0 deletions thirdparty_containers/payara-mp-tck/build.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?xml version="1.0"?>
<project name="payara-mp-tck" default="build" basedir=".">
<taskdef resource="net/sf/antcontrib/antlib.xml" />
<description>
Build payara-mp-tck Docker image
</description>

<!-- set properties for this build -->
<property name="DEST" value="${BUILD_ROOT}/thirdparty_containers/payara-mp-tck" />
<property name="src" location="." />
<property name="jvm_version" location="${JVM_VERSION}" />

<target name="init">
<mkdir dir="${DEST}"/>
</target>

<target name="clean_image" depends="init" description="clean payara-mp-tck tck docker image if there is one">
<exec executable="docker">
<arg line="rmi -f adoptopenjdk-payara-mp-tck" />
</exec>
</target>

<target name="build_image" depends="clean_image" description="build payara-mp-tck tck docker image">
<exec executable="docker" failonerror="true">
<arg line="build -t adoptopenjdk-payara-mp-tck -f dockerfile/Dockerfile --pull . --build-arg SDK=${JVM_VERSION}" />
</exec>
</target>

<target name="dist" depends="build_image" description="generate the distribution">
<copy todir="${DEST}">
<fileset dir="${src}" includes="*.xml, *.mk"/>
</copy>
</target>

<target name="build">
<antcall target="dist" inheritall="true" />
</target>
</project>
78 changes: 78 additions & 0 deletions thirdparty_containers/payara-mp-tck/dockerfile/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# This Dockerfile in thirdparty_containers/payara-mp-tck/dockerfile dir is used to create an image with
# AdoptOpenJDK jdk binary installed. Basic test dependent executions
# are installed during the building process.
#
# Build example: `docker build -t adoptopenjdk-payara-mp-tck .`
#
# This Dockerfile builds image based on adoptopenjdk/openjdk8:latest.
# If you want to build image based on other images, please use
# `--build-arg list` to specify your base image
#
# Build example: `docker build --build-arg IMAGE_NAME=<image_name> --build-arg IMAGE_VERSION=<image_version> -t adoptopenjdk-payara-mp-tck .`

ARG SDK=openjdk8
ARG IMAGE_NAME=adoptopenjdk/$SDK
ARG IMAGE_VERSION=latest

FROM $IMAGE_NAME:$IMAGE_VERSION

# Install test dependent executable files
RUN apt-get update \
&& apt-get -y install \
ant \
apt-transport-https \
ca-certificates \
dirmngr \
curl \
git \
make \
unzip \
vim \
wget \
python3-pip python3-dev \
&& cd /usr/local/bin \
&& ln -s /usr/bin/python3 python \
&& pip3 install --upgrade pip

WORKDIR /
ENV PAYARA_HOME $WORKDIR

# Install Maven
RUN mkdir -p /usr/share/maven \
&& cd /usr/share/maven \
&& wget --no-check-certificate --no-cookies https://archive.apache.org/dist/maven/maven-3/3.5.3/binaries/apache-maven-3.5.3-bin.zip \
&& unzip apache-maven-3.5.3-bin.zip \
&& rm -rf apache-maven-3.5.3-bin.zip \
&& ln -s /usr/share/maven/apache-maven-3.5.3/bin/mvn /usr/bin/mvn \
&& cd /

VOLUME ["/java"]
ENV JAVA_HOME=/java \
PATH=/java/bin:$PATH \
JAVA_TOOL_OPTIONS="-Dfile.encoding=UTF8"

COPY ./dockerfile/payara-mp-tck.sh /payara-mp-tck.sh

#Download and unzip Payara full distribution
RUN curl -L -o /tmp/payara-5.182.zip https://search.maven.org/remotecontent?filepath=fish/payara/distributions/payara/5.182/payara-5.182.zip && \
unzip /tmp/payara-5.182.zip -d / && \
rm -f /tmp/payara-5.182.zip

# Clone the Pyara MicroProfile-TCK-Runners
RUN pwd
RUN git clone https://github.com/payara/MicroProfile-TCK-Runners

ENTRYPOINT ["/bin/bash", "/payara-mp-tck.sh"]
CMD ["--version"]
70 changes: 70 additions & 0 deletions thirdparty_containers/payara-mp-tck/dockerfile/payara-mp-tck.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#/bin/bash
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

if [ -d /java/jre/bin ];then
echo "Using mounted Java8"
export JAVA_BIN=/java/jre/bin
export JAVA_HOME=/java
export PATH=$JAVA_BIN:$PATH
java -version
elif [ -d /java/bin ]; then
echo "Using mounted Java9"
export JAVA_BIN=/java/bin
export JAVA_HOME=/java
export PATH=$JAVA_BIN:$PATH
java -version
else
echo "Using docker image default Java"
java_path=$(type -p java)
suffix="/java"
java_root=${java_path%$suffix}
export JAVA_BIN="$java_root"
echo "JAVA_BIN is: $JAVA_BIN"
$JAVA_BIN/java -version
fi

TEST_SUITE=$1

echo "PATH is : $PATH"
echo "JAVA_HOME is : $JAVA_HOME"
echo "ANT_HOME is: $ANT_HOME"
echo "type -p java is :"
type -p java
echo "java -version is: \n"
java -version
cd ${PAYARA_HOME}/
ls .
pwd

#Start Payara server
${PAYARA_HOME}/payara5/bin/asadmin start-domain

#Start MicroProfile-Metrics TCK
cd ${PAYARA_HOME}/MicroProfile-TCK-Runners/MicroProfile-Metrics/tck-runner
mvn -Ppayara-server-remote test

#Start MicroProfile-Fault-Tolerance TCK
cd ${PAYARA_HOME}/MicroProfile-TCK-Runners/MicroProfile-Fault-Tolerance/tck-runner
mvn -Ppayara-server-remote test

#Start MicroProfile-Config TCK
cd ${PAYARA_HOME}/MicroProfile-TCK-Runners/MicroProfile-Config/tck-runner
mvn -Ppayara-server-remote test

#Start MicroProfile-OpenAPI TCK
cd ${PAYARA_HOME}/MicroProfile-TCK-Runners/MicroProfile-OpenAPI/tck-runner
mvn -Ppayara-server-remote test

#Stop Payara server
${PAYARA_HOME}/payara5/bin/asadmin stop-domain
35 changes: 35 additions & 0 deletions thirdparty_containers/payara-mp-tck/playlist.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-->
<playlist xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../TestConfig/playlist.xsd">
<test>
<testCaseName>payara_microprofile_tck</testCaseName>
<command>docker run -v $(JDK_HOME):/java --name payara-mp-tck adoptopenjdk-payara-mp-tck:latest; \
docker cp payara-mp-tck:/MicroProfile-TCK-Runners/MicroProfile-Metrics/tck-runner/target/surefire-reports $(REPORTDIR)/external_test_reports; \
docker cp payara-mp-tck:/MicroProfile-TCK-Runners/MicroProfile-Fault-Tolerance/tck-runner/target/surefire-reports/junitreports $(REPORTDIR)/external_test_reports; \
docker cp payara-mp-tck:/MicroProfile-TCK-Runners/MicroProfile-Config/tck-runner/target/surefire-reports/junitreports $(REPORTDIR)/external_test_reports; \
docker rm payara-mp-tck; \
$(TEST_STATUS)</command>
<subsets>
<subset>SE80</subset>
<subset>SE90</subset>
</subsets>
<levels>
<level>extended</level>
</levels>
<groups>
<group>external</group>
</groups>
</test>
</playlist>

0 comments on commit ea132cf

Please sign in to comment.