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 TypeMethodDescriptionvoid
beforeContextStart
(Object test) A callback method to be executed before starting the contextorg.apache.camel.Service
Deprecated.org.apache.camel.ConsumerTemplate
consumer()
Gets the reference to the consumer template created during initializationorg.apache.camel.model.ModelCamelContext
context()
Gets the reference to the CamelContext instancevoid
createCamelContext
(Object test) Creates a new CamelContextvoid
dumpRouteCoverage
(Class<?> clazz, String currentTestName, long time) Dumps the route coverage informationorg.apache.camel.FluentProducerTemplate
Gets the reference to the fluent producer template created during initializationvoid
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 testsvoid
Starts the contextvoid
stop()
Fully stops the managervoid
Stops the contextvoid
Stops the templatesorg.apache.camel.ProducerTemplate
template()
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
-