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
AEndpointStrategy
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 theCamelContext
beforehand.
-
-
Constructor Summary
Constructors Constructor Description InterceptSendToMockEndpointStrategy()
Mock all endpoints.InterceptSendToMockEndpointStrategy(String pattern)
Mock endpoints based on the given pattern.InterceptSendToMockEndpointStrategy(String pattern, boolean skip)
Mock endpoints based on the given pattern.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected 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)
String
toString()
-
-
-
Constructor Detail
-
InterceptSendToMockEndpointStrategy
public InterceptSendToMockEndpointStrategy()
Mock all endpoints.
-
InterceptSendToMockEndpointStrategy
public InterceptSendToMockEndpointStrategy(String pattern)
Mock endpoints based on the given pattern.- Parameters:
pattern
- the pattern.- See Also:
EndpointHelper.matchEndpoint(org.apache.camel.CamelContext, String, String)
-
InterceptSendToMockEndpointStrategy
public InterceptSendToMockEndpointStrategy(String pattern, boolean skip)
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:
EndpointHelper.matchEndpoint(org.apache.camel.CamelContext, String, String)
-
-
Method Detail
-
registerEndpoint
public org.apache.camel.Endpoint registerEndpoint(String uri, org.apache.camel.Endpoint endpoint)
- Specified by:
registerEndpoint
in interfaceorg.apache.camel.spi.EndpointStrategy
-
matchPattern
protected boolean matchPattern(String uri, org.apache.camel.Endpoint endpoint, String pattern)
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
-
-