diff --git a/messaging-modules/pom.xml b/messaging-modules/pom.xml index f843b0fe11..8bda46f5cd 100644 --- a/messaging-modules/pom.xml +++ b/messaging-modules/pom.xml @@ -18,7 +18,6 @@ jgroups rabbitmq spring-amqp - spring-apache-camel spring-jms diff --git a/messaging-modules/spring-apache-camel/.gitignore b/messaging-modules/spring-apache-camel/.gitignore index eac473ac50..f137d908d6 100644 --- a/messaging-modules/spring-apache-camel/.gitignore +++ b/messaging-modules/spring-apache-camel/.gitignore @@ -1 +1,2 @@ -/src/test/destination-folder/* \ No newline at end of file +/src/test/destination-folder/* +/output/ \ No newline at end of file diff --git a/messaging-modules/spring-apache-camel/README.md b/messaging-modules/spring-apache-camel/README.md index 6a16e1da05..535c61cbef 100644 --- a/messaging-modules/spring-apache-camel/README.md +++ b/messaging-modules/spring-apache-camel/README.md @@ -4,17 +4,19 @@ This module contains articles about Spring with Apache Camel ### Relevant Articles -- [Apache Camel](http://camel.apache.org/) -- [Enterprise Integration Patterns](http://www.enterpriseintegrationpatterns.com/patterns/messaging/toc.html) - [Introduction To Apache Camel](http://www.baeldung.com/apache-camel-intro) - [Integration Patterns With Apache Camel](http://www.baeldung.com/camel-integration-patterns) - [Using Apache Camel with Spring](http://www.baeldung.com/spring-apache-camel-tutorial) - [Unmarshalling a JSON Array Using camel-jackson](https://www.baeldung.com/java-camel-jackson-json-array) +- [Apache Camel with Spring Boot](https://www.baeldung.com/apache-camel-spring-boot) +- [Apache Camel Routes Testing in Spring Boot](https://www.baeldung.com/spring-boot-apache-camel-routes-testing) +- [Apache Camel Conditional Routing](https://www.baeldung.com/spring-apache-camel-conditional-routing) +- [Apache Camel Exception Handling](https://www.baeldung.com/java-apache-camel-exception-handling) ### Framework Versions: -- Spring 4.2.4 -- Apache Camel 2.16.1 +- Spring 5.3.25 +- Apache Camel 3.14.7 ### Build and Run Application diff --git a/messaging-modules/spring-apache-camel/pom.xml b/messaging-modules/spring-apache-camel/pom.xml index 9f2e74dc36..ec7557666c 100644 --- a/messaging-modules/spring-apache-camel/pom.xml +++ b/messaging-modules/spring-apache-camel/pom.xml @@ -58,11 +58,67 @@ ${env.camel.version} test + + org.apache.camel.springboot + camel-servlet-starter + ${camel.version} + + + org.apache.camel.springboot + camel-jackson-starter + ${camel.version} + + + org.apache.camel.springboot + camel-swagger-java-starter + ${camel.version} + + + org.apache.camel.springboot + camel-spring-boot-starter + ${camel.version} + + + org.springframework.boot + spring-boot-starter-web + + + org.apache.camel + camel-test-spring-junit5 + ${camel.version} + test + - 2.18.1 - 4.3.4.RELEASE + 3.14.7 + 5.3.25 + 3.15.0 + + + spring-boot + + spring-boot:run + + + org.springframework.boot + spring-boot-maven-plugin + + + + repackage + + + com.baeldung.camel.boot.boot.testing.GreetingsFileSpringApplication + + + + + + + + + \ No newline at end of file diff --git a/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/file/ContentBasedFileRouter.java b/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/apache/file/ContentBasedFileRouter.java similarity index 94% rename from messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/file/ContentBasedFileRouter.java rename to messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/apache/file/ContentBasedFileRouter.java index 9106e996c3..2a3f7e5c7b 100644 --- a/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/file/ContentBasedFileRouter.java +++ b/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/apache/file/ContentBasedFileRouter.java @@ -1,4 +1,4 @@ -package com.baeldung.camel.file; +package com.baeldung.camel.apache.file; import org.apache.camel.builder.RouteBuilder; diff --git a/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/file/DeadLetterChannelFileRouter.java b/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/apache/file/DeadLetterChannelFileRouter.java similarity index 94% rename from messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/file/DeadLetterChannelFileRouter.java rename to messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/apache/file/DeadLetterChannelFileRouter.java index fdcad99f02..37a81af458 100644 --- a/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/file/DeadLetterChannelFileRouter.java +++ b/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/apache/file/DeadLetterChannelFileRouter.java @@ -1,4 +1,4 @@ -package com.baeldung.camel.file; +package com.baeldung.camel.apache.file; import org.apache.camel.LoggingLevel; import org.apache.camel.builder.RouteBuilder; diff --git a/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/file/FileProcessor.java b/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/apache/file/FileProcessor.java similarity index 93% rename from messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/file/FileProcessor.java rename to messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/apache/file/FileProcessor.java index 1ea2cad188..ce4d92e8ab 100644 --- a/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/file/FileProcessor.java +++ b/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/apache/file/FileProcessor.java @@ -1,4 +1,4 @@ -package com.baeldung.camel.file; +package com.baeldung.camel.apache.file; import java.text.SimpleDateFormat; import java.util.Date; diff --git a/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/file/FileRouter.java b/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/apache/file/FileRouter.java similarity index 91% rename from messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/file/FileRouter.java rename to messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/apache/file/FileRouter.java index 5216c9a595..760f37677b 100644 --- a/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/file/FileRouter.java +++ b/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/apache/file/FileRouter.java @@ -1,4 +1,4 @@ -package com.baeldung.camel.file; +package com.baeldung.camel.apache.file; import org.apache.camel.builder.RouteBuilder; diff --git a/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/file/MessageTranslatorFileRouter.java b/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/apache/file/MessageTranslatorFileRouter.java similarity index 92% rename from messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/file/MessageTranslatorFileRouter.java rename to messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/apache/file/MessageTranslatorFileRouter.java index b99de99dac..5e65c24c40 100644 --- a/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/file/MessageTranslatorFileRouter.java +++ b/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/apache/file/MessageTranslatorFileRouter.java @@ -1,4 +1,4 @@ -package com.baeldung.camel.file; +package com.baeldung.camel.apache.file; import org.apache.camel.Exchange; import org.apache.camel.builder.RouteBuilder; diff --git a/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/file/MulticastFileRouter.java b/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/apache/file/MulticastFileRouter.java similarity index 95% rename from messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/file/MulticastFileRouter.java rename to messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/apache/file/MulticastFileRouter.java index 75a6e81d45..6f6aad177d 100644 --- a/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/file/MulticastFileRouter.java +++ b/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/apache/file/MulticastFileRouter.java @@ -1,4 +1,4 @@ -package com.baeldung.camel.file; +package com.baeldung.camel.apache.file; import org.apache.camel.builder.RouteBuilder; diff --git a/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/file/SplitterFileRouter.java b/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/apache/file/SplitterFileRouter.java similarity index 93% rename from messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/file/SplitterFileRouter.java rename to messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/apache/file/SplitterFileRouter.java index 551f9c9685..471dfa7a46 100644 --- a/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/file/SplitterFileRouter.java +++ b/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/apache/file/SplitterFileRouter.java @@ -1,4 +1,4 @@ -package com.baeldung.camel.file; +package com.baeldung.camel.apache.file; import org.apache.camel.Exchange; import org.apache.camel.builder.RouteBuilder; diff --git a/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/file/cfg/ContentBasedFileRouterConfig.java b/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/apache/file/cfg/ContentBasedFileRouterConfig.java similarity index 84% rename from messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/file/cfg/ContentBasedFileRouterConfig.java rename to messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/apache/file/cfg/ContentBasedFileRouterConfig.java index ceb68dfa3b..2b24cf2a51 100644 --- a/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/file/cfg/ContentBasedFileRouterConfig.java +++ b/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/apache/file/cfg/ContentBasedFileRouterConfig.java @@ -1,4 +1,4 @@ -package com.baeldung.camel.file.cfg; +package com.baeldung.camel.apache.file.cfg; import java.util.Arrays; import java.util.List; @@ -8,7 +8,7 @@ import org.apache.camel.spring.javaconfig.CamelConfiguration; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import com.baeldung.camel.file.ContentBasedFileRouter; +import com.baeldung.camel.apache.file.ContentBasedFileRouter; @Configuration public class ContentBasedFileRouterConfig extends CamelConfiguration { diff --git a/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/jackson/Fruit.java b/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/apache/jackson/Fruit.java similarity index 87% rename from messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/jackson/Fruit.java rename to messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/apache/jackson/Fruit.java index 1932131ddd..d46eb0afd5 100644 --- a/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/jackson/Fruit.java +++ b/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/apache/jackson/Fruit.java @@ -1,4 +1,4 @@ -package com.baeldung.camel.jackson; +package com.baeldung.camel.apache.jackson; public class Fruit { diff --git a/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/jackson/FruitList.java b/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/apache/jackson/FruitList.java similarity index 84% rename from messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/jackson/FruitList.java rename to messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/apache/jackson/FruitList.java index 02f2b6feb0..f8678c6a1e 100644 --- a/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/jackson/FruitList.java +++ b/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/apache/jackson/FruitList.java @@ -1,4 +1,4 @@ -package com.baeldung.camel.jackson; +package com.baeldung.camel.apache.jackson; import java.util.List; diff --git a/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/main/App.java b/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/apache/main/App.java similarity index 91% rename from messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/main/App.java rename to messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/apache/main/App.java index ac0605a215..6071db0580 100644 --- a/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/main/App.java +++ b/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/apache/main/App.java @@ -1,4 +1,4 @@ -package com.baeldung.camel.main; +package com.baeldung.camel.apache.main; import org.springframework.context.support.ClassPathXmlApplicationContext; diff --git a/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/processor/FileProcessor.java b/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/apache/processor/FileProcessor.java similarity index 89% rename from messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/processor/FileProcessor.java rename to messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/apache/processor/FileProcessor.java index 971dd206cd..5ca61a382a 100644 --- a/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/processor/FileProcessor.java +++ b/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/apache/processor/FileProcessor.java @@ -1,4 +1,4 @@ -package com.baeldung.camel.processor; +package com.baeldung.camel.apache.processor; import org.apache.camel.Exchange; import org.apache.camel.Processor; diff --git a/spring-boot-modules/spring-boot-camel/src/main/java/com/baeldung/camel/Application.java b/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/boot/Application.java similarity index 97% rename from spring-boot-modules/spring-boot-camel/src/main/java/com/baeldung/camel/Application.java rename to messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/boot/Application.java index 48294e9c56..797ad57202 100644 --- a/spring-boot-modules/spring-boot-camel/src/main/java/com/baeldung/camel/Application.java +++ b/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/boot/Application.java @@ -1,4 +1,4 @@ -package com.baeldung.camel; +package com.baeldung.camel.boot; import javax.ws.rs.core.MediaType; @@ -22,7 +22,7 @@ import org.springframework.context.annotation.ComponentScan; import org.springframework.stereotype.Component; @SpringBootApplication(exclude = { WebSocketServletAutoConfiguration.class, AopAutoConfiguration.class, OAuth2ResourceServerAutoConfiguration.class, EmbeddedWebServerFactoryCustomizerAutoConfiguration.class }) -@ComponentScan(basePackages = "com.baeldung.camel") +@ComponentScan(basePackages = "com.baeldung.camel.boot") public class Application { @Value("${server.port}") diff --git a/spring-boot-modules/spring-boot-camel/src/main/java/com/baeldung/camel/ExampleServices.java b/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/boot/ExampleServices.java similarity index 90% rename from spring-boot-modules/spring-boot-camel/src/main/java/com/baeldung/camel/ExampleServices.java rename to messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/boot/ExampleServices.java index ec8f368e68..6fe5a1ed32 100644 --- a/spring-boot-modules/spring-boot-camel/src/main/java/com/baeldung/camel/ExampleServices.java +++ b/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/boot/ExampleServices.java @@ -1,4 +1,4 @@ -package com.baeldung.camel; +package com.baeldung.camel.boot; /** * a Mock class to show how some other layer diff --git a/spring-boot-modules/spring-boot-camel/src/main/java/com/baeldung/camel/MyBean.java b/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/boot/MyBean.java similarity index 90% rename from spring-boot-modules/spring-boot-camel/src/main/java/com/baeldung/camel/MyBean.java rename to messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/boot/MyBean.java index 5368e40c93..759fb06459 100644 --- a/spring-boot-modules/spring-boot-camel/src/main/java/com/baeldung/camel/MyBean.java +++ b/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/boot/MyBean.java @@ -1,4 +1,4 @@ -package com.baeldung.camel; +package com.baeldung.camel.boot; public class MyBean { private Integer id; diff --git a/spring-boot-modules/spring-boot-camel/src/main/java/com/baeldung/camel/boot/testing/GreetingsFileRouter.java b/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/boot/boot/testing/GreetingsFileRouter.java similarity index 89% rename from spring-boot-modules/spring-boot-camel/src/main/java/com/baeldung/camel/boot/testing/GreetingsFileRouter.java rename to messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/boot/boot/testing/GreetingsFileRouter.java index 670af5e08c..381a0a61a5 100644 --- a/spring-boot-modules/spring-boot-camel/src/main/java/com/baeldung/camel/boot/testing/GreetingsFileRouter.java +++ b/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/boot/boot/testing/GreetingsFileRouter.java @@ -1,4 +1,4 @@ -package com.baeldung.camel.boot.testing; +package com.baeldung.camel.boot.boot.testing; import org.apache.camel.builder.RouteBuilder; import org.springframework.stereotype.Component; diff --git a/spring-boot-modules/spring-boot-camel/src/main/java/com/baeldung/camel/boot/testing/GreetingsFileSpringApplication.java b/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/boot/boot/testing/GreetingsFileSpringApplication.java similarity index 87% rename from spring-boot-modules/spring-boot-camel/src/main/java/com/baeldung/camel/boot/testing/GreetingsFileSpringApplication.java rename to messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/boot/boot/testing/GreetingsFileSpringApplication.java index a4e862e65d..1d20d1977a 100644 --- a/spring-boot-modules/spring-boot-camel/src/main/java/com/baeldung/camel/boot/testing/GreetingsFileSpringApplication.java +++ b/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/boot/boot/testing/GreetingsFileSpringApplication.java @@ -1,4 +1,4 @@ -package com.baeldung.camel.boot.testing; +package com.baeldung.camel.boot.boot.testing; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; diff --git a/spring-boot-modules/spring-boot-camel/src/main/java/com/baeldung/camel/conditional/ConditionalBeanRouter.java b/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/boot/conditional/ConditionalBeanRouter.java similarity index 93% rename from spring-boot-modules/spring-boot-camel/src/main/java/com/baeldung/camel/conditional/ConditionalBeanRouter.java rename to messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/boot/conditional/ConditionalBeanRouter.java index 8a03f6ef18..a747ba1f66 100644 --- a/spring-boot-modules/spring-boot-camel/src/main/java/com/baeldung/camel/conditional/ConditionalBeanRouter.java +++ b/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/boot/conditional/ConditionalBeanRouter.java @@ -1,4 +1,4 @@ -package com.baeldung.camel.conditional; +package com.baeldung.camel.boot.conditional; import org.apache.camel.builder.RouteBuilder; import org.springframework.stereotype.Component; diff --git a/spring-boot-modules/spring-boot-camel/src/main/java/com/baeldung/camel/conditional/ConditionalBodyRouter.java b/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/boot/conditional/ConditionalBodyRouter.java similarity index 93% rename from spring-boot-modules/spring-boot-camel/src/main/java/com/baeldung/camel/conditional/ConditionalBodyRouter.java rename to messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/boot/conditional/ConditionalBodyRouter.java index 99d23c747b..ea4f77cb9a 100644 --- a/spring-boot-modules/spring-boot-camel/src/main/java/com/baeldung/camel/conditional/ConditionalBodyRouter.java +++ b/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/boot/conditional/ConditionalBodyRouter.java @@ -1,4 +1,4 @@ -package com.baeldung.camel.conditional; +package com.baeldung.camel.boot.conditional; import org.apache.camel.builder.RouteBuilder; import org.springframework.stereotype.Component; diff --git a/spring-boot-modules/spring-boot-camel/src/main/java/com/baeldung/camel/conditional/ConditionalHeaderRouter.java b/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/boot/conditional/ConditionalHeaderRouter.java similarity index 93% rename from spring-boot-modules/spring-boot-camel/src/main/java/com/baeldung/camel/conditional/ConditionalHeaderRouter.java rename to messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/boot/conditional/ConditionalHeaderRouter.java index e723f97ef1..93371b06b6 100644 --- a/spring-boot-modules/spring-boot-camel/src/main/java/com/baeldung/camel/conditional/ConditionalHeaderRouter.java +++ b/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/boot/conditional/ConditionalHeaderRouter.java @@ -1,4 +1,4 @@ -package com.baeldung.camel.conditional; +package com.baeldung.camel.boot.conditional; import org.apache.camel.builder.RouteBuilder; import org.springframework.stereotype.Component; diff --git a/spring-boot-modules/spring-boot-camel/src/main/java/com/baeldung/camel/conditional/ConditionalRoutingSpringApplication.java b/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/boot/conditional/ConditionalRoutingSpringApplication.java similarity index 88% rename from spring-boot-modules/spring-boot-camel/src/main/java/com/baeldung/camel/conditional/ConditionalRoutingSpringApplication.java rename to messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/boot/conditional/ConditionalRoutingSpringApplication.java index f20d23068a..f11b4302c7 100644 --- a/spring-boot-modules/spring-boot-camel/src/main/java/com/baeldung/camel/conditional/ConditionalRoutingSpringApplication.java +++ b/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/boot/conditional/ConditionalRoutingSpringApplication.java @@ -1,4 +1,4 @@ -package com.baeldung.camel.conditional; +package com.baeldung.camel.boot.conditional; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; diff --git a/spring-boot-modules/spring-boot-camel/src/main/java/com/baeldung/camel/conditional/FruitBean.java b/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/boot/conditional/FruitBean.java similarity index 84% rename from spring-boot-modules/spring-boot-camel/src/main/java/com/baeldung/camel/conditional/FruitBean.java rename to messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/boot/conditional/FruitBean.java index 080e3393b6..a3481361bd 100644 --- a/spring-boot-modules/spring-boot-camel/src/main/java/com/baeldung/camel/conditional/FruitBean.java +++ b/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/boot/conditional/FruitBean.java @@ -1,4 +1,4 @@ -package com.baeldung.camel.conditional; +package com.baeldung.camel.boot.conditional; import org.apache.camel.Exchange; diff --git a/spring-boot-modules/spring-boot-camel/src/main/java/com/baeldung/camel/exception/ExceptionHandlingSpringApplication.java b/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/boot/exception/ExceptionHandlingSpringApplication.java similarity index 88% rename from spring-boot-modules/spring-boot-camel/src/main/java/com/baeldung/camel/exception/ExceptionHandlingSpringApplication.java rename to messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/boot/exception/ExceptionHandlingSpringApplication.java index df4550d9d5..bfa08a5c7a 100644 --- a/spring-boot-modules/spring-boot-camel/src/main/java/com/baeldung/camel/exception/ExceptionHandlingSpringApplication.java +++ b/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/boot/exception/ExceptionHandlingSpringApplication.java @@ -1,4 +1,4 @@ -package com.baeldung.camel.exception; +package com.baeldung.camel.boot.exception; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; diff --git a/spring-boot-modules/spring-boot-camel/src/main/java/com/baeldung/camel/exception/ExceptionHandlingWithDoTryRoute.java b/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/boot/exception/ExceptionHandlingWithDoTryRoute.java similarity index 94% rename from spring-boot-modules/spring-boot-camel/src/main/java/com/baeldung/camel/exception/ExceptionHandlingWithDoTryRoute.java rename to messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/boot/exception/ExceptionHandlingWithDoTryRoute.java index ce3cfc129b..d4c365d25c 100644 --- a/spring-boot-modules/spring-boot-camel/src/main/java/com/baeldung/camel/exception/ExceptionHandlingWithDoTryRoute.java +++ b/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/boot/exception/ExceptionHandlingWithDoTryRoute.java @@ -1,4 +1,4 @@ -package com.baeldung.camel.exception; +package com.baeldung.camel.boot.exception; import java.io.IOException; diff --git a/spring-boot-modules/spring-boot-camel/src/main/java/com/baeldung/camel/exception/ExceptionHandlingWithExceptionClauseRoute.java b/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/boot/exception/ExceptionHandlingWithExceptionClauseRoute.java similarity index 94% rename from spring-boot-modules/spring-boot-camel/src/main/java/com/baeldung/camel/exception/ExceptionHandlingWithExceptionClauseRoute.java rename to messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/boot/exception/ExceptionHandlingWithExceptionClauseRoute.java index 3a438e2402..e2ee3252de 100644 --- a/spring-boot-modules/spring-boot-camel/src/main/java/com/baeldung/camel/exception/ExceptionHandlingWithExceptionClauseRoute.java +++ b/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/boot/exception/ExceptionHandlingWithExceptionClauseRoute.java @@ -1,4 +1,4 @@ -package com.baeldung.camel.exception; +package com.baeldung.camel.boot.exception; import org.apache.camel.builder.RouteBuilder; import org.springframework.beans.factory.annotation.Autowired; diff --git a/spring-boot-modules/spring-boot-camel/src/main/java/com/baeldung/camel/exception/ExceptionLoggingProcessor.java b/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/boot/exception/ExceptionLoggingProcessor.java similarity index 94% rename from spring-boot-modules/spring-boot-camel/src/main/java/com/baeldung/camel/exception/ExceptionLoggingProcessor.java rename to messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/boot/exception/ExceptionLoggingProcessor.java index 84e4072888..66add64441 100644 --- a/spring-boot-modules/spring-boot-camel/src/main/java/com/baeldung/camel/exception/ExceptionLoggingProcessor.java +++ b/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/boot/exception/ExceptionLoggingProcessor.java @@ -1,4 +1,4 @@ -package com.baeldung.camel.exception; +package com.baeldung.camel.boot.exception; import java.util.Map; diff --git a/spring-boot-modules/spring-boot-camel/src/main/java/com/baeldung/camel/exception/ExceptionThrowingRoute.java b/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/boot/exception/ExceptionThrowingRoute.java similarity index 95% rename from spring-boot-modules/spring-boot-camel/src/main/java/com/baeldung/camel/exception/ExceptionThrowingRoute.java rename to messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/boot/exception/ExceptionThrowingRoute.java index 752aabaf1a..bf4d464c23 100644 --- a/spring-boot-modules/spring-boot-camel/src/main/java/com/baeldung/camel/exception/ExceptionThrowingRoute.java +++ b/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/boot/exception/ExceptionThrowingRoute.java @@ -1,4 +1,4 @@ -package com.baeldung.camel.exception; +package com.baeldung.camel.boot.exception; import org.apache.camel.Exchange; import org.apache.camel.Processor; diff --git a/spring-boot-modules/spring-boot-camel/src/main/java/com/baeldung/camel/exception/IllegalArgumentExceptionThrowingProcessor.java b/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/boot/exception/IllegalArgumentExceptionThrowingProcessor.java similarity index 93% rename from spring-boot-modules/spring-boot-camel/src/main/java/com/baeldung/camel/exception/IllegalArgumentExceptionThrowingProcessor.java rename to messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/boot/exception/IllegalArgumentExceptionThrowingProcessor.java index 461a4e6553..db229418d2 100644 --- a/spring-boot-modules/spring-boot-camel/src/main/java/com/baeldung/camel/exception/IllegalArgumentExceptionThrowingProcessor.java +++ b/messaging-modules/spring-apache-camel/src/main/java/com/baeldung/camel/boot/exception/IllegalArgumentExceptionThrowingProcessor.java @@ -1,4 +1,4 @@ -package com.baeldung.camel.exception; +package com.baeldung.camel.boot.exception; import org.apache.camel.Exchange; import org.apache.camel.Processor; diff --git a/spring-boot-modules/spring-boot-camel/src/main/resources/application.properties b/messaging-modules/spring-apache-camel/src/main/resources/application.properties similarity index 100% rename from spring-boot-modules/spring-boot-camel/src/main/resources/application.properties rename to messaging-modules/spring-apache-camel/src/main/resources/application.properties diff --git a/spring-boot-modules/spring-boot-camel/src/main/resources/application.yml b/messaging-modules/spring-apache-camel/src/main/resources/application.yml similarity index 100% rename from spring-boot-modules/spring-boot-camel/src/main/resources/application.yml rename to messaging-modules/spring-apache-camel/src/main/resources/application.yml diff --git a/messaging-modules/spring-apache-camel/src/main/resources/camel-context-ContentBasedFileRouterTest.xml b/messaging-modules/spring-apache-camel/src/main/resources/camel-context-ContentBasedFileRouterTest.xml index d6d3e62f1c..e93b9fb144 100644 --- a/messaging-modules/spring-apache-camel/src/main/resources/camel-context-ContentBasedFileRouterTest.xml +++ b/messaging-modules/spring-apache-camel/src/main/resources/camel-context-ContentBasedFileRouterTest.xml @@ -4,7 +4,7 @@ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd"> - + diff --git a/messaging-modules/spring-apache-camel/src/main/resources/camel-context-DeadLetterChannelFileRouter.xml b/messaging-modules/spring-apache-camel/src/main/resources/camel-context-DeadLetterChannelFileRouter.xml index ef61174b32..b9db0a189f 100644 --- a/messaging-modules/spring-apache-camel/src/main/resources/camel-context-DeadLetterChannelFileRouter.xml +++ b/messaging-modules/spring-apache-camel/src/main/resources/camel-context-DeadLetterChannelFileRouter.xml @@ -4,7 +4,7 @@ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd"> - + diff --git a/messaging-modules/spring-apache-camel/src/main/resources/camel-context-MessageTranslatorFileRouterTest.xml b/messaging-modules/spring-apache-camel/src/main/resources/camel-context-MessageTranslatorFileRouterTest.xml index 7ab988ca8a..fcb9e2b8be 100644 --- a/messaging-modules/spring-apache-camel/src/main/resources/camel-context-MessageTranslatorFileRouterTest.xml +++ b/messaging-modules/spring-apache-camel/src/main/resources/camel-context-MessageTranslatorFileRouterTest.xml @@ -4,7 +4,7 @@ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd"> - + diff --git a/messaging-modules/spring-apache-camel/src/main/resources/camel-context-MulticastFileRouterTest.xml b/messaging-modules/spring-apache-camel/src/main/resources/camel-context-MulticastFileRouterTest.xml index 6f7e7cbb60..73adecbc98 100644 --- a/messaging-modules/spring-apache-camel/src/main/resources/camel-context-MulticastFileRouterTest.xml +++ b/messaging-modules/spring-apache-camel/src/main/resources/camel-context-MulticastFileRouterTest.xml @@ -4,7 +4,7 @@ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd"> - + diff --git a/messaging-modules/spring-apache-camel/src/main/resources/camel-context-SplitterFileRouter.xml b/messaging-modules/spring-apache-camel/src/main/resources/camel-context-SplitterFileRouter.xml index 9d4a890cc6..a2ebe76e63 100644 --- a/messaging-modules/spring-apache-camel/src/main/resources/camel-context-SplitterFileRouter.xml +++ b/messaging-modules/spring-apache-camel/src/main/resources/camel-context-SplitterFileRouter.xml @@ -4,7 +4,7 @@ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd"> - + diff --git a/messaging-modules/spring-apache-camel/src/main/resources/camel-context-test.xml b/messaging-modules/spring-apache-camel/src/main/resources/camel-context-test.xml index e6435db9e5..f306574868 100644 --- a/messaging-modules/spring-apache-camel/src/main/resources/camel-context-test.xml +++ b/messaging-modules/spring-apache-camel/src/main/resources/camel-context-test.xml @@ -4,8 +4,8 @@ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd"> - - + + diff --git a/messaging-modules/spring-apache-camel/src/main/resources/camel-context.xml b/messaging-modules/spring-apache-camel/src/main/resources/camel-context.xml index 63ef406fdf..721ccab95c 100644 --- a/messaging-modules/spring-apache-camel/src/main/resources/camel-context.xml +++ b/messaging-modules/spring-apache-camel/src/main/resources/camel-context.xml @@ -35,5 +35,5 @@ - + \ No newline at end of file diff --git a/messaging-modules/spring-apache-camel/src/test/java/com/baeldung/SpringContextTest.java b/messaging-modules/spring-apache-camel/src/test/java/com/apache/baeldung/SpringContextTest.java similarity index 67% rename from messaging-modules/spring-apache-camel/src/test/java/com/baeldung/SpringContextTest.java rename to messaging-modules/spring-apache-camel/src/test/java/com/apache/baeldung/SpringContextTest.java index 14e7de2095..56969da1d7 100644 --- a/messaging-modules/spring-apache-camel/src/test/java/com/baeldung/SpringContextTest.java +++ b/messaging-modules/spring-apache-camel/src/test/java/com/apache/baeldung/SpringContextTest.java @@ -1,8 +1,8 @@ -package com.baeldung; +package com.apache.baeldung; import org.junit.Test; -import com.baeldung.camel.main.App; +import com.baeldung.camel.apache.main.App; public class SpringContextTest { diff --git a/messaging-modules/spring-apache-camel/src/test/java/com/baeldung/camel/jackson/FruitArrayJacksonUnmarshalUnitTest.java b/messaging-modules/spring-apache-camel/src/test/java/com/apache/baeldung/camel/jackson/FruitArrayJacksonUnmarshalUnitTest.java similarity index 95% rename from messaging-modules/spring-apache-camel/src/test/java/com/baeldung/camel/jackson/FruitArrayJacksonUnmarshalUnitTest.java rename to messaging-modules/spring-apache-camel/src/test/java/com/apache/baeldung/camel/jackson/FruitArrayJacksonUnmarshalUnitTest.java index 4810d7370e..bc0025b263 100644 --- a/messaging-modules/spring-apache-camel/src/test/java/com/baeldung/camel/jackson/FruitArrayJacksonUnmarshalUnitTest.java +++ b/messaging-modules/spring-apache-camel/src/test/java/com/apache/baeldung/camel/jackson/FruitArrayJacksonUnmarshalUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung.camel.jackson; +package com.apache.baeldung.camel.jackson; import java.io.IOException; import java.net.URISyntaxException; @@ -13,6 +13,8 @@ import org.apache.camel.component.mock.MockEndpoint; import org.apache.camel.test.junit4.CamelTestSupport; import org.junit.Test; +import com.baeldung.camel.apache.jackson.Fruit; + public class FruitArrayJacksonUnmarshalUnitTest extends CamelTestSupport { @Test diff --git a/messaging-modules/spring-apache-camel/src/test/java/com/baeldung/camel/jackson/FruitListJacksonUnmarshalUnitTest.java b/messaging-modules/spring-apache-camel/src/test/java/com/apache/baeldung/camel/jackson/FruitListJacksonUnmarshalUnitTest.java similarity index 93% rename from messaging-modules/spring-apache-camel/src/test/java/com/baeldung/camel/jackson/FruitListJacksonUnmarshalUnitTest.java rename to messaging-modules/spring-apache-camel/src/test/java/com/apache/baeldung/camel/jackson/FruitListJacksonUnmarshalUnitTest.java index b5647f02f9..2d15ebf46b 100644 --- a/messaging-modules/spring-apache-camel/src/test/java/com/baeldung/camel/jackson/FruitListJacksonUnmarshalUnitTest.java +++ b/messaging-modules/spring-apache-camel/src/test/java/com/apache/baeldung/camel/jackson/FruitListJacksonUnmarshalUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung.camel.jackson; +package com.apache.baeldung.camel.jackson; import java.io.IOException; import java.net.URISyntaxException; @@ -13,6 +13,9 @@ import org.apache.camel.component.mock.MockEndpoint; import org.apache.camel.test.junit4.CamelTestSupport; import org.junit.Test; +import com.baeldung.camel.apache.jackson.Fruit; +import com.baeldung.camel.apache.jackson.FruitList; + public class FruitListJacksonUnmarshalUnitTest extends CamelTestSupport { @Test diff --git a/messaging-modules/spring-apache-camel/src/test/java/com/apache/camel/file/processor/ContentBasedFileRouterIntegrationTest.java b/messaging-modules/spring-apache-camel/src/test/java/com/apache/camel/file/processor/ContentBasedFileRouterIntegrationTest.java index 23f5787e4e..1fc3ee7515 100644 --- a/messaging-modules/spring-apache-camel/src/test/java/com/apache/camel/file/processor/ContentBasedFileRouterIntegrationTest.java +++ b/messaging-modules/spring-apache-camel/src/test/java/com/apache/camel/file/processor/ContentBasedFileRouterIntegrationTest.java @@ -11,7 +11,7 @@ import org.springframework.context.annotation.AnnotationConfigApplicationContext import org.springframework.context.support.AbstractApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; -import com.baeldung.camel.file.cfg.ContentBasedFileRouterConfig; +import com.baeldung.camel.apache.file.cfg.ContentBasedFileRouterConfig; @RunWith(JUnit4.class) public class ContentBasedFileRouterIntegrationTest { diff --git a/messaging-modules/spring-apache-camel/src/test/java/com/apache/camel/file/processor/FileProcessorIntegrationTest.java b/messaging-modules/spring-apache-camel/src/test/java/com/apache/camel/file/processor/FileProcessorIntegrationTest.java index 1d88e8aeb4..bc5de17537 100644 --- a/messaging-modules/spring-apache-camel/src/test/java/com/apache/camel/file/processor/FileProcessorIntegrationTest.java +++ b/messaging-modules/spring-apache-camel/src/test/java/com/apache/camel/file/processor/FileProcessorIntegrationTest.java @@ -9,7 +9,7 @@ import org.junit.Before; import org.junit.Test; import org.springframework.context.support.ClassPathXmlApplicationContext; -import com.baeldung.camel.file.FileProcessor; +import com.baeldung.camel.apache.file.FileProcessor; public class FileProcessorIntegrationTest { diff --git a/messaging-modules/spring-apache-camel/src/test/java/com/apache/camel/main/AppIntegrationTest.java b/messaging-modules/spring-apache-camel/src/test/java/com/apache/camel/main/AppIntegrationTest.java index b33e6a3b29..cef387dc14 100644 --- a/messaging-modules/spring-apache-camel/src/test/java/com/apache/camel/main/AppIntegrationTest.java +++ b/messaging-modules/spring-apache-camel/src/test/java/com/apache/camel/main/AppIntegrationTest.java @@ -1,6 +1,6 @@ package com.apache.camel.main; -import com.baeldung.camel.main.App; +import com.baeldung.camel.apache.main.App; import junit.framework.TestCase; import org.apache.camel.util.FileUtil; import org.junit.After; diff --git a/spring-boot-modules/spring-boot-camel/src/test/java/com/baeldung/SpringContextTest.java b/messaging-modules/spring-apache-camel/src/test/java/com/boot/SpringContextTest.java similarity index 85% rename from spring-boot-modules/spring-boot-camel/src/test/java/com/baeldung/SpringContextTest.java rename to messaging-modules/spring-apache-camel/src/test/java/com/boot/SpringContextTest.java index ce743e0f77..527877f47e 100644 --- a/spring-boot-modules/spring-boot-camel/src/test/java/com/baeldung/SpringContextTest.java +++ b/messaging-modules/spring-apache-camel/src/test/java/com/boot/SpringContextTest.java @@ -1,11 +1,11 @@ -package com.baeldung; +package com.boot; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; -import com.baeldung.camel.Application; +import com.baeldung.camel.boot.Application; @RunWith(SpringRunner.class) @SpringBootTest(classes = Application.class) diff --git a/spring-boot-modules/spring-boot-camel/src/test/java/com/baeldung/camel/boot/testing/GreetingsFileRouterUnitTest.java b/messaging-modules/spring-apache-camel/src/test/java/com/boot/camel/boot/testing/GreetingsFileRouterUnitTest.java similarity index 71% rename from spring-boot-modules/spring-boot-camel/src/test/java/com/baeldung/camel/boot/testing/GreetingsFileRouterUnitTest.java rename to messaging-modules/spring-apache-camel/src/test/java/com/boot/camel/boot/testing/GreetingsFileRouterUnitTest.java index baeb1fd39c..0f4d71f23b 100644 --- a/spring-boot-modules/spring-boot-camel/src/test/java/com/baeldung/camel/boot/testing/GreetingsFileRouterUnitTest.java +++ b/messaging-modules/spring-apache-camel/src/test/java/com/boot/camel/boot/testing/GreetingsFileRouterUnitTest.java @@ -1,4 +1,6 @@ -package com.baeldung.camel.boot.testing; +package com.boot.camel.boot.testing; + +import static org.springframework.test.annotation.DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD; import org.apache.camel.EndpointInject; import org.apache.camel.ProducerTemplate; @@ -8,10 +10,14 @@ import org.apache.camel.test.spring.junit5.MockEndpoints; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.annotation.DirtiesContext; -@SpringBootTest +import com.baeldung.camel.boot.Application; + +@SpringBootTest(classes = Application.class) @CamelSpringBootTest @MockEndpoints("file:output") +@DirtiesContext(classMode = AFTER_EACH_TEST_METHOD) class GreetingsFileRouterUnitTest { @Autowired @@ -21,6 +27,7 @@ class GreetingsFileRouterUnitTest { private MockEndpoint mock; @Test + @DirtiesContext void whenSendBody_thenGreetingReceivedSuccessfully() throws InterruptedException { mock.expectedBodiesReceived("Hello Baeldung Readers!"); diff --git a/spring-boot-modules/spring-boot-camel/src/test/java/com/baeldung/camel/conditional/ConditionalBeanRouterUnitTest.java b/messaging-modules/spring-apache-camel/src/test/java/com/boot/camel/conditional/ConditionalBeanRouterUnitTest.java similarity index 70% rename from spring-boot-modules/spring-boot-camel/src/test/java/com/baeldung/camel/conditional/ConditionalBeanRouterUnitTest.java rename to messaging-modules/spring-apache-camel/src/test/java/com/boot/camel/conditional/ConditionalBeanRouterUnitTest.java index bba1f21392..46a5bb5eb9 100644 --- a/spring-boot-modules/spring-boot-camel/src/test/java/com/baeldung/camel/conditional/ConditionalBeanRouterUnitTest.java +++ b/messaging-modules/spring-apache-camel/src/test/java/com/boot/camel/conditional/ConditionalBeanRouterUnitTest.java @@ -1,4 +1,6 @@ -package com.baeldung.camel.conditional; +package com.boot.camel.conditional; + +import static org.springframework.test.annotation.DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD; import org.apache.camel.EndpointInject; import org.apache.camel.ProducerTemplate; @@ -7,9 +9,13 @@ import org.apache.camel.test.spring.junit5.CamelSpringBootTest; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.annotation.DirtiesContext; -@SpringBootTest +import com.baeldung.camel.boot.Application; + +@SpringBootTest(classes = Application.class) @CamelSpringBootTest +@DirtiesContext(classMode = AFTER_EACH_TEST_METHOD) class ConditionalBeanRouterUnitTest { @Autowired @@ -19,6 +25,7 @@ class ConditionalBeanRouterUnitTest { private MockEndpoint mock; @Test + @DirtiesContext void whenSendBodyWithFruit_thenFavouriteHeaderReceivedSuccessfully() throws InterruptedException { mock.expectedHeaderReceived("favourite", "Apples"); diff --git a/spring-boot-modules/spring-boot-camel/src/test/java/com/baeldung/camel/conditional/ConditionalBodyRouterUnitTest.java b/messaging-modules/spring-apache-camel/src/test/java/com/boot/camel/conditional/ConditionalBodyRouterUnitTest.java similarity index 70% rename from spring-boot-modules/spring-boot-camel/src/test/java/com/baeldung/camel/conditional/ConditionalBodyRouterUnitTest.java rename to messaging-modules/spring-apache-camel/src/test/java/com/boot/camel/conditional/ConditionalBodyRouterUnitTest.java index 22c12a741f..745b9993ee 100644 --- a/spring-boot-modules/spring-boot-camel/src/test/java/com/baeldung/camel/conditional/ConditionalBodyRouterUnitTest.java +++ b/messaging-modules/spring-apache-camel/src/test/java/com/boot/camel/conditional/ConditionalBodyRouterUnitTest.java @@ -1,4 +1,6 @@ -package com.baeldung.camel.conditional; +package com.boot.camel.conditional; + +import static org.springframework.test.annotation.DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD; import org.apache.camel.EndpointInject; import org.apache.camel.ProducerTemplate; @@ -7,9 +9,13 @@ import org.apache.camel.test.spring.junit5.CamelSpringBootTest; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.annotation.DirtiesContext; -@SpringBootTest +import com.baeldung.camel.boot.Application; + +@SpringBootTest(classes = Application.class) @CamelSpringBootTest +@DirtiesContext(classMode = AFTER_EACH_TEST_METHOD) class ConditionalBodyRouterUnitTest { @Autowired @@ -19,6 +25,7 @@ class ConditionalBodyRouterUnitTest { private MockEndpoint mock; @Test + @DirtiesContext void whenSendBodyWithBaeldung_thenGoodbyeMessageReceivedSuccessfully() throws InterruptedException { mock.expectedBodiesReceived("Goodbye, Baeldung!"); diff --git a/spring-boot-modules/spring-boot-camel/src/test/java/com/baeldung/camel/conditional/ConditionalHeaderRouterUnitTest.java b/messaging-modules/spring-apache-camel/src/test/java/com/boot/camel/conditional/ConditionalHeaderRouterUnitTest.java similarity index 70% rename from spring-boot-modules/spring-boot-camel/src/test/java/com/baeldung/camel/conditional/ConditionalHeaderRouterUnitTest.java rename to messaging-modules/spring-apache-camel/src/test/java/com/boot/camel/conditional/ConditionalHeaderRouterUnitTest.java index 63fbf6682a..b2803f5682 100644 --- a/spring-boot-modules/spring-boot-camel/src/test/java/com/baeldung/camel/conditional/ConditionalHeaderRouterUnitTest.java +++ b/messaging-modules/spring-apache-camel/src/test/java/com/boot/camel/conditional/ConditionalHeaderRouterUnitTest.java @@ -1,4 +1,6 @@ -package com.baeldung.camel.conditional; +package com.boot.camel.conditional; + +import static org.springframework.test.annotation.DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD; import org.apache.camel.EndpointInject; import org.apache.camel.ProducerTemplate; @@ -7,9 +9,13 @@ import org.apache.camel.test.spring.junit5.CamelSpringBootTest; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.annotation.DirtiesContext; -@SpringBootTest +import com.baeldung.camel.boot.Application; + +@SpringBootTest(classes = Application.class) @CamelSpringBootTest +@DirtiesContext(classMode = AFTER_EACH_TEST_METHOD) class ConditionalHeaderRouterUnitTest { @Autowired @@ -19,6 +25,7 @@ class ConditionalHeaderRouterUnitTest { private MockEndpoint mock; @Test + @DirtiesContext void whenSendBodyWithFruit_thenFavouriteHeaderReceivedSuccessfully() throws InterruptedException { mock.expectedHeaderReceived("favourite", "Banana"); diff --git a/spring-boot-modules/spring-boot-camel/src/test/java/com/baeldung/camel/exception/ExceptionHandlingWithDoTryRouteUnitTest.java b/messaging-modules/spring-apache-camel/src/test/java/com/boot/camel/exception/ExceptionHandlingWithDoTryRouteUnitTest.java similarity index 70% rename from spring-boot-modules/spring-boot-camel/src/test/java/com/baeldung/camel/exception/ExceptionHandlingWithDoTryRouteUnitTest.java rename to messaging-modules/spring-apache-camel/src/test/java/com/boot/camel/exception/ExceptionHandlingWithDoTryRouteUnitTest.java index 23d3b1a392..68deb46883 100644 --- a/spring-boot-modules/spring-boot-camel/src/test/java/com/baeldung/camel/exception/ExceptionHandlingWithDoTryRouteUnitTest.java +++ b/messaging-modules/spring-apache-camel/src/test/java/com/boot/camel/exception/ExceptionHandlingWithDoTryRouteUnitTest.java @@ -1,4 +1,6 @@ -package com.baeldung.camel.exception; +package com.boot.camel.exception; + +import static org.springframework.test.annotation.DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD; import org.apache.camel.EndpointInject; import org.apache.camel.ProducerTemplate; @@ -7,9 +9,13 @@ import org.apache.camel.test.spring.junit5.CamelSpringBootTest; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.annotation.DirtiesContext; -@SpringBootTest +import com.baeldung.camel.boot.Application; + +@SpringBootTest(classes = Application.class) @CamelSpringBootTest +@DirtiesContext(classMode = AFTER_EACH_TEST_METHOD) class ExceptionHandlingWithDoTryRouteUnitTest { @Autowired @@ -19,6 +25,7 @@ class ExceptionHandlingWithDoTryRouteUnitTest { private MockEndpoint mock; @Test + @DirtiesContext void whenSendHeaders_thenExceptionRaisedAndHandledSuccessfully() throws Exception { mock.expectedMessageCount(1); diff --git a/spring-boot-modules/spring-boot-camel/src/test/java/com/baeldung/camel/exception/ExceptionHandlingWithExceptionClauseRouteUnitTest.java b/messaging-modules/spring-apache-camel/src/test/java/com/boot/camel/exception/ExceptionHandlingWithExceptionClauseRouteUnitTest.java similarity index 70% rename from spring-boot-modules/spring-boot-camel/src/test/java/com/baeldung/camel/exception/ExceptionHandlingWithExceptionClauseRouteUnitTest.java rename to messaging-modules/spring-apache-camel/src/test/java/com/boot/camel/exception/ExceptionHandlingWithExceptionClauseRouteUnitTest.java index 28d672bd64..25052f2c10 100644 --- a/spring-boot-modules/spring-boot-camel/src/test/java/com/baeldung/camel/exception/ExceptionHandlingWithExceptionClauseRouteUnitTest.java +++ b/messaging-modules/spring-apache-camel/src/test/java/com/boot/camel/exception/ExceptionHandlingWithExceptionClauseRouteUnitTest.java @@ -1,4 +1,6 @@ -package com.baeldung.camel.exception; +package com.boot.camel.exception; + +import static org.springframework.test.annotation.DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD; import org.apache.camel.EndpointInject; import org.apache.camel.ProducerTemplate; @@ -7,9 +9,13 @@ import org.apache.camel.test.spring.junit5.CamelSpringBootTest; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.annotation.DirtiesContext; -@SpringBootTest +import com.baeldung.camel.boot.Application; + +@SpringBootTest(classes = Application.class) @CamelSpringBootTest +@DirtiesContext(classMode = AFTER_EACH_TEST_METHOD) class ExceptionHandlingWithExceptionClauseRouteUnitTest { @Autowired @@ -19,6 +25,7 @@ class ExceptionHandlingWithExceptionClauseRouteUnitTest { private MockEndpoint mock; @Test + @DirtiesContext void whenSendHeaders_thenExceptionRaisedAndHandledSuccessfully() throws Exception { mock.expectedMessageCount(1); diff --git a/spring-boot-modules/spring-boot-camel/src/test/java/com/baeldung/camel/exception/ExceptionThrowingRouteUnitTest.java b/messaging-modules/spring-apache-camel/src/test/java/com/boot/camel/exception/ExceptionThrowingRouteUnitTest.java similarity index 78% rename from spring-boot-modules/spring-boot-camel/src/test/java/com/baeldung/camel/exception/ExceptionThrowingRouteUnitTest.java rename to messaging-modules/spring-apache-camel/src/test/java/com/boot/camel/exception/ExceptionThrowingRouteUnitTest.java index 6e6944fce8..a547e84a0b 100644 --- a/spring-boot-modules/spring-boot-camel/src/test/java/com/baeldung/camel/exception/ExceptionThrowingRouteUnitTest.java +++ b/messaging-modules/spring-apache-camel/src/test/java/com/boot/camel/exception/ExceptionThrowingRouteUnitTest.java @@ -1,7 +1,8 @@ -package com.baeldung.camel.exception; +package com.boot.camel.exception; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.springframework.test.annotation.DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD; import org.apache.camel.CamelContext; import org.apache.camel.Exchange; @@ -11,15 +12,20 @@ import org.apache.camel.test.spring.junit5.CamelSpringBootTest; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.annotation.DirtiesContext; -@SpringBootTest +import com.baeldung.camel.boot.Application; + +@SpringBootTest(classes = Application.class) @CamelSpringBootTest +@DirtiesContext(classMode = AFTER_EACH_TEST_METHOD) class ExceptionThrowingRouteUnitTest { @Autowired private ProducerTemplate template; @Test + @DirtiesContext void whenSendBody_thenExceptionRaisedSuccessfully() { CamelContext context = template.getCamelContext(); Exchange exchange = context.getEndpoint("direct:start-exception") diff --git a/spring-boot-modules/spring-boot-camel/src/test/java/com/baeldung/camel/exception/IllegalArgumentExceptionThrowingProcessorUnitTest.java b/messaging-modules/spring-apache-camel/src/test/java/com/boot/camel/exception/IllegalArgumentExceptionThrowingProcessorUnitTest.java similarity index 76% rename from spring-boot-modules/spring-boot-camel/src/test/java/com/baeldung/camel/exception/IllegalArgumentExceptionThrowingProcessorUnitTest.java rename to messaging-modules/spring-apache-camel/src/test/java/com/boot/camel/exception/IllegalArgumentExceptionThrowingProcessorUnitTest.java index a95abdfd27..9d15f70547 100644 --- a/spring-boot-modules/spring-boot-camel/src/test/java/com/baeldung/camel/exception/IllegalArgumentExceptionThrowingProcessorUnitTest.java +++ b/messaging-modules/spring-apache-camel/src/test/java/com/boot/camel/exception/IllegalArgumentExceptionThrowingProcessorUnitTest.java @@ -1,9 +1,11 @@ -package com.baeldung.camel.exception; +package com.boot.camel.exception; import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.Test; +import com.baeldung.camel.boot.exception.IllegalArgumentExceptionThrowingProcessor; + class IllegalArgumentExceptionThrowingProcessorUnitTest { @Test diff --git a/pom.xml b/pom.xml index 8b395d44f1..d9519fa219 100644 --- a/pom.xml +++ b/pom.xml @@ -939,7 +939,6 @@ quarkus-modules/quarkus-vs-springboot quarkus-modules/quarkus-jandex spring-boot-modules/spring-boot-cassandre - spring-boot-modules/spring-boot-camel spring-boot-modules/spring-boot-3 spring-boot-modules/spring-boot-3-native spring-boot-modules/spring-boot-3-observation @@ -1055,6 +1054,7 @@ tensorflow-java xstream webrtc + messaging-modules/spring-apache-camel @@ -1148,7 +1148,6 @@ quarkus-modules/quarkus-vs-springboot quarkus-modules/quarkus-jandex spring-boot-modules/spring-boot-cassandre - spring-boot-modules/spring-boot-camel spring-boot-modules/spring-boot-3 spring-boot-modules/spring-boot-3-native spring-boot-modules/spring-boot-3-observation @@ -1267,6 +1266,7 @@ tensorflow-java xstream webrtc + messaging-modules/spring-apache-camel diff --git a/spring-boot-modules/spring-boot-camel/.gitignore b/spring-boot-modules/spring-boot-camel/.gitignore deleted file mode 100644 index 16be8f2193..0000000000 --- a/spring-boot-modules/spring-boot-camel/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/output/ diff --git a/spring-boot-modules/spring-boot-camel/README.md b/spring-boot-modules/spring-boot-camel/README.md deleted file mode 100644 index d797f1a0b5..0000000000 --- a/spring-boot-modules/spring-boot-camel/README.md +++ /dev/null @@ -1,30 +0,0 @@ -## Spring Boot Camel - -This module contains articles about Spring Boot with Apache Camel - -### Example for the Article on Camel API with SpringBoot - -To start, run: - -`mvn spring-boot:run` - -Then, make a POST http request to: - -`http://localhost:8080/camel/api/bean` - -Include the HEADER: Content-Type: application/json, - -and a BODY Payload like: - -`{"id": 1,"name": "World"}` - -We will get a return code of 201 and the response: `Hello, World` - if the transform() method from Application class is uncommented and the process() method is commented - -or return code of 201 and the response: `{"id": 10,"name": "Hello, World"}` - if the transform() method from Application class is commented and the process() method is uncommented - -## Relevant articles: - -- [Apache Camel with Spring Boot](https://www.baeldung.com/apache-camel-spring-boot) -- [Apache Camel Routes Testing in Spring Boot](https://www.baeldung.com/spring-boot-apache-camel-routes-testing) -- [Apache Camel Conditional Routing](https://www.baeldung.com/spring-apache-camel-conditional-routing) -- [Apache Camel Exception Handling](https://www.baeldung.com/java-apache-camel-exception-handling) diff --git a/spring-boot-modules/spring-boot-camel/pom.xml b/spring-boot-modules/spring-boot-camel/pom.xml deleted file mode 100644 index ecf7143808..0000000000 --- a/spring-boot-modules/spring-boot-camel/pom.xml +++ /dev/null @@ -1,80 +0,0 @@ - - - 4.0.0 - com.example - spring-boot-camel - 0.0.1-SNAPSHOT - spring-boot-camel - - - com.baeldung.spring-boot-modules - spring-boot-modules - 1.0.0-SNAPSHOT - - - - - org.apache.camel.springboot - camel-servlet-starter - ${camel.version} - - - org.apache.camel.springboot - camel-jackson-starter - ${camel.version} - - - org.apache.camel.springboot - camel-swagger-java-starter - ${camel.version} - - - org.apache.camel.springboot - camel-spring-boot-starter - ${camel.version} - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework.boot - spring-boot-starter-test - test - - - org.apache.camel - camel-test-spring-junit5 - ${camel.version} - test - - - - - spring-boot:run - - - org.springframework.boot - spring-boot-maven-plugin - - - - repackage - - - com.baeldung.camel.boot.testing.GreetingsFileSpringApplication - - - - - - - - - 11 - 3.15.0 - - - \ No newline at end of file diff --git a/spring-boot-modules/spring-boot-camel/src/main/resources/logback.xml b/spring-boot-modules/spring-boot-camel/src/main/resources/logback.xml deleted file mode 100644 index d0b4334f5a..0000000000 --- a/spring-boot-modules/spring-boot-camel/src/main/resources/logback.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n - - - - - - - -