Repository: camel Updated Branches: refs/heads/master 7a01bd236 -> 83ae1a526
Polish Camel CDI test documentation Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/83ae1a52 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/83ae1a52 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/83ae1a52 Branch: refs/heads/master Commit: 83ae1a526da2b9ba97453d75159cf0a6f33d0f8f Parents: 7a01bd2 Author: Antonin Stefanutti <anto...@stefanutti.fr> Authored: Thu Mar 10 16:44:24 2016 +0100 Committer: Antonin Stefanutti <anto...@stefanutti.fr> Committed: Thu Mar 10 16:44:24 2016 +0100 ---------------------------------------------------------------------- .../src/main/docs/cdi-testing.adoc | 27 +++++++++++++++++--- 1 file changed, 23 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/83ae1a52/components/camel-test-cdi/src/main/docs/cdi-testing.adoc ---------------------------------------------------------------------- diff --git a/components/camel-test-cdi/src/main/docs/cdi-testing.adoc b/components/camel-test-cdi/src/main/docs/cdi-testing.adoc index d482412..b208071 100644 --- a/components/camel-test-cdi/src/main/docs/cdi-testing.adoc +++ b/components/camel-test-cdi/src/main/docs/cdi-testing.adoc @@ -125,7 +125,7 @@ public class CamelCdiTest { ---- Camel CDI test provides the `@Order` annotation that you can use to -execute the test methods in a particular sequence, e.g.: +execute the test methods in a particular sequence, e.g.: [source,java] ---- @@ -145,7 +145,7 @@ public class CamelCdiTest { ---- One CDI container is bootstrapped for the entire execution of the test -class. +class. Besides, the test class is deployed as a CDI bean, so that you can control how the runner instantiate the test class, either one test class @@ -435,6 +435,10 @@ You can see the tests in the `camel-example-cdi-test` example for a thorough overview of the following testing patterns for Camel CDI applications. +NOTE: While the patterns above are illustrated using the Camel CDI test +module, they should equally work with Arquillian and PAX Exam unless +otherwise stated or illustrated with a specific example. + [[CDITesting-Testroutes]] Test routes +++++++++++ @@ -468,6 +472,21 @@ public class CamelCdiTest { You can find more information in <<cdi.adoc#CDI-Auto-detectingCamelroutes,auto-detecting Camel routes>>. +In case you prefer declaring the `RouteBuilder` bean in a separate class, +for example to share it more easily across multiple test classes, you can use +the `@Beans` annotation to instruct Camel CDI test to deploy that class as a +CDI bean, e.g.: + +[source,java] +---- +@RunWith(CamelCdiRunner.class) +@Beans(classes = TestRoute.class) +public class CamelCdiTest { + + // ... +} +---- + [[CDITesting-Beanalternatives]] Bean alternatives +++++++++++++++++ @@ -553,7 +572,7 @@ public class CamelCdiTest { } ---- -If your using Arquillian as testing framework, you need to activate the +If you're using Arquillian as testing framework, you need to activate the alternative in your deployment method, e.g.: [source,java] @@ -582,7 +601,7 @@ public class CamelCdiTest { } ---- -[[CDITesting-Camelcontextcustomisation]] +[[CDITesting-Camelcontextcustomization]] Camel context customization +++++++++++++++++++++++++++