https://github.com/toolisticon/camel-spring-boot-testutils
Apache Camel Springboot Test Utils
https://github.com/toolisticon/camel-spring-boot-testutils
camel springboot testing
Last synced: 26 days ago
JSON representation
Apache Camel Springboot Test Utils
- Host: GitHub
- URL: https://github.com/toolisticon/camel-spring-boot-testutils
- Owner: toolisticon
- License: bsd-3-clause
- Created: 2017-11-28T19:56:06.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2023-12-15T17:41:20.000Z (over 2 years ago)
- Last Synced: 2026-01-11T19:24:02.657Z (5 months ago)
- Topics: camel, springboot, testing
- Language: Java
- Homepage:
- Size: 76.2 KB
- Stars: 0
- Watchers: 4
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Camel Springboot Test Utils
[](https://github.com/holisticon#unmaintained)
[](https://travis-ci.org/toolisticon/camel-spring-boot-testutils)
[](https://maven-badges.herokuapp.com/maven-central/io.toolisticon.camel/camel-spring-boot-test-rule)
[](https://codecov.io/gh/toolisticon/camel-spring-boot-testutils)
This projects supplies a small library making testing of Apache Camel components easier.
## Installation and requirements
Minimal tested version:
- Apache Camel 2.20.1
- Springboot 1.5.8-RELEASE
Put the following dependency to your Maven POM file:
io.toolisticon.camel
camel-spring-boot-test-rule
0.0.3
test
## Features
### Test rule
There is a lot written about Camel Spring Testing, but all approaches are based on inheritance (`SpringTestSupport`)
or using a special runner (`CamelSpringBootRunner`). There are good reasons for doing so, but if you are not able to do so,
for example using a different runner , you may use the supplied JUnit test rule for this:
...
import org.springframework.test.context.junit4.rules.CamelSpringClassRule;
import org.springframework.test.context.junit4.rules.SpringMethodRule;
@SpringBootTest
public class SimpleRuleTest {
@ClassRule
public static final CamelSpringClassRule springClassRule = new CamelSpringClassRule();
@Rule
public final SpringMethodRule springMethodRule = new SpringMethodRule();
@Autowired
private CamelContext camelContext;
@Test
@DirtiesContext
public void testMe() throws Exception {
// do something with camelContext here
}
}
### ExcludeRoutes
There is a standard annotation in Camel-Spring to exclude routes `org.apache.camel.test.spring.ExcludeRoutes`. This is not
working using a standard Springboot test. If you use this library, the support is restored. Just annotate
the `org.apache.camel.test.spring.ExcludeRoutes` to your test class containing the `CamelSpringClassRule`
and list the excluded route classes.