Class TestExecutionConfiguration

java.lang.Object
org.apache.camel.test.junit5.TestExecutionConfiguration

public class TestExecutionConfiguration extends Object
This configuration class allows tweaking how the test itself configured and enable/disable features that affect its execution environment.
  • Constructor Details

    • TestExecutionConfiguration

      public TestExecutionConfiguration()
  • Method Details

    • isJmxEnabled

      public boolean isJmxEnabled()
    • withEnableJMX

      public TestExecutionConfiguration withEnableJMX()
      Enables the JMX agent. Must be called before the setUp method.
    • withDisableJMX

      public TestExecutionConfiguration withDisableJMX()
      Disables the JMX agent. Must be called before the setUp method.
    • withJMX

      public TestExecutionConfiguration withJMX(boolean enableJMX)
    • isDumpRouteCoverage

      public boolean isDumpRouteCoverage()
    • withDumpRouteCoverage

      public TestExecutionConfiguration withDumpRouteCoverage(boolean dumpRouteCoverage)
      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

      public TestExecutionConfiguration withUseAdviceWith(boolean useAdviceWith)
      Set when using advice with and return true. This helps to know that advice with is to be used, and CamelContext will not be started before the advice with takes place. This helps by ensuring the advice with has been property setup before the CamelContext is started

      Important: It's important to start CamelContext 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 use
      Tells whether CamelContext should be setup per test or per class.

      By default, it will be setup/teardown per test method. This method returns true when the camel test class is annotated with @TestInstance(TestInstance.Lifecycle.PER_CLASS).

      Important: Use this with care as the CamelContext 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

      public TestExecutionConfiguration withUseRouteBuilder(boolean useRouteBuilder)
      Whether to use the RouteBuilder or not
      Returns:
      true then CamelContext will be auto started, false then CamelContext 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 use
      Sets to auto-start the context of not.
      Parameters:
      autoStartContext -