Package org.apache.camel.test.junit5
Interface CamelContextManager
- All Known Implementing Classes:
LegacyCamelContextManager,TransientCamelContextManager
public interface CamelContextManager
A ContextManager is used to manage the lifecycle of a
CamelContext during test execution-
Method Summary
Modifier and TypeMethodDescriptionvoidbeforeContextStart(Object test) A callback method to be executed before starting the contextorg.apache.camel.ServiceDeprecated.org.apache.camel.ConsumerTemplateconsumer()Gets the reference to the consumer template created during initializationorg.apache.camel.model.ModelCamelContextcontext()Gets the reference to the CamelContext instancevoidcreateCamelContext(Object test) Creates a new CamelContextvoiddumpRouteCoverage(Class<?> clazz, String currentTestName, long time) Dumps the route coverage informationorg.apache.camel.FluentProducerTemplateGets the reference to the fluent producer template created during initializationvoidsetGlobalStore(org.junit.jupiter.api.extension.ExtensionContext.Store globalStore) Sets the JUnit's data context that may be used to provide additional information for some testsvoidStarts the contextvoidstop()Fully stops the managervoidStops the contextvoidStops the templatesorg.apache.camel.ProducerTemplatetemplate()Gets the reference to the producer template created during initialization
-
Method Details
-
createCamelContext
Creates a new CamelContext- Parameters:
test- the test instance requesting the next context- Throws:
Exception- if unable to create the context
-
beforeContextStart
A callback method to be executed before starting the context- Parameters:
test-- Throws:
Exception
-
context
org.apache.camel.model.ModelCamelContext context()Gets the reference to the CamelContext instance- Returns:
- the CamelContext instance
-
template
org.apache.camel.ProducerTemplate template()Gets the reference to the producer template created during initialization- Returns:
- the producer template instance
-
fluentTemplate
org.apache.camel.FluentProducerTemplate fluentTemplate()Gets the reference to the fluent producer template created during initialization- Returns:
- the fluent producer template instance
-
consumer
org.apache.camel.ConsumerTemplate consumer()Gets the reference to the consumer template created during initialization- Returns:
- the consumer template instance
-
camelContextService
Deprecated.When a separate service is used to manage the context lifecycle, this returns the reference to that service- Returns:
- the reference to the context lifecycle service
-
startCamelContext
Starts the context- Throws:
Exception- if unable to start the context for any reason
-
stopCamelContext
void stopCamelContext()Stops the context -
stopTemplates
void stopTemplates()Stops the templates -
stop
void stop()Fully stops the manager -
setGlobalStore
void setGlobalStore(org.junit.jupiter.api.extension.ExtensionContext.Store globalStore) Sets the JUnit's data context that may be used to provide additional information for some tests- Parameters:
globalStore- JUnit's data context instance
-
dumpRouteCoverage
Dumps the route coverage information- Parameters:
clazz-currentTestName-time-- Throws:
Exception
-