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 5e3e507e00c0 Fix flakiness of CxfMessageHeaderTimeoutTest
5e3e507e00c0 is described below

commit 5e3e507e00c016ca8ba3de1ca85d70b28aa4dce0
Author: AurĂ©lien Pupier <[email protected]>
AuthorDate: Tue Jul 28 14:41:29 2026 +0200

    Fix flakiness of CxfMessageHeaderTimeoutTest
    
    applying same pattern than for CxfTimeOutTest
    
https://github.com/apache/camel/commit/391ff6ce0a38f4cf7b7bafd5d7b8a269ff5f4588
    
https://github.com/apache/camel/commit/2b9bdeddf790b773f831aee25751741f9ff1c095
    
    based on this request on develocity
    
https://develocity.apache.org/scans/tests?search.query=project:camel%20tag:main&search.startTimeMax=1785241434521&search.startTimeMin=1784757600000&search.timeZoneId=Europe%2FParis&tests.container=*cxf*
    , it is the only other which is regularly failing (not just flaky)
    
    Signed-off-by: AurĂ©lien Pupier <[email protected]>
---
 .../camel/component/cxf/CxfMessageHeaderTimeoutTest.java  | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git 
a/components/camel-cxf/camel-cxf-spring-soap/src/test/java/org/apache/camel/component/cxf/CxfMessageHeaderTimeoutTest.java
 
b/components/camel-cxf/camel-cxf-spring-soap/src/test/java/org/apache/camel/component/cxf/CxfMessageHeaderTimeoutTest.java
index 1ffa0bde1dea..4765f89d4787 100644
--- 
a/components/camel-cxf/camel-cxf-spring-soap/src/test/java/org/apache/camel/component/cxf/CxfMessageHeaderTimeoutTest.java
+++ 
b/components/camel-cxf/camel-cxf-spring-soap/src/test/java/org/apache/camel/component/cxf/CxfMessageHeaderTimeoutTest.java
@@ -39,8 +39,8 @@ import org.slf4j.LoggerFactory;
 import org.springframework.context.support.AbstractXmlApplicationContext;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 
+import static org.assertj.core.api.Assertions.assertThat;
 import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertTrue;
 
 public class CxfMessageHeaderTimeoutTest extends CamelSpringTestSupport {
 
@@ -66,8 +66,17 @@ public class CxfMessageHeaderTimeoutTest extends 
CamelSpringTestSupport {
         Exchange reply = sendJaxWsMessage(endpointUri);
         Exception e = reply.getException();
         assertNotNull(e, "We should get the exception cause here");
-        assertTrue(e instanceof HttpTimeoutException,
-                String.format("Expected HttpTimeoutException, but got %s", 
e.getClass().getName()));
+        // CXF may either propagate HttpTimeoutException directly or wrap an 
HttpConnectTimeoutException in a
+        // Fault ("Could not send Message.") depending on where in the 
interceptor
+        // chain the timeout is caught. Both cases indicate the timeout was 
applied
+        // correctly, so check the entire cause chain.
+        assertThat(e).satisfiesAnyOf(
+                ex -> assertThat(ex).isInstanceOf(HttpTimeoutException.class),
+                //TODO: when AssertJ 4 is released, to replace with 
throwableChains() for more precise and robust check
+                ex -> assertThat(ex).hasStackTraceContaining(
+                        "Caused by: java.net.http.HttpConnectTimeoutException: 
HTTP connect timed out"),
+                ex -> assertThat(ex).hasStackTraceContaining(
+                        "Caused by: java.net.http.HttpTimeoutException: 
request timed out"));
     }
 
     protected Exchange sendJaxWsMessage(String endpointUri) throws 
InterruptedException {

Reply via email to