Skip to content

Commit e4f8862

Browse files
author
Tomáš Kraus
authored
DbClient integration tests with native image application. (helidon-io#2798)
Signed-off-by: Tomas Kraus <Tomas.Kraus@oracle.com>
1 parent de5da7b commit e4f8862

126 files changed

Lines changed: 12289 additions & 352 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

bom/pom.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1063,6 +1063,17 @@
10631063
<artifactId>helidon-integrations-neo4j-metrics</artifactId>
10641064
<version>${helidon.version}</version>
10651065
</dependency>
1066+
<!-- Helidon tests tools -->
1067+
<dependency>
1068+
<groupId>io.helidon.tests.integration.tools</groupId>
1069+
<artifactId>helidon-tests-integration-tools-service</artifactId>
1070+
<version>${project.version}</version>
1071+
</dependency>
1072+
<dependency>
1073+
<groupId>io.helidon.tests.integration.tools</groupId>
1074+
<artifactId>helidon-tests-integration-tools-client</artifactId>
1075+
<version>${project.version}</version>
1076+
</dependency>
10661077
</dependencies>
10671078
</dependencyManagement>
10681079
</project>

dbclient/jdbc/src/main/resources/META-INF/native-image/io.helidon.dbclient/helidon-dbclient-jdbc/reflect-config.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,13 @@
66
"allPublicMethods": true,
77
"allDeclaredFields": true,
88
"allPublicFields": true
9+
},
10+
{
11+
"name": "java.sql.Statement[]",
12+
"allDeclaredConstructors": true,
13+
"allDeclaredMethods": true,
14+
"allPublicMethods": true,
15+
"allDeclaredFields": true,
16+
"allPublicFields": true
917
}
1018
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[
2+
{
3+
"name": "com.codahale.metrics.MetricRegistry",
4+
"allDeclaredConstructors": true,
5+
"allDeclaredMethods": true,
6+
"allPublicMethods": true,
7+
"allDeclaredFields": true,
8+
"allPublicFields": true
9+
}
10+
]

etc/scripts/build.sh

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash -e
22
#
3-
# Copyright (c) 2018, 2020 Oracle and/or its affiliates.
3+
# Copyright (c) 2018, 2021 Oracle and/or its affiliates.
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.
@@ -15,29 +15,14 @@
1515
# limitations under the License.
1616
#
1717

18-
set -o pipefail || true # trace ERR through pipes
19-
set -o errtrace || true # trace ERR through commands and functions
20-
set -o errexit || true # exit the script if any statement returns a non-true return value
21-
22-
on_error(){
23-
CODE="${?}" && \
24-
set +x && \
25-
printf "[ERROR] Error(code=%s) occurred at %s:%s command: %s\n" \
26-
"${CODE}" "${BASH_SOURCE}" "${LINENO}" "${BASH_COMMAND}"
27-
}
28-
trap on_error ERR
29-
3018
# Path to this script
31-
if [ -h "${0}" ] ; then
32-
readonly SCRIPT_PATH="$(readlink "${0}")"
33-
else
34-
readonly SCRIPT_PATH="${0}"
35-
fi
19+
[ -h "${0}" ] && readonly SCRIPT_PATH="$(readlink "${0}")" || readonly SCRIPT_PATH="${0}"
3620

37-
# Path to the root of the workspace
38-
readonly WS_DIR=$(cd $(dirname -- "${SCRIPT_PATH}") ; cd ../.. ; pwd -P)
21+
# Load pipeline environment setup and define WS_DIR
22+
. $(dirname -- "${SCRIPT_PATH}")/includes/pipeline-env.sh "${SCRIPT_PATH}" '../..'
3923

40-
source ${WS_DIR}/etc/scripts/pipeline-env.sh
24+
# Setup error handling using default settings (defined in includes/error_handlers.sh)
25+
error_trap_setup
4126

4227
mvn ${MAVEN_ARGS} --version
4328

etc/scripts/checkstyle.sh

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash -e
22
#
3-
# Copyright (c) 2018, 2020 Oracle and/or its affiliates.
3+
# Copyright (c) 2018, 2021 Oracle and/or its affiliates.
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.
@@ -15,35 +15,20 @@
1515
# limitations under the License.
1616
#
1717

18-
set -o pipefail || true # trace ERR through pipes
19-
set -o errtrace || true # trace ERR through commands and functions
20-
set -o errexit || true # exit the script if any statement returns a non-true return value
21-
22-
on_error(){
23-
CODE="${?}" && \
24-
set +x && \
25-
printf "[ERROR] Error(code=%s) occurred at %s:%s command: %s\n" \
26-
"${CODE}" "${BASH_SOURCE}" "${LINENO}" "${BASH_COMMAND}"
27-
}
28-
trap on_error ERR
29-
3018
# Path to this script
31-
if [ -h "${0}" ] ; then
32-
readonly SCRIPT_PATH="$(readlink "${0}")"
33-
else
34-
readonly SCRIPT_PATH="${0}"
35-
fi
19+
[ -h "${0}" ] && readonly SCRIPT_PATH="$(readlink "${0}")" || readonly SCRIPT_PATH="${0}"
3620

37-
# Path to the root of the workspace
38-
readonly WS_DIR=$(cd $(dirname -- "${SCRIPT_PATH}") ; cd ../.. ; pwd -P)
21+
# Load pipeline environment setup and define WS_DIR
22+
. $(dirname -- "${SCRIPT_PATH}")/includes/pipeline-env.sh "${SCRIPT_PATH}" '../..'
23+
24+
# Setup error handling using default settings (defined in includes/error_handlers.sh)
25+
error_trap_setup
3926

4027
readonly LOG_FILE=$(mktemp -t XXXcheckstyle-log)
4128

4229
readonly RESULT_FILE=$(mktemp -t XXXcheckstyle-result)
4330

44-
source ${WS_DIR}/etc/scripts/pipeline-env.sh
45-
46-
die(){ echo "${1}" ; exit 1 ;}
31+
die() { echo "${1}" ; exit 1 ;}
4732

4833
mvn ${MAVEN_ARGS} checkstyle:checkstyle-aggregate \
4934
-f ${WS_DIR}/pom.xml \

etc/scripts/copyright.sh

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash -e
22
#
3-
# Copyright (c) 2018, 2020 Oracle and/or its affiliates.
3+
# Copyright (c) 2018, 2021 Oracle and/or its affiliates.
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.
@@ -15,33 +15,18 @@
1515
# limitations under the License.
1616
#
1717

18-
set -o pipefail || true # trace ERR through pipes
19-
set -o errtrace || true # trace ERR through commands and functions
20-
set -o errexit || true # exit the script if any statement returns a non-true return value
21-
22-
on_error(){
23-
CODE="${?}" && \
24-
set +x && \
25-
printf "[ERROR] Error(code=%s) occurred at %s:%s command: %s\n" \
26-
"${CODE}" "${BASH_SOURCE}" "${LINENO}" "${BASH_COMMAND}"
27-
}
28-
trap on_error ERR
29-
3018
# Path to this script
31-
if [ -h "${0}" ] ; then
32-
readonly SCRIPT_PATH="$(readlink "${0}")"
33-
else
34-
readonly SCRIPT_PATH="${0}"
35-
fi
19+
[ -h "${0}" ] && readonly SCRIPT_PATH="$(readlink "${0}")" || readonly SCRIPT_PATH="${0}"
3620

37-
# Path to the root of the workspace
38-
readonly WS_DIR=$(cd $(dirname -- "${SCRIPT_PATH}") ; cd ../.. ; pwd -P)
21+
# Load pipeline environment setup and define WS_DIR
22+
. $(dirname -- "${SCRIPT_PATH}")/includes/pipeline-env.sh "${SCRIPT_PATH}" '../..'
3923

40-
readonly RESULT_FILE=$(mktemp -t XXXcopyright-result)
24+
# Setup error handling using default settings (defined in includes/error_handlers.sh)
25+
error_trap_setup
4126

42-
source ${WS_DIR}/etc/scripts/pipeline-env.sh
27+
readonly RESULT_FILE=$(mktemp -t XXXcopyright-result)
4328

44-
die(){ echo "${1}" ; exit 1 ;}
29+
die() { echo "${1}" ; exit 1 ;}
4530

4631
mvn ${MAVEN_ARGS} -q org.glassfish.copyright:glassfish-copyright-maven-plugin:copyright \
4732
-f ${WS_DIR}/pom.xml \

etc/scripts/gen-javadoc-packagelist.sh

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash -e
22
#
3-
# Copyright (c) 2019, 2020 Oracle and/or its affiliates.
3+
# Copyright (c) 2019, 2021 Oracle and/or its affiliates.
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.
@@ -32,11 +32,7 @@
3232
#
3333

3434
# Path to this script
35-
if [ -h "${0}" ] ; then
36-
readonly SCRIPT_PATH="$(readlink "${0}")"
37-
else
38-
readonly SCRIPT_PATH="${0}"
39-
fi
35+
[ -h "${0}" ] && readonly SCRIPT_PATH="$(readlink "${0}")" || readonly SCRIPT_PATH="${0}"
4036

4137
# Path to the root of the workspace
4238
readonly WS_DIR=$(cd $(dirname -- "${SCRIPT_PATH}") ; cd ../.. ; pwd -P)

etc/scripts/github-release.sh

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22
#
3-
# Copyright (c) 2020 Oracle and/or its affiliates.
3+
# Copyright (c) 2020, 2021 Oracle and/or its affiliates.
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.
@@ -15,17 +15,14 @@
1515
# limitations under the License.
1616
#
1717

18-
set -o pipefail || true # trace ERR through pipes
19-
set -o errtrace || true # trace ERR through commands and functions
20-
set -o errexit || true # exit the script if any statement returns a non-true return value
18+
# Path to this script
19+
[ -h "${0}" ] && readonly SCRIPT_PATH="$(readlink "${0}")" || readonly SCRIPT_PATH="${0}"
2120

22-
on_error(){
23-
CODE="${?}" && \
24-
set +x && \
25-
printf "[ERROR] Error(code=%s) occurred at %s:%s command: %s\n" \
26-
"${CODE}" "${BASH_SOURCE}" "${LINENO}" "${BASH_COMMAND}"
27-
}
28-
trap on_error ERR
21+
# Load error handling functions and define error handling
22+
. $(dirname -- "${SCRIPT_PATH}")/includes/error_handlers.sh
23+
24+
# Setup error handling using default settings (defined in includes/error_handlers.sh)
25+
error_trap_setup
2926

3027
usage(){
3128
cat <<EOF

etc/scripts/includes/docker-env.sh

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# Copyright (c) 2021 Oracle and/or its affiliates.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
15+
16+
###############################################################################
17+
# Local environment setup #
18+
###############################################################################
19+
# Shell variables: WS_DIR
20+
# Arguments: $1 - Script path
21+
# $2 - cd to Helidon root directory from script path
22+
#
23+
# Atleast WS_DIR or both arguments must be passed.
24+
25+
# WS_DIR variable verification.
26+
if [ -z "${WS_DIR}" ]; then
27+
28+
if [ -z "${1}" ]; then
29+
echo "ERROR: Missing required script path, exitting"
30+
exit 1
31+
fi
32+
33+
if [ -z "${2}" ]; then
34+
echo "ERROR: Missing required cd to Helidon root directory from script path, exitting"
35+
exit 1
36+
fi
37+
38+
readonly WS_DIR=$(cd $(dirname -- "${1}") ; cd ${2} ; pwd -P)
39+
40+
fi
41+
42+
# Multiple definition protection.
43+
if [ -z "${__LOCAL_ENV_INCLUDED__}" ]; then
44+
readonly __LOCAL_ENV_INCLUDED__='true'
45+
46+
. ${WS_DIR}/etc/scripts/includes/error_handlers.sh
47+
48+
# Docker helper functions
49+
50+
# Docker container start.
51+
# Database containers require listening TCP port to be mapped to specific host:port.
52+
# Arguments: $1 - name:version of the image
53+
# $2 - name of the container (--name ${2})
54+
# $3 - container port publishing (--publish ${3})
55+
# $4 - additional docker run command arguments
56+
# $5 - name of variable with container running status
57+
# $6 - container start trigger variable name (optional, default true)
58+
docker_start() {
59+
if [ -z "${6}" ] || [ -n "${6}" -a -n "${!6}" ]; then
60+
echo -n 'Starting Docker container: '
61+
docker run -d \
62+
--name "${2}" \
63+
--publish "${3}" \
64+
${4} \
65+
--rm ${1} && \
66+
[ -n "${5}" ] && eval "${5}='1'"
67+
fi
68+
}
69+
70+
# Docker container stop.
71+
# Arguments: $1 - name of the container
72+
# $2 - docker trigger variable name (optional, default true)
73+
docker_stop() {
74+
if [ -z "${2}" ] || [ -n "${2}" -a -n "${!2}" ]; then
75+
echo -n 'Stopping Docker container: '
76+
docker stop "${1}"
77+
fi
78+
}
79+
80+
else
81+
echo "WARNING: ${WS_DIR}/etc/scripts/includes/docker-env.sh included multiple times."
82+
fi
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#!/bin/bash
2+
#
3+
# Copyright (c) 2018, 2021 Oracle and/or its affiliates.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
18+
###############################################################################
19+
# Error handling functions #
20+
###############################################################################
21+
22+
# Multiple definition protection.
23+
# The same code is included in both local and pipeline environment setup.
24+
if [ -z "${__ERROR_HANDLER_INCLUDED__}" ]; then
25+
readonly __ERROR_HANDLER_INCLUDED__='true'
26+
27+
# Default error handler.
28+
# Shell variables: CODE
29+
# BASH_SOURCE
30+
# LINENO
31+
# BASH_COMMAND
32+
on_error() {
33+
CODE="${?}" && \
34+
set +x && \
35+
printf "[ERROR] Error(code=%s) occurred at %s:%s command: %s\n" \
36+
"${CODE}" "${BASH_SOURCE}" "${LINENO}" "${BASH_COMMAND}"
37+
}
38+
39+
# Error handling setup
40+
# Arguments: $1 - error handler name (optional, default name is 'on_error')
41+
error_trap_setup() {
42+
# trace ERR through pipes
43+
set -o pipefail || true
44+
# trace ERR through commands and functions
45+
set -o errtrace || true
46+
# exit the script if any statement returns a non-true return value
47+
set -o errexit || true
48+
# Set error handler
49+
trap "${1:-on_error}" ERR
50+
}
51+
52+
else
53+
echo "WARNING: ${WS_DIR}/etc/scripts/includes/error_handlers.sh included multiple times."
54+
echo "WARNING: Make sure that only one from local and pipeline environment setups is loaded."
55+
fi

0 commit comments

Comments
 (0)