Class CamelContextConfiguration

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

public class CamelContextConfiguration extends Object
Configures a context for test execution
  • Constructor Details

    • CamelContextConfiguration

      public CamelContextConfiguration()
  • Method Details

    • routeFilterIncludePattern

      public String routeFilterIncludePattern()
    • withRouteFilterIncludePattern

      public CamelContextConfiguration withRouteFilterIncludePattern(String routeFilterIncludePattern)
      Used for filtering routes matching the given pattern, which follows the following rules:

      - Match by route id - Match by route input endpoint uri

      The matching is using exact match, by wildcard and regular expression.

      For example, to only include routes which start with foo in their route id's, use: include=foo* And to exclude routes which start from JMS endpoints, use: exclude=jms:*

      Multiple patterns can be separated by comma, for example, to exclude both foo and bar routes, use: exclude=foo*,bar*

      Exclude takes precedence over include.

    • routeFilterExcludePattern

      public String routeFilterExcludePattern()
    • withRouteFilterExcludePattern

      public CamelContextConfiguration withRouteFilterExcludePattern(String routeFilterExcludePattern)
      Used for filtering routes matching the given pattern, which follows the following rules:

      - Match by route id - Match by route input endpoint uri

      The matching is using exact match, by wildcard and regular expression.

      For example, to only include routes which starts with foo in their route id's, use: include=foo* And to exclude routes which start from JMS endpoints, use: exclude=jms:*

      Multiple patterns can be separated by comma, for example, to exclude both foo and bar routes, use: exclude=foo*,bar*

      Exclude takes precedence over include.

    • registry

      public org.apache.camel.spi.Registry registry()
    • withRegistry

      public CamelContextConfiguration withRegistry(org.apache.camel.spi.Registry registry)
      Sets a custom Registry.

      However, if you need to bind beans to the registry, then this is possible already with the bind method on registry, and there is no need to use this method.

    • useDebugger

      public boolean useDebugger()
    • breakpoint

      public org.apache.camel.spi.Breakpoint breakpoint()
    • withBreakpoint

      public CamelContextConfiguration withBreakpoint(DebugBreakpoint breakpoint)
      Provides a debug breakpoint to be executed before and/or after entering processors
      Parameters:
      breakpoint - a new debug breakpoint
    • mockEndpoints

      public String mockEndpoints()
    • withMockEndpoints

      public CamelContextConfiguration withMockEndpoints(String mockEndpoints)
      Enables auto mocking endpoints based on the pattern.

      Use * to mock all endpoints.

      See Also:
      • EndpointHelper.matchEndpoint(CamelContext, String, String)
    • mockEndpointsAndSkip

      public String mockEndpointsAndSkip()
    • withMockEndpointsAndSkip

      public CamelContextConfiguration withMockEndpointsAndSkip(String mockEndpointsAndSkip)
      Enables auto mocking endpoints based on the pattern, and skip sending to original endpoint.

      Use * to mock all endpoints.

      See Also:
      • EndpointHelper.matchEndpoint(CamelContext, String, String)
    • stubEndpoints

      public String stubEndpoints()
    • withStubEndpoints

      public CamelContextConfiguration withStubEndpoints(String pattern)
      Enables auto stub endpoints based on the pattern.

      Use * to stub all endpoints.

      See Also:
      • EndpointHelper.matchEndpoint(CamelContext, String, String)
    • autoStartupExcludePatterns

      public String autoStartupExcludePatterns()
    • withAutoStartupExcludePatterns

      public CamelContextConfiguration withAutoStartupExcludePatterns(String pattern)
      Used for exclusive filtering of routes to not automatically start with Camel starts. The pattern support matching by route id or endpoint urls. Multiple patterns can be specified separated by comma, as example, to exclude all the routes starting from kafka or jms use: kafka,jms.
    • useOverridePropertiesWithPropertiesComponent

      public Properties useOverridePropertiesWithPropertiesComponent()
    • withUseOverridePropertiesWithPropertiesComponent

      public CamelContextConfiguration withUseOverridePropertiesWithPropertiesComponent(Properties useOverridePropertiesWithPropertiesComponent)
      To include and override properties with the Camel PropertiesComponent.
      Parameters:
      useOverridePropertiesWithPropertiesComponent - additional properties to add/override.
    • ignoreMissingLocationWithPropertiesComponent

      public Boolean ignoreMissingLocationWithPropertiesComponent()
    • withIgnoreMissingLocationWithPropertiesComponent

      public CamelContextConfiguration withIgnoreMissingLocationWithPropertiesComponent(Boolean ignoreMissingLocationWithPropertiesComponent)
      Whether to ignore missing locations with the PropertiesComponent. For example, when unit testing, you may want to ignore locations that are not available in the environment used for testing.
      Parameters:
      ignoreMissingLocationWithPropertiesComponent - Use true to ignore, false to not ignore, and null to leave it as configured on the PropertiesComponent
    • camelContextSupplier

      public CamelContextConfiguration.CamelContextSupplier camelContextSupplier()
    • withCamelContextSupplier

      public CamelContextConfiguration withCamelContextSupplier(CamelContextConfiguration.CamelContextSupplier camelContextSupplier)
      To set a supplier for the CamelContext
      Parameters:
      camelContextSupplier - A supplier for the Camel context
    • registryBinder

    • withRegistryBinder

      public CamelContextConfiguration withRegistryBinder(CamelContextConfiguration.RegistryBinder registryBinder)
      A supplier to create a custom Registry.

      Do not use it for binding beans to the registry.

    • shutdownTimeout

      public int shutdownTimeout()
    • withShutdownTimeout

      public CamelContextConfiguration withShutdownTimeout(int shutdownTimeout)
      Sets the timeout to use when shutting down (unit in seconds).

      By default, it uses 10 seconds.

      Parameters:
      shutdownTimeout - the timeout to use
    • camelContextService

      public org.apache.camel.Service camelContextService()
    • withCamelContextService

      public CamelContextConfiguration withCamelContextService(org.apache.camel.Service camelContextService)
      Allows a service to be registered a separate lifecycle service to start and stop the context; such as for Spring when the ApplicationContext is started and stopped, rather than directly stopping the CamelContext
    • routesSupplier

    • withRoutesSupplier

      protected CamelContextConfiguration withRoutesSupplier(CamelContextConfiguration.RoutesSupplier routesSupplier)
      A supplier that classes can use to create a RouteBuilder to define the routes for testing
    • fromEndpoints

      public Map<String,String> fromEndpoints()
    • replaceRouteFromWith

      public void replaceRouteFromWith(String routeId, String fromEndpoint)
      To replace from routes with a different one
      Parameters:
      routeId -
      fromEndpoint -
    • postProcessor

    • withPostProcessor

      protected CamelContextConfiguration withPostProcessor(CamelContextConfiguration.PostProcessor postProcessor)
      Set a custom post-test processor
      Parameters:
      postProcessor - the post-test processor to use