Fix compilation due to API break on test setup and tearDown method in
Camel abstract class
Signed-off-by: Aurélien Pupier <apupier@redhat.com>
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 c81791d..3eca8df 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 @@
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 @@
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 70ba238..c694d0b 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 @@
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 5025331..630d703 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 @@
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 @@
}
@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