You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ja...@apache.org on 2024/01/03 10:57:29 UTC

(camel-quarkus-examples) branch camel-quarkus-main updated: Avoid use of localhost in derby JDBC URL

This is an automated email from the ASF dual-hosted git repository.

jamesnetherton pushed a commit to branch camel-quarkus-main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus-examples.git


The following commit(s) were added to refs/heads/camel-quarkus-main by this push:
     new a89c384  Avoid use of localhost in derby JDBC URL
a89c384 is described below

commit a89c384e427a4c04543e4b61d4298fba2e384800
Author: James Netherton <ja...@gmail.com>
AuthorDate: Wed Jan 3 09:31:34 2024 +0000

    Avoid use of localhost in derby JDBC URL
---
 .../org/acme/jpa/idempotent/repository/DerbyTestResource.java  | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/jpa-idempotent-repository/src/test/java/org/acme/jpa/idempotent/repository/DerbyTestResource.java b/jpa-idempotent-repository/src/test/java/org/acme/jpa/idempotent/repository/DerbyTestResource.java
index 6e456a2..e45da44 100644
--- a/jpa-idempotent-repository/src/test/java/org/acme/jpa/idempotent/repository/DerbyTestResource.java
+++ b/jpa-idempotent-repository/src/test/java/org/acme/jpa/idempotent/repository/DerbyTestResource.java
@@ -52,10 +52,12 @@ public class DerbyTestResource<T extends GenericContainer> implements QuarkusTes
             container.execInContainer("java", "-Djdbc.drivers=org.apache.derbbc.EmbeddedDriver",
                     "org.apache.derby.tools.ij", "/init.sql");
 
-            return CollectionHelper.mapOf("quarkus.datasource.jdbc.url",
-                    "jdbc:derby://localhost:" + container.getMappedPort(DERBY_PORT) + "/my-db", "timer.period", "100",
-                    "timer.delay",
-                    "0", "timer.repeatCount", "4");
+            String url = "jdbc:derby://%s:%d/my-db".formatted(container.getHost(), container.getMappedPort(DERBY_PORT));
+            return CollectionHelper.mapOf(
+                    "quarkus.datasource.jdbc.url", url,
+                    "timer.period", "100",
+                    "timer.delay", "0",
+                    "timer.repeatCount", "4");
         } catch (Exception e) {
             LOGGER.error("An error occurred while starting the derby container", e);
             throw new RuntimeException(e);