Package org.apache.camel.component.mock
Class InterceptSendToMockEndpointStrategy
java.lang.Object
org.apache.camel.component.mock.InterceptSendToMockEndpointStrategy
- All Implemented Interfaces:
org.apache.camel.spi.EndpointStrategy
public class InterceptSendToMockEndpointStrategy
extends Object
implements org.apache.camel.spi.EndpointStrategy
A
EndpointStrategy
which is capable of mocking endpoints.
This strategy will only apply when new endpoints are being created. If you want to replace existing endpoints, you
will have to remove them from the CamelContext
beforehand.-
Constructor Summary
ConstructorDescriptionMock all endpoints.Mock endpoints based on the given pattern.InterceptSendToMockEndpointStrategy
(String pattern, boolean skip) Mock endpoints based on the given pattern. -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
matchPattern
(String uri, org.apache.camel.Endpoint endpoint, String pattern) Does the pattern match the endpoint?protected org.apache.camel.Producer
onInterceptEndpoint
(String uri, org.apache.camel.Endpoint endpoint, org.apache.camel.Endpoint mockEndpoint, org.apache.camel.Producer mockProducer) Callback when an endpoint was intercepted with the given mock endpointorg.apache.camel.Endpoint
registerEndpoint
(String uri, org.apache.camel.Endpoint endpoint) toString()
-
Constructor Details
-
InterceptSendToMockEndpointStrategy
public InterceptSendToMockEndpointStrategy()Mock all endpoints. -
InterceptSendToMockEndpointStrategy
Mock endpoints based on the given pattern.- Parameters:
pattern
- the pattern.- See Also:
-
InterceptSendToMockEndpointStrategy
Mock endpoints based on the given pattern.- Parameters:
pattern
- the pattern.skip
- true to skip sending after the detour to the original endpoint- See Also:
-
-
Method Details
-
registerEndpoint
- Specified by:
registerEndpoint
in interfaceorg.apache.camel.spi.EndpointStrategy
-
matchPattern
Does the pattern match the endpoint?- Parameters:
uri
- the uriendpoint
- the endpointpattern
- the pattern- Returns:
- true to match and therefore intercept, false if not matched and should not intercept
-
onInterceptEndpoint
protected org.apache.camel.Producer onInterceptEndpoint(String uri, org.apache.camel.Endpoint endpoint, org.apache.camel.Endpoint mockEndpoint, org.apache.camel.Producer mockProducer) Callback when an endpoint was intercepted with the given mock endpoint- Parameters:
uri
- the uriendpoint
- the endpointmockEndpoint
- the mocked endpointmockProducer
- the mock producer- Returns:
- the mock producer
-
toString
-