Skip to content

Commit bf4a651

Browse files
gnodetclaude
andcommitted
CAMEL-22549: Fix CXF dispatch oneway tests to check absence of response
For oneway operations, no response message is created. The old getOut() created an empty OUT (null body), but getMessage() returns IN (with request body). Check ExchangeHelper.hasResponse() instead of null body assertion. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent dcf0f8f commit bf4a651

2 files changed

Lines changed: 8 additions & 10 deletions

File tree

components/camel-cxf/camel-cxf-spring-soap/src/test/java/org/apache/camel/component/cxf/CxfDispatchMessageTest.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,14 @@
2525
import org.apache.camel.Exchange;
2626
import org.apache.camel.Processor;
2727
import org.apache.camel.component.cxf.common.message.CxfConstants;
28+
import org.apache.camel.support.ExchangeHelper;
2829
import org.junit.jupiter.api.Test;
2930
import org.springframework.context.support.AbstractApplicationContext;
3031
import org.springframework.context.support.ClassPathXmlApplicationContext;
3132

3233
import static org.junit.jupiter.api.Assertions.assertEquals;
34+
import static org.junit.jupiter.api.Assertions.assertFalse;
3335
import static org.junit.jupiter.api.Assertions.assertNotNull;
34-
import static org.junit.jupiter.api.Assertions.assertNull;
3536
import static org.junit.jupiter.api.Assertions.assertTrue;
3637

3738
/**
@@ -63,10 +64,8 @@ public void testDipatchMessageOneway() throws Exception {
6364
Exchange exchange = sendJaxWsDispatchMessage(name, true);
6465
assertEquals(false, exchange.isFailed(), "The request should be handled sucessfully");
6566

66-
org.apache.camel.Message response = exchange.getMessage();
67-
assertNotNull(response, "The response message must not be null");
68-
69-
assertNull(response.getBody(), "The response body must be null");
67+
// Oneway operation should not produce a response
68+
assertFalse(ExchangeHelper.hasResponse(exchange), "The oneway response must not have a response message");
7069
}
7170

7271
protected Exchange sendJaxWsDispatchMessage(final String name, final boolean oneway) {

components/camel-cxf/camel-cxf-spring-soap/src/test/java/org/apache/camel/component/cxf/CxfDispatchPayloadTest.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,15 @@
2828
import org.apache.camel.component.cxf.common.CxfPayload;
2929
import org.apache.camel.component.cxf.common.message.CxfConstants;
3030
import org.apache.camel.component.cxf.converter.CxfPayloadConverter;
31+
import org.apache.camel.support.ExchangeHelper;
3132
import org.apache.cxf.binding.soap.SoapHeader;
3233
import org.junit.jupiter.api.Test;
3334
import org.springframework.context.support.AbstractApplicationContext;
3435
import org.springframework.context.support.ClassPathXmlApplicationContext;
3536

3637
import static org.junit.jupiter.api.Assertions.assertEquals;
38+
import static org.junit.jupiter.api.Assertions.assertFalse;
3739
import static org.junit.jupiter.api.Assertions.assertNotNull;
38-
import static org.junit.jupiter.api.Assertions.assertNull;
3940
import static org.junit.jupiter.api.Assertions.assertTrue;
4041

4142
/**
@@ -67,10 +68,8 @@ public void testDispatchPayloadOneway() throws Exception {
6768
Exchange exchange = sendJaxWsDispatchPayload(name, true);
6869
assertEquals(false, exchange.isFailed(), "The request should be handled sucessfully");
6970

70-
org.apache.camel.Message response = exchange.getMessage();
71-
assertNotNull(response, "The response must not be null");
72-
73-
assertNull(response.getBody(), "The response must be null");
71+
// Oneway operation should not produce a response
72+
assertFalse(ExchangeHelper.hasResponse(exchange), "The oneway response must not have a response message");
7473
}
7574

7675
private Exchange sendJaxWsDispatchPayload(final String name, final boolean oneway) {

0 commit comments

Comments
 (0)