diff --git a/external/camel/build.xml b/external/camel/build.xml new file mode 100644 index 0000000000..d75f92a630 --- /dev/null +++ b/external/camel/build.xml @@ -0,0 +1,38 @@ + + + + + Build camel-test Docker image + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/external/camel/dockerfile/Dockerfile b/external/camel/dockerfile/Dockerfile new file mode 100644 index 0000000000..44c1c1ad91 --- /dev/null +++ b/external/camel/dockerfile/Dockerfile @@ -0,0 +1,49 @@ +# 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 +# +# https://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 external/camel/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-camel-test -f Dockerfile ../.` +# +# 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= --build-arg IMAGE_VERSION=-t adoptopenjdk-camel-test .` + + +ARG SDK=openjdk8 +ARG IMAGE_NAME=adoptopenjdk/$SDK +ARG IMAGE_VERSION=nightly + +FROM $IMAGE_NAME:$IMAGE_VERSION + +# Install test dependent executable files +RUN apt-get update \ + && apt-get -y install \ + maven \ + git \ + wget + +ENV JAVA_TOOL_OPTIONS="-Dfile.encoding=UTF8" +ENV MODE="java" + +COPY ./dockerfile/camel-test.sh /camel-test.sh +RUN mkdir testResults +WORKDIR / +RUN pwd +RUN git clone https://github.com/apache/camel-quarkus.git + +ENTRYPOINT ["/bin/bash", "/camel-test.sh"] +CMD ["$MODE"] diff --git a/external/camel/dockerfile/camel-test.sh b/external/camel/dockerfile/camel-test.sh new file mode 100644 index 0000000000..914a8f1f45 --- /dev/null +++ b/external/camel/dockerfile/camel-test.sh @@ -0,0 +1,50 @@ +#/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 +# +# https://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. + +# Set up Java to be used by the the camel-test + +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 +elif [ -d /java/bin ]; then + echo "Using mounted Java" + export JAVA_BIN=/java/bin + export JAVA_HOME=/java + export PATH=$JAVA_BIN:$PATH +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" + export JAVA_HOME="${java_root%/bin}" +fi + +java -version + +# See https://camel.apache.org/camel-quarkus/latest/contributor-guide.html +cd /camel-quarkus +pwd +echo "Compile and run camel tests" +mvn clean install +test_exit_code=$? +echo "Build camel completed" + +# find "$(pwd -P)" -name "surefire-reports" + +find ./ -type d -name 'surefire-reports' -exec cp -r "{}" /testResults \; +exit $test_exit_code diff --git a/external/camel/playlist.xml b/external/camel/playlist.xml new file mode 100644 index 0000000000..1eb1c987ef --- /dev/null +++ b/external/camel/playlist.xml @@ -0,0 +1,31 @@ + + + + + camel_test + docker run --name camel-test $(EXTRA_DOCKER_ARGS) --env OPENJ9_JAVA_OPTIONS=-Xmx1g adoptopenjdk-camel-test:latest; \ + $(TEST_STATUS); \ + docker cp camel-test:/testResults/surefire-reports $(REPORTDIR)/external_test_reports; \ + docker rm -f camel-test; \ + docker rmi -f adoptopenjdk-camel-test + + + extended + + + external + + +