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/10/22 08:45:08 UTC
(camel-quarkus) branch 3.15.x updated (be4da90669 -> aba112ecfa)
This is an automated email from the ASF dual-hosted git repository.
jamesnetherton pushed a change to branch 3.15.x
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
from be4da90669 Fix Camel header documentation
new 073e1dce83 Mysql testResource instead of devservices
new adb55c584e Document FHIR native mode requirements for FhirContext
new cb8917a50c Improve some test assertions in FHIR tests
new aba112ecfa Fix check for ServiceRemoveEvent observers
The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../ROOT/pages/reference/extensions/fhir.adoc | 81 ++++++++++++++++++-
.../quarkus/core/CamelLifecycleEventBridge.java | 2 +-
.../fhir/runtime/src/main/doc/configuration.adoc | 3 +-
extensions/fhir/runtime/src/main/doc/usage.adoc | 73 +++++++++++++++++
integration-test-groups/jdbc/mysql/README.adoc | 26 ------
integration-test-groups/jdbc/mysql/pom.xml | 26 +++---
.../jdbc/mysql/Sha256FIPSPasswordPlugin.java | 38 ---------
.../src/main/resources/application.properties | 2 +-
.../component/jdbc/mysql/CamelMysqlJdbcTest.java | 3 +-
.../component/jdbc/mysql/MysqlTestResource.java | 92 ++++++++++++++++++++++
.../fhir/it/AbstractFhirRouteBuilder.java | 7 ++
.../component/fhir/it/FhirDstu2Hl7OrgResource.java | 43 ++++------
.../component/fhir/it/FhirDstu2Resource.java | 40 ++++------
.../component/fhir/it/FhirDstu2_1Resource.java | 40 ++++------
.../component/fhir/it/FhirDstu3Resource.java | 27 +++----
.../quarkus/component/fhir/it/FhirR4Resource.java | 40 ++++------
.../quarkus/component/fhir/it/FhirR5Resource.java | 40 ++++------
.../component/fhir/it/AbstractFhirTest.java | 22 +++++-
integration-tests/jdbc-grouped/pom.xml | 26 +++---
19 files changed, 388 insertions(+), 243 deletions(-)
create mode 100644 extensions/fhir/runtime/src/main/doc/usage.adoc
delete mode 100644 integration-test-groups/jdbc/mysql/README.adoc
delete mode 100644 integration-test-groups/jdbc/mysql/src/main/java/org/apache/camel/quarkus/component/jdbc/mysql/Sha256FIPSPasswordPlugin.java
create mode 100644 integration-test-groups/jdbc/mysql/src/test/java/org/apache/camel/quarkus/component/jdbc/mysql/MysqlTestResource.java
(camel-quarkus) 02/04: Document FHIR native mode requirements for FhirContext
Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
jamesnetherton pushed a commit to branch 3.15.x
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
commit adb55c584e08a5b51926db99dc662988e350d971
Author: James Netherton <ja...@gmail.com>
AuthorDate: Mon Oct 21 11:34:32 2024 +0100
Document FHIR native mode requirements for FhirContext
---
.../ROOT/pages/reference/extensions/fhir.adoc | 81 +++++++++++++++++++++-
.../fhir/runtime/src/main/doc/configuration.adoc | 3 +-
extensions/fhir/runtime/src/main/doc/usage.adoc | 73 +++++++++++++++++++
3 files changed, 153 insertions(+), 4 deletions(-)
diff --git a/docs/modules/ROOT/pages/reference/extensions/fhir.adoc b/docs/modules/ROOT/pages/reference/extensions/fhir.adoc
index 5103d43e8d..104fe8c4a0 100644
--- a/docs/modules/ROOT/pages/reference/extensions/fhir.adoc
+++ b/docs/modules/ROOT/pages/reference/extensions/fhir.adoc
@@ -47,6 +47,84 @@ ifeval::[{doc-show-user-guide-link} == true]
Check the xref:user-guide/index.adoc[User guide] for more information about writing Camel Quarkus applications.
endif::[]
+[id="extensions-fhir-usage"]
+== Usage
+[id="extensions-fhir-usage-configuring-the-fhircontext-in-native-mode"]
+=== Configuring the `FhirContext` in native mode
+
+To ensure `camel-quarkus-fhir` operates correctly in native mode, it is important that the FHIR component and data formats use a native mode optimized `FhirContext`.
+Examples of how to achieve this follow below.
+
+NOTE: To use a particular FHIR version in native mode, you must ensure that it is enabled via the configuration options mentioned below.
+
+Endpoint configuration when using the default `R4` FHIR version.
+
+[source,java]
+----
+public class FhirRoutes extends RouteBuilder {
+ @Override
+ public void configure() {
+ from("direct:start")
+ .to("fhir://create/resource?fhirContext=#R4&inBody=resourceAsString");
+ }
+}
+----
+
+Endpoint configuration when using a custom FHIR version (e.g `R5`).
+
+[source,java]
+----
+public class FhirRoutes extends RouteBuilder {
+ @Override
+ public void configure() {
+ from("direct:start")
+ .to("fhir://create/resource?fhirVersion=R5&fhirContext=#R5&inBody=resourceAsString");
+ }
+}
+----
+
+Instead of setting the `fhirContext` option on every endpoint URI, you can instead configure it directly on the FHIR component.
+
+[source,properties]
+----
+camel.component.fhir.fhir-context=#R4
+----
+
+FHIR data format configuration.
+
+[source,java]
+----
+public class FhirRoutes extends RouteBuilder {
+ // Each FHIR version has a corresponding injectable named bean
+ @Inject
+ @Named("R4")
+ FhirContext r4FhirContext;
+
+ @Inject
+ @Named("R5")
+ FhirContext r5FhirContext;
+
+ @Override
+ public void configure() {
+ // Configure FhirJsonDataFormat with the default R4 FhirContext
+ FhirJsonDataFormat fhirJsonDataFormat = new FhirJsonDataFormat();
+ fhirJsonDataFormat.setFhirContext(r4FhirContext);
+
+ // Configure FhirXmlDataFormat with a custom version and the corresponding FhirContext
+ FhirXmlDataFormat fhirXmlDataFormat = new FhirXmlDataFormat();
+ fhirXmlDataFormat.setVersion("R5");
+ fhirXmlDataFormat.setFhirContext(r5FhirContext);
+
+ from("direct:marshalFhirJson")
+ .marshal(fhirJsonDataFormat);
+
+ from("direct:marshalFhirXml")
+ .marshal(fhirXmlDataFormat);
+ }
+}
+----
+
+
[id="extensions-fhir-ssl-in-native-mode"]
== SSL in native mode
@@ -57,8 +135,7 @@ https://quarkus.io/guides/native-and-ssl[Quarkus SSL guide].
[id="extensions-fhir-additional-camel-quarkus-configuration"]
== Additional Camel Quarkus configuration
-
-By default, only FHIR versions `R4` & `DSTU3` are enabled in native mode, since they are the default values on the FHIR component and DataFormat.
+By default, only FHIR version `R4` is enabled in native mode, since that is also the default version configured on the FHIR component and data formats.
[width="100%",cols="80,5,15",options="header"]
diff --git a/extensions/fhir/runtime/src/main/doc/configuration.adoc b/extensions/fhir/runtime/src/main/doc/configuration.adoc
index 820a98a5aa..f98ecd15b7 100644
--- a/extensions/fhir/runtime/src/main/doc/configuration.adoc
+++ b/extensions/fhir/runtime/src/main/doc/configuration.adoc
@@ -1,2 +1 @@
-
-By default, only FHIR versions `R4` & `DSTU3` are enabled in native mode, since they are the default values on the FHIR component and DataFormat.
+By default, only FHIR version `R4` is enabled in native mode, since that is also the default version configured on the FHIR component and data formats.
diff --git a/extensions/fhir/runtime/src/main/doc/usage.adoc b/extensions/fhir/runtime/src/main/doc/usage.adoc
new file mode 100644
index 0000000000..d2dc499f3a
--- /dev/null
+++ b/extensions/fhir/runtime/src/main/doc/usage.adoc
@@ -0,0 +1,73 @@
+=== Configuring the `FhirContext` in native mode
+
+To ensure `camel-quarkus-fhir` operates correctly in native mode, it is important that the FHIR component and data formats use a native mode optimized `FhirContext`.
+Examples of how to achieve this follow below.
+
+NOTE: To use a particular FHIR version in native mode, you must ensure that it is enabled via the configuration options mentioned below.
+
+Endpoint configuration when using the default `R4` FHIR version.
+
+[source,java]
+----
+public class FhirRoutes extends RouteBuilder {
+ @Override
+ public void configure() {
+ from("direct:start")
+ .to("fhir://create/resource?fhirContext=#R4&inBody=resourceAsString");
+ }
+}
+----
+
+Endpoint configuration when using a custom FHIR version (e.g `R5`).
+
+[source,java]
+----
+public class FhirRoutes extends RouteBuilder {
+ @Override
+ public void configure() {
+ from("direct:start")
+ .to("fhir://create/resource?fhirVersion=R5&fhirContext=#R5&inBody=resourceAsString");
+ }
+}
+----
+
+Instead of setting the `fhirContext` option on every endpoint URI, you can instead configure it directly on the FHIR component.
+
+[source,properties]
+----
+camel.component.fhir.fhir-context=#R4
+----
+
+FHIR data format configuration.
+
+[source,java]
+----
+public class FhirRoutes extends RouteBuilder {
+ // Each FHIR version has a corresponding injectable named bean
+ @Inject
+ @Named("R4")
+ FhirContext r4FhirContext;
+
+ @Inject
+ @Named("R5")
+ FhirContext r5FhirContext;
+
+ @Override
+ public void configure() {
+ // Configure FhirJsonDataFormat with the default R4 FhirContext
+ FhirJsonDataFormat fhirJsonDataFormat = new FhirJsonDataFormat();
+ fhirJsonDataFormat.setFhirContext(r4FhirContext);
+
+ // Configure FhirXmlDataFormat with a custom version and the corresponding FhirContext
+ FhirXmlDataFormat fhirXmlDataFormat = new FhirXmlDataFormat();
+ fhirXmlDataFormat.setVersion("R5");
+ fhirXmlDataFormat.setFhirContext(r5FhirContext);
+
+ from("direct:marshalFhirJson")
+ .marshal(fhirJsonDataFormat);
+
+ from("direct:marshalFhirXml")
+ .marshal(fhirXmlDataFormat);
+ }
+}
+----
(camel-quarkus) 03/04: Improve some test assertions in FHIR tests
Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
jamesnetherton pushed a commit to branch 3.15.x
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
commit cb8917a50ccc45e74d0b35ef176553fe2bdda858
Author: James Netherton <ja...@gmail.com>
AuthorDate: Mon Oct 21 11:37:32 2024 +0100
Improve some test assertions in FHIR tests
---
.../fhir/it/AbstractFhirRouteBuilder.java | 7 ++++
.../component/fhir/it/FhirDstu2Hl7OrgResource.java | 43 +++++++---------------
.../component/fhir/it/FhirDstu2Resource.java | 40 +++++++-------------
.../component/fhir/it/FhirDstu2_1Resource.java | 40 +++++++-------------
.../component/fhir/it/FhirDstu3Resource.java | 27 +++++---------
.../quarkus/component/fhir/it/FhirR4Resource.java | 40 +++++++-------------
.../quarkus/component/fhir/it/FhirR5Resource.java | 40 +++++++-------------
.../component/fhir/it/AbstractFhirTest.java | 22 ++++++++++-
8 files changed, 107 insertions(+), 152 deletions(-)
diff --git a/integration-tests/fhir/src/main/java/org/apache/camel/quarkus/component/fhir/it/AbstractFhirRouteBuilder.java b/integration-tests/fhir/src/main/java/org/apache/camel/quarkus/component/fhir/it/AbstractFhirRouteBuilder.java
index 9d9342e760..44f1af2cbe 100644
--- a/integration-tests/fhir/src/main/java/org/apache/camel/quarkus/component/fhir/it/AbstractFhirRouteBuilder.java
+++ b/integration-tests/fhir/src/main/java/org/apache/camel/quarkus/component/fhir/it/AbstractFhirRouteBuilder.java
@@ -83,6 +83,13 @@ public abstract class AbstractFhirRouteBuilder extends RouteBuilder {
.toF("fhir-%s://create/resource?inBody=resource", sanitizedFhirVersion);
fromF("direct:createResourceAsString-%s", sanitizedFhirVersion)
+ .choice()
+ .when(simple("${header.encodeAs} == 'encodeJson'"))
+ .marshal(fhirJsonDataFormat)
+ .otherwise()
+ .marshal(fhirXmlDataFormat)
+ .end()
+ .convertBodyTo(String.class)
.toF("fhir-%s://create/resource?inBody=resourceAsString", sanitizedFhirVersion);
// Dataformats
diff --git a/integration-tests/fhir/src/main/java/org/apache/camel/quarkus/component/fhir/it/FhirDstu2Hl7OrgResource.java b/integration-tests/fhir/src/main/java/org/apache/camel/quarkus/component/fhir/it/FhirDstu2Hl7OrgResource.java
index 67b70174f4..c94044b793 100644
--- a/integration-tests/fhir/src/main/java/org/apache/camel/quarkus/component/fhir/it/FhirDstu2Hl7OrgResource.java
+++ b/integration-tests/fhir/src/main/java/org/apache/camel/quarkus/component/fhir/it/FhirDstu2Hl7OrgResource.java
@@ -16,7 +16,6 @@
*/
package org.apache.camel.quarkus.component.fhir.it;
-import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.net.URI;
import java.net.URLEncoder;
@@ -125,18 +124,10 @@ public class FhirDstu2Hl7OrgResource {
patient.addAddress().addLine(address);
patient.addName().addGiven(firstName).addFamily(lastName);
- String patientString = null;
Map<String, Object> headers = new HashMap<>();
- headers.put(encodeAs, Boolean.TRUE);
+ headers.put("encodeAs", encodeAs);
- if (encodeAs.equals("encodeJson")) {
- patientString = fhirContextInstance.get().newJsonParser().encodeResourceToString(patient);
- } else {
- patientString = fhirContextInstance.get().newXmlParser().encodeResourceToString(patient);
- }
-
- MethodOutcome result = producerTemplate.requestBodyAndHeaders("direct:createResourceAsString-dstu2-hl7org",
- patientString,
+ MethodOutcome result = producerTemplate.requestBodyAndHeaders("direct:createResourceAsString-dstu2-hl7org", patient,
headers,
MethodOutcome.class);
@@ -177,7 +168,7 @@ public class FhirDstu2Hl7OrgResource {
@Path("/fhir2json")
@GET
- @Produces(MediaType.APPLICATION_OCTET_STREAM)
+ @Produces(MediaType.APPLICATION_JSON)
public Response fhir2json(
@QueryParam("firstName") String firstName,
@QueryParam("lastName") String lastName,
@@ -188,19 +179,16 @@ public class FhirDstu2Hl7OrgResource {
patient.addName().addGiven(firstName).addFamily(lastName);
String patientString = fhirContextInstance.get().newJsonParser().encodeResourceToString(patient);
-
- try (InputStream response = producerTemplate.requestBody("direct:json-to-dstu2-hl7org", patientString,
- InputStream.class)) {
- return Response
- .created(new URI("https:camel.apache.org/"))
- .entity(response)
- .build();
- }
+ String response = producerTemplate.requestBody("direct:json-to-dstu2-hl7org", patientString, String.class);
+ return Response
+ .created(new URI("https:camel.apache.org/"))
+ .entity(response)
+ .build();
}
@Path("/fhir2xml")
@GET
- @Produces(MediaType.APPLICATION_OCTET_STREAM)
+ @Produces(MediaType.APPLICATION_XML)
public Response fhir2xml(
@QueryParam("firstName") String firstName,
@QueryParam("lastName") String lastName,
@@ -211,14 +199,11 @@ public class FhirDstu2Hl7OrgResource {
patient.addName().addGiven(firstName).addFamily(lastName);
String patientString = fhirContextInstance.get().newXmlParser().encodeResourceToString(patient);
-
- try (InputStream response = producerTemplate.requestBody("direct:xml-to-dstu2-hl7org", patientString,
- InputStream.class)) {
- return Response
- .created(new URI("https:camel.apache.org/"))
- .entity(response)
- .build();
- }
+ String response = producerTemplate.requestBody("direct:xml-to-dstu2-hl7org", patientString, String.class);
+ return Response
+ .created(new URI("https:camel.apache.org/"))
+ .entity(response)
+ .build();
}
/////////////////////
diff --git a/integration-tests/fhir/src/main/java/org/apache/camel/quarkus/component/fhir/it/FhirDstu2Resource.java b/integration-tests/fhir/src/main/java/org/apache/camel/quarkus/component/fhir/it/FhirDstu2Resource.java
index dddec0e08a..ed09ec21b5 100644
--- a/integration-tests/fhir/src/main/java/org/apache/camel/quarkus/component/fhir/it/FhirDstu2Resource.java
+++ b/integration-tests/fhir/src/main/java/org/apache/camel/quarkus/component/fhir/it/FhirDstu2Resource.java
@@ -16,7 +16,6 @@
*/
package org.apache.camel.quarkus.component.fhir.it;
-import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.net.URI;
import java.net.URLEncoder;
@@ -130,17 +129,10 @@ public class FhirDstu2Resource {
patient.addAddress().addLine(address);
patient.addName().addGiven(firstName).setFamily(Arrays.asList(new StringDt(lastName)));
- String patientString = null;
Map<String, Object> headers = new HashMap<>();
- headers.put(encodeAs, Boolean.TRUE);
+ headers.put("encodeAs", encodeAs);
- if (encodeAs.equals("encodeJson")) {
- patientString = fhirContextInstance.get().newJsonParser().encodeResourceToString(patient);
- } else {
- patientString = fhirContextInstance.get().newXmlParser().encodeResourceToString(patient);
- }
-
- MethodOutcome result = producerTemplate.requestBodyAndHeaders("direct:createResourceAsString-dstu2", patientString,
+ MethodOutcome result = producerTemplate.requestBodyAndHeaders("direct:createResourceAsString-dstu2", patient,
headers,
MethodOutcome.class);
@@ -181,7 +173,7 @@ public class FhirDstu2Resource {
@Path("/fhir2json")
@GET
- @Produces(MediaType.APPLICATION_OCTET_STREAM)
+ @Produces(MediaType.APPLICATION_JSON)
public Response fhir2json(
@QueryParam("firstName") String firstName,
@QueryParam("lastName") String lastName,
@@ -192,18 +184,16 @@ public class FhirDstu2Resource {
patient.addName().addGiven(firstName).setFamily(Arrays.asList(new StringDt(lastName)));
String patientString = fhirContextInstance.get().newJsonParser().encodeResourceToString(patient);
-
- try (InputStream response = producerTemplate.requestBody("direct:json-to-dstu2", patientString, InputStream.class)) {
- return Response
- .created(new URI("https:camel.apache.org/"))
- .entity(response)
- .build();
- }
+ String response = producerTemplate.requestBody("direct:json-to-dstu2", patientString, String.class);
+ return Response
+ .created(new URI("https:camel.apache.org/"))
+ .entity(response)
+ .build();
}
@Path("/fhir2xml")
@GET
- @Produces(MediaType.APPLICATION_OCTET_STREAM)
+ @Produces(MediaType.APPLICATION_XML)
public Response fhir2xml(
@QueryParam("firstName") String firstName,
@QueryParam("lastName") String lastName,
@@ -214,13 +204,11 @@ public class FhirDstu2Resource {
patient.addName().addGiven(firstName).setFamily(Arrays.asList(new StringDt(lastName)));
String patientString = fhirContextInstance.get().newXmlParser().encodeResourceToString(patient);
-
- try (InputStream response = producerTemplate.requestBody("direct:xml-to-dstu2", patientString, InputStream.class)) {
- return Response
- .created(new URI("https:camel.apache.org/"))
- .entity(response)
- .build();
- }
+ String response = producerTemplate.requestBody("direct:xml-to-dstu2", patientString, String.class);
+ return Response
+ .created(new URI("https:camel.apache.org/"))
+ .entity(response)
+ .build();
}
/////////////////////
diff --git a/integration-tests/fhir/src/main/java/org/apache/camel/quarkus/component/fhir/it/FhirDstu2_1Resource.java b/integration-tests/fhir/src/main/java/org/apache/camel/quarkus/component/fhir/it/FhirDstu2_1Resource.java
index af5d2ad2ea..4d0391fe85 100644
--- a/integration-tests/fhir/src/main/java/org/apache/camel/quarkus/component/fhir/it/FhirDstu2_1Resource.java
+++ b/integration-tests/fhir/src/main/java/org/apache/camel/quarkus/component/fhir/it/FhirDstu2_1Resource.java
@@ -16,7 +16,6 @@
*/
package org.apache.camel.quarkus.component.fhir.it;
-import java.io.InputStream;
import java.net.URI;
import java.net.URLEncoder;
import java.text.ParseException;
@@ -124,17 +123,10 @@ public class FhirDstu2_1Resource {
patient.addAddress().addLine(address);
patient.addName().addGiven(firstName).addFamily(lastName);
- String patientString = null;
Map<String, Object> headers = new HashMap<>();
- headers.put(encodeAs, Boolean.TRUE);
+ headers.put("encodeAs", encodeAs);
- if (encodeAs.equals("encodeJson")) {
- patientString = fhirContextInstance.get().newJsonParser().encodeResourceToString(patient);
- } else {
- patientString = fhirContextInstance.get().newXmlParser().encodeResourceToString(patient);
- }
-
- MethodOutcome result = producerTemplate.requestBodyAndHeaders("direct:createResourceAsString-dstu2-1", patientString,
+ MethodOutcome result = producerTemplate.requestBodyAndHeaders("direct:createResourceAsString-dstu2-1", patient,
headers,
MethodOutcome.class);
@@ -175,7 +167,7 @@ public class FhirDstu2_1Resource {
@Path("/fhir2json")
@GET
- @Produces(MediaType.APPLICATION_OCTET_STREAM)
+ @Produces(MediaType.APPLICATION_JSON)
public Response fhir2json(
@QueryParam("firstName") String firstName,
@QueryParam("lastName") String lastName,
@@ -186,18 +178,16 @@ public class FhirDstu2_1Resource {
patient.addName().addGiven(firstName).addFamily(lastName);
String patientString = fhirContextInstance.get().newJsonParser().encodeResourceToString(patient);
-
- try (InputStream response = producerTemplate.requestBody("direct:json-to-dstu2-1", patientString, InputStream.class)) {
- return Response
- .created(new URI("https:camel.apache.org/"))
- .entity(response)
- .build();
- }
+ String response = producerTemplate.requestBody("direct:json-to-dstu2-1", patientString, String.class);
+ return Response
+ .created(new URI("https:camel.apache.org/"))
+ .entity(response)
+ .build();
}
@Path("/fhir2xml")
@GET
- @Produces(MediaType.APPLICATION_OCTET_STREAM)
+ @Produces(MediaType.APPLICATION_XML)
public Response fhir2xml(
@QueryParam("firstName") String firstName,
@QueryParam("lastName") String lastName,
@@ -208,13 +198,11 @@ public class FhirDstu2_1Resource {
patient.addName().addGiven(firstName).addFamily(lastName);
String patientString = fhirContextInstance.get().newXmlParser().encodeResourceToString(patient);
-
- try (InputStream response = producerTemplate.requestBody("direct:xml-to-dstu2-1", patientString, InputStream.class)) {
- return Response
- .created(new URI("https:camel.apache.org/"))
- .entity(response)
- .build();
- }
+ String response = producerTemplate.requestBody("direct:xml-to-dstu2-1", patientString, String.class);
+ return Response
+ .created(new URI("https:camel.apache.org/"))
+ .entity(response)
+ .build();
}
/////////////////////
diff --git a/integration-tests/fhir/src/main/java/org/apache/camel/quarkus/component/fhir/it/FhirDstu3Resource.java b/integration-tests/fhir/src/main/java/org/apache/camel/quarkus/component/fhir/it/FhirDstu3Resource.java
index ed89c4310d..684124b912 100644
--- a/integration-tests/fhir/src/main/java/org/apache/camel/quarkus/component/fhir/it/FhirDstu3Resource.java
+++ b/integration-tests/fhir/src/main/java/org/apache/camel/quarkus/component/fhir/it/FhirDstu3Resource.java
@@ -126,17 +126,10 @@ public class FhirDstu3Resource {
patient.addAddress().addLine(address);
patient.addName().addGiven(firstName).setFamily(lastName);
- String patientString = null;
Map<String, Object> headers = new HashMap<>();
- headers.put(encodeAs, Boolean.TRUE);
+ headers.put("encodeAs", encodeAs);
- if (encodeAs.equals("encodeJson")) {
- patientString = fhirContextInstance.get().newJsonParser().encodeResourceToString(patient);
- } else {
- patientString = fhirContextInstance.get().newXmlParser().encodeResourceToString(patient);
- }
-
- MethodOutcome result = producerTemplate.requestBodyAndHeaders("direct:createResourceAsString-dstu3", patientString,
+ MethodOutcome result = producerTemplate.requestBodyAndHeaders("direct:createResourceAsString-dstu3", patient,
headers,
MethodOutcome.class);
@@ -177,7 +170,7 @@ public class FhirDstu3Resource {
@Path("/fhir2json")
@GET
- @Produces(MediaType.APPLICATION_OCTET_STREAM)
+ @Produces(MediaType.APPLICATION_JSON)
public Response fhir2json(
@QueryParam("firstName") String firstName,
@QueryParam("lastName") String lastName,
@@ -188,18 +181,16 @@ public class FhirDstu3Resource {
patient.addName().addGiven(firstName).setFamily(lastName);
String patientString = fhirContextInstance.get().newJsonParser().encodeResourceToString(patient);
-
- try (InputStream response = producerTemplate.requestBody("direct:json-to-dstu3", patientString, InputStream.class)) {
- return Response
- .created(new URI("https:camel.apache.org/"))
- .entity(response)
- .build();
- }
+ String response = producerTemplate.requestBody("direct:json-to-dstu3", patientString, String.class);
+ return Response
+ .created(new URI("https:camel.apache.org/"))
+ .entity(response)
+ .build();
}
@Path("/fhir2xml")
@GET
- @Produces(MediaType.APPLICATION_OCTET_STREAM)
+ @Produces(MediaType.APPLICATION_XML)
public Response fhir2xml(
@QueryParam("firstName") String firstName,
@QueryParam("lastName") String lastName,
diff --git a/integration-tests/fhir/src/main/java/org/apache/camel/quarkus/component/fhir/it/FhirR4Resource.java b/integration-tests/fhir/src/main/java/org/apache/camel/quarkus/component/fhir/it/FhirR4Resource.java
index 8ae4d58dae..6534c9eebd 100644
--- a/integration-tests/fhir/src/main/java/org/apache/camel/quarkus/component/fhir/it/FhirR4Resource.java
+++ b/integration-tests/fhir/src/main/java/org/apache/camel/quarkus/component/fhir/it/FhirR4Resource.java
@@ -16,7 +16,6 @@
*/
package org.apache.camel.quarkus.component.fhir.it;
-import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.net.URI;
import java.text.ParseException;
@@ -125,17 +124,10 @@ public class FhirR4Resource {
patient.addAddress().addLine(address);
patient.addName().addGiven(firstName).setFamily(lastName);
- String patientString = null;
Map<String, Object> headers = new HashMap<>();
- headers.put(encodeAs, Boolean.TRUE);
+ headers.put("encodeAs", encodeAs);
- if (encodeAs.equals("encodeJson")) {
- patientString = fhirContextInstance.get().newJsonParser().encodeResourceToString(patient);
- } else {
- patientString = fhirContextInstance.get().newXmlParser().encodeResourceToString(patient);
- }
-
- MethodOutcome result = producerTemplate.requestBodyAndHeaders("direct:createResourceAsString-r4", patientString,
+ MethodOutcome result = producerTemplate.requestBodyAndHeaders("direct:createResourceAsString-r4", patient,
headers,
MethodOutcome.class);
@@ -176,7 +168,7 @@ public class FhirR4Resource {
@Path("/fhir2json")
@GET
- @Produces(MediaType.APPLICATION_OCTET_STREAM)
+ @Produces(MediaType.APPLICATION_JSON)
public Response fhir2json(
@QueryParam("firstName") String firstName,
@QueryParam("lastName") String lastName,
@@ -187,18 +179,16 @@ public class FhirR4Resource {
patient.addName().addGiven(firstName).setFamily(lastName);
String patientString = fhirContextInstance.get().newJsonParser().encodeResourceToString(patient);
-
- try (InputStream response = producerTemplate.requestBody("direct:json-to-r4", patientString, InputStream.class)) {
- return Response
- .created(new URI("https:camel.apache.org/"))
- .entity(response)
- .build();
- }
+ String result = producerTemplate.requestBody("direct:json-to-r4", patientString, String.class);
+ return Response
+ .created(new URI("https:camel.apache.org/"))
+ .entity(result)
+ .build();
}
@Path("/fhir2xml")
@GET
- @Produces(MediaType.APPLICATION_OCTET_STREAM)
+ @Produces(MediaType.APPLICATION_XML)
public Response fhir2xml(
@QueryParam("firstName") String firstName,
@QueryParam("lastName") String lastName,
@@ -209,13 +199,11 @@ public class FhirR4Resource {
patient.addName().addGiven(firstName).setFamily(lastName);
String patientString = fhirContextInstance.get().newXmlParser().encodeResourceToString(patient);
-
- try (InputStream response = producerTemplate.requestBody("direct:xml-to-r4", patientString, InputStream.class)) {
- return Response
- .created(new URI("https:camel.apache.org/"))
- .entity(response)
- .build();
- }
+ String result = producerTemplate.requestBody("direct:xml-to-r4", patientString, String.class);
+ return Response
+ .created(new URI("https:camel.apache.org/"))
+ .entity(result)
+ .build();
}
/////////////////////
diff --git a/integration-tests/fhir/src/main/java/org/apache/camel/quarkus/component/fhir/it/FhirR5Resource.java b/integration-tests/fhir/src/main/java/org/apache/camel/quarkus/component/fhir/it/FhirR5Resource.java
index db6269a1c2..83883ab1b1 100644
--- a/integration-tests/fhir/src/main/java/org/apache/camel/quarkus/component/fhir/it/FhirR5Resource.java
+++ b/integration-tests/fhir/src/main/java/org/apache/camel/quarkus/component/fhir/it/FhirR5Resource.java
@@ -16,7 +16,6 @@
*/
package org.apache.camel.quarkus.component.fhir.it;
-import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.net.URI;
import java.text.ParseException;
@@ -123,17 +122,10 @@ public class FhirR5Resource {
patient.addAddress().addLine(address);
patient.addName().addGiven(firstName).setFamily(lastName);
- String patientString = null;
Map<String, Object> headers = new HashMap<>();
- headers.put(encodeAs, Boolean.TRUE);
+ headers.put("encodeAs", encodeAs);
- if (encodeAs.equals("encodeJson")) {
- patientString = fhirContextInstance.get().newJsonParser().encodeResourceToString(patient);
- } else {
- patientString = fhirContextInstance.get().newXmlParser().encodeResourceToString(patient);
- }
-
- MethodOutcome result = producerTemplate.requestBodyAndHeaders("direct:createResourceAsString-r5", patientString,
+ MethodOutcome result = producerTemplate.requestBodyAndHeaders("direct:createResourceAsString-r5", patient,
headers,
MethodOutcome.class);
@@ -174,7 +166,7 @@ public class FhirR5Resource {
@Path("/fhir2json")
@GET
- @Produces(MediaType.APPLICATION_OCTET_STREAM)
+ @Produces(MediaType.APPLICATION_JSON)
public Response fhir2json(
@QueryParam("firstName") String firstName,
@QueryParam("lastName") String lastName,
@@ -185,18 +177,16 @@ public class FhirR5Resource {
patient.addName().addGiven(firstName).setFamily(lastName);
String patientString = fhirContextInstance.get().newJsonParser().encodeResourceToString(patient);
-
- try (InputStream response = producerTemplate.requestBody("direct:json-to-r5", patientString, InputStream.class)) {
- return Response
- .created(new URI("https:camel.apache.org/"))
- .entity(response)
- .build();
- }
+ String response = producerTemplate.requestBody("direct:json-to-r5", patientString, String.class);
+ return Response
+ .created(new URI("https:camel.apache.org/"))
+ .entity(response)
+ .build();
}
@Path("/fhir2xml")
@GET
- @Produces(MediaType.APPLICATION_OCTET_STREAM)
+ @Produces(MediaType.APPLICATION_XML)
public Response fhir2xml(
@QueryParam("firstName") String firstName,
@QueryParam("lastName") String lastName,
@@ -207,13 +197,11 @@ public class FhirR5Resource {
patient.addName().addGiven(firstName).setFamily(lastName);
String patientString = fhirContextInstance.get().newXmlParser().encodeResourceToString(patient);
-
- try (InputStream response = producerTemplate.requestBody("direct:xml-to-r5", patientString, InputStream.class)) {
- return Response
- .created(new URI("https:camel.apache.org/"))
- .entity(response)
- .build();
- }
+ String response = producerTemplate.requestBody("direct:xml-to-r5", patientString, String.class);
+ return Response
+ .created(new URI("https:camel.apache.org/"))
+ .entity(response)
+ .build();
}
/////////////////////
diff --git a/integration-tests/fhir/src/test/java/org/apache/camel/quarkus/component/fhir/it/AbstractFhirTest.java b/integration-tests/fhir/src/test/java/org/apache/camel/quarkus/component/fhir/it/AbstractFhirTest.java
index 357dfd541a..14ba3a20b7 100644
--- a/integration-tests/fhir/src/test/java/org/apache/camel/quarkus/component/fhir/it/AbstractFhirTest.java
+++ b/integration-tests/fhir/src/test/java/org/apache/camel/quarkus/component/fhir/it/AbstractFhirTest.java
@@ -23,6 +23,7 @@ import java.util.stream.Stream;
import io.restassured.RestAssured;
import io.restassured.http.ContentType;
import io.restassured.path.json.JsonPath;
+import io.restassured.response.ValidatableResponse;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
@@ -45,10 +46,29 @@ abstract class AbstractFhirTest {
@ParameterizedTest
@ValueSource(strings = { "fhir2json", "fhir2xml" })
public void marshalUnmarshal(String path) {
- RestAssured.given()
+ ValidatableResponse response = RestAssured.given()
+ .queryParam("firstName", PATIENT_FIRST_NAME)
+ .queryParam("lastName", PATIENT_LAST_NAME)
+ .queryParam("address", PATIENT_ADDRESS)
.get("/" + path)
.then()
.statusCode(201);
+
+ String familyNameKey = "name[0].family";
+ if (getClass().getSimpleName().matches("FhirDstu2(Hl7Org)?(Test|IT)")) {
+ familyNameKey = "name[0].family[0]";
+ }
+
+ if (path.equals("fhir2json")) {
+ response.body("resourceType", is("Patient"),
+ "name[0].given[0]", is(PATIENT_FIRST_NAME),
+ familyNameKey, is(PATIENT_LAST_NAME),
+ "address[0].line[0]", is(PATIENT_ADDRESS));
+ } else {
+ response.body("Patient.name.given.@value", is(PATIENT_FIRST_NAME),
+ "Patient.name.family.@value", is(PATIENT_LAST_NAME),
+ "Patient.address.line.@value", is(PATIENT_ADDRESS));
+ }
}
@ParameterizedTest
(camel-quarkus) 01/04: Mysql testResource instead of devservices
Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
jamesnetherton pushed a commit to branch 3.15.x
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
commit 073e1dce83794c45c98c3f9bcf0436fc8007828c
Author: JiriOndrusek <on...@gmail.com>
AuthorDate: Thu Oct 17 16:56:58 2024 +0200
Mysql testResource instead of devservices
---
integration-test-groups/jdbc/mysql/README.adoc | 26 ------
integration-test-groups/jdbc/mysql/pom.xml | 26 +++---
.../jdbc/mysql/Sha256FIPSPasswordPlugin.java | 38 ---------
.../src/main/resources/application.properties | 2 +-
.../component/jdbc/mysql/CamelMysqlJdbcTest.java | 3 +-
.../component/jdbc/mysql/MysqlTestResource.java | 92 ++++++++++++++++++++++
integration-tests/jdbc-grouped/pom.xml | 26 +++---
7 files changed, 127 insertions(+), 86 deletions(-)
diff --git a/integration-test-groups/jdbc/mysql/README.adoc b/integration-test-groups/jdbc/mysql/README.adoc
deleted file mode 100644
index 14b0704560..0000000000
--- a/integration-test-groups/jdbc/mysql/README.adoc
+++ /dev/null
@@ -1,26 +0,0 @@
-== JDBC MySql tests
-
-=== FIPS
-
-* To execute the tests on FIPS enabled system add `-Dfips` property so that tests will use prooper transformation for the password. Example of usage:
-
-`mvn clean test -Dfips`
-
-* Dev service (MySql docker image) does not start correctly on FIPS enabled system. Please use external database.
-
-To execute the tests against external database, provide the database's connection information by setting environment variables
-
-```
-export MYSQL_JDBC_URL=#jdbc_url
-export MYSQL_JDBC_USERNAME=#username
-export MYSQL_JDBC_PASSWORD=#password
-```
-
-or for windows:
-
-```
-$Env:MYSQL_JDBC_URL = "#jdbc_url"
-$Env:MYSQL_JDBC_USERNAME="#username"
-$Env:MYSQL_JDBC_PASSWORD
-```
-.
\ No newline at end of file
diff --git a/integration-test-groups/jdbc/mysql/pom.xml b/integration-test-groups/jdbc/mysql/pom.xml
index b70d9d7ca3..43b3e033f2 100644
--- a/integration-test-groups/jdbc/mysql/pom.xml
+++ b/integration-test-groups/jdbc/mysql/pom.xml
@@ -99,6 +99,22 @@
<type>test-jar</type>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.testcontainers</groupId>
+ <artifactId>testcontainers</artifactId>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-junit4-mock</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
@@ -279,12 +295,7 @@
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
- <quarkus.datasource.mysql.jdbc.additional-jdbc-properties.authenticationPlugins>org.apache.camel.quarkus.component.jdbc.mysql.Sha256FIPSPasswordPlugin</quarkus.datasource.mysql.jdbc.additional-jdbc-properties.authenticationPlugins>
- <quarkus.datasource.mysql.jdbc.additional-jdbc-properties.defaultAuthenticationPlugin>cq_fips_plugin</quarkus.datasource.mysql.jdbc.additional-jdbc-properties.defaultAuthenticationPlugin>
<quarkus.datasource.mysql.devservices.enabled>false</quarkus.datasource.mysql.devservices.enabled>
- <quarkus.datasource.mysql.username>${env.MYSQL_JDBC_USERNAME}</quarkus.datasource.mysql.username>
- <quarkus.datasource.mysql.password>${env.MYSQL_JDBC_PASSWORD}</quarkus.datasource.mysql.password>
- <quarkus.datasource.mysql.jdbc.url>${env.MYSQL_JDBC_URL}</quarkus.datasource.mysql.jdbc.url>
</systemPropertyVariables>
</configuration>
</plugin>
@@ -293,12 +304,7 @@
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<systemPropertyVariables>
- <quarkus.datasource.mysql.jdbc.additional-jdbc-properties.authenticationPlugins>org.apache.camel.quarkus.component.jdbc.mysql.Sha256FIPSPasswordPlugin</quarkus.datasource.mysql.jdbc.additional-jdbc-properties.authenticationPlugins>
- <quarkus.datasource.mysql.jdbc.additional-jdbc-properties.defaultAuthenticationPlugin>cq_fips_plugin</quarkus.datasource.mysql.jdbc.additional-jdbc-properties.defaultAuthenticationPlugin>
<quarkus.datasource.mysql.devservices.enabled>false</quarkus.datasource.mysql.devservices.enabled>
- <quarkus.datasource.mysql.username>${env.MYSQL_JDBC_USERNAME}</quarkus.datasource.mysql.username>
- <quarkus.datasource.mysql.password>${env.MYSQL_JDBC_PASSWORD}</quarkus.datasource.mysql.password>
- <quarkus.datasource.mysql.jdbc.url>${env.MYSQL_JDBC_URL}</quarkus.datasource.mysql.jdbc.url>
</systemPropertyVariables>
</configuration>
</plugin>
diff --git a/integration-test-groups/jdbc/mysql/src/main/java/org/apache/camel/quarkus/component/jdbc/mysql/Sha256FIPSPasswordPlugin.java b/integration-test-groups/jdbc/mysql/src/main/java/org/apache/camel/quarkus/component/jdbc/mysql/Sha256FIPSPasswordPlugin.java
deleted file mode 100644
index 70da05c5ad..0000000000
--- a/integration-test-groups/jdbc/mysql/src/main/java/org/apache/camel/quarkus/component/jdbc/mysql/Sha256FIPSPasswordPlugin.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.
- */
-package org.apache.camel.quarkus.component.jdbc.mysql;
-
-import com.mysql.cj.protocol.a.authentication.Sha256PasswordPlugin;
-import io.quarkus.runtime.annotations.RegisterForReflection;
-
-@RegisterForReflection
-public class Sha256FIPSPasswordPlugin extends Sha256PasswordPlugin {
-
- public Sha256FIPSPasswordPlugin() {
- super();
- }
-
- @Override
- public String getProtocolPluginName() {
- return "cq_fips_plugin";
- }
-
- @Override
- protected byte[] encryptPassword() {
- return encryptPassword("RSA/ECB/PKCS1Padding");
- }
-}
diff --git a/integration-test-groups/jdbc/mysql/src/main/resources/application.properties b/integration-test-groups/jdbc/mysql/src/main/resources/application.properties
index 0c3aafab07..6ee2c27fef 100644
--- a/integration-test-groups/jdbc/mysql/src/main/resources/application.properties
+++ b/integration-test-groups/jdbc/mysql/src/main/resources/application.properties
@@ -22,4 +22,4 @@
quarkus.datasource.mysql.db-kind=mysql
quarkus.datasource.mysql.jdbc.max-size=8
-quarkus.native.resources.includes=postgresql.sql,mysql.sql,mariadb.sql,oracle.sql,h2.sql,db2.sql,inserts.sql,mssql.sql,droptables.sql
\ No newline at end of file
+quarkus.native.resources.includes=postgresql.sql,mysql.sql,mariadb.sql,oracle.sql,h2.sql,db2.sql,inserts.sql,mssql.sql,droptables.sql
diff --git a/integration-test-groups/jdbc/mysql/src/test/java/org/apache/camel/quarkus/component/jdbc/mysql/CamelMysqlJdbcTest.java b/integration-test-groups/jdbc/mysql/src/test/java/org/apache/camel/quarkus/component/jdbc/mysql/CamelMysqlJdbcTest.java
index 0cbfb3a01e..7ffdb5d5d5 100644
--- a/integration-test-groups/jdbc/mysql/src/test/java/org/apache/camel/quarkus/component/jdbc/mysql/CamelMysqlJdbcTest.java
+++ b/integration-test-groups/jdbc/mysql/src/test/java/org/apache/camel/quarkus/component/jdbc/mysql/CamelMysqlJdbcTest.java
@@ -18,6 +18,7 @@ package org.apache.camel.quarkus.component.jdbc.mysql;
import java.util.List;
+import io.quarkus.test.common.QuarkusTestResource;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.RestAssured;
import io.restassured.http.ContentType;
@@ -34,7 +35,7 @@ import static org.wildfly.common.Assert.assertNotNull;
@QuarkusTest
@DisabledIfSystemProperty(named = "cq.jdbcKind", matches = "derby")
-//https://github.com/quarkusio/quarkus/issues/23083
+@QuarkusTestResource(value = MysqlTestResource.class)
public class CamelMysqlJdbcTest {
String dbKind = "mysql";
diff --git a/integration-test-groups/jdbc/mysql/src/test/java/org/apache/camel/quarkus/component/jdbc/mysql/MysqlTestResource.java b/integration-test-groups/jdbc/mysql/src/test/java/org/apache/camel/quarkus/component/jdbc/mysql/MysqlTestResource.java
new file mode 100644
index 0000000000..135d9a6950
--- /dev/null
+++ b/integration-test-groups/jdbc/mysql/src/test/java/org/apache/camel/quarkus/component/jdbc/mysql/MysqlTestResource.java
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+package org.apache.camel.quarkus.component.jdbc.mysql;
+
+import java.util.Collections;
+import java.util.Map;
+
+import io.quarkus.test.common.QuarkusTestResourceLifecycleManager;
+import org.eclipse.microprofile.config.ConfigProvider;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testcontainers.containers.GenericContainer;
+import org.testcontainers.containers.wait.strategy.Wait;
+
+/**
+ * This is a workaround because of the FIPS environment.
+ * DevService does not work on FIS https://github.com/quarkusio/quarkus/issues/40526
+ *
+ * If devservice is disabled (by FIPS profile), this test resource starts a simple test container.
+ * (which works on FIPS, because the where the validation of the DB is not solved via connection ,but by the listening
+ * port.)
+ */
+public class MysqlTestResource implements QuarkusTestResourceLifecycleManager {
+ private static final Logger LOG = LoggerFactory.getLogger(MysqlTestResource.class);
+
+ public static final String DB_NAME = "test";
+ public static final String DB_USERNAME = "user";
+ public static final String DB_PASSWORD = "test";
+ private static final int DB_PORT = 3306;
+ private static final String MYSQL_IMAGE = ConfigProvider.getConfig().getValue("mysql.container.image", String.class);
+ private GenericContainer container;
+
+ @Override
+ public Map<String, String> start() {
+
+ //in dev service is not enabled, spawn a db
+ if (!ConfigProvider.getConfig().getOptionalValue("quarkus.datasource.mysql.devservices.enabled", Boolean.class)
+ .orElse(true)) {
+ LOG.info("DevService is disabled, MySql container is starting.");
+
+ container = new GenericContainer<>(MYSQL_IMAGE)
+ .withExposedPorts(DB_PORT)
+ .withEnv("MYSQL_USER", DB_USERNAME)
+ .withEnv("MYSQL_ROOT_PASSWORD", DB_PASSWORD)
+ .withEnv("MYSQL_PASSWORD", DB_PASSWORD)
+ .withEnv("MYSQL_DATABASE", DB_NAME)
+ .waitingFor(Wait.forListeningPort());
+
+ container.start();
+
+ return Map.of(
+ "quarkus.datasource.mysql.jdbc.url", getJdbcUrl(),
+ "quarkus.datasource.mysql.username", DB_USERNAME,
+ "quarkus.datasource.mysql.password", DB_PASSWORD,
+ "quarkus.datasource.mysql.devservices.enabled", "false");
+ }
+ //if devservice is running, nothing has to be done
+ return Collections.emptyMap();
+ }
+
+ @Override
+ public void stop() {
+ try {
+ if (container != null) {
+ container.stop();
+ }
+ } catch (Exception e) {
+ // Ignored
+ }
+ }
+
+ protected String getJdbcUrl() {
+ return "jdbc:mysql://" + container.getHost() + ":" + container.getMappedPort(DB_PORT) + "/"
+ + DB_NAME + "?user=" + DB_USERNAME
+ + "&password=" + DB_PASSWORD;
+ }
+
+}
diff --git a/integration-tests/jdbc-grouped/pom.xml b/integration-tests/jdbc-grouped/pom.xml
index 61a5d2409a..aab703d1cd 100644
--- a/integration-tests/jdbc-grouped/pom.xml
+++ b/integration-tests/jdbc-grouped/pom.xml
@@ -124,6 +124,22 @@
<artifactId>camel-quarkus-integration-test-support</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.testcontainers</groupId>
+ <artifactId>testcontainers</artifactId>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-junit4-mock</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
@@ -297,12 +313,7 @@
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
- <quarkus.datasource.mysql.jdbc.additional-jdbc-properties.authenticationPlugins>org.apache.camel.quarkus.component.jdbc.mysql.Sha256FIPSPasswordPlugin</quarkus.datasource.mysql.jdbc.additional-jdbc-properties.authenticationPlugins>
- <quarkus.datasource.mysql.jdbc.additional-jdbc-properties.defaultAuthenticationPlugin>cq_fips_plugin</quarkus.datasource.mysql.jdbc.additional-jdbc-properties.defaultAuthenticationPlugin>
<quarkus.datasource.mysql.devservices.enabled>false</quarkus.datasource.mysql.devservices.enabled>
- <quarkus.datasource.mysql.username>${env.MYSQL_JDBC_USERNAME}</quarkus.datasource.mysql.username>
- <quarkus.datasource.mysql.password>${env.MYSQL_JDBC_PASSWORD}</quarkus.datasource.mysql.password>
- <quarkus.datasource.mysql.jdbc.url>${env.MYSQL_JDBC_URL}</quarkus.datasource.mysql.jdbc.url>
</systemPropertyVariables>
</configuration>
</plugin>
@@ -311,12 +322,7 @@
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<systemPropertyVariables>
- <quarkus.datasource.mysql.jdbc.additional-jdbc-properties.authenticationPlugins>org.apache.camel.quarkus.component.jdbc.mysql.Sha256FIPSPasswordPlugin</quarkus.datasource.mysql.jdbc.additional-jdbc-properties.authenticationPlugins>
- <quarkus.datasource.mysql.jdbc.additional-jdbc-properties.defaultAuthenticationPlugin>cq_fips_plugin</quarkus.datasource.mysql.jdbc.additional-jdbc-properties.defaultAuthenticationPlugin>
<quarkus.datasource.mysql.devservices.enabled>false</quarkus.datasource.mysql.devservices.enabled>
- <quarkus.datasource.mysql.username>${env.MYSQL_JDBC_USERNAME}</quarkus.datasource.mysql.username>
- <quarkus.datasource.mysql.password>${env.MYSQL_JDBC_PASSWORD}</quarkus.datasource.mysql.password>
- <quarkus.datasource.mysql.jdbc.url>${env.MYSQL_JDBC_URL}</quarkus.datasource.mysql.jdbc.url>
</systemPropertyVariables>
</configuration>
</plugin>
(camel-quarkus) 04/04: Fix check for ServiceRemoveEvent observers
Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
jamesnetherton pushed a commit to branch 3.15.x
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
commit aba112ecfa2517ab054ab046b7efa4e0d7189f7c
Author: James Netherton <ja...@gmail.com>
AuthorDate: Mon Oct 21 12:21:01 2024 +0100
Fix check for ServiceRemoveEvent observers
---
.../java/org/apache/camel/quarkus/core/CamelLifecycleEventBridge.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/CamelLifecycleEventBridge.java b/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/CamelLifecycleEventBridge.java
index 70248ac172..2475fcb251 100644
--- a/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/CamelLifecycleEventBridge.java
+++ b/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/CamelLifecycleEventBridge.java
@@ -127,7 +127,7 @@ public class CamelLifecycleEventBridge implements LifecycleStrategy {
@Override
public void onServiceRemove(CamelContext context, Service service, org.apache.camel.Route route) {
- if (observedLifecycleEvents.contains(ServiceAddEvent.class.getName())) {
+ if (observedLifecycleEvents.contains(ServiceRemoveEvent.class.getName())) {
fireEvent(new ServiceRemoveEvent(context, service, route));
}
}