You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "ppalaga (via GitHub)" <gi...@apache.org> on 2023/03/30 18:17:50 UTC

[GitHub] [camel-quarkus] ppalaga commented on a diff in pull request #4721: Cxf ws-rm tests coverage - JVM only

ppalaga commented on code in PR #4721:
URL: https://github.com/apache/camel-quarkus/pull/4721#discussion_r1153506364


##########
integration-test-groups/cxf-soap/cxf-soap-ws-rm/pom.xml:
##########
@@ -0,0 +1,165 @@
+<?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.0.0-SNAPSHOT</version>
+        <relativePath>../../../poms/build-parent-it/pom.xml</relativePath>
+    </parent>
+
+    <artifactId>camel-quarkus-integration-test-cxf-soap-ws-rm</artifactId>
+    <name>Camel Quarkus :: Integration Tests :: Cxf Soap WS-rm</name>
+    <description>Integration tests for Camel Quarkus CXF extension WS-reliable mssaging</description>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-cxf-soap</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-resteasy</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-seda</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-ws-rm</artifactId>

Review Comment:
   This should be 
   ```suggestion
               <groupId>io.quarkiverse.cxf</groupId>
               <artifactId>quarkus-cxf-rt-ws-rm</artifactId>
   ```



##########
integration-test-groups/cxf-soap/cxf-soap-ws-rm/src/main/java/org/apache/camel/quarkus/component/cxf/soap/wsrm/it/CxfSoapWsrmResource.java:
##########
@@ -0,0 +1,72 @@
+/*
+ * 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.wsrm.it;
+
+import java.net.URI;
+import java.util.LinkedList;
+
+import jakarta.enterprise.context.ApplicationScoped;
+import jakarta.inject.Inject;
+import jakarta.inject.Named;
+import jakarta.ws.rs.Consumes;
+import jakarta.ws.rs.GET;
+import jakarta.ws.rs.POST;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.Produces;
+import jakarta.ws.rs.core.MediaType;
+import jakarta.ws.rs.core.Response;
+import org.apache.camel.ProducerTemplate;
+
+@Path("/cxf-soap")
+@ApplicationScoped
+public class CxfSoapWsrmResource {
+
+    @Inject
+    ProducerTemplate producerTemplate;
+
+    @Inject
+    @Named("results")
+    LinkedList<String> results;
+
+    @Path("/wsrm")
+    @POST
+    @Consumes(MediaType.WILDCARD)
+    @Produces(MediaType.TEXT_PLAIN)
+    public Response wsrm(String msg) throws Exception {
+        String response = producerTemplate.requestBodyAndHeader("seda:rswmInvoker", msg, "enableWsrm", true,

Review Comment:
   Is there any hidden sense in using `rswmInvoker` rather than `wsrmInvoker`?



##########
integration-test-groups/cxf-soap/cxf-soap-ws-rm/src/main/java/org/apache/camel/quarkus/component/cxf/soap/wsrm/it/CxfSoapWsrmRoutes.java:
##########
@@ -0,0 +1,187 @@
+/*
+ * 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.wsrm.it;
+
+import java.util.LinkedList;
+import java.util.Map;
+
+import io.quarkus.runtime.LaunchMode;
+import jakarta.enterprise.context.ApplicationScoped;
+import jakarta.enterprise.inject.Produces;
+import jakarta.inject.Inject;
+import jakarta.inject.Named;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.cxf.jaxws.CxfEndpoint;
+import org.apache.cxf.ext.logging.LoggingFeature;
+import org.apache.cxf.ws.rm.manager.AcksPolicyType;
+import org.apache.cxf.ws.rm.manager.DestinationPolicyType;
+import org.apache.cxf.ws.rmp.v200502.RMAssertion;
+import org.eclipse.microprofile.config.Config;
+import org.eclipse.microprofile.config.ConfigProvider;
+
+@ApplicationScoped
+public class CxfSoapWsrmRoutes extends RouteBuilder {
+
+    @Inject
+    @Named("loggingFeatureWsrm")
+    LoggingFeature loggingFeature;
+
+    @Inject
+    @Named("results")
+    LinkedList<String> results;
+
+    @Override
+    public void configure() {
+
+        from("seda:rswmInvoker")
+                .process(exchange -> {
+                    boolean enableWsrm = exchange.getIn().getHeader("enableWsrm", Boolean.class);
+
+                    Map<String, Object> headers = exchange.getIn().getHeaders();
+                    headers.put("address", getServerUrl() + "/soapservice/" + (enableWsrm ? "wsrm" : "noWsrm") + "/RouterPort");
+
+                    headers.put("endpoint", (enableWsrm ? "wsrm" : "noWsrm") + "ClientEndpoint");
+                })
+                .toD("cxf:bean:${header.endpoint}?address=${header.address}");
+
+        from("cxf:bean:wsrmServerEndpoint")
+                .process("responseProcessorWsrm");
+
+        from("cxf:bean:noWsrmServerEndpoint")
+                .process("responseProcessorWsrm")
+                .process(e -> results.add(e.getIn().getBody(String.class)));
+
+    }
+
+    @Produces
+    @ApplicationScoped
+    @Named("noWsrmClientEndpoint")
+    CxfEndpoint noWwsrmClientEndpoint() {
+        final CxfEndpoint cxfEndpoint = new CxfEndpoint();
+        cxfEndpoint.getFeatures().add(loggingFeature);

Review Comment:
   It would be good to add `quarkus-cxf-rt-features-logging` dependency for the logging feature to work properly in native mode.



##########
integration-test-groups/cxf-soap/cxf-soap-ws-rm/src/main/java/org/apache/camel/quarkus/component/cxf/soap/wsrm/it/MessageLossSimulator.java:
##########
@@ -0,0 +1,112 @@
+/*
+ * 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.wsrm.it;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.ListIterator;
+
+import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.interceptor.InterceptorChain;
+import org.apache.cxf.interceptor.MessageSenderInterceptor;
+import org.apache.cxf.io.AbstractWrappedOutputStream;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.phase.AbstractPhaseInterceptor;
+import org.apache.cxf.phase.PhaseInterceptor;
+import org.apache.cxf.ws.rm.RMContextUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class MessageLossSimulator extends AbstractPhaseInterceptor<Message> {
+    private static final Logger LOG = LoggerFactory.getLogger(MessageLossSimulator.class.getName());
+    private int appMessageCount;
+
+    public MessageLossSimulator() {
+        super("prepare-send");
+        this.addBefore(MessageSenderInterceptor.class.getName());
+    }
+
+    private static String getAction(Object map) {
+        if (map == null) {
+            return null;
+        } else {
+            try {
+                Object o = map.getClass().getMethod("getAction").invoke(map);
+                return (String) o.getClass().getMethod("getValue").invoke(o);

Review Comment:
   Is this reflection handled somehow in native mode?



##########
integration-test-groups/cxf-soap/cxf-soap-ws-rm/src/main/java/org/apache/camel/quarkus/component/cxf/soap/wsrm/it/CxfSoapWsrmResource.java:
##########
@@ -0,0 +1,72 @@
+/*
+ * 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.wsrm.it;
+
+import java.net.URI;
+import java.util.LinkedList;
+
+import jakarta.enterprise.context.ApplicationScoped;
+import jakarta.inject.Inject;
+import jakarta.inject.Named;
+import jakarta.ws.rs.Consumes;
+import jakarta.ws.rs.GET;
+import jakarta.ws.rs.POST;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.Produces;
+import jakarta.ws.rs.core.MediaType;
+import jakarta.ws.rs.core.Response;
+import org.apache.camel.ProducerTemplate;
+
+@Path("/cxf-soap")
+@ApplicationScoped
+public class CxfSoapWsrmResource {
+
+    @Inject
+    ProducerTemplate producerTemplate;
+
+    @Inject
+    @Named("results")

Review Comment:
   The bean name is a bit too generic. One day it might clash with another bean from another test in the group. I'd vote for using `wsrpResults` or similar.



##########
integration-test-groups/cxf-soap/cxf-soap-ws-rm/src/main/java/org/apache/camel/quarkus/component/cxf/soap/wsrm/it/CxfSoapWsrmRoutes.java:
##########
@@ -0,0 +1,187 @@
+/*
+ * 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.wsrm.it;
+
+import java.util.LinkedList;
+import java.util.Map;
+
+import io.quarkus.runtime.LaunchMode;
+import jakarta.enterprise.context.ApplicationScoped;
+import jakarta.enterprise.inject.Produces;
+import jakarta.inject.Inject;
+import jakarta.inject.Named;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.cxf.jaxws.CxfEndpoint;
+import org.apache.cxf.ext.logging.LoggingFeature;
+import org.apache.cxf.ws.rm.manager.AcksPolicyType;
+import org.apache.cxf.ws.rm.manager.DestinationPolicyType;
+import org.apache.cxf.ws.rmp.v200502.RMAssertion;
+import org.eclipse.microprofile.config.Config;
+import org.eclipse.microprofile.config.ConfigProvider;
+
+@ApplicationScoped
+public class CxfSoapWsrmRoutes extends RouteBuilder {
+
+    @Inject
+    @Named("loggingFeatureWsrm")
+    LoggingFeature loggingFeature;
+
+    @Inject
+    @Named("results")
+    LinkedList<String> results;
+
+    @Override
+    public void configure() {
+
+        from("seda:rswmInvoker")
+                .process(exchange -> {
+                    boolean enableWsrm = exchange.getIn().getHeader("enableWsrm", Boolean.class);
+
+                    Map<String, Object> headers = exchange.getIn().getHeaders();
+                    headers.put("address", getServerUrl() + "/soapservice/" + (enableWsrm ? "wsrm" : "noWsrm") + "/RouterPort");
+
+                    headers.put("endpoint", (enableWsrm ? "wsrm" : "noWsrm") + "ClientEndpoint");
+                })
+                .toD("cxf:bean:${header.endpoint}?address=${header.address}");
+
+        from("cxf:bean:wsrmServerEndpoint")
+                .process("responseProcessorWsrm");
+
+        from("cxf:bean:noWsrmServerEndpoint")
+                .process("responseProcessorWsrm")
+                .process(e -> results.add(e.getIn().getBody(String.class)));
+
+    }
+
+    @Produces
+    @ApplicationScoped
+    @Named("noWsrmClientEndpoint")
+    CxfEndpoint noWwsrmClientEndpoint() {
+        final CxfEndpoint cxfEndpoint = new CxfEndpoint();
+        cxfEndpoint.getFeatures().add(loggingFeature);
+        cxfEndpoint.setServiceClass(GreeterService.class);
+        cxfEndpoint.setAddress("/nowsrm/RouterPort");
+        cxfEndpoint.getFeatures().add(new org.apache.cxf.ws.addressing.WSAddressingFeature());
+        //simulate lost messages
+        cxfEndpoint.getOutInterceptors().add(new MessageLossSimulator());
+        return cxfEndpoint;
+    }
+
+    @Produces
+    @ApplicationScoped
+    @Named("wsrmClientEndpoint")
+    CxfEndpoint wsrmClientEndpoint() {
+        CxfEndpoint cxfEndpoint = noWwsrmClientEndpoint();
+        cxfEndpoint.setAddress("/wsrm/RouterPort");
+
+        addWsRmFeature(cxfEndpoint);
+
+        return cxfEndpoint;
+    }
+
+    @Produces
+    @ApplicationScoped
+    @Named("noWsrmServerEndpoint")
+    CxfEndpoint noWsrmServerEndpoint() {
+
+        CxfEndpoint cxfEndpoint = new CxfEndpoint();
+        cxfEndpoint.setServiceClass(GreeterService.class);
+        cxfEndpoint.getFeatures().add(loggingFeature);
+        cxfEndpoint.setAddress("/noWsrm/RouterPort");
+        cxfEndpoint.getInInterceptors().add(new org.apache.cxf.ext.logging.LoggingInInterceptor());
+        cxfEndpoint.getOutInterceptors().add(new org.apache.cxf.ext.logging.LoggingOutInterceptor());
+        cxfEndpoint.getFeatures().add(new org.apache.cxf.ws.addressing.WSAddressingFeature());
+
+        return cxfEndpoint;
+    }
+
+    @Produces
+    @ApplicationScoped
+    @Named("wsrmServerEndpoint")
+    CxfEndpoint wsrmServerEndpoint() {
+
+        CxfEndpoint cxfEndpoint = noWsrmServerEndpoint();
+        cxfEndpoint.setAddress("/wsrm/RouterPort");
+        addWsRmFeature(cxfEndpoint);
+
+        return cxfEndpoint;
+    }
+
+    @Produces
+    @ApplicationScoped
+    @Named("greeterService<Wsrm")

Review Comment:
   ```suggestion
       @Named("greeterServiceWsrm")  
   ```
   
   Typo?



##########
integration-test-groups/cxf-soap/cxf-soap-ws-rm/src/main/java/org/apache/camel/quarkus/component/cxf/soap/wsrm/it/MessageLossSimulator.java:
##########
@@ -0,0 +1,112 @@
+/*
+ * 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.wsrm.it;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.ListIterator;
+
+import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.interceptor.InterceptorChain;
+import org.apache.cxf.interceptor.MessageSenderInterceptor;
+import org.apache.cxf.io.AbstractWrappedOutputStream;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.phase.AbstractPhaseInterceptor;
+import org.apache.cxf.phase.PhaseInterceptor;
+import org.apache.cxf.ws.rm.RMContextUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class MessageLossSimulator extends AbstractPhaseInterceptor<Message> {
+    private static final Logger LOG = LoggerFactory.getLogger(MessageLossSimulator.class.getName());
+    private int appMessageCount;
+
+    public MessageLossSimulator() {
+        super("prepare-send");
+        this.addBefore(MessageSenderInterceptor.class.getName());
+    }
+
+    private static String getAction(Object map) {
+        if (map == null) {
+            return null;
+        } else {
+            try {
+                Object o = map.getClass().getMethod("getAction").invoke(map);
+                return (String) o.getClass().getMethod("getValue").invoke(o);
+            } catch (Throwable var2) {
+                throw new Fault(var2);
+            }
+        }
+    }
+
+    public void handleMessage(Message message) throws Fault {
+        Object maps = RMContextUtils.retrieveMAPs(message, false, true);
+        String action = getAction(maps);
+        if (!RMContextUtils.isRMProtocolMessage(action)) {
+            ++this.appMessageCount;
+            if (0 == this.appMessageCount % 2) {

Review Comment:
   This can be called concurrently. You should either synchronize or use `AtomicInteger` instead of `int`.



##########
integration-test-groups/cxf-soap/cxf-soap-ws-rm/src/main/java/org/apache/camel/quarkus/component/cxf/soap/wsrm/it/CxfSoapWsrmResource.java:
##########
@@ -0,0 +1,72 @@
+/*
+ * 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.wsrm.it;
+
+import java.net.URI;
+import java.util.LinkedList;
+
+import jakarta.enterprise.context.ApplicationScoped;
+import jakarta.inject.Inject;
+import jakarta.inject.Named;
+import jakarta.ws.rs.Consumes;
+import jakarta.ws.rs.GET;
+import jakarta.ws.rs.POST;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.Produces;
+import jakarta.ws.rs.core.MediaType;
+import jakarta.ws.rs.core.Response;
+import org.apache.camel.ProducerTemplate;
+
+@Path("/cxf-soap")
+@ApplicationScoped
+public class CxfSoapWsrmResource {
+
+    @Inject
+    ProducerTemplate producerTemplate;
+
+    @Inject
+    @Named("results")
+    LinkedList<String> results;
+
+    @Path("/wsrm")
+    @POST
+    @Consumes(MediaType.WILDCARD)
+    @Produces(MediaType.TEXT_PLAIN)
+    public Response wsrm(String msg) throws Exception {
+        String response = producerTemplate.requestBodyAndHeader("seda:rswmInvoker", msg, "enableWsrm", true,
+                String.class);
+
+        return Response
+                .created(new URI("https://camel.apache.org/"))
+                .entity(response)
+                .build();
+    }
+
+    @Path("/noWsrm")
+    @POST
+    @Consumes(MediaType.WILDCARD)
+    @Produces(MediaType.TEXT_PLAIN)
+    public void noWsrm(String msg) throws Exception {
+        producerTemplate.sendBodyAndHeader("seda:rswmInvoker", msg, "enableWsrm", false);
+    }
+
+    @Path("/noWsrm")
+    @GET
+    public String noWsrm() throws Exception {
+        return results.isEmpty() ? null : results.getLast();

Review Comment:
   The list can be read/written concurrently. With the current solution it is actually possible to read the second event before the first. 
   I'd vote for using `ConcurrentLinkedDeque` as a FIFO queue - i.e. here you'd use the `poll()` method instead of `getLast()` without having to test `isEmpty()`. You can keep using `add()` in Camel routes.



##########
integration-test-groups/cxf-soap/cxf-soap-ws-rm/src/test/java/org/apache/camel/quarkus/component/cxf/soap/wsrm/it/CxfSoapWsrmTest.java:
##########
@@ -0,0 +1,89 @@
+/*
+ * 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.wsrm.it;
+
+import java.util.concurrent.TimeUnit;
+
+import io.quarkus.test.junit.DisabledOnIntegrationTest;
+import io.quarkus.test.junit.QuarkusTest;
+import io.quarkus.test.junit.QuarkusTestProfile;
+import io.quarkus.test.junit.TestProfile;
+import io.restassured.RestAssured;
+import org.awaitility.Awaitility;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.Matchers.equalTo;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.not;
+
+@QuarkusTest
+@TestProfile(CxfSoapWsrmTest.class)
+public class CxfSoapWsrmTest implements QuarkusTestProfile {
+
+    // Test is ported from WSRMTest in Camel-spring-boot/components-starter/camel-cxf-soap-starter
+    @Test
+    @DisabledOnIntegrationTest // see https://github.com/apache/camel-quarkus/issues/4689
+    public void testWSRM() {
+        RestAssured.given()
+                .body("wsrm1")
+                .post("/cxf-soap/wsrm")
+                .then()
+                .statusCode(201)
+                .body(equalTo("Hello wsrm1!"));
+
+        //second message will be lost (in the first attempt)
+        RestAssured.given()
+                .body("wsrm2")
+                .post("/cxf-soap/wsrm")
+                .then()
+                .statusCode(201)
+                .body(equalTo("Hello wsrm2!"));
+    }

Review Comment:
   I wonder, what we are actually testing in the WSRM scenario? 
   
   I'd say are we making sure that the redelivery works and that the server receives the second message in spite of the first attempt to deliver it failed. How can we be sure that the redelivery takes place? If our MessageLossSimulator is removed by accident or if it does not work as it should, then this test would still pass.
   
   I'd vote for being more paranoid: we should let the MessageLossSimulator add something like `msg + " lost by MessageLossSimulator"` to results and here in the "WSRP on" scenario we should also poll for the content of results. Having that in place, the sequence of messages stored in result would be `Hello wsrm1!`,`wsrm2 lost by MessageLossSimulator`, `Hello wsrm2!`. WDYT?
   



##########
integration-test-groups/cxf-soap/cxf-soap-ws-rm/src/test/java/org/apache/camel/quarkus/component/cxf/soap/wsrm/it/CxfSoapWsrmTest.java:
##########
@@ -0,0 +1,89 @@
+/*
+ * 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.wsrm.it;
+
+import java.util.concurrent.TimeUnit;
+
+import io.quarkus.test.junit.DisabledOnIntegrationTest;
+import io.quarkus.test.junit.QuarkusTest;
+import io.quarkus.test.junit.QuarkusTestProfile;
+import io.quarkus.test.junit.TestProfile;
+import io.restassured.RestAssured;
+import org.awaitility.Awaitility;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.Matchers.equalTo;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.not;
+
+@QuarkusTest
+@TestProfile(CxfSoapWsrmTest.class)
+public class CxfSoapWsrmTest implements QuarkusTestProfile {
+
+    // Test is ported from WSRMTest in Camel-spring-boot/components-starter/camel-cxf-soap-starter
+    @Test
+    @DisabledOnIntegrationTest // see https://github.com/apache/camel-quarkus/issues/4689
+    public void testWSRM() {
+        RestAssured.given()
+                .body("wsrm1")
+                .post("/cxf-soap/wsrm")
+                .then()
+                .statusCode(201)
+                .body(equalTo("Hello wsrm1!"));
+
+        //second message will be lost (in the first attempt)
+        RestAssured.given()
+                .body("wsrm2")
+                .post("/cxf-soap/wsrm")
+                .then()
+                .statusCode(201)
+                .body(equalTo("Hello wsrm2!"));
+    }
+
+    @Test
+    @DisabledOnIntegrationTest // see https://github.com/apache/camel-quarkus/issues/4689
+    public void testNoWSRM() throws InterruptedException {
+        RestAssured.given()
+                .body("noWsrm1")
+                .post("/cxf-soap/noWsrm")
+                .then()
+                .statusCode(204);
+
+        Awaitility.await().pollInterval(50, TimeUnit.MILLISECONDS).atMost(10, TimeUnit.SECONDS).until(() -> {
+            String body = RestAssured.get("/cxf-soap/noWsrm")
+                    .then()
+                    .extract().asString();
+
+            return "Hello noWsrm1!".equals(body);
+        });
+
+        //second message will be lost (in the first attempt)
+        RestAssured.given()
+                .body("noWsrm2")
+                .post("/cxf-soap/noWsrm")
+                .then()
+                .statusCode(204);
+
+        //wait some time to get result (which should not be there)
+        Thread.sleep(10000);
+
+        RestAssured.get("/cxf-soap/noWsrm")
+                .then()
+                .statusCode(200)
+                .body(not(is("Hello noWsrm2!")));

Review Comment:
   If we use a FIFO queue, then it would be empty at this point. Maybe we could send `noWsrm3`  and make sure that it was caught by results? 



##########
integration-test-groups/cxf-soap/cxf-soap-ws-rm/src/main/java/org/apache/camel/quarkus/component/cxf/soap/wsrm/it/CxfSoapWsrmRoutes.java:
##########
@@ -0,0 +1,187 @@
+/*
+ * 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.wsrm.it;
+
+import java.util.LinkedList;
+import java.util.Map;
+
+import io.quarkus.runtime.LaunchMode;
+import jakarta.enterprise.context.ApplicationScoped;
+import jakarta.enterprise.inject.Produces;
+import jakarta.inject.Inject;
+import jakarta.inject.Named;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.cxf.jaxws.CxfEndpoint;
+import org.apache.cxf.ext.logging.LoggingFeature;
+import org.apache.cxf.ws.rm.manager.AcksPolicyType;
+import org.apache.cxf.ws.rm.manager.DestinationPolicyType;
+import org.apache.cxf.ws.rmp.v200502.RMAssertion;
+import org.eclipse.microprofile.config.Config;
+import org.eclipse.microprofile.config.ConfigProvider;
+
+@ApplicationScoped
+public class CxfSoapWsrmRoutes extends RouteBuilder {
+
+    @Inject
+    @Named("loggingFeatureWsrm")
+    LoggingFeature loggingFeature;
+
+    @Inject
+    @Named("results")
+    LinkedList<String> results;
+
+    @Override
+    public void configure() {
+
+        from("seda:rswmInvoker")

Review Comment:
   Are we using seda in some other Maven module of the cxf-soap group? Otherwise I'd vote for using direct instead of seda to keep the number of dependencies minimal.



##########
integration-test-groups/cxf-soap/cxf-soap-ws-rm/src/test/java/org/apache/camel/quarkus/component/cxf/soap/wsrm/it/CxfSoapWsrmTest.java:
##########
@@ -0,0 +1,89 @@
+/*
+ * 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.wsrm.it;
+
+import java.util.concurrent.TimeUnit;
+
+import io.quarkus.test.junit.DisabledOnIntegrationTest;
+import io.quarkus.test.junit.QuarkusTest;
+import io.quarkus.test.junit.QuarkusTestProfile;
+import io.quarkus.test.junit.TestProfile;
+import io.restassured.RestAssured;
+import org.awaitility.Awaitility;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.Matchers.equalTo;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.not;
+
+@QuarkusTest
+@TestProfile(CxfSoapWsrmTest.class)
+public class CxfSoapWsrmTest implements QuarkusTestProfile {
+
+    // Test is ported from WSRMTest in Camel-spring-boot/components-starter/camel-cxf-soap-starter
+    @Test
+    @DisabledOnIntegrationTest // see https://github.com/apache/camel-quarkus/issues/4689
+    public void testWSRM() {
+        RestAssured.given()
+                .body("wsrm1")
+                .post("/cxf-soap/wsrm")
+                .then()
+                .statusCode(201)
+                .body(equalTo("Hello wsrm1!"));
+
+        //second message will be lost (in the first attempt)
+        RestAssured.given()
+                .body("wsrm2")
+                .post("/cxf-soap/wsrm")
+                .then()
+                .statusCode(201)
+                .body(equalTo("Hello wsrm2!"));
+    }
+
+    @Test
+    @DisabledOnIntegrationTest // see https://github.com/apache/camel-quarkus/issues/4689
+    public void testNoWSRM() throws InterruptedException {
+        RestAssured.given()
+                .body("noWsrm1")
+                .post("/cxf-soap/noWsrm")
+                .then()
+                .statusCode(204);
+
+        Awaitility.await().pollInterval(50, TimeUnit.MILLISECONDS).atMost(10, TimeUnit.SECONDS).until(() -> {
+            String body = RestAssured.get("/cxf-soap/noWsrm")
+                    .then()
+                    .extract().asString();
+
+            return "Hello noWsrm1!".equals(body);
+        });
+
+        //second message will be lost (in the first attempt)
+        RestAssured.given()
+                .body("noWsrm2")
+                .post("/cxf-soap/noWsrm")
+                .then()
+                .statusCode(204);
+
+        //wait some time to get result (which should not be there)
+        Thread.sleep(10000);

Review Comment:
   Instead of sleeping for 10 sec we could rather make sure that results contains `noWsrm2 lost by MessageLossSimulator`. 



##########
integration-test-groups/cxf-soap/cxf-soap-ws-rm/src/main/java/org/apache/camel/quarkus/component/cxf/soap/wsrm/it/CxfSoapWsrmRoutes.java:
##########
@@ -0,0 +1,187 @@
+/*
+ * 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.wsrm.it;
+
+import java.util.LinkedList;
+import java.util.Map;
+
+import io.quarkus.runtime.LaunchMode;
+import jakarta.enterprise.context.ApplicationScoped;
+import jakarta.enterprise.inject.Produces;
+import jakarta.inject.Inject;
+import jakarta.inject.Named;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.cxf.jaxws.CxfEndpoint;
+import org.apache.cxf.ext.logging.LoggingFeature;
+import org.apache.cxf.ws.rm.manager.AcksPolicyType;
+import org.apache.cxf.ws.rm.manager.DestinationPolicyType;
+import org.apache.cxf.ws.rmp.v200502.RMAssertion;
+import org.eclipse.microprofile.config.Config;
+import org.eclipse.microprofile.config.ConfigProvider;
+
+@ApplicationScoped
+public class CxfSoapWsrmRoutes extends RouteBuilder {
+
+    @Inject
+    @Named("loggingFeatureWsrm")
+    LoggingFeature loggingFeature;
+
+    @Inject
+    @Named("results")
+    LinkedList<String> results;
+
+    @Override
+    public void configure() {
+
+        from("seda:rswmInvoker")
+                .process(exchange -> {
+                    boolean enableWsrm = exchange.getIn().getHeader("enableWsrm", Boolean.class);
+
+                    Map<String, Object> headers = exchange.getIn().getHeaders();
+                    headers.put("address", getServerUrl() + "/soapservice/" + (enableWsrm ? "wsrm" : "noWsrm") + "/RouterPort");
+
+                    headers.put("endpoint", (enableWsrm ? "wsrm" : "noWsrm") + "ClientEndpoint");
+                })
+                .toD("cxf:bean:${header.endpoint}?address=${header.address}");
+
+        from("cxf:bean:wsrmServerEndpoint")
+                .process("responseProcessorWsrm");
+
+        from("cxf:bean:noWsrmServerEndpoint")
+                .process("responseProcessorWsrm")
+                .process(e -> results.add(e.getIn().getBody(String.class)));
+
+    }
+
+    @Produces
+    @ApplicationScoped
+    @Named("noWsrmClientEndpoint")
+    CxfEndpoint noWwsrmClientEndpoint() {
+        final CxfEndpoint cxfEndpoint = new CxfEndpoint();
+        cxfEndpoint.getFeatures().add(loggingFeature);
+        cxfEndpoint.setServiceClass(GreeterService.class);
+        cxfEndpoint.setAddress("/nowsrm/RouterPort");
+        cxfEndpoint.getFeatures().add(new org.apache.cxf.ws.addressing.WSAddressingFeature());
+        //simulate lost messages
+        cxfEndpoint.getOutInterceptors().add(new MessageLossSimulator());
+        return cxfEndpoint;
+    }
+
+    @Produces
+    @ApplicationScoped
+    @Named("wsrmClientEndpoint")
+    CxfEndpoint wsrmClientEndpoint() {
+        CxfEndpoint cxfEndpoint = noWwsrmClientEndpoint();
+        cxfEndpoint.setAddress("/wsrm/RouterPort");
+
+        addWsRmFeature(cxfEndpoint);
+
+        return cxfEndpoint;
+    }
+
+    @Produces
+    @ApplicationScoped
+    @Named("noWsrmServerEndpoint")
+    CxfEndpoint noWsrmServerEndpoint() {
+
+        CxfEndpoint cxfEndpoint = new CxfEndpoint();
+        cxfEndpoint.setServiceClass(GreeterService.class);
+        cxfEndpoint.getFeatures().add(loggingFeature);
+        cxfEndpoint.setAddress("/noWsrm/RouterPort");
+        cxfEndpoint.getInInterceptors().add(new org.apache.cxf.ext.logging.LoggingInInterceptor());
+        cxfEndpoint.getOutInterceptors().add(new org.apache.cxf.ext.logging.LoggingOutInterceptor());

Review Comment:
   I wonder whether the logging feature added above does anything else than adding these exact two interceptors? I think we can remove these and keep the feature.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org