Package org.apache.camel.test.junit5
Class TestExecutionConfiguration
java.lang.Object
org.apache.camel.test.junit5.TestExecutionConfiguration
This configuration class allows tweaking how the test itself configured and enable/disable features that affect its
execution environment.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
boolean
boolean
boolean
boolean
Whether route coverage is enabledboolean
Whether to use advice withboolean
withAutoStartContext
(boolean autoStartContext) Deprecated.Do not useprotected TestExecutionConfiguration
withCreateCamelContextPerClass
(boolean createCamelContextPerClass) Deprecated.Do not useDisables the JMX agent.withDumpRouteCoverage
(boolean dumpRouteCoverage) Whether to dump route coverage stats at the end of the test.Enables the JMX agent.withJMX
(boolean enableJMX) withUseAdviceWith
(boolean useAdviceWith) Set when using advice with and return true.withUseRouteBuilder
(boolean useRouteBuilder) Whether to use the RouteBuilder or not
-
Constructor Details
-
TestExecutionConfiguration
public TestExecutionConfiguration()
-
-
Method Details
-
isJmxEnabled
public boolean isJmxEnabled() -
withEnableJMX
Enables the JMX agent. Must be called before the setUp method. -
withDisableJMX
Disables the JMX agent. Must be called before the setUp method. -
withJMX
-
isDumpRouteCoverage
public boolean isDumpRouteCoverage() -
withDumpRouteCoverage
Whether to dump route coverage stats at the end of the test. This allows tooling or manual inspection of the stats, so you can generate a route trace diagram of which EIPs have been in use and which have not. Similar concepts as a code coverage report. You can also turn on route coverage globally via setting JVM system property CamelTestRouteCoverage=true.- Parameters:
dumpRouteCoverage
- true to write route coverage status in an xml file in the target/camel-route-coverage directory after the test has finished.
-
isRouteCoverageEnabled
public boolean isRouteCoverageEnabled()Whether route coverage is enabled- Returns:
- true if enabled or false otherwise
-
isUseAdviceWith
public boolean isUseAdviceWith()Whether to use advice with- Returns:
-
withUseAdviceWith
Set when using advice with and return true. This helps to know that advice with is to be used, andCamelContext
will not be started before the advice with takes place. This helps by ensuring the advice with has been property setup before theCamelContext
is started Important: It's important to startCamelContext
manually from the unit test after you are done doing all the advice with.- Returns:
- true if you use advice with in your unit tests.
-
isCreateCamelContextPerClass
public boolean isCreateCamelContextPerClass() -
withCreateCamelContextPerClass
@Deprecated(since="4.7.0") protected TestExecutionConfiguration withCreateCamelContextPerClass(boolean createCamelContextPerClass) Deprecated.Do not useTells whetherCamelContext
should be setup per test or per class. By default, it will be setup/teardown per test method. This method returnstrue
when the camel test class is annotated with @TestInstance(TestInstance.Lifecycle.PER_CLASS). Important: Use this with care as theCamelContext
will carry over state from previous tests, such as endpoints, components etc. So you cannot use this in all your tests.- Returns:
- true per class, false per test.
-
useRouteBuilder
public boolean useRouteBuilder() -
withUseRouteBuilder
Whether to use the RouteBuilder or not- Returns:
- true then
CamelContext
will be auto started, false thenCamelContext
will not be auto started (you will have to start it manually)
-
autoStartContext
public boolean autoStartContext() -
withAutoStartContext
@Deprecated(since="4.7.0") public TestExecutionConfiguration withAutoStartContext(boolean autoStartContext) Deprecated.Do not useSets to auto-start the context of not.- Parameters:
autoStartContext
-
-