You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2025/02/20 10:53:30 UTC
(camel-spring-boot) branch main updated: Update tests to 4.11 changes (#1375)
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-spring-boot.git
The following commit(s) were added to refs/heads/main by this push:
new d37780ab762 Update tests to 4.11 changes (#1375)
d37780ab762 is described below
commit d37780ab762ea893b36fe8c397061dae98f68d90
Author: Federico Mariani <34...@users.noreply.github.com>
AuthorDate: Thu Feb 20 11:53:25 2025 +0100
Update tests to 4.11 changes (#1375)
---
.../aws2/s3/S3MoveAfterReadConsumerTest.java | 9 +++----
.../HttpComponentTimeoutConverterTest.java | 4 ++-
.../kamelet/springboot/KameletLocationTest.java | 31 ++++++++++++++--------
.../openapi/V3SchemaForComplexTypesRequest.json | 1 -
.../openapi/V3SchemaForComplexTypesResponse.json | 1 -
.../SpringBootPlatformHttpEngineTest.java | 2 +-
6 files changed, 27 insertions(+), 21 deletions(-)
diff --git a/components-starter/camel-aws2-s3-starter/src/test/java/org/apache/camel/component/aws2/s3/S3MoveAfterReadConsumerTest.java b/components-starter/camel-aws2-s3-starter/src/test/java/org/apache/camel/component/aws2/s3/S3MoveAfterReadConsumerTest.java
index f0d2a6c4107..8dc9acbbe8d 100644
--- a/components-starter/camel-aws2-s3-starter/src/test/java/org/apache/camel/component/aws2/s3/S3MoveAfterReadConsumerTest.java
+++ b/components-starter/camel-aws2-s3-starter/src/test/java/org/apache/camel/component/aws2/s3/S3MoveAfterReadConsumerTest.java
@@ -84,12 +84,9 @@ public class S3MoveAfterReadConsumerTest extends BaseS3 {
// wait for finish
Awaitility.await().atMost(10, TimeUnit.SECONDS).until(() -> {
- List<S3Object> results = template.request("direct:listObjects", new Processor() {
- @Override
- public void process(Exchange exchange) {
- exchange.getIn().setHeader(AWS2S3Constants.BUCKET_NAME, "already-read");
- exchange.getIn().setHeader(AWS2S3Constants.S3_OPERATION, AWS2S3Operations.listObjects);
- }
+ List<S3Object> results = template.request("direct:listObjects", exchange -> {
+ exchange.getIn().setHeader(AWS2S3Constants.OVERRIDE_BUCKET_NAME, "already-read");
+ exchange.getIn().setHeader(AWS2S3Constants.S3_OPERATION, AWS2S3Operations.listObjects);
}).getMessage().getBody(List.class);
return results.size() == 3 && "movedPrefixtest.txtmovedSuffix".equals(results.get(0).key());
diff --git a/components-starter/camel-http-starter/src/test/java/org/apache/camel/component/http/springboot/HttpComponentTimeoutConverterTest.java b/components-starter/camel-http-starter/src/test/java/org/apache/camel/component/http/springboot/HttpComponentTimeoutConverterTest.java
index 148ec65b754..8dea7168c86 100644
--- a/components-starter/camel-http-starter/src/test/java/org/apache/camel/component/http/springboot/HttpComponentTimeoutConverterTest.java
+++ b/components-starter/camel-http-starter/src/test/java/org/apache/camel/component/http/springboot/HttpComponentTimeoutConverterTest.java
@@ -65,7 +65,9 @@ class HttpComponentTimeoutConverterTest {
@BeforeAll
public static void setUp() throws Exception {
- localServer = ServerBootstrap.bootstrap().register("/checkSoTimeout", (request, response, ctx) -> {
+ localServer = ServerBootstrap.bootstrap()
+ .setCanonicalHostName("localhost")
+ .register("/checkSoTimeout", (request, response, ctx) -> {
response.setCode(HttpStatus.SC_OK);
assertNotNull(currentContext);
response.setEntity(new StringEntity(
diff --git a/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletLocationTest.java b/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletLocationTest.java
index 48acec53c42..dd495b45c8b 100644
--- a/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletLocationTest.java
+++ b/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletLocationTest.java
@@ -19,8 +19,10 @@ package org.apache.camel.component.kamelet.springboot;
import org.apache.camel.CamelContext;
import org.apache.camel.RoutesBuilder;
import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.spi.CamelContextCustomizer;
import org.apache.camel.spi.Resource;
import org.apache.camel.spi.RoutesBuilderLoader;
+import org.apache.camel.spring.boot.CamelContextConfiguration;
import org.junit.jupiter.api.Test;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.EndpointInject;
@@ -45,12 +47,19 @@ public class KameletLocationTest {
@EndpointInject("mock:result")
MockEndpoint mock;
- @Autowired
- private CamelContext context;
+ @Bean
+ protected CamelContextConfiguration camelContextConfiguration() {
+ return new CamelContextConfiguration() {
+ @Override
+ public void beforeApplicationStart(CamelContext camelContext) {
+ camelContext.getRegistry().bind("routes-builder-loader-xml", new MyRoutesLoader());
+ }
+
+ @Override
+ public void afterApplicationStart(CamelContext camelContext) {
- protected CamelContext createCamelContext() throws Exception {
- context.getRegistry().bind("routes-builder-loader-xml", new MyRoutesLoader());
- return context;
+ }
+ };
}
@Test
@@ -77,14 +86,16 @@ public class KameletLocationTest {
// and use this class that has the route template hardcoded from java
public class MyRoutesLoader implements RoutesBuilderLoader {
+ private CamelContext camelContext;
+
@Override
public CamelContext getCamelContext() {
- return context;
+ return camelContext;
}
@Override
public void setCamelContext(CamelContext camelContext) {
- context = camelContext;
+ this.camelContext = camelContext;
}
@Override
@@ -98,9 +109,6 @@ public class KameletLocationTest {
@Override
public void configure() {
routeTemplate("upper").from("kamelet:source").transform().simple("${body.toUpperCase()}");
-
- from("direct:start").kamelet("upper?location=file:resource:classpath:upper-kamelet.xml")
- .to("mock:result");
}
};
}
@@ -127,7 +135,8 @@ public class KameletLocationTest {
return new RouteBuilder() {
@Override
public void configure() {
- from("direct:start").kamelet("upper?location=file:src/test/resources/upper-kamelet.xml")
+ from("direct:start")
+ .kamelet("upper?location=file:src/test/resources/upper-kamelet.xml")
.to("mock:result");
}
};
diff --git a/components-starter/camel-openapi-java-starter/src/test/resources/org/apache/camel/openapi/V3SchemaForComplexTypesRequest.json b/components-starter/camel-openapi-java-starter/src/test/resources/org/apache/camel/openapi/V3SchemaForComplexTypesRequest.json
index 870499eab05..245ff25c089 100644
--- a/components-starter/camel-openapi-java-starter/src/test/resources/org/apache/camel/openapi/V3SchemaForComplexTypesRequest.json
+++ b/components-starter/camel-openapi-java-starter/src/test/resources/org/apache/camel/openapi/V3SchemaForComplexTypesRequest.json
@@ -9,7 +9,6 @@
"summary" : "Demo complex request type",
"operationId" : "verb",
"requestBody" : {
- "description" : "",
"content" : {
"application/json" : {
"schema" : {
diff --git a/components-starter/camel-openapi-java-starter/src/test/resources/org/apache/camel/openapi/V3SchemaForComplexTypesResponse.json b/components-starter/camel-openapi-java-starter/src/test/resources/org/apache/camel/openapi/V3SchemaForComplexTypesResponse.json
index 66a4e86264e..27cfcb248a1 100644
--- a/components-starter/camel-openapi-java-starter/src/test/resources/org/apache/camel/openapi/V3SchemaForComplexTypesResponse.json
+++ b/components-starter/camel-openapi-java-starter/src/test/resources/org/apache/camel/openapi/V3SchemaForComplexTypesResponse.json
@@ -9,7 +9,6 @@
"summary" : "Demo complex response type",
"operationId" : "verb",
"requestBody" : {
- "description" : "",
"content" : {
"application/json" : {
"schema" : {
diff --git a/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpEngineTest.java b/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpEngineTest.java
index 3a0fd033d5e..09d174efa3c 100644
--- a/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpEngineTest.java
+++ b/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpEngineTest.java
@@ -95,7 +95,7 @@ public class SpringBootPlatformHttpEngineTest {
DataHandler attachment = message.getAttachment(attachmentId);
exchange.getMessage().setHeader("myDataHandler", attachment);
exchange.getMessage().setHeader("singleFileContentType",
- exchange.getIn().getHeader(Exchange.CONTENT_TYPE));
+ exchange.getIn().getHeader(Exchange.FILE_CONTENT_TYPE));
exchange.getMessage().setBody(attachment.getContent());
});