You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by zb...@apache.org on 2023/09/15 17:15:25 UTC
[camel-quarkus] branch 3.2.x updated (d485f9f7cc -> 37712bdc95)
This is an automated email from the ASF dual-hosted git repository.
zbendhiba pushed a change to branch 3.2.x
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
from d485f9f7cc Upgrade Quarkus to 3.2.6.Final
new 19e64b2b62 Telegram integration tests: add the possibility to disable running webhook test Fixes #5298
new 37712bdc95 Test Prometheus metrics with CXF SOAP client and service
The 2 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:
.../cxf-soap/cxf-soap-metrics}/pom.xml | 24 ++--
.../cxf/soap/it/metrics/CxfSoapMetricsRoutes.java | 80 +++++++++++++
.../soap/it/metrics/MetricsClientResource.java} | 17 +--
.../cxf/soap/it/metrics/service/HelloService.java} | 17 ++-
.../src/main/resources/application.properties | 16 +--
.../main/resources/wsdl/MetricsHelloService.wsdl | 75 +++++++++++++
.../component/cxf/soap/it/metrics/MetricsIT.java | 4 +-
.../component/cxf/soap/it/metrics/MetricsTest.java | 125 +++++++++++++++++++++
integration-test-groups/cxf-soap/pom.xml | 1 +
integration-tests/cxf-soap-grouped/pom.xml | 8 ++
integration-tests/telegram/README.adoc | 9 +-
.../quarkus/component/telegram/it/Routes.java | 13 ++-
.../src/main/resources/application.properties | 3 +-
.../telegram/it/CustomWebhookCondition.java} | 22 ++--
.../component/telegram/it/TelegramTest.java | 2 +
.../telegram/it/TelegramTestResource.java | 5 +-
16 files changed, 362 insertions(+), 59 deletions(-)
copy {integration-tests/jaxb => integration-test-groups/cxf-soap/cxf-soap-metrics}/pom.xml (89%)
create mode 100644 integration-test-groups/cxf-soap/cxf-soap-metrics/src/main/java/org/apache/camel/quarkus/component/cxf/soap/it/metrics/CxfSoapMetricsRoutes.java
copy integration-test-groups/{xml/jvm/ref/src/main/java/org/apache/camel/quarkus/component/xml/it/XsltRefResource.java => cxf-soap/cxf-soap-metrics/src/main/java/org/apache/camel/quarkus/component/cxf/soap/it/metrics/MetricsClientResource.java} (76%)
copy integration-test-groups/cxf-soap/{cxf-soap-mtom-awt/src/main/java/org/apache/camel/quarkus/component/cxf/soap/mtom/awt/it/IImageService.java => cxf-soap-metrics/src/main/java/org/apache/camel/quarkus/component/cxf/soap/it/metrics/service/HelloService.java} (75%)
copy {integration-tests/main-xml-io-with-beans => integration-test-groups/cxf-soap/cxf-soap-metrics}/src/main/resources/application.properties (83%)
create mode 100644 integration-test-groups/cxf-soap/cxf-soap-metrics/src/main/resources/wsdl/MetricsHelloService.wsdl
copy extensions/aws2-lambda/runtime/src/main/org/apache/lambda/it/Aws2LambdaIT.java => integration-test-groups/cxf-soap/cxf-soap-metrics/src/test/java/org/apache/camel/quarkus/component/cxf/soap/it/metrics/MetricsIT.java (89%)
create mode 100644 integration-test-groups/cxf-soap/cxf-soap-metrics/src/test/java/org/apache/camel/quarkus/component/cxf/soap/it/metrics/MetricsTest.java
copy integration-tests/telegram/src/{main/java/org/apache/camel/quarkus/component/telegram/it/Routes.java => test/java/org/apache/camel/quarkus/component/telegram/it/CustomWebhookCondition.java} (52%)
[camel-quarkus] 01/02: Telegram integration tests: add the possibility to disable running webhook test Fixes #5298
Posted by zb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
zbendhiba pushed a commit to branch 3.2.x
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
commit 19e64b2b6251660a624671e0d05e89b3b0e036d5
Author: Zineb Bendhiba <be...@gmail.com>
AuthorDate: Wed Sep 13 15:23:27 2023 +0200
Telegram integration tests: add the possibility to disable running webhook test
Fixes #5298
---
integration-tests/telegram/README.adoc | 9 ++++++++-
.../quarkus/component/telegram/it/Routes.java | 13 ++++++++++---
.../src/main/resources/application.properties | 3 ++-
.../telegram/it/CustomWebhookCondition.java} | 22 ++++++++++++++--------
.../component/telegram/it/TelegramTest.java | 2 ++
.../telegram/it/TelegramTestResource.java | 5 +----
6 files changed, 37 insertions(+), 17 deletions(-)
diff --git a/integration-tests/telegram/README.adoc b/integration-tests/telegram/README.adoc
index 5521d1640b..39f63449bb 100644
--- a/integration-tests/telegram/README.adoc
+++ b/integration-tests/telegram/README.adoc
@@ -24,4 +24,11 @@ Or
Set environment variable `WIREMOCK_RECORD=true`
-Note that you'll need 2 differents bots, one dedicated to the webhook consumer only.
\ No newline at end of file
+Note that you'll need 2 different bots, one dedicated to the webhook consumer only.
+
+If you want to disable the webhook test, you can set the environment property
+
+[source,shell]
+----
+export TELEGRAM_WEBHOOK_DISABLED=true
+----
\ No newline at end of file
diff --git a/integration-tests/telegram/src/main/java/org/apache/camel/quarkus/component/telegram/it/Routes.java b/integration-tests/telegram/src/main/java/org/apache/camel/quarkus/component/telegram/it/Routes.java
index dab1578264..5153477c1f 100644
--- a/integration-tests/telegram/src/main/java/org/apache/camel/quarkus/component/telegram/it/Routes.java
+++ b/integration-tests/telegram/src/main/java/org/apache/camel/quarkus/component/telegram/it/Routes.java
@@ -18,14 +18,21 @@ package org.apache.camel.quarkus.component.telegram.it;
import jakarta.enterprise.context.ApplicationScoped;
import org.apache.camel.builder.RouteBuilder;
+import org.eclipse.microprofile.config.inject.ConfigProperty;
@ApplicationScoped
public class Routes extends RouteBuilder {
+ @ConfigProperty(name = "webhook.disabled")
+ String webhookDisabled;
+
@Override
public void configure() throws Exception {
- from("webhook:telegram:bots?webhookPath=/my-test&webhook-external-url={{webhook-external-url}}&authorization-token={{webhook-authorization-token}}")
- .log("webhook message : ${body}")
- .to("mock:webhook");
+ boolean isWebhookDisabled = Boolean.parseBoolean(webhookDisabled);
+ if (!isWebhookDisabled) {
+ from("webhook:telegram:bots?webhookPath=/my-test&webhook-external-url={{webhook-external-url}}&authorization-token={{webhook-authorization-token}}")
+ .log("webhook message : ${body}")
+ .to("mock:webhook");
+ }
}
}
diff --git a/integration-tests/telegram/src/main/resources/application.properties b/integration-tests/telegram/src/main/resources/application.properties
index 70f5b391cc..ce05e22964 100644
--- a/integration-tests/telegram/src/main/resources/application.properties
+++ b/integration-tests/telegram/src/main/resources/application.properties
@@ -33,4 +33,5 @@ telegram.chatId=${TELEGRAM_CHAT_ID:1426416050}
#for webhook Telegram consumer
webhook-external-url=${TELEGRAM_WEBHOOK_EXTERNAL_URL:https://my-external-link}
-webhook-authorization-token=${TELEGRAM_WEBHOOK_AUTHORIZATION_TOKEN:fake-token}
\ No newline at end of file
+webhook-authorization-token=${TELEGRAM_WEBHOOK_AUTHORIZATION_TOKEN:fake-token}
+webhook.disabled=${TELEGRAM_WEBHOOK_DISABLED:false}
\ No newline at end of file
diff --git a/integration-tests/telegram/src/main/java/org/apache/camel/quarkus/component/telegram/it/Routes.java b/integration-tests/telegram/src/test/java/org/apache/camel/quarkus/component/telegram/it/CustomWebhookCondition.java
similarity index 52%
copy from integration-tests/telegram/src/main/java/org/apache/camel/quarkus/component/telegram/it/Routes.java
copy to integration-tests/telegram/src/test/java/org/apache/camel/quarkus/component/telegram/it/CustomWebhookCondition.java
index dab1578264..9429229a3a 100644
--- a/integration-tests/telegram/src/main/java/org/apache/camel/quarkus/component/telegram/it/Routes.java
+++ b/integration-tests/telegram/src/test/java/org/apache/camel/quarkus/component/telegram/it/CustomWebhookCondition.java
@@ -16,16 +16,22 @@
*/
package org.apache.camel.quarkus.component.telegram.it;
-import jakarta.enterprise.context.ApplicationScoped;
-import org.apache.camel.builder.RouteBuilder;
+import org.junit.jupiter.api.extension.ConditionEvaluationResult;
+import org.junit.jupiter.api.extension.ExecutionCondition;
+import org.junit.jupiter.api.extension.ExtensionContext;
-@ApplicationScoped
-public class Routes extends RouteBuilder {
+public class CustomWebhookCondition implements ExecutionCondition {
+ private static final String TELEGRAM_WEBHOOK_DISABLED = "TELEGRAM_WEBHOOK_DISABLED";
@Override
- public void configure() throws Exception {
- from("webhook:telegram:bots?webhookPath=/my-test&webhook-external-url={{webhook-external-url}}&authorization-token={{webhook-authorization-token}}")
- .log("webhook message : ${body}")
- .to("mock:webhook");
+ public ConditionEvaluationResult evaluateExecutionCondition(ExtensionContext extensionContext) {
+ boolean isWebhookDisabled = System.getenv(TELEGRAM_WEBHOOK_DISABLED) != null
+ && Boolean.parseBoolean(System.getenv(TELEGRAM_WEBHOOK_DISABLED));
+
+ if (isWebhookDisabled) {
+ return ConditionEvaluationResult.disabled("Webhook test is disabled");
+ }
+
+ return ConditionEvaluationResult.enabled("Webhook test is enabled");
}
}
diff --git a/integration-tests/telegram/src/test/java/org/apache/camel/quarkus/component/telegram/it/TelegramTest.java b/integration-tests/telegram/src/test/java/org/apache/camel/quarkus/component/telegram/it/TelegramTest.java
index 9f2af1af52..44a918d3e7 100644
--- a/integration-tests/telegram/src/test/java/org/apache/camel/quarkus/component/telegram/it/TelegramTest.java
+++ b/integration-tests/telegram/src/test/java/org/apache/camel/quarkus/component/telegram/it/TelegramTest.java
@@ -35,6 +35,7 @@ import org.apache.camel.quarkus.test.TrustStoreResource;
import org.apache.camel.quarkus.test.wiremock.MockServer;
import org.jboss.logging.Logger;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
import static com.github.tomakehurst.wiremock.client.WireMock.equalTo;
@@ -212,6 +213,7 @@ public class TelegramTest {
}
@Test
+ @ExtendWith(CustomWebhookCondition.class)
void testWebhookEndpoint() {
//simulate POST messages from Telegram
final var message = "{\n" +
diff --git a/integration-tests/telegram/src/test/java/org/apache/camel/quarkus/component/telegram/it/TelegramTestResource.java b/integration-tests/telegram/src/test/java/org/apache/camel/quarkus/component/telegram/it/TelegramTestResource.java
index 092025061c..1ffe6f34c6 100644
--- a/integration-tests/telegram/src/test/java/org/apache/camel/quarkus/component/telegram/it/TelegramTestResource.java
+++ b/integration-tests/telegram/src/test/java/org/apache/camel/quarkus/component/telegram/it/TelegramTestResource.java
@@ -26,8 +26,6 @@ public class TelegramTestResource extends WireMockTestResourceLifecycleManager {
private static final String TELEGRAM_API_BASE_URL = "https://api.telegram.org";
private static final String TELEGRAM_ENV_AUTHORIZATION_TOKEN = "TELEGRAM_AUTHORIZATION_TOKEN";
private static final String TELEGRAM_ENV_CHAT_ID = "TELEGRAM_CHAT_ID";
- private static final String TELEGRAM_ENV_WEBHOOK_EXTERNAL_URL = "TELEGRAM_WEBHOOK_EXTERNAL_URL";
- private static final String TELEGRAM_ENV_WEBHOOK_AUTHORIZATION_TOKEN = "TELEGRAM_WEBHOOK_AUTHORIZATION_TOKEN";
@Override
public Map<String, String> start() {
@@ -45,7 +43,6 @@ public class TelegramTestResource extends WireMockTestResourceLifecycleManager {
@Override
protected boolean isMockingEnabled() {
- return !envVarsPresent(TELEGRAM_ENV_AUTHORIZATION_TOKEN, TELEGRAM_ENV_CHAT_ID, TELEGRAM_ENV_WEBHOOK_EXTERNAL_URL,
- TELEGRAM_ENV_WEBHOOK_AUTHORIZATION_TOKEN);
+ return !envVarsPresent(TELEGRAM_ENV_AUTHORIZATION_TOKEN, TELEGRAM_ENV_CHAT_ID);
}
}
[camel-quarkus] 02/02: Test Prometheus metrics with CXF SOAP client and service
Posted by zb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
zbendhiba pushed a commit to branch 3.2.x
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
commit 37712bdc954392f5fa7f6f5dfc44c487934eb59d
Author: Peter Palaga <pp...@redhat.com>
AuthorDate: Wed Sep 13 12:53:14 2023 +0200
Test Prometheus metrics with CXF SOAP client and service
---
.../cxf-soap/cxf-soap-metrics/pom.xml | 139 +++++++++++++++++++++
.../cxf/soap/it/metrics/CxfSoapMetricsRoutes.java | 80 ++++++++++++
.../cxf/soap/it/metrics/MetricsClientResource.java | 41 ++++++
.../cxf/soap/it/metrics/service/HelloService.java | 32 +++++
.../src/main/resources/application.properties | 21 ++++
.../main/resources/wsdl/MetricsHelloService.wsdl | 75 +++++++++++
.../component/cxf/soap/it/metrics/MetricsIT.java | 24 ++++
.../component/cxf/soap/it/metrics/MetricsTest.java | 125 ++++++++++++++++++
integration-test-groups/cxf-soap/pom.xml | 1 +
integration-tests/cxf-soap-grouped/pom.xml | 8 ++
10 files changed, 546 insertions(+)
diff --git a/integration-test-groups/cxf-soap/cxf-soap-metrics/pom.xml b/integration-test-groups/cxf-soap/cxf-soap-metrics/pom.xml
new file mode 100644
index 0000000000..ce1258b3d9
--- /dev/null
+++ b/integration-test-groups/cxf-soap/cxf-soap-metrics/pom.xml
@@ -0,0 +1,139 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-build-parent-it</artifactId>
+ <version>3.2.1-SNAPSHOT</version>
+ <relativePath>../../../poms/build-parent-it/pom.xml</relativePath>
+ </parent>
+
+ <artifactId>camel-quarkus-integration-test-cxf-soap-metrics</artifactId>
+
+ <name>Quarkus CXF - Integration Test - Metrics</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-cxf-soap</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-direct</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.quarkiverse.cxf</groupId>
+ <artifactId>quarkus-cxf-rt-features-metrics</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-micrometer-registry-prometheus</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-resteasy</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-junit5</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>io.rest-assured</groupId>
+ <artifactId>rest-assured</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.assertj</groupId>
+ <artifactId>assertj-core</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <profiles>
+ <profile>
+ <id>native</id>
+ <activation>
+ <property>
+ <name>native</name>
+ </property>
+ </activation>
+ <properties>
+ <quarkus.package.type>native</quarkus.package.type>
+ </properties>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>integration-test</goal>
+ <goal>verify</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>virtualDependencies</id>
+ <activation>
+ <property>
+ <name>!noVirtualDependencies</name>
+ </property>
+ </activation>
+ <dependencies>
+ <!-- The following dependencies guarantee that this module is built after them. You can update them by running `mvn process-resources -Pformat -N` from the source tree root directory -->
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-cxf-soap-deployment</artifactId>
+ <version>${project.version}</version>
+ <type>pom</type>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>*</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-direct-deployment</artifactId>
+ <version>${project.version}</version>
+ <type>pom</type>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>*</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ </dependencies>
+ </profile>
+ </profiles>
+
+</project>
diff --git a/integration-test-groups/cxf-soap/cxf-soap-metrics/src/main/java/org/apache/camel/quarkus/component/cxf/soap/it/metrics/CxfSoapMetricsRoutes.java b/integration-test-groups/cxf-soap/cxf-soap-metrics/src/main/java/org/apache/camel/quarkus/component/cxf/soap/it/metrics/CxfSoapMetricsRoutes.java
new file mode 100644
index 0000000000..3248172ac5
--- /dev/null
+++ b/integration-test-groups/cxf-soap/cxf-soap-metrics/src/main/java/org/apache/camel/quarkus/component/cxf/soap/it/metrics/CxfSoapMetricsRoutes.java
@@ -0,0 +1,80 @@
+/*
+ * 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.cxf.soap.it.metrics;
+
+import io.quarkiverse.cxf.metrics.QuarkusCxfMetricsFeature;
+import jakarta.enterprise.context.ApplicationScoped;
+import jakarta.enterprise.context.SessionScoped;
+import jakarta.enterprise.inject.Produces;
+import jakarta.inject.Named;
+import org.apache.camel.Message;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.cxf.jaxws.CxfEndpoint;
+import org.apache.camel.quarkus.component.cxf.soap.it.metrics.service.HelloService;
+import org.eclipse.microprofile.config.inject.ConfigProperty;
+
+@ApplicationScoped
+public class CxfSoapMetricsRoutes extends RouteBuilder {
+
+ @ConfigProperty(name = "quarkus.http.test-port")
+ String port;
+
+ @Override
+ public void configure() {
+
+ from("direct:clientMetrics")
+ .to("cxf:bean:clientMetricsEndpoint?dataFormat=POJO");
+
+ from("cxf:bean:metricsServiceEndpoint")
+ .process(e -> {
+ try {
+ /* We have to slow down a bit so that the native test is able to see some elapsedTime */
+ Thread.sleep(20);
+ } catch (InterruptedException ex) {
+ Thread.currentThread().interrupt();
+ }
+ Message message = e.getMessage();
+ message.setBody("Hello " + message.getBody(String.class) + "!", String.class);
+ });
+
+ }
+
+ @Produces
+ @SessionScoped
+ @Named
+ CxfEndpoint clientMetricsEndpoint() {
+ final CxfEndpoint result = new CxfEndpoint();
+ result.setServiceClass(HelloService.class);
+ result.setAddress("http://localhost:" + port + "/soapservice/hello-metrics");
+ result.setWsdlURL("wsdl/MetricsHelloService.wsdl");
+ result.getFeatures().add(new QuarkusCxfMetricsFeature());
+ return result;
+ }
+
+ @Produces
+ @ApplicationScoped
+ @Named
+ CxfEndpoint metricsServiceEndpoint() {
+ final CxfEndpoint result = new CxfEndpoint();
+ result.setServiceClass(HelloService.class);
+ result.setAddress("/hello-metrics");
+ result.setWsdlURL("wsdl/MetricsHelloService.wsdl");
+ result.getFeatures().add(new QuarkusCxfMetricsFeature());
+ return result;
+ }
+
+}
diff --git a/integration-test-groups/cxf-soap/cxf-soap-metrics/src/main/java/org/apache/camel/quarkus/component/cxf/soap/it/metrics/MetricsClientResource.java b/integration-test-groups/cxf-soap/cxf-soap-metrics/src/main/java/org/apache/camel/quarkus/component/cxf/soap/it/metrics/MetricsClientResource.java
new file mode 100644
index 0000000000..f7845c8269
--- /dev/null
+++ b/integration-test-groups/cxf-soap/cxf-soap-metrics/src/main/java/org/apache/camel/quarkus/component/cxf/soap/it/metrics/MetricsClientResource.java
@@ -0,0 +1,41 @@
+/*
+ * 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.cxf.soap.it.metrics;
+
+import java.io.IOException;
+
+import jakarta.inject.Inject;
+import jakarta.ws.rs.POST;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.Produces;
+import jakarta.ws.rs.core.MediaType;
+import org.apache.camel.ProducerTemplate;
+
+@Path("/cxf-soap/metrics/client")
+public class MetricsClientResource {
+
+ @Inject
+ ProducerTemplate producerTemplate;
+
+ @POST
+ @Path("/hello")
+ @Produces(MediaType.TEXT_PLAIN)
+ public String hello(String body) throws IOException {
+ return producerTemplate.requestBody("direct:clientMetrics", body, String.class);
+ }
+
+}
diff --git a/integration-test-groups/cxf-soap/cxf-soap-metrics/src/main/java/org/apache/camel/quarkus/component/cxf/soap/it/metrics/service/HelloService.java b/integration-test-groups/cxf-soap/cxf-soap-metrics/src/main/java/org/apache/camel/quarkus/component/cxf/soap/it/metrics/service/HelloService.java
new file mode 100644
index 0000000000..a7826139c9
--- /dev/null
+++ b/integration-test-groups/cxf-soap/cxf-soap-metrics/src/main/java/org/apache/camel/quarkus/component/cxf/soap/it/metrics/service/HelloService.java
@@ -0,0 +1,32 @@
+/*
+ * 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.cxf.soap.it.metrics.service;
+
+import jakarta.jws.WebMethod;
+import jakarta.jws.WebParam;
+import jakarta.jws.WebService;
+
+/**
+ * The simplest Hello service.
+ */
+@WebService(name = "HelloService", serviceName = "HelloService")
+public interface HelloService {
+
+ @WebMethod
+ String hello(@WebParam(name = "text") String text);
+
+}
diff --git a/integration-test-groups/cxf-soap/cxf-soap-metrics/src/main/resources/application.properties b/integration-test-groups/cxf-soap/cxf-soap-metrics/src/main/resources/application.properties
new file mode 100644
index 0000000000..29ce2938e3
--- /dev/null
+++ b/integration-test-groups/cxf-soap/cxf-soap-metrics/src/main/resources/application.properties
@@ -0,0 +1,21 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+quarkus.cxf.path = /soapservice
+
+quarkus.micrometer.export.json.enabled = true
+quarkus.micrometer.export.json.path = metrics/json
+quarkus.micrometer.export.prometheus.path = metrics/prometheus
diff --git a/integration-test-groups/cxf-soap/cxf-soap-metrics/src/main/resources/wsdl/MetricsHelloService.wsdl b/integration-test-groups/cxf-soap/cxf-soap-metrics/src/main/resources/wsdl/MetricsHelloService.wsdl
new file mode 100644
index 0000000000..c8c557cb61
--- /dev/null
+++ b/integration-test-groups/cxf-soap/cxf-soap-metrics/src/main/resources/wsdl/MetricsHelloService.wsdl
@@ -0,0 +1,75 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!--
+
+ 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.
+
+-->
+<wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://service.metrics.it.soap.cxf.component.quarkus.camel.apache.org/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:ns1="http://schemas.xmlsoap.org/soap/http" name="HelloService" targetNamespace="http://service.metrics.it.soap.cxf.component.quarkus.camel.apache.org/">
+ <wsdl:types>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://service.metrics.it.soap.cxf.component.quarkus.camel.apache.org/" elementFormDefault="unqualified" targetNamespace="http://service.metrics.it.soap.cxf.component.quarkus.camel.apache.org/" version="1.0">
+
+ <xs:element name="hello" type="tns:hello"/>
+
+ <xs:element name="helloResponse" type="tns:helloResponse"/>
+
+ <xs:complexType name="hello">
+ <xs:sequence>
+ <xs:element minOccurs="0" name="text" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="helloResponse">
+ <xs:sequence>
+ <xs:element minOccurs="0" name="return" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+
+</xs:schema>
+ </wsdl:types>
+ <wsdl:message name="hello">
+ <wsdl:part element="tns:hello" name="parameters">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="helloResponse">
+ <wsdl:part element="tns:helloResponse" name="parameters">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:portType name="HelloService">
+ <wsdl:operation name="hello">
+ <wsdl:input message="tns:hello" name="hello">
+ </wsdl:input>
+ <wsdl:output message="tns:helloResponse" name="helloResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="HelloServiceSoapBinding" type="tns:HelloService">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="hello">
+ <soap:operation soapAction="" style="document"/>
+ <wsdl:input name="hello">
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="helloResponse">
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="HelloService">
+ <wsdl:port binding="tns:HelloServiceSoapBinding" name="HelloServicePort">
+ <soap:address location="http://localhost:8080/soap/hello"/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
\ No newline at end of file
diff --git a/integration-test-groups/cxf-soap/cxf-soap-metrics/src/test/java/org/apache/camel/quarkus/component/cxf/soap/it/metrics/MetricsIT.java b/integration-test-groups/cxf-soap/cxf-soap-metrics/src/test/java/org/apache/camel/quarkus/component/cxf/soap/it/metrics/MetricsIT.java
new file mode 100644
index 0000000000..51af96183c
--- /dev/null
+++ b/integration-test-groups/cxf-soap/cxf-soap-metrics/src/test/java/org/apache/camel/quarkus/component/cxf/soap/it/metrics/MetricsIT.java
@@ -0,0 +1,24 @@
+/*
+ * 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.cxf.soap.it.metrics;
+
+import io.quarkus.test.junit.QuarkusIntegrationTest;
+
+@QuarkusIntegrationTest
+public class MetricsIT extends MetricsTest {
+
+}
diff --git a/integration-test-groups/cxf-soap/cxf-soap-metrics/src/test/java/org/apache/camel/quarkus/component/cxf/soap/it/metrics/MetricsTest.java b/integration-test-groups/cxf-soap/cxf-soap-metrics/src/test/java/org/apache/camel/quarkus/component/cxf/soap/it/metrics/MetricsTest.java
new file mode 100644
index 0000000000..54a6a79588
--- /dev/null
+++ b/integration-test-groups/cxf-soap/cxf-soap-metrics/src/test/java/org/apache/camel/quarkus/component/cxf/soap/it/metrics/MetricsTest.java
@@ -0,0 +1,125 @@
+/*
+ * 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.cxf.soap.it.metrics;
+
+import java.util.Map;
+
+import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.RestAssured;
+import io.restassured.path.json.JsonPath;
+import org.assertj.core.api.Assertions;
+import org.eclipse.microprofile.config.Config;
+import org.eclipse.microprofile.config.ConfigProvider;
+import org.hamcrest.CoreMatchers;
+import org.junit.jupiter.api.Test;
+
+import static io.restassured.RestAssured.given;
+
+@QuarkusTest
+public class MetricsTest {
+
+ @Test
+ void serverAndClient() {
+ {
+ final Map<String, Object> metrics = getMetrics();
+ /* There should be no cxf metrics available before we call anything */
+ Assertions.assertThat(metrics.get("cxf.server.requests")).isNull();
+ Assertions.assertThat(metrics.get("cxf.client.requests")).isNull();
+ }
+
+ /* First send a direct request to the service circumventing the in-app client */
+ final String SOAP_REQUEST = "<x:Envelope xmlns:x=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:cxf=\"http://service.metrics.it.soap.cxf.component.quarkus.camel.apache.org/\">\n"
+ +
+ " <x:Header/>\n" +
+ " <x:Body>\n" +
+ " <cxf:hello>\n" +
+ " <text>foo</text>\n" +
+ " </cxf:hello>\n" +
+ " </x:Body>\n" +
+ "</x:Envelope>";
+ given()
+ .header("Content-Type", "text/xml")
+ .body(SOAP_REQUEST)
+ .when()
+ .post("/soapservice/hello-metrics")
+ .then()
+ .statusCode(200)
+ .body(CoreMatchers.containsString("Hello foo"));
+
+ {
+ final Map<String, Object> metrics = getMetrics();
+ @SuppressWarnings("unchecked")
+ Map<String, Object> serverRequests = (Map<String, Object>) metrics.get("cxf.server.requests");
+ Assertions.assertThat(serverRequests).isNotNull();
+ Assertions.assertThat(serverRequests.get(
+ "count;exception=None;faultCode=None;method=POST;operation=hello;outcome=SUCCESS;status=200;uri=/soapservice/hello-metrics"))
+ .isEqualTo(1);
+ Assertions.assertThat((Float) serverRequests.get(
+ "elapsedTime;exception=None;faultCode=None;method=POST;operation=hello;outcome=SUCCESS;status=200;uri=/soapservice/hello-metrics"))
+ .isGreaterThan(0.0F);
+ }
+
+ final Config config = ConfigProvider.getConfig();
+ final int port = config.getValue("quarkus.http.test-port", Integer.class);
+
+ /* Now send a request using the in-app client */
+ given()
+ .body("Joe")
+ .when()
+ .post("/cxf-soap/metrics/client/hello")
+ .then()
+ .statusCode(200)
+ .body(CoreMatchers.containsString("Hello Joe"));
+ {
+ final Map<String, Object> metrics = getMetrics();
+ @SuppressWarnings("unchecked")
+ Map<String, Object> serverRequests = (Map<String, Object>) metrics.get("cxf.server.requests");
+ Assertions.assertThat(serverRequests).isNotNull();
+ Assertions.assertThat(serverRequests.get(
+ "count;exception=None;faultCode=None;method=POST;operation=hello;outcome=SUCCESS;status=200;uri=/soapservice/hello-metrics"))
+ .isEqualTo(2);
+ Assertions.assertThat((Float) serverRequests.get(
+ "elapsedTime;exception=None;faultCode=None;method=POST;operation=hello;outcome=SUCCESS;status=200;uri=/soapservice/hello-metrics"))
+ .isGreaterThan(0.0F);
+
+ Map<String, Object> clientRequests = (Map<String, Object>) metrics.get("cxf.client.requests");
+ Assertions.assertThat(clientRequests).isNotNull();
+ Assertions.assertThat(clientRequests.get(
+ "count;exception=None;faultCode=None;method=POST;operation=hello;outcome=SUCCESS;status=200;uri=http://localhost:"
+ + port + "/soapservice/hello-metrics"))
+ .isEqualTo(1);
+ Assertions.assertThat((Float) clientRequests.get(
+ "elapsedTime;exception=None;faultCode=None;method=POST;operation=hello;outcome=SUCCESS;status=200;uri=http://localhost:"
+ + port + "/soapservice/hello-metrics"))
+ .isGreaterThan(0.0F);
+
+ }
+
+ }
+
+ private Map<String, Object> getMetrics() {
+ final String body = RestAssured.given()
+ .header("Content-Type", "application/json")
+ .get("/q/metrics/json")
+ .then()
+ .statusCode(200)
+ .extract().body().asString();
+ final JsonPath jp = new JsonPath(body);
+ return jp.getJsonObject("$");
+ }
+
+}
diff --git a/integration-test-groups/cxf-soap/pom.xml b/integration-test-groups/cxf-soap/pom.xml
index accdcdc897..d0572d2fb7 100644
--- a/integration-test-groups/cxf-soap/pom.xml
+++ b/integration-test-groups/cxf-soap/pom.xml
@@ -39,6 +39,7 @@
<!-- extensions a..z; do not remove this comment, it is important when sorting via mvn process-resources -Pformat -->
<module>cxf-soap-client</module>
<module>cxf-soap-converter</module>
+ <module>cxf-soap-metrics</module>
<module>cxf-soap-mtom</module>
<module>cxf-soap-mtom-awt</module>
<module>cxf-soap-rest</module>
diff --git a/integration-tests/cxf-soap-grouped/pom.xml b/integration-tests/cxf-soap-grouped/pom.xml
index 1c9f13107d..b39cd06fd4 100644
--- a/integration-tests/cxf-soap-grouped/pom.xml
+++ b/integration-tests/cxf-soap-grouped/pom.xml
@@ -60,6 +60,14 @@
<groupId>io.quarkiverse.cxf</groupId>
<artifactId>quarkus-cxf-xjc-plugins</artifactId>
</dependency>
+ <dependency>
+ <groupId>io.quarkiverse.cxf</groupId>
+ <artifactId>quarkus-cxf-rt-features-metrics</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-micrometer-registry-prometheus</artifactId>
+ </dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>