From 585d499bd813c9b8232ea04df6caab8a9b81d48e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Aug 2024 15:02:01 +0200 Subject: [PATCH] Bump quarkus.version from 3.13.2 to 3.14.0 (#284) * Bump quarkus.version from 3.13.2 to 3.14.0 Bumps `quarkus.version` from 3.13.2 to 3.14.0. Updates `io.quarkus:quarkus-bom` from 3.13.2 to 3.14.0 - [Release notes](https://github.com/quarkusio/quarkus/releases) - [Commits](https://github.com/quarkusio/quarkus/compare/3.13.2...3.14.0) Updates `io.quarkus:quarkus-maven-plugin` from 3.13.2 to 3.14.0 Updates `io.quarkus:quarkus-extension-processor` from 3.13.2 to 3.14.0 Updates `io.quarkus:quarkus-extension-maven-plugin` from 3.13.2 to 3.14.0 - [Release notes](https://github.com/quarkusio/quarkus/releases) - [Commits](https://github.com/quarkusio/quarkus/compare/3.13.2...3.14.0) --- updated-dependencies: - dependency-name: io.quarkus:quarkus-bom dependency-type: direct:production update-type: version-update:semver-minor - dependency-name: io.quarkus:quarkus-maven-plugin dependency-type: direct:production update-type: version-update:semver-minor - dependency-name: io.quarkus:quarkus-extension-processor dependency-type: direct:production update-type: version-update:semver-minor - dependency-name: io.quarkus:quarkus-extension-maven-plugin dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Migrate to ConfigMapping using interface because, well idk. --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Michael J. Simons --- .../DevServicesBuildTimeConfig.java | 30 +- .../deployment/Neo4jBuildTimeConfig.java | 22 +- .../deployment/Neo4jDevServicesProcessor.java | 12 +- .../Neo4jDevUiConsoleProcessor.java | 2 +- .../deployment/Neo4jDriverProcessor.java | 2 +- .../ROOT/pages/includes/attributes.adoc | 2 +- .../ROOT/pages/includes/quarkus-neo4j.adoc | 250 +++++------ .../includes/quarkus-neo4j_quarkus.neo4j.adoc | 422 ++++++++++++++++++ docs/pom.xml | 16 +- pom.xml | 7 +- runtime/pom.xml | 5 + .../neo4j/runtime/Neo4jConfiguration.java | 172 ++++--- .../neo4j/runtime/Neo4jDriverRecorder.java | 33 +- .../runtime/Neo4jDriverRecorderTest.java | 40 +- 14 files changed, 722 insertions(+), 293 deletions(-) create mode 100644 docs/modules/ROOT/pages/includes/quarkus-neo4j_quarkus.neo4j.adoc diff --git a/deployment/src/main/java/io/quarkus/neo4j/deployment/DevServicesBuildTimeConfig.java b/deployment/src/main/java/io/quarkus/neo4j/deployment/DevServicesBuildTimeConfig.java index cbae555..1ad33f3 100644 --- a/deployment/src/main/java/io/quarkus/neo4j/deployment/DevServicesBuildTimeConfig.java +++ b/deployment/src/main/java/io/quarkus/neo4j/deployment/DevServicesBuildTimeConfig.java @@ -5,45 +5,47 @@ import java.util.OptionalInt; import io.quarkus.runtime.annotations.ConfigGroup; -import io.quarkus.runtime.annotations.ConfigItem; +import io.smallrye.config.WithDefault; @ConfigGroup -public class DevServicesBuildTimeConfig { +public interface DevServicesBuildTimeConfig { /** * If DevServices has been explicitly enabled or disabled. DevServices is generally enabled * by default, unless there is an existing configuration present. * When DevServices is enabled Quarkus will attempt to automatically configure and start * a database when running in Dev or Test mode. + * + * @return whether dev services are enabled or not */ - @ConfigItem - public Optional enabled = Optional.empty(); + Optional enabled(); /** - * The container image name to use, for container based DevServices providers. + * {@return the container image name to use, for container based DevServices providers} */ - @ConfigItem(defaultValue = "neo4j:5") - public String imageName; + @WithDefault("neo4j:5") + String imageName(); /** - * Additional environment entries that can be added to the container before its start. + * {@return additional environment entries that can be added to the container before its start} */ - @ConfigItem - public Map additionalEnv; + Map additionalEnv(); /** * This value can be used to specify the port to which the bolt-port of the container is exposed. It must be a free * port, otherwise startup will fail. A random, free port will be used by default. Either way, a messsage will be * logged on which port the Neo4j container is reachable over bolt. + * + * @return a specific port to bind the containers bolt-port to */ - @ConfigItem - public OptionalInt boltPort = OptionalInt.empty(); + OptionalInt boltPort(); /** * This value can be used to specify the port to which the http-port of the container is exposed. It must be a free * port, otherwise startup will fail. A random, free port will be used by default. Either way, a messsage will be * logged on which port the Neo4j Browser is available. + * + * @return a specific port to bind the containers http-port to */ - @ConfigItem - public OptionalInt httpPort = OptionalInt.empty(); + OptionalInt httpPort(); } diff --git a/deployment/src/main/java/io/quarkus/neo4j/deployment/Neo4jBuildTimeConfig.java b/deployment/src/main/java/io/quarkus/neo4j/deployment/Neo4jBuildTimeConfig.java index a02812e..7e7d133 100644 --- a/deployment/src/main/java/io/quarkus/neo4j/deployment/Neo4jBuildTimeConfig.java +++ b/deployment/src/main/java/io/quarkus/neo4j/deployment/Neo4jBuildTimeConfig.java @@ -1,21 +1,25 @@ package io.quarkus.neo4j.deployment; -import io.quarkus.runtime.annotations.ConfigItem; import io.quarkus.runtime.annotations.ConfigPhase; import io.quarkus.runtime.annotations.ConfigRoot; +import io.smallrye.config.ConfigMapping; +import io.smallrye.config.WithDefault; +import io.smallrye.config.WithName; -@ConfigRoot(name = "neo4j", phase = ConfigPhase.BUILD_TIME) -public class Neo4jBuildTimeConfig { +@ConfigMapping(prefix = "quarkus.neo4j") +@ConfigRoot(phase = ConfigPhase.BUILD_TIME) +public interface Neo4jBuildTimeConfig { /** - * Whether a health check is published in case the smallrye-health extension is present. + * {@return whether a health check is published in case the smallrye-health extension is present} */ - @ConfigItem(name = "health.enabled", defaultValue = "true") - public boolean healthEnabled; + @WithName("health.enabled") + @WithDefault("true") + boolean healthEnabled(); /** - * Configuration for DevServices. DevServices allows Quarkus to automatically start a Neo4j instance in dev and test mode. + * DevServices allows Quarkus to automatically start a Neo4j instance in dev and test mode. + * {@return Configuration for DevServices} */ - @ConfigItem - public DevServicesBuildTimeConfig devservices; + DevServicesBuildTimeConfig devservices(); } diff --git a/deployment/src/main/java/io/quarkus/neo4j/deployment/Neo4jDevServicesProcessor.java b/deployment/src/main/java/io/quarkus/neo4j/deployment/Neo4jDevServicesProcessor.java index 780e537..ae6c7c8 100644 --- a/deployment/src/main/java/io/quarkus/neo4j/deployment/Neo4jDevServicesProcessor.java +++ b/deployment/src/main/java/io/quarkus/neo4j/deployment/Neo4jDevServicesProcessor.java @@ -56,7 +56,7 @@ public DevServicesResultBuildItem startNeo4jDevService( LoggingSetupBuildItem loggingSetupBuildItem, GlobalDevServicesConfig globalDevServicesConfig) { - var configuration = new Neo4jDevServiceConfig(neo4jBuildTimeConfig.devservices); + var configuration = new Neo4jDevServiceConfig(neo4jBuildTimeConfig.devservices()); if (devService != null) { if (configuration.equals(runningConfiguration)) { @@ -213,10 +213,10 @@ private static final class Neo4jDevServiceConfig { Neo4jDevServiceConfig(DevServicesBuildTimeConfig devServicesConfig) { this.devServicesEnabled = enabled(devServicesConfig); - this.imageName = devServicesConfig.imageName; - this.additionalEnv = new HashMap<>(devServicesConfig.additionalEnv); - this.fixedBoltPort = devServicesConfig.boltPort; - this.fixedHttpPort = devServicesConfig.httpPort; + this.imageName = devServicesConfig.imageName(); + this.additionalEnv = new HashMap<>(devServicesConfig.additionalEnv()); + this.fixedBoltPort = devServicesConfig.boltPort(); + this.fixedHttpPort = devServicesConfig.httpPort(); } @Override @@ -248,6 +248,6 @@ public int hashCode() { * @return {@literal true} if Neo4j dev services are enabled or not */ static boolean enabled(DevServicesBuildTimeConfig devServicesConfig) { - return Optional.ofNullable(devServicesConfig).flatMap(cfg -> cfg.enabled).orElse(true); + return Optional.ofNullable(devServicesConfig).flatMap(DevServicesBuildTimeConfig::enabled).orElse(true); } } diff --git a/deployment/src/main/java/io/quarkus/neo4j/deployment/Neo4jDevUiConsoleProcessor.java b/deployment/src/main/java/io/quarkus/neo4j/deployment/Neo4jDevUiConsoleProcessor.java index cf7a58c..26b80ca 100644 --- a/deployment/src/main/java/io/quarkus/neo4j/deployment/Neo4jDevUiConsoleProcessor.java +++ b/deployment/src/main/java/io/quarkus/neo4j/deployment/Neo4jDevUiConsoleProcessor.java @@ -16,7 +16,7 @@ CardPageBuildItem create( Neo4jBuildTimeConfig neo4jBuildTimeConfig) { var cardPageBuildItem = new CardPageBuildItem(); - if (Neo4jDevServicesProcessor.enabled(neo4jBuildTimeConfig.devservices)) { + if (Neo4jDevServicesProcessor.enabled(neo4jBuildTimeConfig.devservices())) { // Find the appropriate config for (DevServicesResultBuildItem runningDevService : runningDevServices) { diff --git a/deployment/src/main/java/io/quarkus/neo4j/deployment/Neo4jDriverProcessor.java b/deployment/src/main/java/io/quarkus/neo4j/deployment/Neo4jDriverProcessor.java index 8e53256..fe0b74d 100644 --- a/deployment/src/main/java/io/quarkus/neo4j/deployment/Neo4jDriverProcessor.java +++ b/deployment/src/main/java/io/quarkus/neo4j/deployment/Neo4jDriverProcessor.java @@ -47,7 +47,7 @@ Neo4jDriverBuildItem configureDriverProducer(Neo4jDriverRecorder recorder, @BuildStep HealthBuildItem addHealthCheck(Neo4jBuildTimeConfig buildTimeConfig) { return new HealthBuildItem("io.quarkus.neo4j.runtime.health.Neo4jHealthCheck", - buildTimeConfig.healthEnabled); + buildTimeConfig.healthEnabled()); } @BuildStep diff --git a/docs/modules/ROOT/pages/includes/attributes.adoc b/docs/modules/ROOT/pages/includes/attributes.adoc index d431db9..692db6f 100644 --- a/docs/modules/ROOT/pages/includes/attributes.adoc +++ b/docs/modules/ROOT/pages/includes/attributes.adoc @@ -1,4 +1,4 @@ -:quarkus-version: 3.13.2 +:quarkus-version: 3.14.0 :quarkus-neo4j-version: 4.2.2 :maven-version: 3.8.1+ diff --git a/docs/modules/ROOT/pages/includes/quarkus-neo4j.adoc b/docs/modules/ROOT/pages/includes/quarkus-neo4j.adoc index 111e412..177e3ad 100644 --- a/docs/modules/ROOT/pages/includes/quarkus-neo4j.adoc +++ b/docs/modules/ROOT/pages/includes/quarkus-neo4j.adoc @@ -1,21 +1,19 @@ - -:summaryTableId: quarkus-neo4j +:summaryTableId: quarkus-neo4j_quarkus-neo4j [.configuration-legend] icon:lock[title=Fixed at build time] Configuration property fixed at build time - All other configuration properties are overridable at runtime [.configuration-reference.searchable, cols="80,.^10,.^10"] |=== -h|[[quarkus-neo4j_configuration]]link:#quarkus-neo4j_configuration[Configuration property] - +h|[.header-title]##Configuration property## h|Type h|Default -a|icon:lock[title=Fixed at build time] [[quarkus-neo4j_quarkus-neo4j-health-enabled]]`link:#quarkus-neo4j_quarkus-neo4j-health-enabled[quarkus.neo4j.health.enabled]` - +a|icon:lock[title=Fixed at build time] [[quarkus-neo4j_quarkus-neo4j-health-enabled]] [.property-path]##`quarkus.neo4j.health.enabled`## [.description] -- -Whether a health check is published in case the smallrye-health extension is present. +whether a health check is published in case the smallrye-health extension is present + ifdef::add-copy-button-to-env-var[] Environment variable: env_var_with_copy_button:+++QUARKUS_NEO4J_HEALTH_ENABLED+++[] @@ -23,33 +21,33 @@ endif::add-copy-button-to-env-var[] ifndef::add-copy-button-to-env-var[] Environment variable: `+++QUARKUS_NEO4J_HEALTH_ENABLED+++` endif::add-copy-button-to-env-var[] ---|boolean +-- +|boolean |`true` - -a|icon:lock[title=Fixed at build time] [[quarkus-neo4j_quarkus-neo4j-devservices-enabled]]`link:#quarkus-neo4j_quarkus-neo4j-devservices-enabled[quarkus.neo4j.devservices.enabled]` - +a|icon:lock[title=Fixed at build time] [[quarkus-neo4j_quarkus-neo4j-devservices-enabled]] [.property-path]##`quarkus.neo4j.devservices.enabled`## [.description] -- If DevServices has been explicitly enabled or disabled. DevServices is generally enabled by default, unless there is an existing configuration present. When DevServices is enabled Quarkus will attempt to automatically configure and start a database when running in Dev or Test mode. + ifdef::add-copy-button-to-env-var[] Environment variable: env_var_with_copy_button:+++QUARKUS_NEO4J_DEVSERVICES_ENABLED+++[] endif::add-copy-button-to-env-var[] ifndef::add-copy-button-to-env-var[] Environment variable: `+++QUARKUS_NEO4J_DEVSERVICES_ENABLED+++` endif::add-copy-button-to-env-var[] ---|boolean +-- +|boolean | - -a|icon:lock[title=Fixed at build time] [[quarkus-neo4j_quarkus-neo4j-devservices-image-name]]`link:#quarkus-neo4j_quarkus-neo4j-devservices-image-name[quarkus.neo4j.devservices.image-name]` - +a|icon:lock[title=Fixed at build time] [[quarkus-neo4j_quarkus-neo4j-devservices-image-name]] [.property-path]##`quarkus.neo4j.devservices.image-name`## [.description] -- -The container image name to use, for container based DevServices providers. +the container image name to use, for container based DevServices providers + ifdef::add-copy-button-to-env-var[] Environment variable: env_var_with_copy_button:+++QUARKUS_NEO4J_DEVSERVICES_IMAGE_NAME+++[] @@ -57,50 +55,67 @@ endif::add-copy-button-to-env-var[] ifndef::add-copy-button-to-env-var[] Environment variable: `+++QUARKUS_NEO4J_DEVSERVICES_IMAGE_NAME+++` endif::add-copy-button-to-env-var[] ---|string +-- +|string |`neo4j:5` +a|icon:lock[title=Fixed at build time] [[quarkus-neo4j_quarkus-neo4j-devservices-additional-env-additional-env]] [.property-path]##`quarkus.neo4j.devservices.additional-env."additional-env"`## -a|icon:lock[title=Fixed at build time] [[quarkus-neo4j_quarkus-neo4j-devservices-bolt-port]]`link:#quarkus-neo4j_quarkus-neo4j-devservices-bolt-port[quarkus.neo4j.devservices.bolt-port]` +[.description] +-- +additional environment entries that can be added to the container before its start +ifdef::add-copy-button-to-env-var[] +Environment variable: env_var_with_copy_button:+++QUARKUS_NEO4J_DEVSERVICES_ADDITIONAL_ENV__ADDITIONAL_ENV_+++[] +endif::add-copy-button-to-env-var[] +ifndef::add-copy-button-to-env-var[] +Environment variable: `+++QUARKUS_NEO4J_DEVSERVICES_ADDITIONAL_ENV__ADDITIONAL_ENV_+++` +endif::add-copy-button-to-env-var[] +-- +|Map +| + +a|icon:lock[title=Fixed at build time] [[quarkus-neo4j_quarkus-neo4j-devservices-bolt-port]] [.property-path]##`quarkus.neo4j.devservices.bolt-port`## + [.description] -- This value can be used to specify the port to which the bolt-port of the container is exposed. It must be a free port, otherwise startup will fail. A random, free port will be used by default. Either way, a messsage will be logged on which port the Neo4j container is reachable over bolt. + ifdef::add-copy-button-to-env-var[] Environment variable: env_var_with_copy_button:+++QUARKUS_NEO4J_DEVSERVICES_BOLT_PORT+++[] endif::add-copy-button-to-env-var[] ifndef::add-copy-button-to-env-var[] Environment variable: `+++QUARKUS_NEO4J_DEVSERVICES_BOLT_PORT+++` endif::add-copy-button-to-env-var[] ---|int +-- +|int | - -a|icon:lock[title=Fixed at build time] [[quarkus-neo4j_quarkus-neo4j-devservices-http-port]]`link:#quarkus-neo4j_quarkus-neo4j-devservices-http-port[quarkus.neo4j.devservices.http-port]` - +a|icon:lock[title=Fixed at build time] [[quarkus-neo4j_quarkus-neo4j-devservices-http-port]] [.property-path]##`quarkus.neo4j.devservices.http-port`## [.description] -- This value can be used to specify the port to which the http-port of the container is exposed. It must be a free port, otherwise startup will fail. A random, free port will be used by default. Either way, a messsage will be logged on which port the Neo4j Browser is available. + ifdef::add-copy-button-to-env-var[] Environment variable: env_var_with_copy_button:+++QUARKUS_NEO4J_DEVSERVICES_HTTP_PORT+++[] endif::add-copy-button-to-env-var[] ifndef::add-copy-button-to-env-var[] Environment variable: `+++QUARKUS_NEO4J_DEVSERVICES_HTTP_PORT+++` endif::add-copy-button-to-env-var[] ---|int +-- +|int | - -a| [[quarkus-neo4j_quarkus-neo4j-uri]]`link:#quarkus-neo4j_quarkus-neo4j-uri[quarkus.neo4j.uri]` - +a| [[quarkus-neo4j_quarkus-neo4j-uri]] [.property-path]##`quarkus.neo4j.uri`## [.description] -- -The uri this driver should connect to. The driver supports bolt, bolt{plus}routing or neo4j as schemes. +the uri this driver should connect to. The driver supports bolt, bolt+routing or neo4j as schemes + ifdef::add-copy-button-to-env-var[] Environment variable: env_var_with_copy_button:+++QUARKUS_NEO4J_URI+++[] @@ -108,16 +123,16 @@ endif::add-copy-button-to-env-var[] ifndef::add-copy-button-to-env-var[] Environment variable: `+++QUARKUS_NEO4J_URI+++` endif::add-copy-button-to-env-var[] ---|string +-- +|string |`bolt://localhost:7687` - -a| [[quarkus-neo4j_quarkus-neo4j-encrypted]]`link:#quarkus-neo4j_quarkus-neo4j-encrypted[quarkus.neo4j.encrypted]` - +a| [[quarkus-neo4j_quarkus-neo4j-encrypted]] [.property-path]##`quarkus.neo4j.encrypted`## [.description] -- -If the driver should use encrypted traffic. +if the driver should use encrypted traffic + ifdef::add-copy-button-to-env-var[] Environment variable: env_var_with_copy_button:+++QUARKUS_NEO4J_ENCRYPTED+++[] @@ -125,16 +140,16 @@ endif::add-copy-button-to-env-var[] ifndef::add-copy-button-to-env-var[] Environment variable: `+++QUARKUS_NEO4J_ENCRYPTED+++` endif::add-copy-button-to-env-var[] ---|boolean +-- +|boolean |`false` - -a| [[quarkus-neo4j_quarkus-neo4j-max-transaction-retry-time]]`link:#quarkus-neo4j_quarkus-neo4j-max-transaction-retry-time[quarkus.neo4j.max-transaction-retry-time]` - +a| [[quarkus-neo4j_quarkus-neo4j-max-transaction-retry-time]] [.property-path]##`quarkus.neo4j.max-transaction-retry-time`## [.description] -- -Configure the maximum time transactions are allowed to retry. +the maximum time transactions are allowed to retry + ifdef::add-copy-button-to-env-var[] Environment variable: env_var_with_copy_button:+++QUARKUS_NEO4J_MAX_TRANSACTION_RETRY_TIME+++[] @@ -142,40 +157,20 @@ endif::add-copy-button-to-env-var[] ifndef::add-copy-button-to-env-var[] Environment variable: `+++QUARKUS_NEO4J_MAX_TRANSACTION_RETRY_TIME+++` endif::add-copy-button-to-env-var[] ---|link:https://docs.oracle.com/javase/8/docs/api/java/time/Duration.html[Duration] - link:#duration-note-anchor-{summaryTableId}[icon:question-circle[title=More information about the Duration format]] -|`30S` - - -a|icon:lock[title=Fixed at build time] [[quarkus-neo4j_quarkus-neo4j-devservices-additional-env-additional-env]]`link:#quarkus-neo4j_quarkus-neo4j-devservices-additional-env-additional-env[quarkus.neo4j.devservices.additional-env."additional-env"]` - - -[.description] -- -Additional environment entries that can be added to the container before its start. - -ifdef::add-copy-button-to-env-var[] -Environment variable: env_var_with_copy_button:+++QUARKUS_NEO4J_DEVSERVICES_ADDITIONAL_ENV__ADDITIONAL_ENV_+++[] -endif::add-copy-button-to-env-var[] -ifndef::add-copy-button-to-env-var[] -Environment variable: `+++QUARKUS_NEO4J_DEVSERVICES_ADDITIONAL_ENV__ADDITIONAL_ENV_+++` -endif::add-copy-button-to-env-var[] ---|link:https://docs.oracle.com/javase/8/docs/api/java/lang/String.html[String] - -| - - -h|[[quarkus-neo4j_quarkus-neo4j-authentication-authentication]]link:#quarkus-neo4j_quarkus-neo4j-authentication-authentication[Authentication] +|link:https://docs.oracle.com/en/java/javase/17/docs/api/java/time/Duration.html[Duration] link:#duration-note-anchor-{summaryTableId}[icon:question-circle[title=More information about the Duration format]] +|`30S` +h|[[quarkus-neo4j_section_quarkus-neo4j-authentication]] [.section-name.section-level0]##the authentication## h|Type h|Default -a| [[quarkus-neo4j_quarkus-neo4j-authentication-username]]`link:#quarkus-neo4j_quarkus-neo4j-authentication-username[quarkus.neo4j.authentication.username]` - +a| [[quarkus-neo4j_quarkus-neo4j-authentication-username]] [.property-path]##`quarkus.neo4j.authentication.username`## [.description] -- -The login of the user connecting to the database. +the login of the user connecting to the database + ifdef::add-copy-button-to-env-var[] Environment variable: env_var_with_copy_button:+++QUARKUS_NEO4J_AUTHENTICATION_USERNAME+++[] @@ -183,16 +178,16 @@ endif::add-copy-button-to-env-var[] ifndef::add-copy-button-to-env-var[] Environment variable: `+++QUARKUS_NEO4J_AUTHENTICATION_USERNAME+++` endif::add-copy-button-to-env-var[] ---|string +-- +|string |`neo4j` - -a| [[quarkus-neo4j_quarkus-neo4j-authentication-password]]`link:#quarkus-neo4j_quarkus-neo4j-authentication-password[quarkus.neo4j.authentication.password]` - +a| [[quarkus-neo4j_quarkus-neo4j-authentication-password]] [.property-path]##`quarkus.neo4j.authentication.password`## [.description] -- -The password of the user connecting to the database. +the password of the user connecting to the database + ifdef::add-copy-button-to-env-var[] Environment variable: env_var_with_copy_button:+++QUARKUS_NEO4J_AUTHENTICATION_PASSWORD+++[] @@ -200,16 +195,16 @@ endif::add-copy-button-to-env-var[] ifndef::add-copy-button-to-env-var[] Environment variable: `+++QUARKUS_NEO4J_AUTHENTICATION_PASSWORD+++` endif::add-copy-button-to-env-var[] ---|string +-- +|string |`neo4j` - -a| [[quarkus-neo4j_quarkus-neo4j-authentication-disabled]]`link:#quarkus-neo4j_quarkus-neo4j-authentication-disabled[quarkus.neo4j.authentication.disabled]` - +a| [[quarkus-neo4j_quarkus-neo4j-authentication-disabled]] [.property-path]##`quarkus.neo4j.authentication.disabled`## [.description] -- -Set this to true to disable authentication. +whether disable authentication or not + ifdef::add-copy-button-to-env-var[] Environment variable: env_var_with_copy_button:+++QUARKUS_NEO4J_AUTHENTICATION_DISABLED+++[] @@ -217,38 +212,38 @@ endif::add-copy-button-to-env-var[] ifndef::add-copy-button-to-env-var[] Environment variable: `+++QUARKUS_NEO4J_AUTHENTICATION_DISABLED+++` endif::add-copy-button-to-env-var[] ---|boolean +-- +|boolean |`false` - -a| [[quarkus-neo4j_quarkus-neo4j-authentication-value]]`link:#quarkus-neo4j_quarkus-neo4j-authentication-value[quarkus.neo4j.authentication.value]` - +a| [[quarkus-neo4j_quarkus-neo4j-authentication-value]] [.property-path]##`quarkus.neo4j.authentication.value`## [.description] -- An optional field that when is not empty has precedence over `username` and `password`. It behaves the same way as `NEO4J_AUTH` in the official docker image, containing both the username and password separated via a single forward slash (`/`). + ifdef::add-copy-button-to-env-var[] Environment variable: env_var_with_copy_button:+++QUARKUS_NEO4J_AUTHENTICATION_VALUE+++[] endif::add-copy-button-to-env-var[] ifndef::add-copy-button-to-env-var[] Environment variable: `+++QUARKUS_NEO4J_AUTHENTICATION_VALUE+++` endif::add-copy-button-to-env-var[] ---|string +-- +|string | -h|[[quarkus-neo4j_quarkus-neo4j-trust-settings-configure-trust-settings-for-encrypted-traffic]]link:#quarkus-neo4j_quarkus-neo4j-trust-settings-configure-trust-settings-for-encrypted-traffic[Configure trust settings for encrypted traffic] - +h|[[quarkus-neo4j_section_quarkus-neo4j-trust-settings]] [.section-name.section-level0]##the trust settings for encrypted traffic## h|Type h|Default -a| [[quarkus-neo4j_quarkus-neo4j-trust-settings-strategy]]`link:#quarkus-neo4j_quarkus-neo4j-trust-settings-strategy[quarkus.neo4j.trust-settings.strategy]` - +a| [[quarkus-neo4j_quarkus-neo4j-trust-settings-strategy]] [.property-path]##`quarkus.neo4j.trust-settings.strategy`## [.description] -- -Configures which trust strategy to apply when using encrypted traffic. +which trust strategy to apply when using encrypted traffic + ifdef::add-copy-button-to-env-var[] Environment variable: env_var_with_copy_button:+++QUARKUS_NEO4J_TRUST_SETTINGS_STRATEGY+++[] @@ -256,17 +251,16 @@ endif::add-copy-button-to-env-var[] ifndef::add-copy-button-to-env-var[] Environment variable: `+++QUARKUS_NEO4J_TRUST_SETTINGS_STRATEGY+++` endif::add-copy-button-to-env-var[] --- a| -`trust-all-certificates`, `trust-custom-ca-signed-certificates`, `trust-system-ca-signed-certificates` +-- +a|Strategy |`trust-system-ca-signed-certificates` - -a| [[quarkus-neo4j_quarkus-neo4j-trust-settings-cert-file]]`link:#quarkus-neo4j_quarkus-neo4j-trust-settings-cert-file[quarkus.neo4j.trust-settings.cert-file]` - +a| [[quarkus-neo4j_quarkus-neo4j-trust-settings-cert-file]] [.property-path]##`quarkus.neo4j.trust-settings.cert-file`## [.description] -- -The file of the certificate to use. +the file of the certificate to use + ifdef::add-copy-button-to-env-var[] Environment variable: env_var_with_copy_button:+++QUARKUS_NEO4J_TRUST_SETTINGS_CERT_FILE+++[] @@ -274,16 +268,16 @@ endif::add-copy-button-to-env-var[] ifndef::add-copy-button-to-env-var[] Environment variable: `+++QUARKUS_NEO4J_TRUST_SETTINGS_CERT_FILE+++` endif::add-copy-button-to-env-var[] ---|path +-- +|path | - -a| [[quarkus-neo4j_quarkus-neo4j-trust-settings-hostname-verification-enabled]]`link:#quarkus-neo4j_quarkus-neo4j-trust-settings-hostname-verification-enabled[quarkus.neo4j.trust-settings.hostname-verification-enabled]` - +a| [[quarkus-neo4j_quarkus-neo4j-trust-settings-hostname-verification-enabled]] [.property-path]##`quarkus.neo4j.trust-settings.hostname-verification-enabled`## [.description] -- -If hostname verification is used. +whether hostname verification is used + ifdef::add-copy-button-to-env-var[] Environment variable: env_var_with_copy_button:+++QUARKUS_NEO4J_TRUST_SETTINGS_HOSTNAME_VERIFICATION_ENABLED+++[] @@ -291,21 +285,21 @@ endif::add-copy-button-to-env-var[] ifndef::add-copy-button-to-env-var[] Environment variable: `+++QUARKUS_NEO4J_TRUST_SETTINGS_HOSTNAME_VERIFICATION_ENABLED+++` endif::add-copy-button-to-env-var[] ---|boolean +-- +|boolean |`false` -h|[[quarkus-neo4j_quarkus-neo4j-pool-connection-pool]]link:#quarkus-neo4j_quarkus-neo4j-pool-connection-pool[Connection pool] - +h|[[quarkus-neo4j_section_quarkus-neo4j-pool]] [.section-name.section-level0]##the connection pool## h|Type h|Default -a| [[quarkus-neo4j_quarkus-neo4j-pool-metrics-enabled]]`link:#quarkus-neo4j_quarkus-neo4j-pool-metrics-enabled[quarkus.neo4j.pool.metrics.enabled]` - +a| [[quarkus-neo4j_quarkus-neo4j-pool-metrics-enabled]] [.property-path]##`quarkus.neo4j.pool.metrics.enabled`## [.description] -- -Flag, if metrics are enabled. +lag, if metrics are enabled + ifdef::add-copy-button-to-env-var[] Environment variable: env_var_with_copy_button:+++QUARKUS_NEO4J_POOL_METRICS_ENABLED+++[] @@ -313,16 +307,16 @@ endif::add-copy-button-to-env-var[] ifndef::add-copy-button-to-env-var[] Environment variable: `+++QUARKUS_NEO4J_POOL_METRICS_ENABLED+++` endif::add-copy-button-to-env-var[] ---|boolean +-- +|boolean |`false` - -a| [[quarkus-neo4j_quarkus-neo4j-pool-log-leaked-sessions]]`link:#quarkus-neo4j_quarkus-neo4j-pool-log-leaked-sessions[quarkus.neo4j.pool.log-leaked-sessions]` - +a| [[quarkus-neo4j_quarkus-neo4j-pool-log-leaked-sessions]] [.property-path]##`quarkus.neo4j.pool.log-leaked-sessions`## [.description] -- -Flag, if leaked sessions logging is enabled. +if leaked sessions logging is enabled + ifdef::add-copy-button-to-env-var[] Environment variable: env_var_with_copy_button:+++QUARKUS_NEO4J_POOL_LOG_LEAKED_SESSIONS+++[] @@ -330,16 +324,16 @@ endif::add-copy-button-to-env-var[] ifndef::add-copy-button-to-env-var[] Environment variable: `+++QUARKUS_NEO4J_POOL_LOG_LEAKED_SESSIONS+++` endif::add-copy-button-to-env-var[] ---|boolean +-- +|boolean |`false` - -a| [[quarkus-neo4j_quarkus-neo4j-pool-max-connection-pool-size]]`link:#quarkus-neo4j_quarkus-neo4j-pool-max-connection-pool-size[quarkus.neo4j.pool.max-connection-pool-size]` - +a| [[quarkus-neo4j_quarkus-neo4j-pool-max-connection-pool-size]] [.property-path]##`quarkus.neo4j.pool.max-connection-pool-size`## [.description] -- -The maximum amount of connections in the connection pool towards a single database. +the maximum amount of connections in the connection pool towards a single database + ifdef::add-copy-button-to-env-var[] Environment variable: env_var_with_copy_button:+++QUARKUS_NEO4J_POOL_MAX_CONNECTION_POOL_SIZE+++[] @@ -347,67 +341,67 @@ endif::add-copy-button-to-env-var[] ifndef::add-copy-button-to-env-var[] Environment variable: `+++QUARKUS_NEO4J_POOL_MAX_CONNECTION_POOL_SIZE+++` endif::add-copy-button-to-env-var[] ---|int +-- +|int |`100` - -a| [[quarkus-neo4j_quarkus-neo4j-pool-idle-time-before-connection-test]]`link:#quarkus-neo4j_quarkus-neo4j-pool-idle-time-before-connection-test[quarkus.neo4j.pool.idle-time-before-connection-test]` - +a| [[quarkus-neo4j_quarkus-neo4j-pool-idle-time-before-connection-test]] [.property-path]##`quarkus.neo4j.pool.idle-time-before-connection-test`## [.description] -- Pooled connections that have been idle in the pool for longer than this timeout will be tested before they are used again. The value `0` means connections will always be tested for validity and negative values mean connections will never be tested. + ifdef::add-copy-button-to-env-var[] Environment variable: env_var_with_copy_button:+++QUARKUS_NEO4J_POOL_IDLE_TIME_BEFORE_CONNECTION_TEST+++[] endif::add-copy-button-to-env-var[] ifndef::add-copy-button-to-env-var[] Environment variable: `+++QUARKUS_NEO4J_POOL_IDLE_TIME_BEFORE_CONNECTION_TEST+++` endif::add-copy-button-to-env-var[] ---|link:https://docs.oracle.com/javase/8/docs/api/java/time/Duration.html[Duration] - link:#duration-note-anchor-{summaryTableId}[icon:question-circle[title=More information about the Duration format]] +-- +|link:https://docs.oracle.com/en/java/javase/17/docs/api/java/time/Duration.html[Duration] link:#duration-note-anchor-{summaryTableId}[icon:question-circle[title=More information about the Duration format]] |`-0.001S` - -a| [[quarkus-neo4j_quarkus-neo4j-pool-max-connection-lifetime]]`link:#quarkus-neo4j_quarkus-neo4j-pool-max-connection-lifetime[quarkus.neo4j.pool.max-connection-lifetime]` - +a| [[quarkus-neo4j_quarkus-neo4j-pool-max-connection-lifetime]] [.property-path]##`quarkus.neo4j.pool.max-connection-lifetime`## [.description] -- Pooled connections older than this threshold will be closed and removed from the pool. + ifdef::add-copy-button-to-env-var[] Environment variable: env_var_with_copy_button:+++QUARKUS_NEO4J_POOL_MAX_CONNECTION_LIFETIME+++[] endif::add-copy-button-to-env-var[] ifndef::add-copy-button-to-env-var[] Environment variable: `+++QUARKUS_NEO4J_POOL_MAX_CONNECTION_LIFETIME+++` endif::add-copy-button-to-env-var[] ---|link:https://docs.oracle.com/javase/8/docs/api/java/time/Duration.html[Duration] - link:#duration-note-anchor-{summaryTableId}[icon:question-circle[title=More information about the Duration format]] +-- +|link:https://docs.oracle.com/en/java/javase/17/docs/api/java/time/Duration.html[Duration] link:#duration-note-anchor-{summaryTableId}[icon:question-circle[title=More information about the Duration format]] |`1H` - -a| [[quarkus-neo4j_quarkus-neo4j-pool-connection-acquisition-timeout]]`link:#quarkus-neo4j_quarkus-neo4j-pool-connection-acquisition-timeout[quarkus.neo4j.pool.connection-acquisition-timeout]` - +a| [[quarkus-neo4j_quarkus-neo4j-pool-connection-acquisition-timeout]] [.property-path]##`quarkus.neo4j.pool.connection-acquisition-timeout`## [.description] -- Acquisition of new connections will be attempted for at most configured timeout. + ifdef::add-copy-button-to-env-var[] Environment variable: env_var_with_copy_button:+++QUARKUS_NEO4J_POOL_CONNECTION_ACQUISITION_TIMEOUT+++[] endif::add-copy-button-to-env-var[] ifndef::add-copy-button-to-env-var[] Environment variable: `+++QUARKUS_NEO4J_POOL_CONNECTION_ACQUISITION_TIMEOUT+++` endif::add-copy-button-to-env-var[] ---|link:https://docs.oracle.com/javase/8/docs/api/java/time/Duration.html[Duration] - link:#duration-note-anchor-{summaryTableId}[icon:question-circle[title=More information about the Duration format]] +-- +|link:https://docs.oracle.com/en/java/javase/17/docs/api/java/time/Duration.html[Duration] link:#duration-note-anchor-{summaryTableId}[icon:question-circle[title=More information about the Duration format]] |`1M` + |=== + ifndef::no-duration-note[] [NOTE] -[id='duration-note-anchor-{summaryTableId}'] +[id=duration-note-anchor-quarkus-neo4j_quarkus-neo4j] .About the Duration format ==== To write duration values, use the standard `java.time.Duration` format. @@ -424,3 +418,5 @@ In other cases, the simplified format is translated to the `java.time.Duration` * If the value is a number followed by `d`, it is prefixed with `P`. ==== endif::no-duration-note[] + +:!summaryTableId: \ No newline at end of file diff --git a/docs/modules/ROOT/pages/includes/quarkus-neo4j_quarkus.neo4j.adoc b/docs/modules/ROOT/pages/includes/quarkus-neo4j_quarkus.neo4j.adoc new file mode 100644 index 0000000..177e3ad --- /dev/null +++ b/docs/modules/ROOT/pages/includes/quarkus-neo4j_quarkus.neo4j.adoc @@ -0,0 +1,422 @@ +:summaryTableId: quarkus-neo4j_quarkus-neo4j +[.configuration-legend] +icon:lock[title=Fixed at build time] Configuration property fixed at build time - All other configuration properties are overridable at runtime +[.configuration-reference.searchable, cols="80,.^10,.^10"] +|=== + +h|[.header-title]##Configuration property## +h|Type +h|Default + +a|icon:lock[title=Fixed at build time] [[quarkus-neo4j_quarkus-neo4j-health-enabled]] [.property-path]##`quarkus.neo4j.health.enabled`## + +[.description] +-- +whether a health check is published in case the smallrye-health extension is present + + +ifdef::add-copy-button-to-env-var[] +Environment variable: env_var_with_copy_button:+++QUARKUS_NEO4J_HEALTH_ENABLED+++[] +endif::add-copy-button-to-env-var[] +ifndef::add-copy-button-to-env-var[] +Environment variable: `+++QUARKUS_NEO4J_HEALTH_ENABLED+++` +endif::add-copy-button-to-env-var[] +-- +|boolean +|`true` + +a|icon:lock[title=Fixed at build time] [[quarkus-neo4j_quarkus-neo4j-devservices-enabled]] [.property-path]##`quarkus.neo4j.devservices.enabled`## + +[.description] +-- +If DevServices has been explicitly enabled or disabled. DevServices is generally enabled by default, unless there is an existing configuration present. When DevServices is enabled Quarkus will attempt to automatically configure and start a database when running in Dev or Test mode. + + +ifdef::add-copy-button-to-env-var[] +Environment variable: env_var_with_copy_button:+++QUARKUS_NEO4J_DEVSERVICES_ENABLED+++[] +endif::add-copy-button-to-env-var[] +ifndef::add-copy-button-to-env-var[] +Environment variable: `+++QUARKUS_NEO4J_DEVSERVICES_ENABLED+++` +endif::add-copy-button-to-env-var[] +-- +|boolean +| + +a|icon:lock[title=Fixed at build time] [[quarkus-neo4j_quarkus-neo4j-devservices-image-name]] [.property-path]##`quarkus.neo4j.devservices.image-name`## + +[.description] +-- +the container image name to use, for container based DevServices providers + + +ifdef::add-copy-button-to-env-var[] +Environment variable: env_var_with_copy_button:+++QUARKUS_NEO4J_DEVSERVICES_IMAGE_NAME+++[] +endif::add-copy-button-to-env-var[] +ifndef::add-copy-button-to-env-var[] +Environment variable: `+++QUARKUS_NEO4J_DEVSERVICES_IMAGE_NAME+++` +endif::add-copy-button-to-env-var[] +-- +|string +|`neo4j:5` + +a|icon:lock[title=Fixed at build time] [[quarkus-neo4j_quarkus-neo4j-devservices-additional-env-additional-env]] [.property-path]##`quarkus.neo4j.devservices.additional-env."additional-env"`## + +[.description] +-- +additional environment entries that can be added to the container before its start + + +ifdef::add-copy-button-to-env-var[] +Environment variable: env_var_with_copy_button:+++QUARKUS_NEO4J_DEVSERVICES_ADDITIONAL_ENV__ADDITIONAL_ENV_+++[] +endif::add-copy-button-to-env-var[] +ifndef::add-copy-button-to-env-var[] +Environment variable: `+++QUARKUS_NEO4J_DEVSERVICES_ADDITIONAL_ENV__ADDITIONAL_ENV_+++` +endif::add-copy-button-to-env-var[] +-- +|Map +| + +a|icon:lock[title=Fixed at build time] [[quarkus-neo4j_quarkus-neo4j-devservices-bolt-port]] [.property-path]##`quarkus.neo4j.devservices.bolt-port`## + +[.description] +-- +This value can be used to specify the port to which the bolt-port of the container is exposed. It must be a free port, otherwise startup will fail. A random, free port will be used by default. Either way, a messsage will be logged on which port the Neo4j container is reachable over bolt. + + +ifdef::add-copy-button-to-env-var[] +Environment variable: env_var_with_copy_button:+++QUARKUS_NEO4J_DEVSERVICES_BOLT_PORT+++[] +endif::add-copy-button-to-env-var[] +ifndef::add-copy-button-to-env-var[] +Environment variable: `+++QUARKUS_NEO4J_DEVSERVICES_BOLT_PORT+++` +endif::add-copy-button-to-env-var[] +-- +|int +| + +a|icon:lock[title=Fixed at build time] [[quarkus-neo4j_quarkus-neo4j-devservices-http-port]] [.property-path]##`quarkus.neo4j.devservices.http-port`## + +[.description] +-- +This value can be used to specify the port to which the http-port of the container is exposed. It must be a free port, otherwise startup will fail. A random, free port will be used by default. Either way, a messsage will be logged on which port the Neo4j Browser is available. + + +ifdef::add-copy-button-to-env-var[] +Environment variable: env_var_with_copy_button:+++QUARKUS_NEO4J_DEVSERVICES_HTTP_PORT+++[] +endif::add-copy-button-to-env-var[] +ifndef::add-copy-button-to-env-var[] +Environment variable: `+++QUARKUS_NEO4J_DEVSERVICES_HTTP_PORT+++` +endif::add-copy-button-to-env-var[] +-- +|int +| + +a| [[quarkus-neo4j_quarkus-neo4j-uri]] [.property-path]##`quarkus.neo4j.uri`## + +[.description] +-- +the uri this driver should connect to. The driver supports bolt, bolt+routing or neo4j as schemes + + +ifdef::add-copy-button-to-env-var[] +Environment variable: env_var_with_copy_button:+++QUARKUS_NEO4J_URI+++[] +endif::add-copy-button-to-env-var[] +ifndef::add-copy-button-to-env-var[] +Environment variable: `+++QUARKUS_NEO4J_URI+++` +endif::add-copy-button-to-env-var[] +-- +|string +|`bolt://localhost:7687` + +a| [[quarkus-neo4j_quarkus-neo4j-encrypted]] [.property-path]##`quarkus.neo4j.encrypted`## + +[.description] +-- +if the driver should use encrypted traffic + + +ifdef::add-copy-button-to-env-var[] +Environment variable: env_var_with_copy_button:+++QUARKUS_NEO4J_ENCRYPTED+++[] +endif::add-copy-button-to-env-var[] +ifndef::add-copy-button-to-env-var[] +Environment variable: `+++QUARKUS_NEO4J_ENCRYPTED+++` +endif::add-copy-button-to-env-var[] +-- +|boolean +|`false` + +a| [[quarkus-neo4j_quarkus-neo4j-max-transaction-retry-time]] [.property-path]##`quarkus.neo4j.max-transaction-retry-time`## + +[.description] +-- +the maximum time transactions are allowed to retry + + +ifdef::add-copy-button-to-env-var[] +Environment variable: env_var_with_copy_button:+++QUARKUS_NEO4J_MAX_TRANSACTION_RETRY_TIME+++[] +endif::add-copy-button-to-env-var[] +ifndef::add-copy-button-to-env-var[] +Environment variable: `+++QUARKUS_NEO4J_MAX_TRANSACTION_RETRY_TIME+++` +endif::add-copy-button-to-env-var[] +-- +|link:https://docs.oracle.com/en/java/javase/17/docs/api/java/time/Duration.html[Duration] link:#duration-note-anchor-{summaryTableId}[icon:question-circle[title=More information about the Duration format]] +|`30S` + +h|[[quarkus-neo4j_section_quarkus-neo4j-authentication]] [.section-name.section-level0]##the authentication## +h|Type +h|Default + +a| [[quarkus-neo4j_quarkus-neo4j-authentication-username]] [.property-path]##`quarkus.neo4j.authentication.username`## + +[.description] +-- +the login of the user connecting to the database + + +ifdef::add-copy-button-to-env-var[] +Environment variable: env_var_with_copy_button:+++QUARKUS_NEO4J_AUTHENTICATION_USERNAME+++[] +endif::add-copy-button-to-env-var[] +ifndef::add-copy-button-to-env-var[] +Environment variable: `+++QUARKUS_NEO4J_AUTHENTICATION_USERNAME+++` +endif::add-copy-button-to-env-var[] +-- +|string +|`neo4j` + +a| [[quarkus-neo4j_quarkus-neo4j-authentication-password]] [.property-path]##`quarkus.neo4j.authentication.password`## + +[.description] +-- +the password of the user connecting to the database + + +ifdef::add-copy-button-to-env-var[] +Environment variable: env_var_with_copy_button:+++QUARKUS_NEO4J_AUTHENTICATION_PASSWORD+++[] +endif::add-copy-button-to-env-var[] +ifndef::add-copy-button-to-env-var[] +Environment variable: `+++QUARKUS_NEO4J_AUTHENTICATION_PASSWORD+++` +endif::add-copy-button-to-env-var[] +-- +|string +|`neo4j` + +a| [[quarkus-neo4j_quarkus-neo4j-authentication-disabled]] [.property-path]##`quarkus.neo4j.authentication.disabled`## + +[.description] +-- +whether disable authentication or not + + +ifdef::add-copy-button-to-env-var[] +Environment variable: env_var_with_copy_button:+++QUARKUS_NEO4J_AUTHENTICATION_DISABLED+++[] +endif::add-copy-button-to-env-var[] +ifndef::add-copy-button-to-env-var[] +Environment variable: `+++QUARKUS_NEO4J_AUTHENTICATION_DISABLED+++` +endif::add-copy-button-to-env-var[] +-- +|boolean +|`false` + +a| [[quarkus-neo4j_quarkus-neo4j-authentication-value]] [.property-path]##`quarkus.neo4j.authentication.value`## + +[.description] +-- +An optional field that when is not empty has precedence over `username` and `password`. It behaves the same way as `NEO4J_AUTH` in the official docker image, containing both the username and password separated via a single forward slash (`/`). + + +ifdef::add-copy-button-to-env-var[] +Environment variable: env_var_with_copy_button:+++QUARKUS_NEO4J_AUTHENTICATION_VALUE+++[] +endif::add-copy-button-to-env-var[] +ifndef::add-copy-button-to-env-var[] +Environment variable: `+++QUARKUS_NEO4J_AUTHENTICATION_VALUE+++` +endif::add-copy-button-to-env-var[] +-- +|string +| + + +h|[[quarkus-neo4j_section_quarkus-neo4j-trust-settings]] [.section-name.section-level0]##the trust settings for encrypted traffic## +h|Type +h|Default + +a| [[quarkus-neo4j_quarkus-neo4j-trust-settings-strategy]] [.property-path]##`quarkus.neo4j.trust-settings.strategy`## + +[.description] +-- +which trust strategy to apply when using encrypted traffic + + +ifdef::add-copy-button-to-env-var[] +Environment variable: env_var_with_copy_button:+++QUARKUS_NEO4J_TRUST_SETTINGS_STRATEGY+++[] +endif::add-copy-button-to-env-var[] +ifndef::add-copy-button-to-env-var[] +Environment variable: `+++QUARKUS_NEO4J_TRUST_SETTINGS_STRATEGY+++` +endif::add-copy-button-to-env-var[] +-- +a|Strategy +|`trust-system-ca-signed-certificates` + +a| [[quarkus-neo4j_quarkus-neo4j-trust-settings-cert-file]] [.property-path]##`quarkus.neo4j.trust-settings.cert-file`## + +[.description] +-- +the file of the certificate to use + + +ifdef::add-copy-button-to-env-var[] +Environment variable: env_var_with_copy_button:+++QUARKUS_NEO4J_TRUST_SETTINGS_CERT_FILE+++[] +endif::add-copy-button-to-env-var[] +ifndef::add-copy-button-to-env-var[] +Environment variable: `+++QUARKUS_NEO4J_TRUST_SETTINGS_CERT_FILE+++` +endif::add-copy-button-to-env-var[] +-- +|path +| + +a| [[quarkus-neo4j_quarkus-neo4j-trust-settings-hostname-verification-enabled]] [.property-path]##`quarkus.neo4j.trust-settings.hostname-verification-enabled`## + +[.description] +-- +whether hostname verification is used + + +ifdef::add-copy-button-to-env-var[] +Environment variable: env_var_with_copy_button:+++QUARKUS_NEO4J_TRUST_SETTINGS_HOSTNAME_VERIFICATION_ENABLED+++[] +endif::add-copy-button-to-env-var[] +ifndef::add-copy-button-to-env-var[] +Environment variable: `+++QUARKUS_NEO4J_TRUST_SETTINGS_HOSTNAME_VERIFICATION_ENABLED+++` +endif::add-copy-button-to-env-var[] +-- +|boolean +|`false` + + +h|[[quarkus-neo4j_section_quarkus-neo4j-pool]] [.section-name.section-level0]##the connection pool## +h|Type +h|Default + +a| [[quarkus-neo4j_quarkus-neo4j-pool-metrics-enabled]] [.property-path]##`quarkus.neo4j.pool.metrics.enabled`## + +[.description] +-- +lag, if metrics are enabled + + +ifdef::add-copy-button-to-env-var[] +Environment variable: env_var_with_copy_button:+++QUARKUS_NEO4J_POOL_METRICS_ENABLED+++[] +endif::add-copy-button-to-env-var[] +ifndef::add-copy-button-to-env-var[] +Environment variable: `+++QUARKUS_NEO4J_POOL_METRICS_ENABLED+++` +endif::add-copy-button-to-env-var[] +-- +|boolean +|`false` + +a| [[quarkus-neo4j_quarkus-neo4j-pool-log-leaked-sessions]] [.property-path]##`quarkus.neo4j.pool.log-leaked-sessions`## + +[.description] +-- +if leaked sessions logging is enabled + + +ifdef::add-copy-button-to-env-var[] +Environment variable: env_var_with_copy_button:+++QUARKUS_NEO4J_POOL_LOG_LEAKED_SESSIONS+++[] +endif::add-copy-button-to-env-var[] +ifndef::add-copy-button-to-env-var[] +Environment variable: `+++QUARKUS_NEO4J_POOL_LOG_LEAKED_SESSIONS+++` +endif::add-copy-button-to-env-var[] +-- +|boolean +|`false` + +a| [[quarkus-neo4j_quarkus-neo4j-pool-max-connection-pool-size]] [.property-path]##`quarkus.neo4j.pool.max-connection-pool-size`## + +[.description] +-- +the maximum amount of connections in the connection pool towards a single database + + +ifdef::add-copy-button-to-env-var[] +Environment variable: env_var_with_copy_button:+++QUARKUS_NEO4J_POOL_MAX_CONNECTION_POOL_SIZE+++[] +endif::add-copy-button-to-env-var[] +ifndef::add-copy-button-to-env-var[] +Environment variable: `+++QUARKUS_NEO4J_POOL_MAX_CONNECTION_POOL_SIZE+++` +endif::add-copy-button-to-env-var[] +-- +|int +|`100` + +a| [[quarkus-neo4j_quarkus-neo4j-pool-idle-time-before-connection-test]] [.property-path]##`quarkus.neo4j.pool.idle-time-before-connection-test`## + +[.description] +-- +Pooled connections that have been idle in the pool for longer than this timeout will be tested before they are used again. The value `0` means connections will always be tested for validity and negative values mean connections will never be tested. + + +ifdef::add-copy-button-to-env-var[] +Environment variable: env_var_with_copy_button:+++QUARKUS_NEO4J_POOL_IDLE_TIME_BEFORE_CONNECTION_TEST+++[] +endif::add-copy-button-to-env-var[] +ifndef::add-copy-button-to-env-var[] +Environment variable: `+++QUARKUS_NEO4J_POOL_IDLE_TIME_BEFORE_CONNECTION_TEST+++` +endif::add-copy-button-to-env-var[] +-- +|link:https://docs.oracle.com/en/java/javase/17/docs/api/java/time/Duration.html[Duration] link:#duration-note-anchor-{summaryTableId}[icon:question-circle[title=More information about the Duration format]] +|`-0.001S` + +a| [[quarkus-neo4j_quarkus-neo4j-pool-max-connection-lifetime]] [.property-path]##`quarkus.neo4j.pool.max-connection-lifetime`## + +[.description] +-- +Pooled connections older than this threshold will be closed and removed from the pool. + + +ifdef::add-copy-button-to-env-var[] +Environment variable: env_var_with_copy_button:+++QUARKUS_NEO4J_POOL_MAX_CONNECTION_LIFETIME+++[] +endif::add-copy-button-to-env-var[] +ifndef::add-copy-button-to-env-var[] +Environment variable: `+++QUARKUS_NEO4J_POOL_MAX_CONNECTION_LIFETIME+++` +endif::add-copy-button-to-env-var[] +-- +|link:https://docs.oracle.com/en/java/javase/17/docs/api/java/time/Duration.html[Duration] link:#duration-note-anchor-{summaryTableId}[icon:question-circle[title=More information about the Duration format]] +|`1H` + +a| [[quarkus-neo4j_quarkus-neo4j-pool-connection-acquisition-timeout]] [.property-path]##`quarkus.neo4j.pool.connection-acquisition-timeout`## + +[.description] +-- +Acquisition of new connections will be attempted for at most configured timeout. + + +ifdef::add-copy-button-to-env-var[] +Environment variable: env_var_with_copy_button:+++QUARKUS_NEO4J_POOL_CONNECTION_ACQUISITION_TIMEOUT+++[] +endif::add-copy-button-to-env-var[] +ifndef::add-copy-button-to-env-var[] +Environment variable: `+++QUARKUS_NEO4J_POOL_CONNECTION_ACQUISITION_TIMEOUT+++` +endif::add-copy-button-to-env-var[] +-- +|link:https://docs.oracle.com/en/java/javase/17/docs/api/java/time/Duration.html[Duration] link:#duration-note-anchor-{summaryTableId}[icon:question-circle[title=More information about the Duration format]] +|`1M` + + +|=== + +ifndef::no-duration-note[] +[NOTE] +[id=duration-note-anchor-quarkus-neo4j_quarkus-neo4j] +.About the Duration format +==== +To write duration values, use the standard `java.time.Duration` format. +See the link:https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/time/Duration.html#parse(java.lang.CharSequence)[Duration#parse() Java API documentation] for more information. + +You can also use a simplified format, starting with a number: + +* If the value is only a number, it represents time in seconds. +* If the value is a number followed by `ms`, it represents time in milliseconds. + +In other cases, the simplified format is translated to the `java.time.Duration` format for parsing: + +* If the value is a number followed by `h`, `m`, or `s`, it is prefixed with `PT`. +* If the value is a number followed by `d`, it is prefixed with `P`. +==== +endif::no-duration-note[] + +:!summaryTableId: \ No newline at end of file diff --git a/docs/pom.xml b/docs/pom.xml index 92d472a..12c27f3 100644 --- a/docs/pom.xml +++ b/docs/pom.xml @@ -39,6 +39,14 @@ + + io.quarkus + quarkus-config-doc-maven-plugin + true + + ${project.basedir}/modules/ROOT/pages/includes/ + + maven-resources-plugin @@ -51,14 +59,6 @@ ${project.basedir}/modules/ROOT/pages/includes/ - - ${project.basedir}/../target/asciidoc/generated/config/ - - quarkus-neo4j.adoc - quarkus-neo4j-config-group-dev-services-build-time-config.adoc - - false - ${project.basedir}/templates/includes attributes.adoc diff --git a/pom.xml b/pom.xml index 37ad9bd..e4c4625 100644 --- a/pom.xml +++ b/pom.xml @@ -30,7 +30,7 @@ 17 UTF-8 UTF-8 - 3.13.2 + 3.14.0 3.26.3 5.23.0 @@ -63,6 +63,11 @@ quarkus-maven-plugin ${quarkus.version} + + io.quarkus + quarkus-config-doc-maven-plugin + ${quarkus.version} + maven-compiler-plugin ${compiler-plugin.version} diff --git a/runtime/pom.xml b/runtime/pom.xml index ab64311..367ba3d 100644 --- a/runtime/pom.xml +++ b/runtime/pom.xml @@ -35,6 +35,11 @@ assertj-core test + + org.mockito + mockito-core + test + diff --git a/runtime/src/main/java/io/quarkus/neo4j/runtime/Neo4jConfiguration.java b/runtime/src/main/java/io/quarkus/neo4j/runtime/Neo4jConfiguration.java index aab6674..fb03c87 100644 --- a/runtime/src/main/java/io/quarkus/neo4j/runtime/Neo4jConfiguration.java +++ b/runtime/src/main/java/io/quarkus/neo4j/runtime/Neo4jConfiguration.java @@ -9,90 +9,91 @@ import io.quarkus.runtime.annotations.ConfigDocSection; import io.quarkus.runtime.annotations.ConfigGroup; -import io.quarkus.runtime.annotations.ConfigItem; import io.quarkus.runtime.annotations.ConfigPhase; import io.quarkus.runtime.annotations.ConfigRoot; +import io.smallrye.config.ConfigMapping; +import io.smallrye.config.WithDefault; +import io.smallrye.config.WithName; +@ConfigMapping(prefix = "quarkus.neo4j") @ConfigRoot(phase = ConfigPhase.RUN_TIME) -public class Neo4jConfiguration { +public interface Neo4jConfiguration { - static final String DEFAULT_SERVER_URI = "bolt://localhost:7687"; - static final String DEFAULT_USERNAME = "neo4j"; - static final String DEFAULT_PASSWORD = "neo4j"; + String DEFAULT_SERVER_URI = "bolt://localhost:7687"; + String DEFAULT_USERNAME = "neo4j"; + String DEFAULT_PASSWORD = "neo4j"; /** - * The uri this driver should connect to. The driver supports bolt, bolt+routing or neo4j as schemes. + * {@return the uri this driver should connect to. The driver supports bolt, bolt+routing or neo4j as schemes} */ - @ConfigItem(defaultValue = DEFAULT_SERVER_URI) - public String uri; + @WithDefault(DEFAULT_SERVER_URI) + String uri(); /** - * Authentication. + * {@return the authentication} */ - @ConfigItem @ConfigDocSection - public Authentication authentication; + Authentication authentication(); /** - * If the driver should use encrypted traffic. + * {@return if the driver should use encrypted traffic} */ - @ConfigItem - public boolean encrypted; + @WithDefault("false") + boolean encrypted(); /** - * Configure trust settings for encrypted traffic. + * {@return the trust settings for encrypted traffic} */ - @ConfigItem @ConfigDocSection - public TrustSettings trustSettings; + TrustSettings trustSettings(); /** - * Configure the maximum time transactions are allowed to retry. + * {@return the maximum time transactions are allowed to retry} */ - @ConfigItem(defaultValue = "30S") - public Duration maxTransactionRetryTime; + @WithDefault("30S") + Duration maxTransactionRetryTime(); /** - * Connection pool. + * {@return the connection pool} */ - @ConfigItem @ConfigDocSection - public Pool pool; + Pool pool(); @ConfigGroup - static class Authentication { + interface Authentication { /** - * The login of the user connecting to the database. + * {@return the login of the user connecting to the database} */ - @ConfigItem(defaultValue = DEFAULT_USERNAME) - public String username; + @WithDefault(DEFAULT_USERNAME) + String username(); /** - * The password of the user connecting to the database. + * {@return the password of the user connecting to the database} */ - @ConfigItem(defaultValue = DEFAULT_PASSWORD) - public String password; + @WithDefault(DEFAULT_PASSWORD) + String password(); /** - * Set this to true to disable authentication. + * {@return whether disable authentication or not} */ - @ConfigItem - public boolean disabled; + @WithDefault("false") + boolean disabled(); /** * An optional field that when is not empty has precedence over {@link #username} and {@link #password}. It behaves * the same way as {@literal NEO4J_AUTH} in the official docker image, containing both the username and password * separated via a single forward slash ({@code /}). + * + * @return a concrete value for the token, overriding all other settings */ - @ConfigItem - public Optional value; + Optional value(); } @ConfigGroup - static class TrustSettings { + interface TrustSettings { - public enum Strategy { + enum Strategy { TRUST_ALL_CERTIFICATES, @@ -102,45 +103,37 @@ public enum Strategy { } /** - * Configures which trust strategy to apply when using encrypted traffic. + * {@return which trust strategy to apply when using encrypted traffic} */ - @ConfigItem(defaultValue = "TRUST_SYSTEM_CA_SIGNED_CERTIFICATES") - public Strategy strategy; + @WithDefault("TRUST_SYSTEM_CA_SIGNED_CERTIFICATES") + Strategy strategy(); /** - * The file of the certificate to use. + * {@return the file of the certificate to use} */ - @ConfigItem - public Optional certFile = Optional.empty(); + Optional certFile(); /** - * If hostname verification is used. + * {@return whether hostname verification is used} */ - @ConfigItem - public boolean hostnameVerificationEnabled; + @WithDefault("false") + boolean hostnameVerificationEnabled(); - Config.TrustStrategy toInternalRepresentation() { + default Config.TrustStrategy toInternalRepresentation() { Config.TrustStrategy internalRepresentation; - Strategy nonNullStrategy = strategy == null ? Strategy.TRUST_SYSTEM_CA_SIGNED_CERTIFICATES : strategy; - switch (nonNullStrategy) { - case TRUST_ALL_CERTIFICATES: - internalRepresentation = Config.TrustStrategy.trustAllCertificates(); - break; - case TRUST_SYSTEM_CA_SIGNED_CERTIFICATES: - internalRepresentation = Config.TrustStrategy.trustSystemCertificates(); - break; - case TRUST_CUSTOM_CA_SIGNED_CERTIFICATES: - - File certFile = this.certFile.map(Path::toFile).filter(File::isFile) + Strategy nonNullStrategy = strategy() == null ? Strategy.TRUST_SYSTEM_CA_SIGNED_CERTIFICATES : strategy(); + internalRepresentation = switch (nonNullStrategy) { + case TRUST_ALL_CERTIFICATES -> Config.TrustStrategy.trustAllCertificates(); + case TRUST_SYSTEM_CA_SIGNED_CERTIFICATES -> Config.TrustStrategy.trustSystemCertificates(); + case TRUST_CUSTOM_CA_SIGNED_CERTIFICATES -> { + File certFile = certFile().map(Path::toFile).filter(File::isFile) .orElseThrow(() -> new RuntimeException("Configured trust strategy requires a certificate file.")); - internalRepresentation = Config.TrustStrategy.trustCustomCertificateSignedBy(certFile); - break; - default: - throw new RuntimeException("Unknown trust strategy: " + this.strategy.name()); - } + yield Config.TrustStrategy.trustCustomCertificateSignedBy(certFile); + } + }; - if (hostnameVerificationEnabled) { + if (hostnameVerificationEnabled()) { internalRepresentation.withHostnameVerification(); } else { internalRepresentation.withoutHostnameVerification(); @@ -150,57 +143,52 @@ Config.TrustStrategy toInternalRepresentation() { } @ConfigGroup - static class Pool { + interface Pool { /** - * Flag, if metrics are enabled. + * {@return lag, if metrics are enabled} */ - @ConfigItem(name = "metrics.enabled") - public boolean metricsEnabled; + @WithName("metrics.enabled") + @WithDefault("false") + boolean metricsEnabled(); /** - * Flag, if leaked sessions logging is enabled. + * {@return if leaked sessions logging is enabled} */ - @ConfigItem - public boolean logLeakedSessions; + @WithDefault("false") + boolean logLeakedSessions(); /** - * The maximum amount of connections in the connection pool towards a single database. + * {@return the maximum amount of connections in the connection pool towards a single database} */ - @ConfigItem(defaultValue = "100") - public int maxConnectionPoolSize; + @WithDefault("100") + int maxConnectionPoolSize(); /** * Pooled connections that have been idle in the pool for longer than this timeout will be tested before they are used * again. The value {@literal 0} means connections will always be tested for validity and negative values mean * connections * will never be tested. + * + * @return the maximum idle time before connections are tested again */ - @ConfigItem(defaultValue = "-0.001S") - public Duration idleTimeBeforeConnectionTest; + @WithDefault("-0.001S") + Duration idleTimeBeforeConnectionTest(); /** * Pooled connections older than this threshold will be closed and removed from the pool. + * + * @return the lifetime of a connection */ - @ConfigItem(defaultValue = "1H") - public Duration maxConnectionLifetime; + @WithDefault("1H") + Duration maxConnectionLifetime(); /** * Acquisition of new connections will be attempted for at most configured timeout. + * + * @return the acquisition timeout */ - @ConfigItem(defaultValue = "1M") - public Duration connectionAcquisitionTimeout; - - @Override - public String toString() { - return "Pool{" + - "metricsEnabled=" + metricsEnabled + - ", logLeakedSessions=" + logLeakedSessions + - ", maxConnectionPoolSize=" + maxConnectionPoolSize + - ", idleTimeBeforeConnectionTest=" + idleTimeBeforeConnectionTest + - ", maxConnectionLifetime=" + maxConnectionLifetime + - ", connectionAcquisitionTimeout=" + connectionAcquisitionTimeout + - '}'; - } + @WithDefault("1M") + Duration connectionAcquisitionTimeout(); } } diff --git a/runtime/src/main/java/io/quarkus/neo4j/runtime/Neo4jDriverRecorder.java b/runtime/src/main/java/io/quarkus/neo4j/runtime/Neo4jDriverRecorder.java index 33ab420..f80acb9 100644 --- a/runtime/src/main/java/io/quarkus/neo4j/runtime/Neo4jDriverRecorder.java +++ b/runtime/src/main/java/io/quarkus/neo4j/runtime/Neo4jDriverRecorder.java @@ -35,13 +35,13 @@ public class Neo4jDriverRecorder { public RuntimeValue initializeDriver(Neo4jConfiguration configuration, ShutdownContext shutdownContext) { - String uri = configuration.uri; + String uri = configuration.uri(); AuthToken authToken = getAuthToken(configuration); Config.ConfigBuilder configBuilder = createBaseConfig(); configureSsl(configBuilder, configuration); - configurePoolSettings(configBuilder, configuration.pool); - configBuilder.withMaxTransactionRetryTime(configuration.maxTransactionRetryTime.toMillis(), TimeUnit.MILLISECONDS); + configurePoolSettings(configBuilder, configuration.pool()); + configBuilder.withMaxTransactionRetryTime(configuration.maxTransactionRetryTime().toMillis(), TimeUnit.MILLISECONDS); Driver driver = GraphDatabase.driver(uri, authToken, configBuilder.build()); shutdownContext.addShutdownTask(driver::close); @@ -49,13 +49,14 @@ public RuntimeValue initializeDriver(Neo4jConfiguration configuration, S } static AuthToken getAuthToken(Neo4jConfiguration configuration) { - if (configuration.authentication.disabled) { + if (configuration.authentication().disabled()) { return AuthTokens.none(); } - return configuration.authentication.value + return configuration.authentication().value() .map(Neo4jDriverRecorder::toAuthToken) .orElseGet( - () -> AuthTokens.basic(configuration.authentication.username, configuration.authentication.password)); + () -> AuthTokens.basic(configuration.authentication().username(), + configuration.authentication().password())); } static AuthToken toAuthToken(String value) { @@ -70,7 +71,7 @@ static AuthToken toAuthToken(String value) { } public Consumer registerMetrics(Neo4jConfiguration configuration) { - if (configuration.pool != null && configuration.pool.metricsEnabled) { + if (configuration.pool() != null && configuration.pool().metricsEnabled()) { return metricsFactory -> { // if the pool hasn't been used yet, the ConnectionPoolMetrics object doesn't exist, so use zeros instead metricsFactory.builder("neo4j.acquired").buildCounter( @@ -133,7 +134,7 @@ private static Config.ConfigBuilder createBaseConfig() { private static void configureSsl(Config.ConfigBuilder configBuilder, Neo4jConfiguration configuration) { - var uri = URI.create(configuration.uri); + var uri = URI.create(configuration.uri()); var scheme = uri.getScheme(); boolean isSecurityScheme = Scheme.isSecurityScheme(scheme); @@ -159,9 +160,9 @@ private static void configureSsl(Config.ConfigBuilder configBuilder, Neo4jConfig "Native SSL is disabled, communication between this client and the Neo4j server cannot be encrypted."); configBuilder.withoutEncryption(); } else { - if (configuration.encrypted) { + if (configuration.encrypted()) { configBuilder.withEncryption(); - configBuilder.withTrustStrategy(configuration.trustSettings.toInternalRepresentation()); + configBuilder.withTrustStrategy(configuration.trustSettings().toInternalRepresentation()); } else { configBuilder.withoutEncryption(); } @@ -174,16 +175,16 @@ private static void configurePoolSettings(Config.ConfigBuilder configBuilder, Ne log.debug("Configuring Neo4j pool settings with " + pool); } - if (pool.logLeakedSessions) { + if (pool.logLeakedSessions()) { configBuilder.withLeakedSessionsLogging(); } - configBuilder.withMaxConnectionPoolSize(pool.maxConnectionPoolSize); - configBuilder.withConnectionLivenessCheckTimeout(pool.idleTimeBeforeConnectionTest.toMillis(), MILLISECONDS); - configBuilder.withMaxConnectionLifetime(pool.maxConnectionLifetime.toMillis(), MILLISECONDS); - configBuilder.withConnectionAcquisitionTimeout(pool.connectionAcquisitionTimeout.toMillis(), MILLISECONDS); + configBuilder.withMaxConnectionPoolSize(pool.maxConnectionPoolSize()); + configBuilder.withConnectionLivenessCheckTimeout(pool.idleTimeBeforeConnectionTest().toMillis(), MILLISECONDS); + configBuilder.withMaxConnectionLifetime(pool.maxConnectionLifetime().toMillis(), MILLISECONDS); + configBuilder.withConnectionAcquisitionTimeout(pool.connectionAcquisitionTimeout().toMillis(), MILLISECONDS); - if (pool.metricsEnabled) { + if (pool.metricsEnabled()) { configBuilder.withDriverMetrics(); } else { configBuilder.withoutDriverMetrics(); diff --git a/runtime/src/test/java/io/quarkus/neo4j/runtime/Neo4jDriverRecorderTest.java b/runtime/src/test/java/io/quarkus/neo4j/runtime/Neo4jDriverRecorderTest.java index a74e7bf..a95a57c 100644 --- a/runtime/src/test/java/io/quarkus/neo4j/runtime/Neo4jDriverRecorderTest.java +++ b/runtime/src/test/java/io/quarkus/neo4j/runtime/Neo4jDriverRecorderTest.java @@ -2,6 +2,8 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; import java.util.Optional; @@ -15,9 +17,10 @@ class Neo4jDriverRecorderTest { @Test // GH-168 void authTokenShouldBeNoneWhenDisabled() { - var configuration = new Neo4jConfiguration(); - configuration.authentication = new Neo4jConfiguration.Authentication(); - configuration.authentication.disabled = true; + var configuration = mock(Neo4jConfiguration.class); + var authentication = mock(Neo4jConfiguration.Authentication.class); + when(authentication.disabled()).thenReturn(true); + when(configuration.authentication()).thenReturn(authentication); var authToken = Neo4jDriverRecorder.getAuthToken(configuration); assertThat(authToken).isEqualTo(AuthTokens.none()); } @@ -25,11 +28,12 @@ void authTokenShouldBeNoneWhenDisabled() { @Test // GH-168 void shouldUseUserNamePassword() { - var configuration = new Neo4jConfiguration(); - configuration.authentication = new Neo4jConfiguration.Authentication(); - configuration.authentication.value = Optional.empty(); - configuration.authentication.username = "foo"; - configuration.authentication.password = "bar"; + var configuration = mock(Neo4jConfiguration.class); + var authentication = mock(Neo4jConfiguration.Authentication.class); + when(authentication.value()).thenReturn(Optional.empty()); + when(authentication.username()).thenReturn("foo"); + when(authentication.password()).thenReturn("bar"); + when(configuration.authentication()).thenReturn(authentication); var authToken = Neo4jDriverRecorder.getAuthToken(configuration); assertThat(authToken).isEqualTo(AuthTokens.basic("foo", "bar")); } @@ -37,9 +41,10 @@ void shouldUseUserNamePassword() { @Test // GH-168 void shouldUseValue() { - var configuration = new Neo4jConfiguration(); - configuration.authentication = new Neo4jConfiguration.Authentication(); - configuration.authentication.value = Optional.of("foo/bar"); + var configuration = mock(Neo4jConfiguration.class); + var authentication = mock(Neo4jConfiguration.Authentication.class); + when(authentication.value()).thenReturn(Optional.of("foo/bar")); + when(configuration.authentication()).thenReturn(authentication); var authToken = Neo4jDriverRecorder.getAuthToken(configuration); assertThat(authToken).isEqualTo(AuthTokens.basic("foo", "bar")); } @@ -47,11 +52,12 @@ void shouldUseValue() { @Test // GH-168 void valueShouldHavePrecedence() { - var configuration = new Neo4jConfiguration(); - configuration.authentication = new Neo4jConfiguration.Authentication(); - configuration.authentication.value = Optional.of("foo/bar"); - configuration.authentication.username = "wurst"; - configuration.authentication.password = "salat"; + var configuration = mock(Neo4jConfiguration.class); + var authentication = mock(Neo4jConfiguration.Authentication.class); + when(authentication.value()).thenReturn(Optional.of("foo/bar")); + when(authentication.username()).thenReturn("wurst"); + when(authentication.password()).thenReturn("salat"); + when(configuration.authentication()).thenReturn(authentication); var authToken = Neo4jDriverRecorder.getAuthToken(configuration); assertThat(authToken).isEqualTo(AuthTokens.basic("foo", "bar")); } @@ -64,4 +70,4 @@ void invalidAuthValuesShouldBeCaught(String value) { .withMessage( "Invalid value for NEO4J_AUTH, the only supported format is /, neither username nor password are optional"); } -} \ No newline at end of file +}