From ea5067ec6803a04183607d289b17b99586090113 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Kraus?= Date: Thu, 8 Sep 2022 15:57:28 +0200 Subject: [PATCH 1/8] Fixed DB CLient Integration Tests build. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tomáš Kraus --- etc/scripts/includes/mysql.sh | 3 +- etc/scripts/includes/pgsql.sh | 3 +- tests/integration/dbclient/appl/pom.xml | 61 ++++++++- .../dbclient/appl/AbstractService.java | 2 +- .../integration/dbclient/appl/ApplMain.java | 19 ++- .../dbclient/appl/InitService.java | 15 +-- .../dbclient/appl/VerifyService.java | 14 +- .../appl/dbmapper/DbClientMapperProvider.java | 4 +- .../dbmapper/DbRowToJsonObjectMapper.java | 8 +- .../appl/health/HealthCheckService.java | 19 ++- .../appl/interceptor/InterceptorService.java | 14 +- .../dbclient/appl/mapping/MapperService.java | 14 +- .../dbclient/appl/model/Pokemon.java | 7 +- .../appl/result/FlowControlService.java | 14 +- .../appl/simple/SimpleDeleteService.java | 10 +- .../appl/simple/SimpleGetService.java | 10 +- .../appl/simple/SimpleInsertService.java | 6 +- .../appl/simple/SimpleQueryService.java | 14 +- .../appl/simple/SimpleUpdateService.java | 12 +- .../appl/statement/DmlStatementService.java | 12 +- .../appl/statement/GetStatementService.java | 10 +- .../appl/statement/QueryStatementService.java | 14 +- .../dbclient/appl/tools/ExitService.java | 4 +- .../transaction/TransactionDeleteService.java | 12 +- .../transaction/TransactionGetService.java | 10 +- .../transaction/TransactionInsertService.java | 10 +- .../TransactionQueriesService.java | 14 +- .../transaction/TransactionUpdateService.java | 12 +- .../dbclient/appl/src/main/resources/h2.yaml | 84 ++++++++++++ .../dbclient/appl/it/ApplInitIT.java | 37 +++--- .../integration/dbclient/appl/it/LogData.java | 7 +- .../dbclient/appl/it/VerifyData.java | 6 +- .../appl/it/health/HealthCheckIT.java | 42 +++--- .../dbclient/appl/it/mapping/MapperIT.java | 46 ++++--- .../appl/it/metrics/ServerMetricsCheckIT.java | 7 +- .../appl/it/result/FlowControlIT.java | 16 +-- .../appl/it/simple/SimpleDeleteIT.java | 20 ++- .../dbclient/appl/it/simple/SimpleGetIT.java | 14 +- .../appl/it/simple/SimpleInsertIT.java | 18 ++- .../appl/it/simple/SimpleQueriesIT.java | 14 +- .../appl/it/simple/SimpleUpdateIT.java | 20 ++- .../appl/it/statement/DmlStatementIT.java | 20 ++- .../appl/it/statement/GetStatementIT.java | 14 +- .../appl/it/statement/QueryStatementIT.java | 16 +-- .../appl/it/tools/LifeCycleExtension.java | 37 ++++-- .../it/transaction/TransactionDeleteIT.java | 20 ++- .../appl/it/transaction/TransactionGetIT.java | 14 +- .../it/transaction/TransactionInsertIT.java | 18 ++- .../it/transaction/TransactionQueriesIT.java | 14 +- .../it/transaction/TransactionUpdateIT.java | 18 ++- .../src/test/resources/logging.properties | 2 +- tests/integration/dbclient/common/pom.xml | 16 ++- .../common/tests/health/HealthCheckIT.java | 37 +++--- .../tests/health/ServerHealthCheckIT.java | 21 +-- .../tests/metrics/ServerMetricsCheckIT.java | 17 ++- tests/integration/dbclient/jdbc/pom.xml | 121 +++++++++++++++++- .../dbclient/jdbc/src/test/resources/h2.yaml | 80 ++++++++++++ tests/integration/dbclient/mongodb/pom.xml | 12 ++ tests/integration/dbclient/test.sh | 14 +- tests/integration/pom.xml | 9 +- 60 files changed, 738 insertions(+), 440 deletions(-) create mode 100644 tests/integration/dbclient/appl/src/main/resources/h2.yaml create mode 100644 tests/integration/dbclient/jdbc/src/test/resources/h2.yaml diff --git a/etc/scripts/includes/mysql.sh b/etc/scripts/includes/mysql.sh index 2eb4ce58ec3..1f6e526831b 100644 --- a/etc/scripts/includes/mysql.sh +++ b/etc/scripts/includes/mysql.sh @@ -1,5 +1,5 @@ # -# Copyright (c) 2021 Oracle and/or its affiliates. +# Copyright (c) 2021, 2022 Oracle and/or its affiliates. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -33,5 +33,6 @@ readonly DOCKER_ENV="-e MYSQL_USER=${DB_USER} -e MYSQL_DATABASE=${DB_NAME} -e MY readonly DOCKER_IMG='mysql:8' readonly DB_PROFILE='mysql' +readonly DB_PROPERTY='db=mysql' echo " - Database URL: ${DB_URL}" diff --git a/etc/scripts/includes/pgsql.sh b/etc/scripts/includes/pgsql.sh index 9b5f6e0afc4..75f950a6597 100644 --- a/etc/scripts/includes/pgsql.sh +++ b/etc/scripts/includes/pgsql.sh @@ -1,5 +1,5 @@ # -# Copyright (c) 2021 Oracle and/or its affiliates. +# Copyright (c) 2021, 2022 Oracle and/or its affiliates. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -31,5 +31,6 @@ readonly DOCKER_ENV="-e POSTGRES_USER=${DB_USER} -e POSTGRES_DB=${DB_NAME} -e PO readonly DOCKER_IMG='postgres' readonly DB_PROFILE='pgsql' +readonly DB_PROPERTY='db=pgsql' echo " - Database URL: ${DB_URL}" diff --git a/tests/integration/dbclient/appl/pom.xml b/tests/integration/dbclient/appl/pom.xml index 11a567eb292..76051557ee7 100644 --- a/tests/integration/dbclient/appl/pom.xml +++ b/tests/integration/dbclient/appl/pom.xml @@ -54,6 +54,10 @@ io.helidon.config helidon-config-yaml + + io.helidon.logging + helidon-logging-jul + io.helidon.reactive.webserver helidon-reactive-webserver @@ -66,6 +70,10 @@ io.helidon.reactive.media helidon-reactive-media-jsonb + + io.helidon.reactive.health + helidon-reactive-health + io.helidon.reactive.dbclient helidon-reactive-dbclient-jdbc @@ -86,6 +94,15 @@ io.helidon.tests.integration.tools helidon-tests-integration-tools-service + + io.helidon.reactive.metrics + helidon-reactive-metrics + + + io.helidon.reactive.webclient + helidon-reactive-webclient + test + io.helidon.tests.integration.tools helidon-tests-integration-tools-client @@ -109,11 +126,6 @@ runtime true - - io.helidon.reactive.webclient - helidon-reactive-webclient - test - org.junit.jupiter junit-jupiter-api @@ -239,8 +251,41 @@ + + h2 + + + !db + + + + h2.yaml + test + sa + + jdbc:h2:mem:${db.database};INIT=SET TRACE_LEVEL_FILE=4;DATABASE_TO_UPPER=FALSE + + + + io.helidon.integrations.db + h2 + + + com.h2database + h2 + runtime + + + + mysql + + + db + mysql + + io.helidon.integrations.db @@ -257,6 +302,12 @@ pgsql + + + db + pgsql + + io.helidon.integrations.db diff --git a/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/AbstractService.java b/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/AbstractService.java index 062b76dac53..0e97d9276e7 100644 --- a/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/AbstractService.java +++ b/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/AbstractService.java @@ -20,9 +20,9 @@ import java.util.logging.Logger; import io.helidon.reactive.dbclient.DbClient; -import io.helidon.tests.integration.tools.service.RemoteTestException; import io.helidon.reactive.webserver.ServerRequest; import io.helidon.reactive.webserver.Service; +import io.helidon.tests.integration.tools.service.RemoteTestException; /** * Common web service code for testing application. diff --git a/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/ApplMain.java b/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/ApplMain.java index 43517337bff..af4c6c526ed 100644 --- a/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/ApplMain.java +++ b/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/ApplMain.java @@ -15,10 +15,9 @@ */ package io.helidon.tests.integration.dbclient.appl; +import java.lang.System.Logger.Level; import java.util.Map; -import java.util.logging.Logger; -import io.helidon.logging.common.LogConfig; import io.helidon.config.Config; import io.helidon.config.ConfigSources; import io.helidon.reactive.dbclient.DbClient; @@ -29,7 +28,9 @@ import io.helidon.reactive.health.HealthSupport; import io.helidon.reactive.media.jsonb.JsonbSupport; import io.helidon.reactive.media.jsonp.JsonpSupport; -import io.helidon.metrics.MetricsSupport; +import io.helidon.reactive.metrics.MetricsSupport; +import io.helidon.reactive.webserver.Routing; +import io.helidon.reactive.webserver.WebServer; import io.helidon.tests.integration.dbclient.appl.health.HealthCheckService; import io.helidon.tests.integration.dbclient.appl.interceptor.InterceptorService; import io.helidon.tests.integration.dbclient.appl.mapping.MapperService; @@ -48,8 +49,6 @@ import io.helidon.tests.integration.dbclient.appl.transaction.TransactionInsertService; import io.helidon.tests.integration.dbclient.appl.transaction.TransactionQueriesService; import io.helidon.tests.integration.dbclient.appl.transaction.TransactionUpdateService; -import io.helidon.reactive.webserver.Routing; -import io.helidon.reactive.webserver.WebServer; /** * Main class. @@ -57,7 +56,7 @@ */ public class ApplMain { - private static final Logger LOGGER = Logger.getLogger(ApplMain.class.getName()); + private static final System.Logger LOGGER = System.getLogger(ApplMain.class.getName()); private static final String CONFIG_PROPERTY_NAME="app.config"; @@ -76,7 +75,7 @@ private static WebServer startServer(final String configFile) { .statementTypes(DbStatementType.GET)) .build(); final HealthSupport health = HealthSupport.builder() - .addLiveness(DbClientHealthCheck + .add(DbClientHealthCheck .builder(dbClient) //.dml() .statementName("ping") @@ -123,8 +122,7 @@ private static WebServer startServer(final String configFile) { .build(); // Prepare routing for the server - final WebServer.Builder serverBuilder = WebServer.builder() - .routing(routing) + final WebServer.Builder serverBuilder = WebServer.builder(routing) // Get webserver config from the "server" section of application.yaml .config(config.get("server")); @@ -161,9 +159,8 @@ public static void main(String[] args) { } else { configFile = System.getProperty(CONFIG_PROPERTY_NAME, DEFAULT_CONFIG_FILE); } - LOGGER.info(() -> String.format("Configuration file: %s", configFile)); + LOGGER.log(Level.INFO, () -> String.format("Configuration file: %s", configFile)); - LogConfig.configureRuntime(); startServer(configFile); } diff --git a/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/InitService.java b/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/InitService.java index 07562db3885..75946aae52c 100644 --- a/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/InitService.java +++ b/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/InitService.java @@ -20,22 +20,21 @@ import java.util.function.Supplier; import java.util.logging.Logger; -import jakarta.json.Json; -import jakarta.json.JsonObjectBuilder; - import io.helidon.common.reactive.Single; import io.helidon.config.Config; +import io.helidon.health.HealthCheck; +import io.helidon.health.HealthCheckResponse; import io.helidon.reactive.dbclient.DbClient; import io.helidon.reactive.dbclient.health.DbClientHealthCheck; -import io.helidon.tests.integration.dbclient.appl.model.Pokemon; -import io.helidon.tests.integration.dbclient.appl.model.Type; import io.helidon.reactive.webserver.Routing; import io.helidon.reactive.webserver.ServerRequest; import io.helidon.reactive.webserver.ServerResponse; import io.helidon.reactive.webserver.Service; +import io.helidon.tests.integration.dbclient.appl.model.Pokemon; +import io.helidon.tests.integration.dbclient.appl.model.Type; -import org.eclipse.microprofile.health.HealthCheck; -import org.eclipse.microprofile.health.HealthCheckResponse; +import jakarta.json.Json; +import jakarta.json.JsonObjectBuilder; import static io.helidon.tests.integration.tools.service.AppResponse.exceptionStatus; import static io.helidon.tests.integration.tools.service.AppResponse.okStatus; @@ -103,7 +102,7 @@ private void testHealthCheck(final ServerRequest request, final ServerResponse r dbClient, dbConfig.get("health-check")); HealthCheckResponse checkResponse = check.call(); - HealthCheckResponse.Status checkState = checkResponse.getStatus(); + HealthCheckResponse.Status checkState = checkResponse.status(); final JsonObjectBuilder data = Json.createObjectBuilder(); data.add("state", checkState.name()); response.send(okStatus(data.build())); diff --git a/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/VerifyService.java b/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/VerifyService.java index b632b0207c4..acae348276a 100644 --- a/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/VerifyService.java +++ b/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/VerifyService.java @@ -17,19 +17,19 @@ import java.util.logging.Logger; -import jakarta.json.Json; -import jakarta.json.JsonArrayBuilder; -import jakarta.json.JsonObject; -import jakarta.json.JsonObjectBuilder; - import io.helidon.config.Config; import io.helidon.reactive.dbclient.DbClient; -import io.helidon.tests.integration.tools.service.AppResponse; -import io.helidon.tests.integration.tools.service.RemoteTestException; import io.helidon.reactive.webserver.Routing; import io.helidon.reactive.webserver.ServerRequest; import io.helidon.reactive.webserver.ServerResponse; import io.helidon.reactive.webserver.Service; +import io.helidon.tests.integration.tools.service.AppResponse; +import io.helidon.tests.integration.tools.service.RemoteTestException; + +import jakarta.json.Json; +import jakarta.json.JsonArrayBuilder; +import jakarta.json.JsonObject; +import jakarta.json.JsonObjectBuilder; import static io.helidon.tests.integration.dbclient.appl.AbstractService.QUERY_ID_PARAM; import static io.helidon.tests.integration.tools.service.AppResponse.exceptionStatus; diff --git a/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/dbmapper/DbClientMapperProvider.java b/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/dbmapper/DbClientMapperProvider.java index 2773a4b33f4..ff52d67de3c 100644 --- a/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/dbmapper/DbClientMapperProvider.java +++ b/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/dbmapper/DbClientMapperProvider.java @@ -17,13 +17,13 @@ import java.util.Optional; -import jakarta.json.JsonObject; - import io.helidon.reactive.dbclient.DbMapper; import io.helidon.reactive.dbclient.spi.DbMapperProvider; import io.helidon.tests.integration.dbclient.appl.model.Pokemon; import io.helidon.tests.integration.dbclient.appl.model.RangePoJo; +import jakarta.json.JsonObject; + /** * Provides DB Client mappers. */ diff --git a/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/dbmapper/DbRowToJsonObjectMapper.java b/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/dbmapper/DbRowToJsonObjectMapper.java index 999d572f355..0d14db4fef5 100644 --- a/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/dbmapper/DbRowToJsonObjectMapper.java +++ b/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/dbmapper/DbRowToJsonObjectMapper.java @@ -24,16 +24,16 @@ import java.util.Map; import java.util.function.BiConsumer; +import io.helidon.reactive.dbclient.DbColumn; +import io.helidon.reactive.dbclient.DbMapper; +import io.helidon.reactive.dbclient.DbRow; + import jakarta.json.Json; import jakarta.json.JsonNumber; import jakarta.json.JsonObject; import jakarta.json.JsonObjectBuilder; import jakarta.json.JsonValue; -import io.helidon.reactive.dbclient.DbColumn; -import io.helidon.reactive.dbclient.DbMapper; -import io.helidon.reactive.dbclient.DbRow; - // This implementation is limited only to conversions required by jUnit tests. /** * Mapper for DbRow to JsonObject conversion. diff --git a/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/health/HealthCheckService.java b/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/health/HealthCheckService.java index b12d21421cb..2fcf4d38b30 100644 --- a/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/health/HealthCheckService.java +++ b/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/health/HealthCheckService.java @@ -18,21 +18,20 @@ import java.util.Map; import java.util.logging.Logger; -import jakarta.json.Json; -import jakarta.json.JsonObjectBuilder; - import io.helidon.config.Config; +import io.helidon.health.HealthCheck; +import io.helidon.health.HealthCheckResponse; import io.helidon.reactive.dbclient.DbClient; import io.helidon.reactive.dbclient.health.DbClientHealthCheck; -import io.helidon.tests.integration.dbclient.appl.AbstractService; -import io.helidon.tests.integration.tools.service.AppResponse; -import io.helidon.tests.integration.tools.service.RemoteTestException; import io.helidon.reactive.webserver.Routing; import io.helidon.reactive.webserver.ServerRequest; import io.helidon.reactive.webserver.ServerResponse; +import io.helidon.tests.integration.dbclient.appl.AbstractService; +import io.helidon.tests.integration.tools.service.AppResponse; +import io.helidon.tests.integration.tools.service.RemoteTestException; -import org.eclipse.microprofile.health.HealthCheck; -import org.eclipse.microprofile.health.HealthCheckResponse; +import jakarta.json.Json; +import jakarta.json.JsonObjectBuilder; import static io.helidon.tests.integration.tools.service.AppResponse.exceptionStatus; @@ -91,8 +90,8 @@ public void run() { try { JsonObjectBuilder job = Json.createObjectBuilder(); HealthCheckResponse hcResponse = check.call(); - HealthCheckResponse.Status state = hcResponse.getStatus(); - job.add("name", hcResponse.getName()); + HealthCheckResponse.Status state = hcResponse.status(); + job.add("name", check.name()); job.add("status", state.name()); response.send(AppResponse.okStatus(job.build())); } catch (Throwable t) { diff --git a/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/interceptor/InterceptorService.java b/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/interceptor/InterceptorService.java index 6d7813d93c7..b4733184d2a 100644 --- a/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/interceptor/InterceptorService.java +++ b/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/interceptor/InterceptorService.java @@ -18,23 +18,23 @@ import java.util.Map; import java.util.logging.Logger; -import jakarta.json.Json; -import jakarta.json.JsonArrayBuilder; -import jakarta.json.JsonObject; - import io.helidon.common.reactive.Multi; import io.helidon.common.reactive.Single; import io.helidon.reactive.dbclient.DbClient; import io.helidon.reactive.dbclient.DbClientService; import io.helidon.reactive.dbclient.DbClientServiceContext; import io.helidon.reactive.dbclient.DbRow; +import io.helidon.reactive.webserver.Routing; +import io.helidon.reactive.webserver.ServerRequest; +import io.helidon.reactive.webserver.ServerResponse; import io.helidon.tests.integration.dbclient.appl.AbstractService; import io.helidon.tests.integration.dbclient.appl.model.Pokemon; import io.helidon.tests.integration.tools.service.AppResponse; import io.helidon.tests.integration.tools.service.RemoteTestException; -import io.helidon.reactive.webserver.Routing; -import io.helidon.reactive.webserver.ServerRequest; -import io.helidon.reactive.webserver.ServerResponse; + +import jakarta.json.Json; +import jakarta.json.JsonArrayBuilder; +import jakarta.json.JsonObject; import static io.helidon.tests.integration.tools.service.AppResponse.exceptionStatus; diff --git a/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/mapping/MapperService.java b/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/mapping/MapperService.java index 49e72ee293b..de35791f021 100644 --- a/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/mapping/MapperService.java +++ b/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/mapping/MapperService.java @@ -22,22 +22,22 @@ import java.util.function.Function; import java.util.logging.Logger; -import jakarta.json.Json; -import jakarta.json.JsonArrayBuilder; -import jakarta.json.JsonObject; - import io.helidon.common.reactive.Multi; import io.helidon.common.reactive.Single; import io.helidon.reactive.dbclient.DbClient; import io.helidon.reactive.dbclient.DbRow; +import io.helidon.reactive.webserver.Routing; +import io.helidon.reactive.webserver.ServerRequest; +import io.helidon.reactive.webserver.ServerResponse; import io.helidon.tests.integration.dbclient.appl.AbstractService; import io.helidon.tests.integration.dbclient.appl.model.Pokemon; import io.helidon.tests.integration.dbclient.appl.model.Type; import io.helidon.tests.integration.tools.service.AppResponse; import io.helidon.tests.integration.tools.service.RemoteTestException; -import io.helidon.reactive.webserver.Routing; -import io.helidon.reactive.webserver.ServerRequest; -import io.helidon.reactive.webserver.ServerResponse; + +import jakarta.json.Json; +import jakarta.json.JsonArrayBuilder; +import jakarta.json.JsonObject; import static io.helidon.tests.integration.dbclient.appl.model.Type.TYPES; import static io.helidon.tests.integration.tools.service.AppResponse.exceptionStatus; diff --git a/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/model/Pokemon.java b/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/model/Pokemon.java index 6edab210b94..2fbde650402 100644 --- a/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/model/Pokemon.java +++ b/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/model/Pokemon.java @@ -15,21 +15,20 @@ */ package io.helidon.tests.integration.dbclient.appl.model; - import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; +import io.helidon.reactive.dbclient.DbMapper; +import io.helidon.reactive.dbclient.DbRow; + import jakarta.json.Json; import jakarta.json.JsonArrayBuilder; import jakarta.json.JsonObject; import jakarta.json.JsonObjectBuilder; -import io.helidon.reactive.dbclient.DbMapper; -import io.helidon.reactive.dbclient.DbRow; - import static io.helidon.tests.integration.dbclient.appl.model.Type.TYPES; /** diff --git a/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/result/FlowControlService.java b/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/result/FlowControlService.java index c6388072358..03b9b94cd5a 100644 --- a/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/result/FlowControlService.java +++ b/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/result/FlowControlService.java @@ -22,20 +22,20 @@ import java.util.concurrent.Flow.Subscription; import java.util.logging.Logger; -import jakarta.json.Json; -import jakarta.json.JsonObject; -import jakarta.json.JsonObjectBuilder; - import io.helidon.common.reactive.Multi; import io.helidon.reactive.dbclient.DbClient; import io.helidon.reactive.dbclient.DbRow; +import io.helidon.reactive.webserver.Routing; +import io.helidon.reactive.webserver.ServerRequest; +import io.helidon.reactive.webserver.ServerResponse; import io.helidon.tests.integration.dbclient.appl.AbstractService; import io.helidon.tests.integration.dbclient.appl.model.Type; import io.helidon.tests.integration.tools.service.AppResponse; import io.helidon.tests.integration.tools.service.RemoteTestException; -import io.helidon.reactive.webserver.Routing; -import io.helidon.reactive.webserver.ServerRequest; -import io.helidon.reactive.webserver.ServerResponse; + +import jakarta.json.Json; +import jakarta.json.JsonObject; +import jakarta.json.JsonObjectBuilder; import static io.helidon.tests.integration.tools.service.AppResponse.exceptionStatus; diff --git a/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/simple/SimpleDeleteService.java b/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/simple/SimpleDeleteService.java index 25a72318699..6409576471b 100644 --- a/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/simple/SimpleDeleteService.java +++ b/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/simple/SimpleDeleteService.java @@ -19,16 +19,16 @@ import java.util.function.Function; import java.util.logging.Logger; -import jakarta.json.Json; - import io.helidon.common.reactive.Single; import io.helidon.reactive.dbclient.DbClient; -import io.helidon.tests.integration.dbclient.appl.AbstractService; -import io.helidon.tests.integration.tools.service.AppResponse; -import io.helidon.tests.integration.tools.service.RemoteTestException; import io.helidon.reactive.webserver.Routing; import io.helidon.reactive.webserver.ServerRequest; import io.helidon.reactive.webserver.ServerResponse; +import io.helidon.tests.integration.dbclient.appl.AbstractService; +import io.helidon.tests.integration.tools.service.AppResponse; +import io.helidon.tests.integration.tools.service.RemoteTestException; + +import jakarta.json.Json; import static io.helidon.tests.integration.tools.service.AppResponse.exceptionStatus; diff --git a/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/simple/SimpleGetService.java b/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/simple/SimpleGetService.java index e0e4fee4baf..dba05563416 100644 --- a/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/simple/SimpleGetService.java +++ b/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/simple/SimpleGetService.java @@ -20,17 +20,17 @@ import java.util.function.Function; import java.util.logging.Logger; -import jakarta.json.JsonObject; - import io.helidon.common.reactive.Single; import io.helidon.reactive.dbclient.DbClient; import io.helidon.reactive.dbclient.DbRow; -import io.helidon.tests.integration.dbclient.appl.AbstractService; -import io.helidon.tests.integration.tools.service.AppResponse; -import io.helidon.tests.integration.tools.service.RemoteTestException; import io.helidon.reactive.webserver.Routing; import io.helidon.reactive.webserver.ServerRequest; import io.helidon.reactive.webserver.ServerResponse; +import io.helidon.tests.integration.dbclient.appl.AbstractService; +import io.helidon.tests.integration.tools.service.AppResponse; +import io.helidon.tests.integration.tools.service.RemoteTestException; + +import jakarta.json.JsonObject; import static io.helidon.tests.integration.tools.service.AppResponse.exceptionStatus; diff --git a/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/simple/SimpleInsertService.java b/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/simple/SimpleInsertService.java index d4b62b9cd02..1ba4f349cb3 100644 --- a/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/simple/SimpleInsertService.java +++ b/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/simple/SimpleInsertService.java @@ -22,14 +22,14 @@ import io.helidon.common.reactive.Single; import io.helidon.reactive.dbclient.DbClient; +import io.helidon.reactive.webserver.Routing; +import io.helidon.reactive.webserver.ServerRequest; +import io.helidon.reactive.webserver.ServerResponse; import io.helidon.tests.integration.dbclient.appl.AbstractService; import io.helidon.tests.integration.dbclient.appl.model.Pokemon; import io.helidon.tests.integration.dbclient.appl.model.Type; import io.helidon.tests.integration.tools.service.AppResponse; import io.helidon.tests.integration.tools.service.RemoteTestException; -import io.helidon.reactive.webserver.Routing; -import io.helidon.reactive.webserver.ServerRequest; -import io.helidon.reactive.webserver.ServerResponse; import static io.helidon.tests.integration.dbclient.appl.model.Type.TYPES; diff --git a/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/simple/SimpleQueryService.java b/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/simple/SimpleQueryService.java index d3453b65abf..2e0c8b169dd 100644 --- a/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/simple/SimpleQueryService.java +++ b/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/simple/SimpleQueryService.java @@ -19,19 +19,19 @@ import java.util.function.Function; import java.util.logging.Logger; -import jakarta.json.Json; -import jakarta.json.JsonArrayBuilder; -import jakarta.json.JsonObject; - import io.helidon.common.reactive.Multi; import io.helidon.reactive.dbclient.DbClient; import io.helidon.reactive.dbclient.DbRow; -import io.helidon.tests.integration.dbclient.appl.AbstractService; -import io.helidon.tests.integration.tools.service.AppResponse; -import io.helidon.tests.integration.tools.service.RemoteTestException; import io.helidon.reactive.webserver.Routing; import io.helidon.reactive.webserver.ServerRequest; import io.helidon.reactive.webserver.ServerResponse; +import io.helidon.tests.integration.dbclient.appl.AbstractService; +import io.helidon.tests.integration.tools.service.AppResponse; +import io.helidon.tests.integration.tools.service.RemoteTestException; + +import jakarta.json.Json; +import jakarta.json.JsonArrayBuilder; +import jakarta.json.JsonObject; import static io.helidon.tests.integration.tools.service.AppResponse.exceptionStatus; diff --git a/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/simple/SimpleUpdateService.java b/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/simple/SimpleUpdateService.java index 8e176d123e8..f6ceac583ef 100644 --- a/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/simple/SimpleUpdateService.java +++ b/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/simple/SimpleUpdateService.java @@ -19,18 +19,18 @@ import java.util.function.Function; import java.util.logging.Logger; -import jakarta.json.Json; -import jakarta.json.JsonObject; - import io.helidon.common.reactive.Single; import io.helidon.reactive.dbclient.DbClient; +import io.helidon.reactive.webserver.Routing; +import io.helidon.reactive.webserver.ServerRequest; +import io.helidon.reactive.webserver.ServerResponse; import io.helidon.tests.integration.dbclient.appl.AbstractService; import io.helidon.tests.integration.dbclient.appl.model.Pokemon; import io.helidon.tests.integration.tools.service.AppResponse; import io.helidon.tests.integration.tools.service.RemoteTestException; -import io.helidon.reactive.webserver.Routing; -import io.helidon.reactive.webserver.ServerRequest; -import io.helidon.reactive.webserver.ServerResponse; + +import jakarta.json.Json; +import jakarta.json.JsonObject; import static io.helidon.tests.integration.tools.service.AppResponse.exceptionStatus; diff --git a/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/statement/DmlStatementService.java b/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/statement/DmlStatementService.java index 8cd35f54c7e..15dca7b0819 100644 --- a/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/statement/DmlStatementService.java +++ b/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/statement/DmlStatementService.java @@ -22,18 +22,18 @@ import java.util.function.Function; import java.util.logging.Logger; -import jakarta.json.Json; -import jakarta.json.JsonObject; - import io.helidon.common.reactive.Single; import io.helidon.reactive.dbclient.DbClient; +import io.helidon.reactive.webserver.Routing; +import io.helidon.reactive.webserver.ServerRequest; +import io.helidon.reactive.webserver.ServerResponse; import io.helidon.tests.integration.dbclient.appl.AbstractService; import io.helidon.tests.integration.dbclient.appl.model.Pokemon; import io.helidon.tests.integration.tools.service.AppResponse; import io.helidon.tests.integration.tools.service.RemoteTestException; -import io.helidon.reactive.webserver.Routing; -import io.helidon.reactive.webserver.ServerRequest; -import io.helidon.reactive.webserver.ServerResponse; + +import jakarta.json.Json; +import jakarta.json.JsonObject; import static io.helidon.tests.integration.tools.service.AppResponse.exceptionStatus; diff --git a/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/statement/GetStatementService.java b/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/statement/GetStatementService.java index 2193bbe2b11..084e71341ce 100644 --- a/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/statement/GetStatementService.java +++ b/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/statement/GetStatementService.java @@ -23,18 +23,18 @@ import java.util.function.BiFunction; import java.util.logging.Logger; -import jakarta.json.JsonObject; - import io.helidon.common.reactive.Single; import io.helidon.reactive.dbclient.DbClient; import io.helidon.reactive.dbclient.DbRow; +import io.helidon.reactive.webserver.Routing; +import io.helidon.reactive.webserver.ServerRequest; +import io.helidon.reactive.webserver.ServerResponse; import io.helidon.tests.integration.dbclient.appl.AbstractService; import io.helidon.tests.integration.dbclient.appl.model.RangePoJo; import io.helidon.tests.integration.tools.service.AppResponse; import io.helidon.tests.integration.tools.service.RemoteTestException; -import io.helidon.reactive.webserver.Routing; -import io.helidon.reactive.webserver.ServerRequest; -import io.helidon.reactive.webserver.ServerResponse; + +import jakarta.json.JsonObject; import static io.helidon.tests.integration.tools.service.AppResponse.exceptionStatus; diff --git a/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/statement/QueryStatementService.java b/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/statement/QueryStatementService.java index 0e1363215c7..4becd73a459 100644 --- a/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/statement/QueryStatementService.java +++ b/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/statement/QueryStatementService.java @@ -22,19 +22,19 @@ import java.util.function.BiFunction; import java.util.logging.Logger; -import jakarta.json.Json; -import jakarta.json.JsonArrayBuilder; -import jakarta.json.JsonObject; - import io.helidon.common.reactive.Multi; import io.helidon.reactive.dbclient.DbClient; import io.helidon.reactive.dbclient.DbRow; -import io.helidon.tests.integration.dbclient.appl.AbstractService; -import io.helidon.tests.integration.dbclient.appl.model.RangePoJo; -import io.helidon.tests.integration.tools.service.RemoteTestException; import io.helidon.reactive.webserver.Routing; import io.helidon.reactive.webserver.ServerRequest; import io.helidon.reactive.webserver.ServerResponse; +import io.helidon.tests.integration.dbclient.appl.AbstractService; +import io.helidon.tests.integration.dbclient.appl.model.RangePoJo; +import io.helidon.tests.integration.tools.service.RemoteTestException; + +import jakarta.json.Json; +import jakarta.json.JsonArrayBuilder; +import jakarta.json.JsonObject; import static io.helidon.tests.integration.tools.service.AppResponse.exceptionStatus; import static io.helidon.tests.integration.tools.service.AppResponse.okStatus; diff --git a/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/tools/ExitService.java b/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/tools/ExitService.java index b8228627c69..bc89c5b41b8 100644 --- a/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/tools/ExitService.java +++ b/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/tools/ExitService.java @@ -18,12 +18,12 @@ import java.util.logging.Logger; import io.helidon.common.http.HttpMediaType; -import io.helidon.tests.integration.dbclient.appl.InitService; import io.helidon.reactive.webserver.Routing; import io.helidon.reactive.webserver.ServerRequest; import io.helidon.reactive.webserver.ServerResponse; import io.helidon.reactive.webserver.Service; import io.helidon.reactive.webserver.WebServer; +import io.helidon.tests.integration.dbclient.appl.InitService; /** * Web resource to terminate web server. @@ -51,7 +51,7 @@ public void setServer(final WebServer server) { * @return {@code null} value */ public String exit(final ServerRequest request, final ServerResponse response) { - response.headers().contentType(MediaType.TEXT_PLAIN); + response.headers().contentType(HttpMediaType.TEXT_PLAIN); response.send("Testing web application shutting down."); ExitThread.start(server); return null; diff --git a/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/transaction/TransactionDeleteService.java b/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/transaction/TransactionDeleteService.java index 9dc2d7d8255..db2935ffe54 100644 --- a/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/transaction/TransactionDeleteService.java +++ b/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/transaction/TransactionDeleteService.java @@ -19,17 +19,17 @@ import java.util.function.Function; import java.util.logging.Logger; -import jakarta.json.Json; -import jakarta.json.JsonObject; - import io.helidon.common.reactive.Single; import io.helidon.reactive.dbclient.DbClient; -import io.helidon.tests.integration.dbclient.appl.AbstractService; -import io.helidon.tests.integration.tools.service.AppResponse; -import io.helidon.tests.integration.tools.service.RemoteTestException; import io.helidon.reactive.webserver.Routing; import io.helidon.reactive.webserver.ServerRequest; import io.helidon.reactive.webserver.ServerResponse; +import io.helidon.tests.integration.dbclient.appl.AbstractService; +import io.helidon.tests.integration.tools.service.AppResponse; +import io.helidon.tests.integration.tools.service.RemoteTestException; + +import jakarta.json.Json; +import jakarta.json.JsonObject; import static io.helidon.tests.integration.tools.service.AppResponse.exceptionStatus; diff --git a/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/transaction/TransactionGetService.java b/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/transaction/TransactionGetService.java index 2fa87d36351..da3e0b0efef 100644 --- a/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/transaction/TransactionGetService.java +++ b/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/transaction/TransactionGetService.java @@ -20,17 +20,17 @@ import java.util.function.Function; import java.util.logging.Logger; -import jakarta.json.JsonObject; - import io.helidon.common.reactive.Single; import io.helidon.reactive.dbclient.DbClient; import io.helidon.reactive.dbclient.DbRow; -import io.helidon.tests.integration.dbclient.appl.AbstractService; -import io.helidon.tests.integration.tools.service.AppResponse; -import io.helidon.tests.integration.tools.service.RemoteTestException; import io.helidon.reactive.webserver.Routing; import io.helidon.reactive.webserver.ServerRequest; import io.helidon.reactive.webserver.ServerResponse; +import io.helidon.tests.integration.dbclient.appl.AbstractService; +import io.helidon.tests.integration.tools.service.AppResponse; +import io.helidon.tests.integration.tools.service.RemoteTestException; + +import jakarta.json.JsonObject; import static io.helidon.tests.integration.tools.service.AppResponse.exceptionStatus; diff --git a/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/transaction/TransactionInsertService.java b/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/transaction/TransactionInsertService.java index 0f1c1f26227..9fa99dc64e8 100644 --- a/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/transaction/TransactionInsertService.java +++ b/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/transaction/TransactionInsertService.java @@ -20,18 +20,18 @@ import java.util.function.Function; import java.util.logging.Logger; -import jakarta.json.JsonObject; - import io.helidon.common.reactive.Single; import io.helidon.reactive.dbclient.DbClient; +import io.helidon.reactive.webserver.Routing; +import io.helidon.reactive.webserver.ServerRequest; +import io.helidon.reactive.webserver.ServerResponse; import io.helidon.tests.integration.dbclient.appl.AbstractService; import io.helidon.tests.integration.dbclient.appl.model.Pokemon; import io.helidon.tests.integration.dbclient.appl.model.Type; import io.helidon.tests.integration.tools.service.AppResponse; import io.helidon.tests.integration.tools.service.RemoteTestException; -import io.helidon.reactive.webserver.Routing; -import io.helidon.reactive.webserver.ServerRequest; -import io.helidon.reactive.webserver.ServerResponse; + +import jakarta.json.JsonObject; import static io.helidon.tests.integration.dbclient.appl.model.Type.TYPES; diff --git a/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/transaction/TransactionQueriesService.java b/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/transaction/TransactionQueriesService.java index 4f58629739a..548217154ec 100644 --- a/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/transaction/TransactionQueriesService.java +++ b/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/transaction/TransactionQueriesService.java @@ -19,19 +19,19 @@ import java.util.function.Function; import java.util.logging.Logger; -import jakarta.json.Json; -import jakarta.json.JsonArrayBuilder; -import jakarta.json.JsonObject; - import io.helidon.common.reactive.Multi; import io.helidon.reactive.dbclient.DbClient; import io.helidon.reactive.dbclient.DbRow; -import io.helidon.tests.integration.dbclient.appl.AbstractService; -import io.helidon.tests.integration.tools.service.AppResponse; -import io.helidon.tests.integration.tools.service.RemoteTestException; import io.helidon.reactive.webserver.Routing; import io.helidon.reactive.webserver.ServerRequest; import io.helidon.reactive.webserver.ServerResponse; +import io.helidon.tests.integration.dbclient.appl.AbstractService; +import io.helidon.tests.integration.tools.service.AppResponse; +import io.helidon.tests.integration.tools.service.RemoteTestException; + +import jakarta.json.Json; +import jakarta.json.JsonArrayBuilder; +import jakarta.json.JsonObject; import static io.helidon.tests.integration.tools.service.AppResponse.exceptionStatus; diff --git a/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/transaction/TransactionUpdateService.java b/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/transaction/TransactionUpdateService.java index 9834fc93999..afc73da4e7f 100644 --- a/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/transaction/TransactionUpdateService.java +++ b/tests/integration/dbclient/appl/src/main/java/io/helidon/tests/integration/dbclient/appl/transaction/TransactionUpdateService.java @@ -19,18 +19,18 @@ import java.util.function.Function; import java.util.logging.Logger; -import jakarta.json.Json; -import jakarta.json.JsonObject; - import io.helidon.common.reactive.Single; import io.helidon.reactive.dbclient.DbClient; +import io.helidon.reactive.webserver.Routing; +import io.helidon.reactive.webserver.ServerRequest; +import io.helidon.reactive.webserver.ServerResponse; import io.helidon.tests.integration.dbclient.appl.AbstractService; import io.helidon.tests.integration.dbclient.appl.model.Pokemon; import io.helidon.tests.integration.tools.service.AppResponse; import io.helidon.tests.integration.tools.service.RemoteTestException; -import io.helidon.reactive.webserver.Routing; -import io.helidon.reactive.webserver.ServerRequest; -import io.helidon.reactive.webserver.ServerResponse; + +import jakarta.json.Json; +import jakarta.json.JsonObject; import static io.helidon.tests.integration.tools.service.AppResponse.exceptionStatus; diff --git a/tests/integration/dbclient/appl/src/main/resources/h2.yaml b/tests/integration/dbclient/appl/src/main/resources/h2.yaml new file mode 100644 index 00000000000..4371f61cd67 --- /dev/null +++ b/tests/integration/dbclient/appl/src/main/resources/h2.yaml @@ -0,0 +1,84 @@ +# +# Copyright (c) 2022 Oracle and/or its affiliates. +# +# 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. +# + +server: + port: 0 + host: 0.0.0.0 + +db: + source: jdbc + connection: + url: ${db.url} + username: ${db.user} + password: ${db.password} + health-check: + type: query + statement: "SELECT 0" + statements: + # custom query ping statement + ping-query: "SELECT 0" + # database schema drop statements + drop-types: "DROP TABLE Types" + drop-pokemons: "DROP TABLE Pokemons" + drop-poketypes: "DROP TABLE PokemonTypes" + # database schema initialization statements + create-types: "CREATE TABLE Types (id INTEGER NOT NULL PRIMARY KEY, name VARCHAR(64) NOT NULL)" + create-pokemons: "CREATE TABLE Pokemons (id INTEGER NOT NULL PRIMARY KEY, name VARCHAR(64) NOT NULL)" + create-poketypes: "CREATE TABLE PokemonTypes (id_pokemon INTEGER NOT NULL, id_type INTEGER NOT NULL REFERENCES Types(id))" + # database schema cleanup statements + drop-types: "DROP TABLE Types" + drop-pokemons: "DROP TABLE Pokemons" + drop-poketypes: "DROP TABLE PokemonTypes" + # data initialization statements + insert-type: "INSERT INTO Types(id, name) VALUES(?, ?)" + insert-pokemon: "INSERT INTO Pokemons(id, name) VALUES(?, ?)" + insert-poketype: "INSERT INTO PokemonTypes(id_pokemon, id_type) VALUES(?, ?)" + # data initialization verification statements + select-types: "SELECT id, name FROM Types" + select-pokemons: "SELECT id, name FROM Pokemons" + select-poketypes: "SELECT id_pokemon, id_type FROM PokemonTypes p WHERE id_pokemon = ?" + # data cleanup verification statements + select-poketypes-all: "SELECT id_pokemon, id_type FROM PokemonTypes" + # retrieve max. Pokemon ID + select-max-id: "SELECT MAX(id) FROM Pokemons" + # test queries + select-pokemon-named-arg: "SELECT id, name FROM Pokemons WHERE name=:name" + select-pokemon-order-arg: "SELECT id, name FROM Pokemons WHERE name=?" + # test DML insert + insert-pokemon-named-arg: "INSERT INTO Pokemons(id, name) VALUES(:id, :name)" + insert-pokemon-order-arg: "INSERT INTO Pokemons(id, name) VALUES(?, ?)" + # Pokemon mapper uses reverse order of indexed arguments + insert-pokemon-order-arg-rev: "INSERT INTO Pokemons(name, id) VALUES(?, ?)" + # test DML update + select-pokemon-by-id: "SELECT id, name FROM Pokemons WHERE id=?" + update-pokemon-named-arg: "UPDATE Pokemons SET name=:name WHERE id=:id" + update-pokemon-order-arg: "UPDATE Pokemons SET name=? WHERE id=?" + # test DML delete + delete-pokemon-named-arg: "DELETE FROM Pokemons WHERE id=:id" + delete-pokemon-order-arg: "DELETE FROM Pokemons WHERE id=?" + # Pokemon mapper uses full list of attributes + delete-pokemon-full-named-arg: "DELETE FROM Pokemons WHERE name=:name AND id=:id" + delete-pokemon-full-order-arg: "DELETE FROM Pokemons WHERE name=? AND id=?" + # test DbStatementQuery methods + select-pokemons-idrng-named-arg: "SELECT id, name FROM Pokemons WHERE id > :idmin AND id < :idmax" + select-pokemons-idrng-order-arg: "SELECT id, name FROM Pokemons WHERE id > ? AND id < ?" + # Test query with both named and ordered parameters (shall cause an exception) + select-pokemons-error-arg: "SELECT id, name FROM Pokemons WHERE id > :id AND name = ?" + +# Tests configuration +test: + # Whether database supports ping statement as DML (default value is true) + ping-dml: false diff --git a/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/ApplInitIT.java b/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/ApplInitIT.java index c9d78c09877..c4f5b6ca9af 100644 --- a/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/ApplInitIT.java +++ b/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/ApplInitIT.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Oracle and/or its affiliates. + * Copyright (c) 2021, 2022 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,11 +15,7 @@ */ package io.helidon.tests.integration.dbclient.appl.it; -import java.util.logging.Level; -import java.util.logging.Logger; - -import jakarta.json.JsonObject; -import jakarta.json.JsonValue; +import java.lang.System.Logger.Level; import io.helidon.tests.integration.dbclient.appl.it.tools.JsonTools; import io.helidon.tests.integration.tools.client.HelidonProcessRunner; @@ -27,6 +23,8 @@ import io.helidon.tests.integration.tools.client.TestClient; import io.helidon.tests.integration.tools.client.TestServiceClient; +import jakarta.json.JsonObject; +import jakarta.json.JsonValue; import org.junit.jupiter.api.MethodOrderer.OrderAnnotation; import org.junit.jupiter.api.Order; import org.junit.jupiter.api.Test; @@ -38,7 +36,7 @@ @TestMethodOrder(OrderAnnotation.class) public class ApplInitIT { - private static final Logger LOGGER = Logger.getLogger(ApplInitIT.class.getName()); + private static final System.Logger LOGGER = System.getLogger(ApplInitIT.class.getName()); private final TestServiceClient testClient = TestClient.builder() .port(HelidonProcessRunner.HTTP_PORT) @@ -48,19 +46,19 @@ public class ApplInitIT { // Test executor methods private void executeTest(final String testName) { - LOGGER.fine(() -> String.format("Running %s", testName)); + LOGGER.log(Level.INFO, () -> String.format("Running %s", testName)); JsonObject data = testClient .callServiceAndGetData(testName) .asJsonObject(); - LogData.logJsonObject(Level.FINER, data); + LogData.logJsonObject(Level.DEBUG, data); } private void executeInit(final String testName) { - LOGGER.fine(() -> String.format("Running %s", testName)); + LOGGER.log(Level.INFO, () -> String.format("Running %s", testName)); JsonValue data = testClient .callServiceAndGetData(testName); Long count = JsonTools.getLong(data); - LOGGER.finer(() -> String.format("Rows modified: %d", count)); + LOGGER.log(Level.DEBUG, () -> String.format("Rows modified: %d", count)); } @Test @@ -75,37 +73,32 @@ public void testHealthCheck() { executeTest("testPing"); } - @Test - @Order(3) + // Called from LifeCycleExtension in setup phase public void testDropSchema() { try { executeInit("testDropSchema"); // This remote call will fail on fresh database without existing tables. } catch (HelidonTestException ex){ - LOGGER.info(() -> "Remote database tables did not exist."); + LOGGER.log(Level.INFO, () -> "Remote database tables did not exist."); } } - @Test - @Order(4) + // Called from LifeCycleExtension in setup phase public void testInitSchema() { executeInit("testInitSchema"); } - @Test - @Order(5) + // Called from LifeCycleExtension in setup phase public void testInitTypes() { executeInit("testInitTypes"); } - @Test - @Order(6) + // Called from LifeCycleExtension in setup phase public void testInitPokemons() { executeInit("testInitPokemons"); } - @Test - @Order(7) + // Called from LifeCycleExtension in setup phase public void testInitPokemonTypes() { executeInit("testInitPokemonTypes"); } diff --git a/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/LogData.java b/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/LogData.java index 41810947526..4c093dd4c7b 100644 --- a/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/LogData.java +++ b/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/LogData.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Oracle and/or its affiliates. + * Copyright (c) 2021, 2022 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,8 +15,7 @@ */ package io.helidon.tests.integration.dbclient.appl.it; -import java.util.logging.Level; -import java.util.logging.Logger; +import java.lang.System.Logger.Level; import jakarta.json.JsonArray; import jakarta.json.JsonObject; @@ -26,7 +25,7 @@ */ public class LogData { - private static final Logger LOGGER = Logger.getLogger(LogData.class.getName()); + private static final System.Logger LOGGER = System.getLogger(LogData.class.getName()); /** * Log JSON object in human readable form. diff --git a/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/VerifyData.java b/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/VerifyData.java index e0ec1e6a7cb..b826055d0bc 100644 --- a/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/VerifyData.java +++ b/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/VerifyData.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Oracle and/or its affiliates. + * Copyright (c) 2021, 2022 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,12 +17,12 @@ import java.util.logging.Logger; -import jakarta.json.JsonObject; - import io.helidon.tests.integration.dbclient.appl.model.Pokemon; import io.helidon.tests.integration.dbclient.appl.tools.QueryParams; import io.helidon.tests.integration.tools.client.TestClient; +import jakarta.json.JsonObject; + import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.notNullValue; diff --git a/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/health/HealthCheckIT.java b/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/health/HealthCheckIT.java index 48ada399802..12dfc4f362a 100644 --- a/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/health/HealthCheckIT.java +++ b/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/health/HealthCheckIT.java @@ -15,10 +15,7 @@ */ package io.helidon.tests.integration.dbclient.appl.it.health; -import java.util.logging.Level; -import java.util.logging.Logger; - -import jakarta.json.JsonObject; +import java.lang.System.Logger.Level; import io.helidon.tests.integration.dbclient.appl.it.LogData; import io.helidon.tests.integration.dbclient.appl.tools.QueryParams; @@ -26,6 +23,7 @@ import io.helidon.tests.integration.tools.client.TestClient; import io.helidon.tests.integration.tools.client.TestServiceClient; +import jakarta.json.JsonObject; import org.eclipse.microprofile.health.HealthCheckResponse; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; @@ -39,7 +37,7 @@ @TestInstance(TestInstance.Lifecycle.PER_CLASS) public class HealthCheckIT { - private static final Logger LOGGER = Logger.getLogger(HealthCheckIT.class.getName()); + private static final System.Logger LOGGER = System.getLogger(HealthCheckIT.class.getName()); private final TestServiceClient testClient = TestClient.builder() .port(HelidonProcessRunner.HTTP_PORT) @@ -51,18 +49,18 @@ public class HealthCheckIT { @BeforeAll public void setup() { - LOGGER.info(() -> "Running HealthCheckIT setup"); + LOGGER.log(Level.INFO, () -> "Running HealthCheckIT setup"); final JsonObject dbTypeValue = testClient .callServiceAndGetData("Verify", "getDatabaseType", null) .asJsonObject(); - LogData.logJsonObject(Level.FINER, dbTypeValue); + LogData.logJsonObject(Level.DEBUG, dbTypeValue); dbType = dbTypeValue.getString("type"); final JsonObject pingDmlValue = testClient .callServiceAndGetData( "Verify", "getConfigParam", QueryParams.single(QueryParams.NAME, "test.ping-dml")) .asJsonObject(); - LogData.logJsonObject(Level.FINER, pingDmlValue); + LogData.logJsonObject(Level.DEBUG, pingDmlValue); if (pingDmlValue.containsKey("config")) { pingDml = Boolean.parseBoolean(pingDmlValue.getString("config")); } @@ -73,11 +71,11 @@ public void setup() { */ @Test public void testHealthCheck() { - LOGGER.info(() -> "Running test testHealthCheck"); + LOGGER.log(Level.INFO, () -> "Running test testHealthCheck"); JsonObject data = testClient .callServiceAndGetData("testHealthCheck") .asJsonObject(); - LogData.logJsonObject(Level.FINER, data); + LogData.logJsonObject(Level.DEBUG, data); assertThat(data.getString("status"), equalTo(HealthCheckResponse.Status.UP.name())); } @@ -86,14 +84,14 @@ public void testHealthCheck() { */ @Test public void testHealthCheckWithName() { - LOGGER.info(() -> "Running test testHealthCheckWithName"); + LOGGER.log(Level.INFO, () -> "Running test testHealthCheckWithName"); final String hcName = "TestHC"; JsonObject data = testClient .callServiceAndGetData( "testHealthCheckWithName", QueryParams.single(QueryParams.NAME, hcName)) .asJsonObject(); - LogData.logJsonObject(Level.FINER, data); + LogData.logJsonObject(Level.DEBUG, data); assertThat(data.getString("status"), equalTo(HealthCheckResponse.Status.UP.name())); assertThat(data.getString("name"), equalTo(hcName)); } @@ -103,15 +101,15 @@ public void testHealthCheckWithName() { */ @Test public void testHealthCheckWithCustomNamedDML() { - LOGGER.info(() -> "Running test testHealthCheckWithCustomNamedDML"); + LOGGER.log(Level.INFO, () -> "Running test testHealthCheckWithCustomNamedDML"); if (!pingDml) { - LOGGER.info(() -> String.format("Database %s does not support DML ping, skipping this test", dbType)); + LOGGER.log(Level.INFO, () -> String.format("Database %s does not support DML ping, skipping this test", dbType)); return; } JsonObject data = testClient .callServiceAndGetData("testHealthCheckWithCustomNamedDML") .asJsonObject(); - LogData.logJsonObject(Level.FINER, data); + LogData.logJsonObject(Level.DEBUG, data); assertThat(data.getString("status"), equalTo(HealthCheckResponse.Status.UP.name())); } @@ -120,15 +118,15 @@ public void testHealthCheckWithCustomNamedDML() { */ @Test public void testHealthCheckWithCustomDML() { - LOGGER.info(() -> "Running test testHealthCheckWithCustomDML"); + LOGGER.log(Level.INFO, () -> "Running test testHealthCheckWithCustomDML"); if (!pingDml) { - LOGGER.info(() -> String.format("Database %s does not support DML ping, skipping this test", dbType)); + LOGGER.log(Level.INFO, () -> String.format("Database %s does not support DML ping, skipping this test", dbType)); return; } JsonObject data = testClient .callServiceAndGetData("testHealthCheckWithCustomDML") .asJsonObject(); - LogData.logJsonObject(Level.FINER, data); + LogData.logJsonObject(Level.DEBUG, data); assertThat(data.getString("status"), equalTo(HealthCheckResponse.Status.UP.name())); } @@ -137,11 +135,11 @@ public void testHealthCheckWithCustomDML() { */ @Test public void testHealthCheckWithCustomNamedQuery() { - LOGGER.info(() -> "Running test testHealthCheckWithCustomNamedQuery"); + LOGGER.log(Level.INFO, () -> "Running test testHealthCheckWithCustomNamedQuery"); JsonObject data = testClient .callServiceAndGetData("testHealthCheckWithCustomNamedQuery") .asJsonObject(); - LogData.logJsonObject(Level.FINER, data); + LogData.logJsonObject(Level.DEBUG, data); assertThat(data.getString("status"), equalTo(HealthCheckResponse.Status.UP.name())); } @@ -150,11 +148,11 @@ public void testHealthCheckWithCustomNamedQuery() { */ @Test public void testHealthCheckWithCustomQuery() { - LOGGER.info(() -> "Running test testHealthCheckWithCustomQuery"); + LOGGER.log(Level.INFO, () -> "Running test testHealthCheckWithCustomQuery"); JsonObject data = testClient .callServiceAndGetData("testHealthCheckWithCustomQuery") .asJsonObject(); - LogData.logJsonObject(Level.FINER, data); + LogData.logJsonObject(Level.DEBUG, data); assertThat(data.getString("status"), equalTo(HealthCheckResponse.Status.UP.name())); } diff --git a/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/mapping/MapperIT.java b/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/mapping/MapperIT.java index 7c1d7242b8a..ab962dd91cf 100644 --- a/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/mapping/MapperIT.java +++ b/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/mapping/MapperIT.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Oracle and/or its affiliates. + * Copyright (c) 2021, 2022 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,12 +15,7 @@ */ package io.helidon.tests.integration.dbclient.appl.it.mapping; -import java.util.logging.Level; -import java.util.logging.Logger; - -import jakarta.json.JsonArray; -import jakarta.json.JsonObject; -import jakarta.json.JsonValue; +import java.lang.System.Logger.Level; import io.helidon.tests.integration.dbclient.appl.it.LogData; import io.helidon.tests.integration.dbclient.appl.it.VerifyData; @@ -31,6 +26,9 @@ import io.helidon.tests.integration.tools.client.TestClient; import io.helidon.tests.integration.tools.client.TestServiceClient; +import jakarta.json.JsonArray; +import jakarta.json.JsonObject; +import jakarta.json.JsonValue; import org.junit.jupiter.api.Test; import static org.hamcrest.MatcherAssert.assertThat; @@ -43,7 +41,7 @@ */ public class MapperIT { - private static final Logger LOGGER = Logger.getLogger(MapperIT.class.getName()); + private static final System.Logger LOGGER = System.getLogger(MapperIT.class.getName()); private final TestServiceClient testClient = TestClient.builder() .port(HelidonProcessRunner.HTTP_PORT) @@ -51,23 +49,23 @@ public class MapperIT { .build(); private void executeInsertTest(final String testName, final int id) { - LOGGER.fine(() -> String.format("Running %s", testName)); + LOGGER.log(Level.INFO, () -> String.format("Running %s", testName)); try { JsonObject data = testClient.callServiceAndGetData( testName, QueryParams.single(QueryParams.ID, String.valueOf(id))) .asJsonObject(); - LogData.logJsonObject(Level.FINER, data); + LogData.logJsonObject(Level.DEBUG, data); JsonObject pokemonData = VerifyData.getPokemon(testClient, id); - LogData.logJsonObject(Level.FINER, pokemonData); + LogData.logJsonObject(Level.DEBUG, pokemonData); VerifyData.verifyPokemon(pokemonData, data); } catch (Exception e) { - LOGGER.log(Level.WARNING, e, () -> String.format("Exception in %s: %s", testName, e.getMessage())); + LOGGER.log(Level.WARNING, () -> String.format("Exception in %s: %s", testName, e.getMessage()), e); } } private void executeUpdateTest(final String testName, final int id, final String newName) { - LOGGER.fine(() -> String.format("Running %s", testName)); + LOGGER.log(Level.INFO, () -> String.format("Running %s", testName)); try { Pokemon pokemon = Pokemon.POKEMONS.get(id); Pokemon updatedPokemon = new Pokemon(pokemon.getId(), newName, pokemon.getTypes()); @@ -78,31 +76,31 @@ private void executeUpdateTest(final String testName, final int id, final String .add(QueryParams.ID, String.valueOf(id)) .build()); Long count = JsonTools.getLong(data); - LOGGER.fine(() -> String.format("Rows updated: %d", count)); + LOGGER.log(Level.DEBUG, () -> String.format("Rows updated: %d", count)); JsonObject pokemonData = VerifyData.getPokemon(testClient, pokemon.getId()); - LogData.logJsonObject(Level.FINER, pokemonData); + LogData.logJsonObject(Level.DEBUG, pokemonData); assertThat(count, equalTo(1L)); VerifyData.verifyPokemon(pokemonData, updatedPokemon); } catch (Exception e) { - LOGGER.log(Level.WARNING, e, () -> String.format("Exception in %s: %s", testName, e.getMessage())); + LOGGER.log(Level.WARNING, () -> String.format("Exception in %s: %s", testName, e.getMessage()), e); } } private void executeDeleteTest(final String testName, final int id) { - LOGGER.fine(() -> String.format("Running %s", testName)); + LOGGER.log(Level.INFO, () -> String.format("Running %s", testName)); try { JsonValue data = testClient.callServiceAndGetData( testName, QueryParams.single(QueryParams.ID, String.valueOf(id))) .asJsonObject(); Long count = JsonTools.getLong(data); - LOGGER.fine(() -> String.format("Rows deleted: %d", count)); + LOGGER.log(Level.DEBUG, () -> String.format("Rows deleted: %d", count)); JsonObject pokemonData = VerifyData.getPokemon(testClient, id); - LogData.logJsonObject(Level.FINER, pokemonData); + LogData.logJsonObject(Level.DEBUG, pokemonData); assertThat(count, equalTo(1)); assertThat(pokemonData.isEmpty(), equalTo(true)); } catch (Exception e) { - LOGGER.log(Level.WARNING, e, () -> String.format("Exception in %s: %s", testName, e.getMessage())); + LOGGER.log(Level.WARNING, () -> String.format("Exception in %s: %s", testName, e.getMessage()), e); } } @@ -161,13 +159,13 @@ public void testDeleteWithNamedMapping() { */ @Test public void testQueryWithMapping() { - LOGGER.fine(() -> "Running testQueryWithMapping"); + LOGGER.log(Level.INFO, () -> "Running testQueryWithMapping"); final Pokemon pokemon = Pokemon.POKEMONS.get(1); JsonArray data = testClient.callServiceAndGetData( "testQueryWithMapping", QueryParams.single(QueryParams.NAME, pokemon.getName())) .asJsonArray(); - LogData.logJsonArray(Level.FINER, data); + LogData.logJsonArray(Level.DEBUG, data); assertThat(data.size(), equalTo(1)); VerifyData.verifyPokemon(data.getJsonObject(0), pokemon); } @@ -177,13 +175,13 @@ public void testQueryWithMapping() { */ @Test public void testGetWithMapping() { - LOGGER.fine(() -> "Running testGetWithMapping"); + LOGGER.log(Level.INFO, () -> "Running testGetWithMapping"); final Pokemon pokemon = Pokemon.POKEMONS.get(2); JsonObject data = testClient.callServiceAndGetData( "testGetWithMapping", QueryParams.single(QueryParams.NAME, pokemon.getName()) ).asJsonObject(); - LogData.logJsonObject(Level.FINER, data); + LogData.logJsonObject(Level.DEBUG, data); VerifyData.verifyPokemon(data, pokemon); } diff --git a/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/metrics/ServerMetricsCheckIT.java b/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/metrics/ServerMetricsCheckIT.java index 66449123970..65177b4993d 100644 --- a/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/metrics/ServerMetricsCheckIT.java +++ b/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/metrics/ServerMetricsCheckIT.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Oracle and/or its affiliates. + * Copyright (c) 2021, 2022 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,14 +18,13 @@ import java.io.IOException; import java.util.logging.Logger; -import jakarta.json.JsonObject; -import jakarta.json.JsonValue; - import io.helidon.tests.integration.dbclient.appl.model.Pokemon; import io.helidon.tests.integration.dbclient.appl.tools.QueryParams; import io.helidon.tests.integration.tools.client.HelidonProcessRunner; import io.helidon.tests.integration.tools.client.TestClient; +import jakarta.json.JsonObject; +import jakarta.json.JsonValue; import org.junit.jupiter.api.Test; import static org.hamcrest.MatcherAssert.assertThat; diff --git a/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/result/FlowControlIT.java b/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/result/FlowControlIT.java index 1fd1a54223f..332f6df1169 100644 --- a/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/result/FlowControlIT.java +++ b/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/result/FlowControlIT.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Oracle and/or its affiliates. + * Copyright (c) 2021, 2022 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,16 +15,14 @@ */ package io.helidon.tests.integration.dbclient.appl.it.result; -import java.util.logging.Level; -import java.util.logging.Logger; - -import jakarta.json.JsonObject; +import java.lang.System.Logger.Level; import io.helidon.tests.integration.dbclient.appl.it.LogData; import io.helidon.tests.integration.tools.client.HelidonProcessRunner; import io.helidon.tests.integration.tools.client.TestClient; import io.helidon.tests.integration.tools.client.TestServiceClient; +import jakarta.json.JsonObject; import org.junit.jupiter.api.MethodOrderer; import org.junit.jupiter.api.Order; import org.junit.jupiter.api.Test; @@ -36,7 +34,7 @@ @TestMethodOrder(MethodOrderer.OrderAnnotation.class) public class FlowControlIT { - private static final Logger LOGGER = Logger.getLogger(FlowControlIT.class.getName()); + private static final System.Logger LOGGER = System.getLogger(FlowControlIT.class.getName()); private final TestServiceClient testClient = TestClient.builder() .port(HelidonProcessRunner.HTTP_PORT) @@ -45,14 +43,14 @@ public class FlowControlIT { // Test executor method private void executeTest(final String testName) { - LOGGER.fine(() -> String.format("Running %s", testName)); + LOGGER.log(Level.INFO, () -> String.format("Running %s", testName)); try { JsonObject data = testClient .callServiceAndGetData(testName) .asJsonObject(); - LogData.logJsonObject(Level.FINER, data); + LogData.logJsonObject(Level.DEBUG, data); } catch (Exception e) { - LOGGER.log(Level.WARNING, e, () -> String.format("Exception in %s: %s", testName, e.getMessage())); + LOGGER.log(Level.WARNING, () -> String.format("Exception in %s: %s", testName, e.getMessage()), e); } } diff --git a/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/simple/SimpleDeleteIT.java b/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/simple/SimpleDeleteIT.java index faaa5a4fbac..d0b422a15f4 100644 --- a/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/simple/SimpleDeleteIT.java +++ b/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/simple/SimpleDeleteIT.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Oracle and/or its affiliates. + * Copyright (c) 2021, 2022 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,11 +15,7 @@ */ package io.helidon.tests.integration.dbclient.appl.it.simple; -import java.util.logging.Level; -import java.util.logging.Logger; - -import jakarta.json.JsonObject; -import jakarta.json.JsonValue; +import java.lang.System.Logger.Level; import io.helidon.tests.integration.dbclient.appl.it.LogData; import io.helidon.tests.integration.dbclient.appl.it.VerifyData; @@ -29,6 +25,8 @@ import io.helidon.tests.integration.tools.client.TestClient; import io.helidon.tests.integration.tools.client.TestServiceClient; +import jakarta.json.JsonObject; +import jakarta.json.JsonValue; import org.junit.jupiter.api.Test; import static org.hamcrest.MatcherAssert.assertThat; @@ -39,7 +37,7 @@ */ public class SimpleDeleteIT { - private static final Logger LOGGER = Logger.getLogger(SimpleQueriesIT.class.getName()); + private static final System.Logger LOGGER = System.getLogger(SimpleQueriesIT.class.getName()); private final TestServiceClient testClient = TestClient.builder() .port(HelidonProcessRunner.HTTP_PORT) @@ -48,19 +46,19 @@ public class SimpleDeleteIT { // Test executor method private void executeTest(final String testName, final int id) { - LOGGER.fine(() -> String.format("Running %s", testName)); + LOGGER.log(Level.INFO, () -> String.format("Running %s", testName)); try { JsonValue data = testClient.callServiceAndGetData( testName, QueryParams.single(QueryParams.ID, String.valueOf(id))); Long count = JsonTools.getLong(data); - LOGGER.fine(() -> String.format("Rows deleted: %d", count)); + LOGGER.log(Level.DEBUG, () -> String.format("Rows deleted: %d", count)); JsonObject pokemonData = VerifyData.getPokemon(testClient, id); - LogData.logJsonObject(Level.FINER, pokemonData); + LogData.logJsonObject(Level.DEBUG, pokemonData); assertThat(count, equalTo(1L)); assertThat(pokemonData.isEmpty(), equalTo(true)); } catch (Exception e) { - LOGGER.log(Level.WARNING, e, () -> String.format("Exception in %s: %s", testName, e.getMessage())); + LOGGER.log(Level.WARNING, () -> String.format("Exception in %s: %s", testName, e.getMessage()), e); } } diff --git a/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/simple/SimpleGetIT.java b/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/simple/SimpleGetIT.java index 75a2f91c52f..3eb2519938a 100644 --- a/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/simple/SimpleGetIT.java +++ b/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/simple/SimpleGetIT.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Oracle and/or its affiliates. + * Copyright (c) 2021, 2022 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,10 +15,7 @@ */ package io.helidon.tests.integration.dbclient.appl.it.simple; -import java.util.logging.Level; -import java.util.logging.Logger; - -import jakarta.json.JsonObject; +import java.lang.System.Logger.Level; import io.helidon.tests.integration.dbclient.appl.it.LogData; import io.helidon.tests.integration.dbclient.appl.it.VerifyData; @@ -28,6 +25,7 @@ import io.helidon.tests.integration.tools.client.TestClient; import io.helidon.tests.integration.tools.client.TestServiceClient; +import jakarta.json.JsonObject; import org.junit.jupiter.api.Test; /** @@ -35,7 +33,7 @@ */ public class SimpleGetIT { - private static final Logger LOGGER = Logger.getLogger(SimpleGetIT.class.getName()); + private static final System.Logger LOGGER = System.getLogger(SimpleGetIT.class.getName()); private final TestServiceClient testClient = TestClient.builder() .port(HelidonProcessRunner.HTTP_PORT) @@ -44,12 +42,12 @@ public class SimpleGetIT { // Test executor method public void executeTest(final String testName, final Pokemon pokemon) { - LOGGER.fine(() -> String.format("Running %s", testName)); + LOGGER.log(Level.INFO, () -> String.format("Running %s", testName)); JsonObject data = testClient.callServiceAndGetData( testName, QueryParams.single(QueryParams.NAME, pokemon.getName()) ).asJsonObject(); - LogData.logJsonObject(Level.FINER, data); + LogData.logJsonObject(Level.DEBUG, data); VerifyData.verifyPokemon(data, pokemon); } diff --git a/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/simple/SimpleInsertIT.java b/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/simple/SimpleInsertIT.java index 26ba908f3b2..c4dee225c05 100644 --- a/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/simple/SimpleInsertIT.java +++ b/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/simple/SimpleInsertIT.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Oracle and/or its affiliates. + * Copyright (c) 2021, 2022 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,10 +15,7 @@ */ package io.helidon.tests.integration.dbclient.appl.it.simple; -import java.util.logging.Level; -import java.util.logging.Logger; - -import jakarta.json.JsonObject; +import java.lang.System.Logger.Level; import io.helidon.tests.integration.dbclient.appl.it.LogData; import io.helidon.tests.integration.dbclient.appl.it.VerifyData; @@ -27,6 +24,7 @@ import io.helidon.tests.integration.tools.client.TestClient; import io.helidon.tests.integration.tools.client.TestServiceClient; +import jakarta.json.JsonObject; import org.junit.jupiter.api.Test; /** @@ -34,7 +32,7 @@ */ public class SimpleInsertIT { - private static final Logger LOGGER = Logger.getLogger(SimpleQueriesIT.class.getName()); + private static final System.Logger LOGGER = System.getLogger(SimpleQueriesIT.class.getName()); private final TestServiceClient testClient = TestClient.builder() .port(HelidonProcessRunner.HTTP_PORT) @@ -43,18 +41,18 @@ public class SimpleInsertIT { // Test executor method private void executeTest(final String testName, final int id) { - LOGGER.fine(() -> String.format("Running %s", testName)); + LOGGER.log(Level.INFO, () -> String.format("Running %s", testName)); try { JsonObject data = testClient.callServiceAndGetData( testName, QueryParams.single(QueryParams.ID, String.valueOf(id))) .asJsonObject(); - LogData.logJsonObject(Level.FINER, data); + LogData.logJsonObject(Level.DEBUG, data); JsonObject pokemonData = VerifyData.getPokemon(testClient, id); - LogData.logJsonObject(Level.FINER, pokemonData); + LogData.logJsonObject(Level.DEBUG, pokemonData); VerifyData.verifyPokemon(pokemonData, data); } catch (Exception e) { - LOGGER.log(Level.WARNING, e, () -> String.format("Exception in %s: %s", testName, e.getMessage())); + LOGGER.log(Level.WARNING, () -> String.format("Exception in %s: %s", testName, e.getMessage()), e); } } diff --git a/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/simple/SimpleQueriesIT.java b/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/simple/SimpleQueriesIT.java index 326f6968fbf..f1c67173c31 100644 --- a/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/simple/SimpleQueriesIT.java +++ b/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/simple/SimpleQueriesIT.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Oracle and/or its affiliates. + * Copyright (c) 2021, 2022 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,10 +15,7 @@ */ package io.helidon.tests.integration.dbclient.appl.it.simple; -import java.util.logging.Level; -import java.util.logging.Logger; - -import jakarta.json.JsonArray; +import java.lang.System.Logger.Level; import io.helidon.tests.integration.dbclient.appl.it.LogData; import io.helidon.tests.integration.dbclient.appl.it.VerifyData; @@ -28,6 +25,7 @@ import io.helidon.tests.integration.tools.client.TestClient; import io.helidon.tests.integration.tools.client.TestServiceClient; +import jakarta.json.JsonArray; import org.hamcrest.Matchers; import org.junit.jupiter.api.Test; @@ -39,7 +37,7 @@ public class SimpleQueriesIT { /** Local logger instance. */ - static final Logger LOGGER = Logger.getLogger(SimpleQueriesIT.class.getName()); + static final System.Logger LOGGER = System.getLogger(SimpleQueriesIT.class.getName()); private final TestServiceClient testClient = TestClient.builder() .port(HelidonProcessRunner.HTTP_PORT) @@ -48,12 +46,12 @@ public class SimpleQueriesIT { // Test executor method private void executeTest(final String testName, final Pokemon pokemon) { - LOGGER.fine(() -> String.format("Running %s", testName)); + LOGGER.log(Level.INFO, () -> String.format("Running %s", testName)); JsonArray data = testClient.callServiceAndGetData( testName, QueryParams.single(QueryParams.NAME, pokemon.getName())) .asJsonArray(); - LogData.logJsonArray(Level.FINER, data); + LogData.logJsonArray(Level.DEBUG, data); assertThat(data.size(), Matchers.equalTo(1)); VerifyData.verifyPokemon(data.getJsonObject(0), pokemon); } diff --git a/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/simple/SimpleUpdateIT.java b/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/simple/SimpleUpdateIT.java index 010a13e819e..6d7fd8fa706 100644 --- a/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/simple/SimpleUpdateIT.java +++ b/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/simple/SimpleUpdateIT.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Oracle and/or its affiliates. + * Copyright (c) 2021, 2022 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,11 +15,7 @@ */ package io.helidon.tests.integration.dbclient.appl.it.simple; -import java.util.logging.Level; -import java.util.logging.Logger; - -import jakarta.json.JsonObject; -import jakarta.json.JsonValue; +import java.lang.System.Logger.Level; import io.helidon.tests.integration.dbclient.appl.it.LogData; import io.helidon.tests.integration.dbclient.appl.it.VerifyData; @@ -30,6 +26,8 @@ import io.helidon.tests.integration.tools.client.TestClient; import io.helidon.tests.integration.tools.client.TestServiceClient; +import jakarta.json.JsonObject; +import jakarta.json.JsonValue; import org.junit.jupiter.api.Test; import static org.hamcrest.MatcherAssert.assertThat; @@ -40,7 +38,7 @@ */ public class SimpleUpdateIT { - private static final Logger LOGGER = Logger.getLogger(SimpleQueriesIT.class.getName()); + private static final System.Logger LOGGER = System.getLogger(SimpleQueriesIT.class.getName()); private final TestServiceClient testClient = TestClient.builder() .port(HelidonProcessRunner.HTTP_PORT) @@ -49,7 +47,7 @@ public class SimpleUpdateIT { // Test executor method private void executeTest(final String testName, final int id, final String newName) { - LOGGER.fine(() -> String.format("Running %s", testName)); + LOGGER.log(Level.INFO, () -> String.format("Running %s", testName)); try { Pokemon pokemon = Pokemon.POKEMONS.get(id); Pokemon updatedPokemon = new Pokemon(pokemon.getId(), newName, pokemon.getTypes()); @@ -60,13 +58,13 @@ private void executeTest(final String testName, final int id, final String newNa .add(QueryParams.ID, String.valueOf(id)) .build()); Long count = JsonTools.getLong(data); - LOGGER.fine(() -> String.format("Rows updated: %d", count)); + LOGGER.log(Level.DEBUG, () -> String.format("Rows updated: %d", count)); JsonObject pokemonData = VerifyData.getPokemon(testClient, pokemon.getId()); - LogData.logJsonObject(Level.FINER, pokemonData); + LogData.logJsonObject(Level.DEBUG, pokemonData); assertThat(count, equalTo(1L)); VerifyData.verifyPokemon(pokemonData, updatedPokemon); } catch (Exception e) { - LOGGER.log(Level.WARNING, e, () -> String.format("Exception in %s: %s", testName, e.getMessage())); + LOGGER.log(Level.WARNING, () -> String.format("Exception in %s: %s", testName, e.getMessage()), e); } } diff --git a/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/statement/DmlStatementIT.java b/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/statement/DmlStatementIT.java index 7484d295e9c..ce06cff4d74 100644 --- a/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/statement/DmlStatementIT.java +++ b/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/statement/DmlStatementIT.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Oracle and/or its affiliates. + * Copyright (c) 2021, 2022 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,11 +15,7 @@ */ package io.helidon.tests.integration.dbclient.appl.it.statement; -import java.util.logging.Level; -import java.util.logging.Logger; - -import jakarta.json.JsonObject; -import jakarta.json.JsonValue; +import java.lang.System.Logger.Level; import io.helidon.tests.integration.dbclient.appl.it.LogData; import io.helidon.tests.integration.dbclient.appl.it.VerifyData; @@ -30,6 +26,8 @@ import io.helidon.tests.integration.tools.client.TestClient; import io.helidon.tests.integration.tools.client.TestServiceClient; +import jakarta.json.JsonObject; +import jakarta.json.JsonValue; import org.junit.jupiter.api.Test; import static org.hamcrest.MatcherAssert.assertThat; @@ -40,7 +38,7 @@ */ public class DmlStatementIT { - private static final Logger LOGGER = Logger.getLogger(DmlStatementIT.class.getName()); + private static final System.Logger LOGGER = System.getLogger(DmlStatementIT.class.getName()); private final TestServiceClient testClient = TestClient.builder() .port(HelidonProcessRunner.HTTP_PORT) @@ -49,7 +47,7 @@ public class DmlStatementIT { // Test executor method private void executeTest(final String testName, final int id, final String newName) { - LOGGER.fine(() -> String.format("Running %s", testName)); + LOGGER.log(Level.INFO, () -> String.format("Running %s", testName)); try { Pokemon pokemon = Pokemon.POKEMONS.get(id); Pokemon updatedPokemon = new Pokemon(pokemon.getId(), newName, pokemon.getTypes()); @@ -60,13 +58,13 @@ private void executeTest(final String testName, final int id, final String newNa .add(QueryParams.ID, String.valueOf(id)) .build()); Long count = JsonTools.getLong(data); - LOGGER.fine(() -> String.format("Rows modified: %d", count)); + LOGGER.log(Level.DEBUG, () -> String.format("Rows modified: %d", count)); JsonObject pokemonData = VerifyData.getPokemon(testClient, pokemon.getId()); - LogData.logJsonObject(Level.FINER, pokemonData); + LogData.logJsonObject(Level.DEBUG, pokemonData); assertThat(count, equalTo(1L)); VerifyData.verifyPokemon(pokemonData, updatedPokemon); } catch (Exception e) { - LOGGER.log(Level.WARNING, e, () -> String.format("Exception in %s: %s", testName, e.getMessage())); + LOGGER.log(Level.WARNING, () -> String.format("Exception in %s: %s", testName, e.getMessage()), e); } } diff --git a/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/statement/GetStatementIT.java b/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/statement/GetStatementIT.java index ea75f47c262..63b7a9d4efb 100644 --- a/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/statement/GetStatementIT.java +++ b/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/statement/GetStatementIT.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Oracle and/or its affiliates. + * Copyright (c) 2021, 2022 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,10 +15,7 @@ */ package io.helidon.tests.integration.dbclient.appl.it.statement; -import java.util.logging.Level; -import java.util.logging.Logger; - -import jakarta.json.JsonObject; +import java.lang.System.Logger.Level; import io.helidon.tests.integration.dbclient.appl.it.LogData; import io.helidon.tests.integration.dbclient.appl.it.VerifyData; @@ -28,6 +25,7 @@ import io.helidon.tests.integration.tools.client.TestClient; import io.helidon.tests.integration.tools.client.TestServiceClient; +import jakarta.json.JsonObject; import org.junit.jupiter.api.Test; import static org.hamcrest.MatcherAssert.assertThat; @@ -38,7 +36,7 @@ */ public class GetStatementIT { - private static final Logger LOGGER = Logger.getLogger(GetStatementIT.class.getName()); + private static final System.Logger LOGGER = System.getLogger(GetStatementIT.class.getName()); private final TestServiceClient testClient = TestClient.builder() .port(HelidonProcessRunner.HTTP_PORT) @@ -47,7 +45,7 @@ public class GetStatementIT { // Test executor method public void executeTest(final String testName, final int fromId, final int toId) { - LOGGER.fine(() -> String.format("Running %s", testName)); + LOGGER.log(Level.INFO, () -> String.format("Running %s", testName)); JsonObject data = testClient.callServiceAndGetData( testName, QueryParams.builder() @@ -55,7 +53,7 @@ public void executeTest(final String testName, final int fromId, final int toId) .add(QueryParams.TO_ID, String.valueOf(toId)) .build() ).asJsonObject(); - LogData.logJsonObject(Level.FINER, data); + LogData.logJsonObject(Level.DEBUG, data); int counter[] = { 0 }; Pokemon.POKEMONS.keySet().forEach(id -> { if (id > fromId && id < toId) { diff --git a/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/statement/QueryStatementIT.java b/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/statement/QueryStatementIT.java index c54b7883b8f..acc5a3acfe3 100644 --- a/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/statement/QueryStatementIT.java +++ b/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/statement/QueryStatementIT.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Oracle and/or its affiliates. + * Copyright (c) 2021, 2022 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,11 +15,7 @@ */ package io.helidon.tests.integration.dbclient.appl.it.statement; -import java.util.logging.Level; -import java.util.logging.Logger; - -import jakarta.json.JsonArray; -import jakarta.json.JsonObject; +import java.lang.System.Logger.Level; import io.helidon.tests.integration.dbclient.appl.it.LogData; import io.helidon.tests.integration.dbclient.appl.it.VerifyData; @@ -29,6 +25,8 @@ import io.helidon.tests.integration.tools.client.TestClient; import io.helidon.tests.integration.tools.client.TestServiceClient; +import jakarta.json.JsonArray; +import jakarta.json.JsonObject; import org.junit.jupiter.api.Test; import static org.hamcrest.MatcherAssert.assertThat; @@ -42,7 +40,7 @@ public class QueryStatementIT { /** Local logger instance. */ - static final Logger LOGGER = Logger.getLogger(QueryStatementIT.class.getName()); + static final System.Logger LOGGER = System.getLogger(QueryStatementIT.class.getName()); private final TestServiceClient testClient = TestClient.builder() .port(HelidonProcessRunner.HTTP_PORT) @@ -51,7 +49,7 @@ public class QueryStatementIT { // Test executor method private void executeTest(final String testName, final int fromId, final int toId) { - LOGGER.fine(() -> String.format("Running %s", testName)); + LOGGER.log(Level.INFO, () -> String.format("Running %s", testName)); JsonArray data = testClient.callServiceAndGetData( testName, QueryParams.builder() @@ -59,7 +57,7 @@ private void executeTest(final String testName, final int fromId, final int toId .add(QueryParams.TO_ID, String.valueOf(toId)) .build() ).asJsonArray(); - LogData.logJsonArray(Level.FINER, data); + LogData.logJsonArray(Level.DEBUG, data); assertThat(data.size(), equalTo(toId - fromId - 1)); data.getValuesAs(JsonObject.class).forEach(dataPokemon -> { int id = dataPokemon.getInt("id"); diff --git a/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/tools/LifeCycleExtension.java b/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/tools/LifeCycleExtension.java index 5fa3109c556..1b204ab9d05 100644 --- a/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/tools/LifeCycleExtension.java +++ b/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/tools/LifeCycleExtension.java @@ -15,26 +15,26 @@ */ package io.helidon.tests.integration.dbclient.appl.it.tools; +import java.lang.System.Logger.Level; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.util.concurrent.TimeUnit; -import java.util.logging.Level; -import java.util.logging.Logger; +import io.helidon.reactive.webclient.WebClient; +import io.helidon.reactive.webclient.WebClientResponse; import io.helidon.tests.integration.dbclient.appl.ApplMain; +import io.helidon.tests.integration.dbclient.appl.it.ApplInitIT; import io.helidon.tests.integration.tools.client.HelidonProcessRunner; import io.helidon.tests.integration.tools.client.HelidonProcessRunner.ExecType; import io.helidon.tests.integration.tools.client.TestsLifeCycleExtension; -import io.helidon.reactive.webclient.WebClient; -import io.helidon.reactive.webclient.WebClientResponse; /** * jUnit test life cycle extensions. */ public class LifeCycleExtension extends TestsLifeCycleExtension { - private static final Logger LOGGER = Logger.getLogger(LifeCycleExtension.class.getName()); + private static final System.Logger LOGGER = System.getLogger(LifeCycleExtension.class.getName()); /* Thread sleep time in miliseconds while waiting for database or appserver to come up. */ private static final int SLEEP_MILIS = 250; @@ -54,7 +54,7 @@ public LifeCycleExtension() { @Override public void check() { - LOGGER.fine("Running test application check()"); + LOGGER.log(Level.DEBUG, "Running test application check()"); waitForDatabase(); } @@ -63,7 +63,16 @@ public void check() { */ @Override public void setup() { - LOGGER.fine("Running test application setup()"); + LOGGER.log(Level.DEBUG, "Running test application setup()"); + // Call schema initialization services + if ("h2.yaml".equals(appConfigProperty)) { + ApplInitIT init = new ApplInitIT(); + init.testDropSchema(); + init.testInitSchema(); + init.testInitTypes(); + init.testInitPokemons(); + init.testInitPokemonTypes(); + } } /** @@ -72,7 +81,7 @@ public void setup() { */ @Override public void close() throws Throwable { - LOGGER.fine("Running test application close()"); + LOGGER.log(Level.DEBUG, "Running test application close()"); shutdown(); } @@ -118,19 +127,19 @@ public static void waitForDatabase() { long endTm = 1000 * TIMEOUT + System.currentTimeMillis(); while (true) { try { - LOGGER.finest(() -> String.format("Connection check: user=%s password=%s url=%s", dbUser, dbPassword, dbUrl)); + LOGGER.log(Level.DEBUG, () -> String.format("Connection check: user=%s password=%s url=%s", dbUser, dbPassword, dbUrl)); Connection conn = DriverManager.getConnection(dbUrl, dbUser, dbPassword); closeConnection(conn); return; } catch (SQLException ex) { - LOGGER.finest(() -> String.format("Connection check: %s", ex.getMessage())); + LOGGER.log(Level.DEBUG, () -> String.format("Connection check: %s", ex.getMessage())); if (System.currentTimeMillis() > endTm) { throw new IllegalStateException(String.format("Database is not ready within %d seconds", TIMEOUT)); } try { Thread.sleep(SLEEP_MILIS); } catch (InterruptedException ie) { - LOGGER.log(Level.WARNING, ie, () -> String.format("Thread was interrupted: %s", ie.getMessage())); + LOGGER.log(Level.WARNING, () -> String.format("Thread was interrupted: %s", ie.getMessage()), ie); } } } @@ -148,10 +157,10 @@ public void shutdown() { .path("/Exit") .submit() .await(1, TimeUnit.MINUTES); - LOGGER.info(() -> String.format( + LOGGER.log(Level.INFO, () -> String.format( "Status: %s", response.status())); - LOGGER.info(() -> String.format( + LOGGER.log(Level.INFO, () -> String.format( "Response: %s", response .content() @@ -164,7 +173,7 @@ private static void closeConnection(final Connection connection) { try { connection.close(); } catch (SQLException ex) { - LOGGER.warning(() -> String.format("Could not close database connection: %s", ex.getMessage())); + LOGGER.log(Level.WARNING, () -> String.format("Could not close database connection: %s", ex.getMessage())); } } diff --git a/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/transaction/TransactionDeleteIT.java b/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/transaction/TransactionDeleteIT.java index ab65c39deda..ad3e27c9c85 100644 --- a/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/transaction/TransactionDeleteIT.java +++ b/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/transaction/TransactionDeleteIT.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Oracle and/or its affiliates. + * Copyright (c) 2021, 2022 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,11 +15,7 @@ */ package io.helidon.tests.integration.dbclient.appl.it.transaction; -import java.util.logging.Level; -import java.util.logging.Logger; - -import jakarta.json.JsonObject; -import jakarta.json.JsonValue; +import java.lang.System.Logger.Level; import io.helidon.tests.integration.dbclient.appl.it.LogData; import io.helidon.tests.integration.dbclient.appl.it.VerifyData; @@ -29,6 +25,8 @@ import io.helidon.tests.integration.tools.client.TestClient; import io.helidon.tests.integration.tools.client.TestServiceClient; +import jakarta.json.JsonObject; +import jakarta.json.JsonValue; import org.junit.jupiter.api.Test; import static org.hamcrest.MatcherAssert.assertThat; @@ -39,7 +37,7 @@ */ public class TransactionDeleteIT { - private static final Logger LOGGER = Logger.getLogger(TransactionDeleteIT.class.getName()); + private static final System.Logger LOGGER = System.getLogger(TransactionDeleteIT.class.getName()); private final TestServiceClient testClient = TestClient.builder() .port(HelidonProcessRunner.HTTP_PORT) @@ -48,19 +46,19 @@ public class TransactionDeleteIT { // Test executor method private void executeTest(final String testName, final int id) { - LOGGER.fine(() -> String.format("Running %s", testName)); + LOGGER.log(Level.INFO, () -> String.format("Running %s", testName)); try { JsonValue data = testClient.callServiceAndGetData( testName, QueryParams.single(QueryParams.ID, String.valueOf(id))); Long count = JsonTools.getLong(data); - LOGGER.fine(() -> String.format("Rows deleted: %d", count)); + LOGGER.log(Level.DEBUG, () -> String.format("Rows deleted: %d", count)); JsonObject pokemonData = VerifyData.getPokemon(testClient, id); - LogData.logJsonObject(Level.FINER, pokemonData); + LogData.logJsonObject(Level.DEBUG, pokemonData); assertThat(count, equalTo(1L)); assertThat(pokemonData.isEmpty(), equalTo(true)); } catch (Exception e) { - LOGGER.log(Level.WARNING, e, () -> String.format("Exception in %s: %s", testName, e.getMessage())); + LOGGER.log(Level.WARNING, () -> String.format("Exception in %s: %s", testName, e.getMessage()), e); } } diff --git a/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/transaction/TransactionGetIT.java b/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/transaction/TransactionGetIT.java index 12afab1f132..48f41fd8556 100644 --- a/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/transaction/TransactionGetIT.java +++ b/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/transaction/TransactionGetIT.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Oracle and/or its affiliates. + * Copyright (c) 2021, 2022 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,10 +15,7 @@ */ package io.helidon.tests.integration.dbclient.appl.it.transaction; -import java.util.logging.Level; -import java.util.logging.Logger; - -import jakarta.json.JsonObject; +import java.lang.System.Logger.Level; import io.helidon.tests.integration.dbclient.appl.it.LogData; import io.helidon.tests.integration.dbclient.appl.it.VerifyData; @@ -28,6 +25,7 @@ import io.helidon.tests.integration.tools.client.TestClient; import io.helidon.tests.integration.tools.client.TestServiceClient; +import jakarta.json.JsonObject; import org.junit.jupiter.api.Test; /** @@ -35,7 +33,7 @@ */ public class TransactionGetIT { - private static final Logger LOGGER = Logger.getLogger(TransactionGetIT.class.getName()); + private static final System.Logger LOGGER = System.getLogger(TransactionGetIT.class.getName()); private final TestServiceClient testClient = TestClient.builder() .port(HelidonProcessRunner.HTTP_PORT) @@ -44,12 +42,12 @@ public class TransactionGetIT { // Test executor method public void executeTest(final String testName, final Pokemon pokemon) { - LOGGER.fine(() -> String.format("Running %s", testName)); + LOGGER.log(Level.INFO, () -> String.format("Running %s", testName)); JsonObject data = testClient.callServiceAndGetData( testName, QueryParams.single(QueryParams.NAME, pokemon.getName()) ).asJsonObject(); - LogData.logJsonObject(Level.FINER, data); + LogData.logJsonObject(Level.DEBUG, data); VerifyData.verifyPokemon(data, pokemon); } diff --git a/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/transaction/TransactionInsertIT.java b/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/transaction/TransactionInsertIT.java index d24cd52ecd5..156523f6048 100644 --- a/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/transaction/TransactionInsertIT.java +++ b/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/transaction/TransactionInsertIT.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Oracle and/or its affiliates. + * Copyright (c) 2021, 2022 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,10 +15,7 @@ */ package io.helidon.tests.integration.dbclient.appl.it.transaction; -import java.util.logging.Level; -import java.util.logging.Logger; - -import jakarta.json.JsonObject; +import java.lang.System.Logger.Level; import io.helidon.tests.integration.dbclient.appl.it.LogData; import io.helidon.tests.integration.dbclient.appl.it.VerifyData; @@ -27,6 +24,7 @@ import io.helidon.tests.integration.tools.client.TestClient; import io.helidon.tests.integration.tools.client.TestServiceClient; +import jakarta.json.JsonObject; import org.junit.jupiter.api.Test; /** @@ -34,7 +32,7 @@ */ public class TransactionInsertIT { - private static final Logger LOGGER = Logger.getLogger(TransactionInsertIT.class.getName()); + private static final System.Logger LOGGER = System.getLogger(TransactionInsertIT.class.getName()); private final TestServiceClient testClient = TestClient.builder() .port(HelidonProcessRunner.HTTP_PORT) @@ -43,18 +41,18 @@ public class TransactionInsertIT { // Test executor method private void executeTest(final String testName, final int id) { - LOGGER.fine(() -> String.format("Running %s", testName)); + LOGGER.log(Level.INFO, () -> String.format("Running %s", testName)); try { JsonObject data = testClient.callServiceAndGetData( testName, QueryParams.single(QueryParams.ID, String.valueOf(id))) .asJsonObject(); - LogData.logJsonObject(Level.FINER, data); + LogData.logJsonObject(Level.DEBUG, data); JsonObject pokemonData = VerifyData.getPokemon(testClient, id); - LogData.logJsonObject(Level.FINER, pokemonData); + LogData.logJsonObject(Level.DEBUG, pokemonData); VerifyData.verifyPokemon(pokemonData, data); } catch (Exception e) { - LOGGER.log(Level.WARNING, e, () -> String.format("Exception in %s: %s", testName, e.getMessage())); + LOGGER.log(Level.WARNING, () -> String.format("Exception in %s: %s", testName, e.getMessage()), e); } } diff --git a/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/transaction/TransactionQueriesIT.java b/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/transaction/TransactionQueriesIT.java index e52a31b1b3b..d996b427cef 100644 --- a/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/transaction/TransactionQueriesIT.java +++ b/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/transaction/TransactionQueriesIT.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Oracle and/or its affiliates. + * Copyright (c) 2021, 2022 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,10 +15,7 @@ */ package io.helidon.tests.integration.dbclient.appl.it.transaction; -import java.util.logging.Level; -import java.util.logging.Logger; - -import jakarta.json.JsonArray; +import java.lang.System.Logger.Level; import io.helidon.tests.integration.dbclient.appl.it.LogData; import io.helidon.tests.integration.dbclient.appl.it.VerifyData; @@ -28,6 +25,7 @@ import io.helidon.tests.integration.tools.client.TestClient; import io.helidon.tests.integration.tools.client.TestServiceClient; +import jakarta.json.JsonArray; import org.hamcrest.Matchers; import org.junit.jupiter.api.Test; @@ -39,7 +37,7 @@ public class TransactionQueriesIT { /** Local logger instance. */ - static final Logger LOGGER = Logger.getLogger(TransactionQueriesIT.class.getName()); + static final System.Logger LOGGER = System.getLogger(TransactionQueriesIT.class.getName()); private final TestServiceClient testClient = TestClient.builder() .port(HelidonProcessRunner.HTTP_PORT) @@ -48,12 +46,12 @@ public class TransactionQueriesIT { // Test executor method private void executeTest(final String testName, final Pokemon pokemon) { - LOGGER.fine(() -> String.format("Running %s", testName)); + LOGGER.log(Level.INFO, () -> String.format("Running %s", testName)); JsonArray data = testClient.callServiceAndGetData( testName, QueryParams.single(QueryParams.NAME, pokemon.getName())) .asJsonArray(); - LogData.logJsonArray(Level.FINER, data); + LogData.logJsonArray(Level.DEBUG, data); assertThat(data.size(), Matchers.equalTo(1)); VerifyData.verifyPokemon(data.getJsonObject(0), pokemon); } diff --git a/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/transaction/TransactionUpdateIT.java b/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/transaction/TransactionUpdateIT.java index a47bc7a4796..36cda198297 100644 --- a/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/transaction/TransactionUpdateIT.java +++ b/tests/integration/dbclient/appl/src/test/java/io/helidon/tests/integration/dbclient/appl/it/transaction/TransactionUpdateIT.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Oracle and/or its affiliates. + * Copyright (c) 2021, 2022 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,11 +15,7 @@ */ package io.helidon.tests.integration.dbclient.appl.it.transaction; -import java.util.logging.Level; -import java.util.logging.Logger; - -import jakarta.json.JsonObject; -import jakarta.json.JsonValue; +import java.lang.System.Logger.Level; import io.helidon.tests.integration.dbclient.appl.it.LogData; import io.helidon.tests.integration.dbclient.appl.it.VerifyData; @@ -30,6 +26,8 @@ import io.helidon.tests.integration.tools.client.TestClient; import io.helidon.tests.integration.tools.client.TestServiceClient; +import jakarta.json.JsonObject; +import jakarta.json.JsonValue; import org.junit.jupiter.api.Test; import static org.hamcrest.MatcherAssert.assertThat; @@ -40,7 +38,7 @@ */ public class TransactionUpdateIT { - private static final Logger LOGGER = Logger.getLogger(TransactionUpdateIT.class.getName()); + private static final System.Logger LOGGER = System.getLogger(TransactionUpdateIT.class.getName()); private final TestServiceClient testClient = TestClient.builder() .port(HelidonProcessRunner.HTTP_PORT) @@ -49,7 +47,7 @@ public class TransactionUpdateIT { // Test executor method private void executeTest(final String testName, final int id, final String newName) { - LOGGER.fine(() -> String.format("Running %s", testName)); + LOGGER.log(Level.INFO, () -> String.format("Running %s", testName)); try { Pokemon pokemon = Pokemon.POKEMONS.get(id); Pokemon updatedPokemon = new Pokemon(pokemon.getId(), newName, pokemon.getTypes()); @@ -61,11 +59,11 @@ private void executeTest(final String testName, final int id, final String newNa .build()); Long count = JsonTools.getLong(data); JsonObject pokemonData = VerifyData.getPokemon(testClient, pokemon.getId()); - LogData.logJsonObject(Level.FINER, pokemonData); + LogData.logJsonObject(Level.DEBUG, pokemonData); assertThat(count, equalTo(1L)); VerifyData.verifyPokemon(pokemonData, updatedPokemon); } catch (Exception e) { - LOGGER.log(Level.WARNING, e, () -> String.format("Exception in %s: %s", testName, e.getMessage())); + LOGGER.log(Level.WARNING, () -> String.format("Exception in %s: %s", testName, e.getMessage()), e); } } diff --git a/tests/integration/dbclient/appl/src/test/resources/logging.properties b/tests/integration/dbclient/appl/src/test/resources/logging.properties index 1509d795ec1..ae82fbe61fb 100644 --- a/tests/integration/dbclient/appl/src/test/resources/logging.properties +++ b/tests/integration/dbclient/appl/src/test/resources/logging.properties @@ -18,7 +18,7 @@ # For more information see $JAVA_HOME/jre/lib/logging.properties # Send messages to the console -handlers=io.helidon.logging.jul.HelidonConsoleHandler +# handlers=io.helidon.logging.jul.HelidonConsoleHandler # HelidonConsoleHandler uses a SimpleFormatter subclass that replaces "!thread!" with the current thread java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS %4$s %3$s !thread!: %5$s%6$s%n # Global logging level. Can be overridden by specific loggers diff --git a/tests/integration/dbclient/common/pom.xml b/tests/integration/dbclient/common/pom.xml index f6bf6710bf1..5e64ea2e54f 100644 --- a/tests/integration/dbclient/common/pom.xml +++ b/tests/integration/dbclient/common/pom.xml @@ -40,6 +40,18 @@ io.helidon.config helidon-config-yaml + + io.helidon.metrics + helidon-metrics + + + io.helidon.reactive.metrics + helidon-reactive-metrics + + + io.helidon.reactive.health + helidon-reactive-health + io.helidon.reactive.dbclient helidon-reactive-dbclient-common @@ -52,10 +64,6 @@ io.helidon.reactive.dbclient helidon-reactive-dbclient-metrics - - io.helidon.metrics - helidon-metrics - org.eclipse.parsson parsson diff --git a/tests/integration/dbclient/common/src/main/java/io/helidon/tests/integration/dbclient/common/tests/health/HealthCheckIT.java b/tests/integration/dbclient/common/src/main/java/io/helidon/tests/integration/dbclient/common/tests/health/HealthCheckIT.java index 30a9f48c3b0..4a0c53865f5 100644 --- a/tests/integration/dbclient/common/src/main/java/io/helidon/tests/integration/dbclient/common/tests/health/HealthCheckIT.java +++ b/tests/integration/dbclient/common/src/main/java/io/helidon/tests/integration/dbclient/common/tests/health/HealthCheckIT.java @@ -18,17 +18,18 @@ import java.util.logging.Level; import java.util.logging.Logger; -import io.helidon.config.Config; -import io.helidon.reactive.dbclient.health.DbClientHealthCheck; - -import org.eclipse.microprofile.health.HealthCheck; -import org.eclipse.microprofile.health.HealthCheckResponse; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; +import io.helidon.config.Config; +import io.helidon.health.HealthCheck; +import io.helidon.health.HealthCheckResponse; +import io.helidon.reactive.dbclient.health.DbClientHealthCheck; + import static io.helidon.tests.integration.dbclient.common.AbstractIT.CONFIG; import static io.helidon.tests.integration.dbclient.common.AbstractIT.DB_CLIENT; -import static org.hamcrest.CoreMatchers.*; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.notNullValue; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.equalTo; @@ -56,8 +57,8 @@ public void testHealthCheck() { LOGGER.log(Level.INFO, "Running test testHealthCheck"); HealthCheck check = DbClientHealthCheck.create(DB_CLIENT, CONFIG.get("db.health-check")); HealthCheckResponse response = check.call(); - HealthCheckResponse.Status state = response.getStatus(); - assertThat("Healthcheck failed, response: " + response.getData(), state, equalTo(HealthCheckResponse.Status.UP)); + HealthCheckResponse.Status state = response.status(); + assertThat("Health check failed, response: " + response.details(), state, equalTo(HealthCheckResponse.Status.UP)); } /** @@ -69,8 +70,8 @@ public void testHealthCheckWithName() { final String hcName = "TestHC"; HealthCheck check = DbClientHealthCheck.builder(DB_CLIENT).config(CONFIG.get("db.health-check")).name(hcName).build(); HealthCheckResponse response = check.call(); - String name = response.getName(); - HealthCheckResponse.Status state = response.getStatus(); + String name = check.name(); + HealthCheckResponse.Status state = response.status(); assertThat(name, equalTo(hcName)); assertThat(state, equalTo(HealthCheckResponse.Status.UP)); } @@ -87,8 +88,8 @@ public void testHealthCheckWithCustomNamedDML() { } HealthCheck check = DbClientHealthCheck.builder(DB_CLIENT).dml().statementName("ping-dml").build(); HealthCheckResponse response = check.call(); - HealthCheckResponse.Status state = response.getStatus(); - assertThat("Healthcheck failed, response: " + response.getData(), state, equalTo(HealthCheckResponse.Status.UP)); + HealthCheckResponse.Status state = response.status(); + assertThat("Health check failed, response: " + response.details(), state, equalTo(HealthCheckResponse.Status.UP)); } /** @@ -108,8 +109,8 @@ public void testHealthCheckWithCustomDML() { LOGGER.log(Level.INFO, () -> String.format("Using db.statements.ping-dml value %s", statement)); HealthCheck check = DbClientHealthCheck.builder(DB_CLIENT).dml().statement(statement).build(); HealthCheckResponse response = check.call(); - HealthCheckResponse.Status state = response.getStatus(); - assertThat("Healthcheck failed, response: " + response.getData(), state, equalTo(HealthCheckResponse.Status.UP)); + HealthCheckResponse.Status state = response.status(); + assertThat("Health check failed, response: " + response.details(), state, equalTo(HealthCheckResponse.Status.UP)); } /** @@ -120,8 +121,8 @@ public void testHealthCheckWithCustomNamedQuery() { LOGGER.log(Level.INFO, "Running test testHealthCheckWithCustomNamedQuery"); HealthCheck check = DbClientHealthCheck.builder(DB_CLIENT).query().statementName("ping-query").build(); HealthCheckResponse response = check.call(); - HealthCheckResponse.Status state = response.getStatus(); - assertThat("Healthcheck failed, response: " + response.getData(), state, equalTo(HealthCheckResponse.Status.UP)); + HealthCheckResponse.Status state = response.status(); + assertThat("Health check failed, response: " + response.details(), state, equalTo(HealthCheckResponse.Status.UP)); } /** @@ -137,8 +138,8 @@ public void testHealthCheckWithCustomQuery() { LOGGER.log(Level.INFO, () -> String.format("Using db.statements.ping-query value %s", statement)); HealthCheck check = DbClientHealthCheck.builder(DB_CLIENT).query().statement(statement).build(); HealthCheckResponse response = check.call(); - HealthCheckResponse.Status state = response.getStatus(); - assertThat("Healthcheck failed, response: " + response.getData(), state, equalTo(HealthCheckResponse.Status.UP)); + HealthCheckResponse.Status state = response.status(); + assertThat("Health check failed, response: " + response.details(), state, equalTo(HealthCheckResponse.Status.UP)); } diff --git a/tests/integration/dbclient/common/src/main/java/io/helidon/tests/integration/dbclient/common/tests/health/ServerHealthCheckIT.java b/tests/integration/dbclient/common/src/main/java/io/helidon/tests/integration/dbclient/common/tests/health/ServerHealthCheckIT.java index 7167f6d743a..da9d1c46368 100644 --- a/tests/integration/dbclient/common/src/main/java/io/helidon/tests/integration/dbclient/common/tests/health/ServerHealthCheckIT.java +++ b/tests/integration/dbclient/common/src/main/java/io/helidon/tests/integration/dbclient/common/tests/health/ServerHealthCheckIT.java @@ -30,22 +30,20 @@ import jakarta.json.JsonArray; import jakarta.json.JsonReader; import jakarta.json.JsonStructure; -import jakarta.json.JsonValue; import jakarta.json.stream.JsonParsingException; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + import io.helidon.common.reactive.Multi; -import io.helidon.config.Config; +import io.helidon.health.HealthCheck; import io.helidon.reactive.dbclient.DbRow; import io.helidon.reactive.dbclient.health.DbClientHealthCheck; import io.helidon.reactive.health.HealthSupport; import io.helidon.reactive.webserver.Routing; import io.helidon.reactive.webserver.WebServer; -import org.eclipse.microprofile.health.HealthCheck; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; - import static io.helidon.tests.integration.dbclient.common.AbstractIT.CONFIG; import static io.helidon.tests.integration.dbclient.common.AbstractIT.DB_CLIENT; import static org.hamcrest.MatcherAssert.assertThat; @@ -67,7 +65,7 @@ public class ServerHealthCheckIT { private static Routing createRouting() { HealthCheck check = DbClientHealthCheck.create(DB_CLIENT, CONFIG.get("db.health-check")); final HealthSupport health = HealthSupport.builder() - .addLiveness(check) + .add(check) .build(); return Routing.builder() .register(health) // Health at "/health" @@ -144,13 +142,8 @@ public void testHttpHealth() throws IOException, InterruptedException { } JsonArray checks = jsonResponse.asJsonObject().getJsonArray("checks"); assertThat(checks.size(), greaterThan(0)); - checks.stream().map((check) -> { - String name = check.asJsonObject().getString("name"); - return check; - }).forEachOrdered((check) -> { - String state = check.asJsonObject().getString("state"); + checks.stream().forEachOrdered((check) -> { String status = check.asJsonObject().getString("status"); - assertThat(state, equalTo("UP")); assertThat(status, equalTo("UP")); }); } diff --git a/tests/integration/dbclient/common/src/main/java/io/helidon/tests/integration/dbclient/common/tests/metrics/ServerMetricsCheckIT.java b/tests/integration/dbclient/common/src/main/java/io/helidon/tests/integration/dbclient/common/tests/metrics/ServerMetricsCheckIT.java index 29a2e01958c..f7fa7b07051 100644 --- a/tests/integration/dbclient/common/src/main/java/io/helidon/tests/integration/dbclient/common/tests/metrics/ServerMetricsCheckIT.java +++ b/tests/integration/dbclient/common/src/main/java/io/helidon/tests/integration/dbclient/common/tests/metrics/ServerMetricsCheckIT.java @@ -26,24 +26,23 @@ import java.util.concurrent.ExecutionException; import java.util.logging.Logger; -import jakarta.json.Json; -import jakarta.json.JsonObject; -import jakarta.json.JsonReader; -import jakarta.json.JsonValue; -import jakarta.json.stream.JsonParsingException; - import io.helidon.common.reactive.Multi; import io.helidon.config.Config; import io.helidon.reactive.dbclient.DbClient; import io.helidon.reactive.dbclient.DbRow; import io.helidon.reactive.dbclient.DbStatementType; import io.helidon.reactive.dbclient.metrics.DbClientMetrics; -import io.helidon.metrics.MetricsSupport; -import io.helidon.tests.integration.dbclient.common.AbstractIT; -import io.helidon.tests.integration.dbclient.common.AbstractIT.Pokemon; +import io.helidon.reactive.metrics.MetricsSupport; import io.helidon.reactive.webserver.Routing; import io.helidon.reactive.webserver.WebServer; +import io.helidon.tests.integration.dbclient.common.AbstractIT; +import io.helidon.tests.integration.dbclient.common.AbstractIT.Pokemon; +import jakarta.json.Json; +import jakarta.json.JsonObject; +import jakarta.json.JsonReader; +import jakarta.json.JsonValue; +import jakarta.json.stream.JsonParsingException; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; diff --git a/tests/integration/dbclient/jdbc/pom.xml b/tests/integration/dbclient/jdbc/pom.xml index 979a28a0a8d..d4a7bd5b4a2 100644 --- a/tests/integration/dbclient/jdbc/pom.xml +++ b/tests/integration/dbclient/jdbc/pom.xml @@ -182,11 +182,121 @@ + + + h2 + + + !db + + + + h2.yaml + 9092 + localhost + test + sa + password + jdbc:h2:tcp://${db.host}:${db.port}/${db.database};DATABASE_TO_UPPER=FALSE + org.h2.tools.Server + + + + io.helidon.integrations.db + h2 + + + com.h2database + h2 + runtime + + + + + + org.apache.maven.plugins + maven-failsafe-plugin + + + h2.yaml + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + copy-libs + package + + copy-dependencies + + + h2 + + + + + + org.codehaus.mojo + exec-maven-plugin + + + start-db + pre-integration-test + + exec + + + java + + -classpath + ${project.build.directory}/dependency/h2-${version.lib.h2}.jar + ${mainClassH2} + -tcp + -tcpPassword + ${db.password} + -tcpPort + ${db.port} + -baseDir + ${project.build.directory}/h2 + -ifNotExists + + true + + + + stop-db + post-integration-test + + exec + + + java + + -classpath + ${project.build.directory}/dependency/h2-${version.lib.h2}.jar + ${mainClassH2} + -tcpShutdown + tcp://localhost:${db.port} + -tcpPassword + ${db.password} + + + + + + + + + mysql - mysql + db + mysql @@ -258,7 +368,8 @@ mariadb - mariadb + db + mariadb @@ -330,7 +441,8 @@ pgsql - pgsql + db + pgsql @@ -400,7 +512,8 @@ mssql - mssql + db + mssqk diff --git a/tests/integration/dbclient/jdbc/src/test/resources/h2.yaml b/tests/integration/dbclient/jdbc/src/test/resources/h2.yaml new file mode 100644 index 00000000000..5a2a73a214e --- /dev/null +++ b/tests/integration/dbclient/jdbc/src/test/resources/h2.yaml @@ -0,0 +1,80 @@ +# +# Copyright (c) 2019, 2022 Oracle and/or its affiliates. +# +# 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. +# + +server: + port: 0 + host: 0.0.0.0 + +db: + source: jdbc + connection: + url: ${db.url} + username: ${db.user} + password: ${db.password} + health-check: + type: query + statement: "SELECT 0" + statements: + # custom query ping statement + ping-query: "SELECT 0" + # database schema initialization statements + create-types: "CREATE TABLE Types (id INTEGER NOT NULL PRIMARY KEY, name VARCHAR(64) NOT NULL)" + create-pokemons: "CREATE TABLE Pokemons (id INTEGER NOT NULL PRIMARY KEY, name VARCHAR(64) NOT NULL)" + create-poketypes: "CREATE TABLE PokemonTypes (id_pokemon INTEGER NOT NULL REFERENCES Pokemons(id), id_type INTEGER NOT NULL REFERENCES Types(id))" + # database schema cleanup statements + drop-types: "DROP TABLE Types" + drop-pokemons: "DROP TABLE Pokemons" + drop-poketypes: "DROP TABLE PokemonTypes" + # data initialization statements + insert-type: "INSERT INTO Types(id, name) VALUES(?, ?)" + insert-pokemon: "INSERT INTO Pokemons(id, name) VALUES(?, ?)" + insert-poketype: "INSERT INTO PokemonTypes(id_pokemon, id_type) VALUES(?, ?)" + # data initialization verification statements + select-types: "SELECT id, name FROM Types" + select-pokemons: "SELECT id, name FROM Pokemons" + select-poketypes: "SELECT id_pokemon, id_type FROM PokemonTypes p WHERE id_pokemon = ?" + # data cleanup verification statements + select-poketypes-all: "SELECT id_pokemon, id_type FROM PokemonTypes" + # retrieve max. Pokemon ID + select-max-id: "SELECT MAX(id) FROM Pokemons" + # test queries + select-pokemon-named-arg: "SELECT id, name FROM Pokemons WHERE name=:name" + select-pokemon-order-arg: "SELECT id, name FROM Pokemons WHERE name=?" + # test DML insert + insert-pokemon-named-arg: "INSERT INTO Pokemons(id, name) VALUES(:id, :name)" + insert-pokemon-order-arg: "INSERT INTO Pokemons(id, name) VALUES(?, ?)" + # Pokemon mapper uses reverse order of indexed arguments + insert-pokemon-order-arg-rev: "INSERT INTO Pokemons(name, id) VALUES(?, ?)" + # test DML update + select-pokemon-by-id: "SELECT id, name FROM Pokemons WHERE id=?" + update-pokemon-named-arg: "UPDATE Pokemons SET name=:name WHERE id=:id" + update-pokemon-order-arg: "UPDATE Pokemons SET name=? WHERE id=?" + # test DML delete + delete-pokemon-named-arg: "DELETE FROM Pokemons WHERE id=:id" + delete-pokemon-order-arg: "DELETE FROM Pokemons WHERE id=?" + # Pokemon mapper uses full list of attributes + delete-pokemon-full-named-arg: "DELETE FROM Pokemons WHERE name=:name AND id=:id" + delete-pokemon-full-order-arg: "DELETE FROM Pokemons WHERE name=? AND id=?" + # test DbStatementQuery methods + select-pokemons-idrng-named-arg: "SELECT id, name FROM Pokemons WHERE id > :idmin AND id < :idmax" + select-pokemons-idrng-order-arg: "SELECT id, name FROM Pokemons WHERE id > ? AND id < ?" + # Test query with both named and ordered parameters (shall cause an exception) + select-pokemons-error-arg: "SELECT id, name FROM Pokemons WHERE id > :id AND name = ?" + +# Tests configuration +test: + # Whether database supports ping statement as DML (default value is true) + ping-dml: false diff --git a/tests/integration/dbclient/mongodb/pom.xml b/tests/integration/dbclient/mongodb/pom.xml index 336d4343198..f25d6120f33 100644 --- a/tests/integration/dbclient/mongodb/pom.xml +++ b/tests/integration/dbclient/mongodb/pom.xml @@ -167,6 +167,18 @@ + + + skip + + + !db + + + + true + +