This is an automated email from the ASF dual-hosted git repository.

davsclaus 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 96ab0f2cb69d chore : clean up deprecation warnings in camel-cxf tests, 
mostly doPostSetup/doPostTearDown and URL changes (#21959)
96ab0f2cb69d is described below

commit 96ab0f2cb69dac9b388817d8cc0a2a50a7127585
Author: Tom Cunningham <[email protected]>
AuthorDate: Thu Mar 12 15:17:15 2026 -0400

    chore : clean up deprecation warnings in camel-cxf tests, mostly 
doPostSetup/doPostTearDown and URL changes (#21959)
---
 .../cxf/jaxws/CxfConsumerNamespacePayLoadTest.java          | 13 +++++++------
 .../component/cxf/jaxws/CxfCustomizedExceptionTest.java     |  5 ++---
 .../cxf/jaxws/CxfMultipleConsumersSupportTest.java          |  8 ++++----
 .../cxf/jaxws/CxfPayLoadSoapHeaderViaCamelHeaderTest.java   |  2 +-
 .../cxf/common/message/DefaultCxfMessageMapperTest.java     |  1 -
 .../camel/component/cxf/transport/CamelDestinationTest.java |  3 +--
 .../component/cxf/transport/CamelTransportTestSupport.java  |  4 ++--
 .../cxf/common/message/DefaultCxfMessageMapperTest.java     |  1 -
 .../component/cxf/transport/CamelTransportTestSupport.java  |  4 ++--
 9 files changed, 19 insertions(+), 22 deletions(-)

diff --git 
a/components/camel-cxf/camel-cxf-soap/src/test/java/org/apache/camel/component/cxf/jaxws/CxfConsumerNamespacePayLoadTest.java
 
b/components/camel-cxf/camel-cxf-soap/src/test/java/org/apache/camel/component/cxf/jaxws/CxfConsumerNamespacePayLoadTest.java
index a11b332011fa..30995a034964 100644
--- 
a/components/camel-cxf/camel-cxf-soap/src/test/java/org/apache/camel/component/cxf/jaxws/CxfConsumerNamespacePayLoadTest.java
+++ 
b/components/camel-cxf/camel-cxf-soap/src/test/java/org/apache/camel/component/cxf/jaxws/CxfConsumerNamespacePayLoadTest.java
@@ -18,7 +18,6 @@ package org.apache.camel.component.cxf.jaxws;
 
 import org.apache.hc.client5.http.classic.methods.HttpPost;
 import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
-import org.apache.hc.client5.http.impl.classic.CloseableHttpResponse;
 import org.apache.hc.client5.http.impl.classic.HttpClientBuilder;
 import org.apache.hc.core5.http.ContentType;
 import org.apache.hc.core5.http.io.entity.EntityUtils;
@@ -57,12 +56,14 @@ public class CxfConsumerNamespacePayLoadTest extends 
CxfConsumerPayloadTest {
         StringEntity entity = new StringEntity(ECHO_REQUEST, 
ContentType.create("text/xml", "ISO-8859-1"));
         post.setEntity(entity);
 
-        try (CloseableHttpClient httpclient = 
HttpClientBuilder.create().build();
-             CloseableHttpResponse response = httpclient.execute(post)) {
-            assertEquals(200, response.getCode());
-            String responseBody = EntityUtils.toString(response.getEntity());
+        try (CloseableHttpClient httpclient = 
HttpClientBuilder.create().build()) {
+            httpclient.execute(post, response -> {
+                assertEquals(200, response.getCode());
+                String responseBody = 
EntityUtils.toString(response.getEntity());
 
-            assertEquals(ECHO_RESPONSE, responseBody, "Get a wrong response");
+                assertEquals(ECHO_RESPONSE, responseBody, "Get a wrong 
response");
+                return null;
+            });
         }
 
     }
diff --git 
a/components/camel-cxf/camel-cxf-soap/src/test/java/org/apache/camel/component/cxf/jaxws/CxfCustomizedExceptionTest.java
 
b/components/camel-cxf/camel-cxf-soap/src/test/java/org/apache/camel/component/cxf/jaxws/CxfCustomizedExceptionTest.java
index ebc403c3dbc3..f14df50a16f6 100644
--- 
a/components/camel-cxf/camel-cxf-soap/src/test/java/org/apache/camel/component/cxf/jaxws/CxfCustomizedExceptionTest.java
+++ 
b/components/camel-cxf/camel-cxf-soap/src/test/java/org/apache/camel/component/cxf/jaxws/CxfCustomizedExceptionTest.java
@@ -19,7 +19,7 @@ package org.apache.camel.component.cxf.jaxws;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
-import java.net.URL;
+import java.net.URI;
 import java.net.URLConnection;
 
 import org.w3c.dom.Document;
@@ -151,8 +151,7 @@ public class CxfCustomizedExceptionTest extends 
CamelTestSupport {
 
     @Test
     public void testInvokingServiceFromHTTPURL() throws Exception {
-        URL url = new URL(routerAddress);
-        URLConnection urlConnection = url.openConnection();
+        URLConnection urlConnection = 
URI.create(routerAddress).toURL().openConnection();
         urlConnection.setDoInput(true);
         urlConnection.setDoOutput(true);
         urlConnection.setUseCaches(false);
diff --git 
a/components/camel-cxf/camel-cxf-soap/src/test/java/org/apache/camel/component/cxf/jaxws/CxfMultipleConsumersSupportTest.java
 
b/components/camel-cxf/camel-cxf-soap/src/test/java/org/apache/camel/component/cxf/jaxws/CxfMultipleConsumersSupportTest.java
index 51f0ad0bc9a4..52a952da5bc0 100644
--- 
a/components/camel-cxf/camel-cxf-soap/src/test/java/org/apache/camel/component/cxf/jaxws/CxfMultipleConsumersSupportTest.java
+++ 
b/components/camel-cxf/camel-cxf-soap/src/test/java/org/apache/camel/component/cxf/jaxws/CxfMultipleConsumersSupportTest.java
@@ -40,6 +40,8 @@ public class CxfMultipleConsumersSupportTest extends 
CamelTestSupport {
 
     @Test
     public void testMultipleConsumersNotAllowed() throws Exception {
+        testConfiguration().withUseRouteBuilder(false);
+        context.stop();
         context.addRoutes(new RouteBuilder() {
             @Override
             public void configure() throws Exception {
@@ -58,6 +60,8 @@ public class CxfMultipleConsumersSupportTest extends 
CamelTestSupport {
 
     @Test
     public void testNoMultipleConsumers() throws Exception {
+        testConfiguration().withUseRouteBuilder(false);
+        context.stop();
         context.addRoutes(new RouteBuilder() {
             @Override
             public void configure() throws Exception {
@@ -79,8 +83,4 @@ public class CxfMultipleConsumersSupportTest extends 
CamelTestSupport {
         MockEndpoint.assertIsSatisfied(context);
     }
 
-    @Override
-    public boolean isUseRouteBuilder() {
-        return false;
-    }
 }
diff --git 
a/components/camel-cxf/camel-cxf-soap/src/test/java/org/apache/camel/component/cxf/jaxws/CxfPayLoadSoapHeaderViaCamelHeaderTest.java
 
b/components/camel-cxf/camel-cxf-soap/src/test/java/org/apache/camel/component/cxf/jaxws/CxfPayLoadSoapHeaderViaCamelHeaderTest.java
index ad43d222c9b2..690260284767 100644
--- 
a/components/camel-cxf/camel-cxf-soap/src/test/java/org/apache/camel/component/cxf/jaxws/CxfPayLoadSoapHeaderViaCamelHeaderTest.java
+++ 
b/components/camel-cxf/camel-cxf-soap/src/test/java/org/apache/camel/component/cxf/jaxws/CxfPayLoadSoapHeaderViaCamelHeaderTest.java
@@ -72,7 +72,7 @@ public class CxfPayLoadSoapHeaderViaCamelHeaderTest extends 
CxfPayLoadSoapHeader
                 = "<OrderRequest 
xmlns=\"http://camel.apache.org/pizza/types\";><Toppings><Topping>topping_value</Topping></Toppings></OrderRequest>";
         MockEndpoint mock = getMockEndpoint("mock:end");
         mock.expectedMessageCount(1);
-        sendBody("direct:start", body);
+        template().sendBody("direct:start", body);
         MockEndpoint.assertIsSatisfied(context);
         Document message = 
mock.getExchanges().get(0).getIn().getMandatoryBody(Document.class);
         Element root = message.getDocumentElement();
diff --git 
a/components/camel-cxf/camel-cxf-spring-transport/src/test/java/org/apache/camel/component/cxf/common/message/DefaultCxfMessageMapperTest.java
 
b/components/camel-cxf/camel-cxf-spring-transport/src/test/java/org/apache/camel/component/cxf/common/message/DefaultCxfMessageMapperTest.java
index 1be26e772449..7b2f4821ee2e 100644
--- 
a/components/camel-cxf/camel-cxf-spring-transport/src/test/java/org/apache/camel/component/cxf/common/message/DefaultCxfMessageMapperTest.java
+++ 
b/components/camel-cxf/camel-cxf-spring-transport/src/test/java/org/apache/camel/component/cxf/common/message/DefaultCxfMessageMapperTest.java
@@ -82,7 +82,6 @@ public class DefaultCxfMessageMapperTest {
         Exchange camelExchange = mock(Exchange.class);
         when(camelExchange.getProperty(CamelTransportConstants.CXF_EXCHANGE,
                 org.apache.cxf.message.Exchange.class)).thenReturn(new 
ExchangeImpl());
-        when(camelExchange.hasOut()).thenReturn(false);
         when(camelExchange.getIn()).thenReturn(camelMessage);
         when(camelMessage.getHeaders()).thenReturn(Collections.emptyMap());
         when(camelMessage.getHeader(Exchange.CONTENT_TYPE, 
String.class)).thenReturn(null);
diff --git 
a/components/camel-cxf/camel-cxf-spring-transport/src/test/java/org/apache/camel/component/cxf/transport/CamelDestinationTest.java
 
b/components/camel-cxf/camel-cxf-spring-transport/src/test/java/org/apache/camel/component/cxf/transport/CamelDestinationTest.java
index 1013ca0bf0eb..8389a45f69a4 100644
--- 
a/components/camel-cxf/camel-cxf-spring-transport/src/test/java/org/apache/camel/component/cxf/transport/CamelDestinationTest.java
+++ 
b/components/camel-cxf/camel-cxf-spring-transport/src/test/java/org/apache/camel/component/cxf/transport/CamelDestinationTest.java
@@ -26,7 +26,6 @@ import jakarta.xml.ws.WebServiceException;
 import javax.xml.namespace.QName;
 
 import org.apache.camel.CamelContext;
-import org.apache.camel.NoSuchEndpointException;
 import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.builder.RouteBuilder;
 import 
org.apache.camel.component.cxf.transport.CamelDestination.ConsumerProcessor;
@@ -293,7 +292,7 @@ public class CamelDestinationTest extends 
CamelTransportTestSupport {
 
         Throwable c = ex.getCause();
         assertNotNull(c);
-        assertTrue(c instanceof NoSuchEndpointException);
+        assertTrue(c instanceof IllegalArgumentException);
     }
 
 }
diff --git 
a/components/camel-cxf/camel-cxf-spring-transport/src/test/java/org/apache/camel/component/cxf/transport/CamelTransportTestSupport.java
 
b/components/camel-cxf/camel-cxf-spring-transport/src/test/java/org/apache/camel/component/cxf/transport/CamelTransportTestSupport.java
index ddf07cc81cc6..3f49b02f9538 100644
--- 
a/components/camel-cxf/camel-cxf-spring-transport/src/test/java/org/apache/camel/component/cxf/transport/CamelTransportTestSupport.java
+++ 
b/components/camel-cxf/camel-cxf-spring-transport/src/test/java/org/apache/camel/component/cxf/transport/CamelTransportTestSupport.java
@@ -45,7 +45,7 @@ public abstract class CamelTransportTestSupport extends 
CamelTestSupport {
     protected Message inMessage;
 
     @Override
-    public void doPostSetup() {
+    public void setupResources() {
         BusFactory bf = BusFactory.newInstance();
         //setup the camel transport for the bus
         bus = bf.createBus();
@@ -61,7 +61,7 @@ public abstract class CamelTransportTestSupport extends 
CamelTestSupport {
     }
 
     @Override
-    public void doPostTearDown() {
+    public void cleanupResources() {
         bus.shutdown(true);
     }
 
diff --git 
a/components/camel-cxf/camel-cxf-transport/src/test/java/org/apache/camel/component/cxf/common/message/DefaultCxfMessageMapperTest.java
 
b/components/camel-cxf/camel-cxf-transport/src/test/java/org/apache/camel/component/cxf/common/message/DefaultCxfMessageMapperTest.java
index 1be26e772449..7b2f4821ee2e 100644
--- 
a/components/camel-cxf/camel-cxf-transport/src/test/java/org/apache/camel/component/cxf/common/message/DefaultCxfMessageMapperTest.java
+++ 
b/components/camel-cxf/camel-cxf-transport/src/test/java/org/apache/camel/component/cxf/common/message/DefaultCxfMessageMapperTest.java
@@ -82,7 +82,6 @@ public class DefaultCxfMessageMapperTest {
         Exchange camelExchange = mock(Exchange.class);
         when(camelExchange.getProperty(CamelTransportConstants.CXF_EXCHANGE,
                 org.apache.cxf.message.Exchange.class)).thenReturn(new 
ExchangeImpl());
-        when(camelExchange.hasOut()).thenReturn(false);
         when(camelExchange.getIn()).thenReturn(camelMessage);
         when(camelMessage.getHeaders()).thenReturn(Collections.emptyMap());
         when(camelMessage.getHeader(Exchange.CONTENT_TYPE, 
String.class)).thenReturn(null);
diff --git 
a/components/camel-cxf/camel-cxf-transport/src/test/java/org/apache/camel/component/cxf/transport/CamelTransportTestSupport.java
 
b/components/camel-cxf/camel-cxf-transport/src/test/java/org/apache/camel/component/cxf/transport/CamelTransportTestSupport.java
index 029a1118367a..94791309e327 100644
--- 
a/components/camel-cxf/camel-cxf-transport/src/test/java/org/apache/camel/component/cxf/transport/CamelTransportTestSupport.java
+++ 
b/components/camel-cxf/camel-cxf-transport/src/test/java/org/apache/camel/component/cxf/transport/CamelTransportTestSupport.java
@@ -45,7 +45,7 @@ public abstract class CamelTransportTestSupport extends 
CamelTestSupport {
     protected Message inMessage;
 
     @Override
-    public void doPostSetup() {
+    public void setupResources() {
         BusFactory bf = BusFactory.newInstance();
         //setup the camel transport for the bus
         bus = bf.createBus();
@@ -61,7 +61,7 @@ public abstract class CamelTransportTestSupport extends 
CamelTestSupport {
     }
 
     @Override
-    public void doPostTearDown() throws Exception {
+    public void cleanupResources() throws Exception {
         bus.shutdown(true);
     }
 

Reply via email to