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-examples.git
commit 74a65080069b0d73f641d20e20d3a63f527dbe70 Author: Aurélien Pupier <[email protected]> AuthorDate: Fri Aug 16 17:52:47 2024 +0200 Fix compilation due to API break on test setup and tearDown method in Camel abstract class Signed-off-by: Aurélien Pupier <[email protected]> --- .../org/apache/camel/example/cafe/CafeRouteSpringTest.java | 14 +++++--------- .../java/org/apache/camel/example/kafka/KafkaTest.java | 6 +++--- .../test/java/org/apache/camel/example/MainHealthTest.java | 8 +++----- 3 files changed, 11 insertions(+), 17 deletions(-) diff --git a/cafe/src/test/java/org/apache/camel/example/cafe/CafeRouteSpringTest.java b/cafe/src/test/java/org/apache/camel/example/cafe/CafeRouteSpringTest.java index c81791d4..3eca8dfd 100644 --- a/cafe/src/test/java/org/apache/camel/example/cafe/CafeRouteSpringTest.java +++ b/cafe/src/test/java/org/apache/camel/example/cafe/CafeRouteSpringTest.java @@ -19,8 +19,6 @@ package org.apache.camel.example.cafe; import org.apache.camel.CamelContext; import org.apache.camel.example.cafe.test.TestDrinkRouter; import org.apache.camel.example.cafe.test.TestWaiter; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; import org.springframework.context.support.AbstractApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; @@ -28,19 +26,17 @@ class CafeRouteSpringTest extends CafeRouteBuilderTest { private AbstractApplicationContext applicationContext; @Override - @BeforeEach - public void setUp() throws Exception { + public void setupResources() throws Exception { applicationContext = new ClassPathXmlApplicationContext("META-INF/camel-routes.xml"); - setUseRouteBuilder(false); - super.setUp(); + testConfigurationBuilder.withUseRouteBuilder(false); + super.setupResources(); waiter = applicationContext.getBean("waiter", TestWaiter.class); driverRouter = applicationContext.getBean("drinkRouter", TestDrinkRouter.class); } @Override - @AfterEach - public void tearDown() throws Exception { - super.tearDown(); + public void cleanupResources() throws Exception { + super.cleanupResources(); if (applicationContext != null) { applicationContext.stop(); } diff --git a/kafka/src/test/java/org/apache/camel/example/kafka/KafkaTest.java b/kafka/src/test/java/org/apache/camel/example/kafka/KafkaTest.java index 70ba2384..c694d0b1 100644 --- a/kafka/src/test/java/org/apache/camel/example/kafka/KafkaTest.java +++ b/kafka/src/test/java/org/apache/camel/example/kafka/KafkaTest.java @@ -57,11 +57,11 @@ class KafkaTest extends CamelTestSupport { return camelContext; } - @BeforeEach - public void setUp() throws Exception { + public void setupResources() throws Exception { // Replace the from endpoint to send messages easily + // still use the deprecated method for now as method is not visible camelContextConfiguration().replaceRouteFromWith("input", "direct:in"); replaceRouteFromWith("input", "direct:in"); - super.setUp(); + super.setupResources(); } @Test diff --git a/main-health/src/test/java/org/apache/camel/example/MainHealthTest.java b/main-health/src/test/java/org/apache/camel/example/MainHealthTest.java index 5025331c..630d703f 100644 --- a/main-health/src/test/java/org/apache/camel/example/MainHealthTest.java +++ b/main-health/src/test/java/org/apache/camel/example/MainHealthTest.java @@ -19,11 +19,9 @@ package org.apache.camel.example; import java.util.Properties; import java.util.concurrent.TimeUnit; -import org.apache.camel.builder.AdviceWith; import org.apache.camel.builder.NotifyBuilder; import org.apache.camel.main.MainConfigurationProperties; import org.apache.camel.test.main.junit5.CamelMainTestSupport; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import static org.apache.camel.util.PropertiesHelper.asProperties; @@ -40,11 +38,11 @@ class MainHealthTest extends CamelMainTestSupport { } @Override - @BeforeEach - public void setUp() throws Exception { + public void setupResources() throws Exception { // Prevent failure by replacing the failing endpoint + // still use the deprecated method for now as method is not visible camelContextConfiguration().replaceRouteFromWith("netty", "direct:foo"); replaceRouteFromWith("netty", "direct:foo"); - super.setUp(); + super.setupResources(); } @Test
