This is an automated email from the ASF dual-hosted git repository.
apupier pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 9235b3ca29fe CAMEL-26777: camel-cxf - fix flaky and slow
FailOverFeatureTest
9235b3ca29fe is described below
commit 9235b3ca29fe8f63a6f5db2f118e145dfed7925f
Author: Aurélien Pupier <[email protected]>
AuthorDate: Thu Nov 12 16:54:23 2026 +0100
CAMEL-26777: camel-cxf - fix flaky and slow FailOverFeatureTest
- Set synchronous=true on the non-existent endpoints to avoid hitting
the CXF-9272 async callback hang on refused connections pending CXF 4.2.5
(aligning with CAMEL-26600 / CAMEL-26696).
- Configure an explicit 5s ConnectionTimeout and ReceiveTimeout on the
CxfProducer endpoint via CxfConfigurer so that dropped/blackholed
packets fail fast and trigger failover to SERVICE_ADDRESS well before
the CxfConsumer 30s continuation timeout expires.
Co-authored-by: IBM Bob 2.2.1 <[email protected]>
Signed-off-by: Aurélien Pupier <[email protected]>
---
.../component/cxf/jaxws/FailOverFeatureTest.java | 29 +++++++++++++++++++---
1 file changed, 26 insertions(+), 3 deletions(-)
diff --git
a/components/camel-cxf/camel-cxf-soap/src/test/java/org/apache/camel/component/cxf/jaxws/FailOverFeatureTest.java
b/components/camel-cxf/camel-cxf-soap/src/test/java/org/apache/camel/component/cxf/jaxws/FailOverFeatureTest.java
index 3484e3ee2bfc..31916931d074 100644
---
a/components/camel-cxf/camel-cxf-soap/src/test/java/org/apache/camel/component/cxf/jaxws/FailOverFeatureTest.java
+++
b/components/camel-cxf/camel-cxf-soap/src/test/java/org/apache/camel/component/cxf/jaxws/FailOverFeatureTest.java
@@ -24,9 +24,13 @@ import org.apache.camel.impl.DefaultCamelContext;
import org.apache.camel.test.AvailablePortFinder;
import org.apache.cxf.clustering.FailoverFeature;
import org.apache.cxf.clustering.RandomStrategy;
+import org.apache.cxf.endpoint.Client;
import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory;
import org.apache.cxf.frontend.ClientProxyFactoryBean;
import org.apache.cxf.frontend.ServerFactoryBean;
+import org.apache.cxf.transport.http.HTTPConduit;
+import org.apache.cxf.transports.http.configuration.HTTPClientPolicy;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
@@ -132,9 +136,9 @@ public class FailOverFeatureTest {
+ "&dataFormat=PAYLOAD";
// use a non-exists address to trigger fail-over
- // another problem is: if synchronous=false fail-over will not happen
+ // synchronous=true guards against CXF-9272 async callback hang on
refused connections (CAMEL-26600, CAMEL-26696)
String real = "cxf://" + NONE_EXIST_ADDRESS + "?wsdlURL=" +
SERVICE_ADDRESS + "?wsdl"
- + "&dataFormat=PAYLOAD";
+ + "&dataFormat=PAYLOAD&synchronous=true";
context1 = new DefaultCamelContext();
startRoute(context1, proxy, real);
@@ -146,8 +150,9 @@ public class FailOverFeatureTest {
+ "&dataFormat=POJO";
// use a non-exists address to trigger fail-over
+ // synchronous=true guards against CXF-9272 async callback hang on
refused connections (CAMEL-26600, CAMEL-26696)
String real = "cxf://" + NONE_EXIST_ADDRESS + "?serviceClass=" +
"org.apache.camel.component.cxf.jaxws.HelloService"
- + "&dataFormat=POJO";
+ + "&dataFormat=POJO&synchronous=true";
context2 = new DefaultCamelContext();
startRoute(context2, proxy, real);
@@ -170,6 +175,24 @@ public class FailOverFeatureTest {
CxfEndpoint endpoint = (CxfEndpoint) (ctx.getEndpoint(real));
endpoint.getFeatures().add(ff);
+ endpoint.setCxfConfigurer(new CxfConfigurer() {
+ @Override
+ public void configure(AbstractWSDLBasedEndpointFactory
factoryBean) {
+ }
+
+ @Override
+ public void configureClient(Client client) {
+ HTTPConduit conduit = (HTTPConduit)
client.getConduit();
+ HTTPClientPolicy policy = new HTTPClientPolicy();
+ policy.setConnectionTimeout(5000);
+ policy.setReceiveTimeout(5000);
+ conduit.setClient(policy);
+ }
+
+ @Override
+ public void configureServer(Server server) {
+ }
+ });
from(proxy).to(endpoint);
}