Class CamelContextTestHelper
java.lang.Object
org.apache.camel.test.junit5.util.CamelContextTestHelper
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringJVM system property which can be set to true to turn on dumping route coverage statistics. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidconfigureIncludeExcludePatterns(org.apache.camel.CamelContext context, String include, String exclude) Configure route filtering patternsstatic voidconfigurePropertiesComponent(org.apache.camel.CamelContext context, Properties extra, org.apache.camel.spi.PropertiesSource propertiesSource, Boolean ignore) Configure the PropertiesComponent from the given contextstatic org.apache.camel.CamelContextcreateCamelContext(org.apache.camel.spi.Registry registry) static voidenableAutoMocking(org.apache.camel.CamelContext context, String pattern, String mockAndSkipPattern) Enables auto mockingstatic booleanisRouteCoverageEnabled(boolean legacyDumpCoverage) static booleanisSkipAutoStartContext(TestExecutionConfiguration configuration) static org.apache.camel.component.mock.MockEndpointlookupEndpoint(org.apache.camel.CamelContext context, String uri, boolean create, String target) Lookup endpoint with the given URI on the contextstatic voidreplaceFromEndpoints(org.apache.camel.model.ModelCamelContext context, Map<String, String> fromEndpoints) Replaces the 'from' endpoints of the given context with the ones from the provided mapstatic voidsetupDebugger(org.apache.camel.CamelContext context, org.apache.camel.spi.Breakpoint breakpoint) static voidsetupRoutes(org.apache.camel.CamelContext context, org.apache.camel.RoutesBuilder[] builders) Configures routes on the given contextstatic voidstartCamelContext(org.apache.camel.CamelContext context) Start the given contextstatic voidstartCamelContextOrService(org.apache.camel.CamelContext context, org.apache.camel.Service camelContextService) Starts a CamelContext or a service managing the CamelContext.
-
Field Details
-
ROUTE_COVERAGE_ENABLED
JVM system property which can be set to true to turn on dumping route coverage statistics.- See Also:
-
-
Method Details
-
createCamelContext
public static org.apache.camel.CamelContext createCamelContext(org.apache.camel.spi.Registry registry) throws Exception - Throws:
Exception
-
setupDebugger
public static void setupDebugger(org.apache.camel.CamelContext context, org.apache.camel.spi.Breakpoint breakpoint) -
setupRoutes
public static void setupRoutes(org.apache.camel.CamelContext context, org.apache.camel.RoutesBuilder[] builders) throws Exception Configures routes on the given context- Parameters:
context- the context to add the routes tobuilders- an array of route builders- Throws:
Exception
-
lookupEndpoint
public static org.apache.camel.component.mock.MockEndpoint lookupEndpoint(org.apache.camel.CamelContext context, String uri, boolean create, String target) Lookup endpoint with the given URI on the context- Parameters:
context- the context to lookup endpointsuri- the endpoint URIcreate- whether to create the endpoint if it does not existtarget- the query-stripped normalized URI- Returns:
- the MockEndpoint instance associated with the normalized URI (aka target)
-
enableAutoMocking
public static void enableAutoMocking(org.apache.camel.CamelContext context, String pattern, String mockAndSkipPattern) Enables auto mocking- Parameters:
context-pattern-mockAndSkipPattern-
-
configurePropertiesComponent
public static void configurePropertiesComponent(org.apache.camel.CamelContext context, Properties extra, org.apache.camel.spi.PropertiesSource propertiesSource, Boolean ignore) Configure the PropertiesComponent from the given context- Parameters:
context- the context with the PropertiesComponent to configureextra- override properties to use (if any)propertiesSource- custom properties source to use to load/lookup propertiesignore- whether to ignore missing properties locations
-
configureIncludeExcludePatterns
public static void configureIncludeExcludePatterns(org.apache.camel.CamelContext context, String include, String exclude) Configure route filtering patterns- Parameters:
context- the context to configure the patternsinclude- the inclusion patternexclude- the exclusion pattern
-
startCamelContext
Start the given context- Parameters:
context- the context to start- Throws:
Exception
-
startCamelContextOrService
public static void startCamelContextOrService(org.apache.camel.CamelContext context, org.apache.camel.Service camelContextService) throws Exception Starts a CamelContext or a service managing the CamelContext. The service takes priority if provided.- Parameters:
context- the context to startcamelContextService- the service managing the CamelContext- Throws:
Exception
-
replaceFromEndpoints
public static void replaceFromEndpoints(org.apache.camel.model.ModelCamelContext context, Map<String, String> fromEndpoints) throws ExceptionReplaces the 'from' endpoints of the given context with the ones from the provided map- Parameters:
context- the context to have the 'from' endpoints replacedfromEndpoints- the map with the new endpoint Uris- Throws:
Exception
-
isSkipAutoStartContext
-
isRouteCoverageEnabled
public static boolean isRouteCoverageEnabled(boolean legacyDumpCoverage)
-