org.apache.camel.impl
Class InterceptSendToMockEndpointStrategy

java.lang.Object
  extended by org.apache.camel.impl.InterceptSendToMockEndpointStrategy
All Implemented Interfaces:
EndpointStrategy

public class InterceptSendToMockEndpointStrategy
extends Object
implements EndpointStrategy

A EndpointStrategy which is capable of mocking endpoints.

This strategy will only apply when new endpoints is being created. If you want to apply existing endpoints, you will have to remove them from the CamelContext beforehand.

Version:

Constructor Summary
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
protected  boolean matchPattern(String uri, Endpoint endpoint, String pattern)
          Does the pattern match the endpoint?
protected  Producer onInterceptEndpoint(String uri, Endpoint endpoint, MockEndpoint mockEndpoint, Producer mockProducer)
          Callback when an endpoint was intercepted with the given mock endpoint
 Endpoint registerEndpoint(String uri, Endpoint endpoint)
          Register the endpoint.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

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 Endpoint registerEndpoint(String uri,
                                 Endpoint endpoint)
Description copied from interface: EndpointStrategy
Register the endpoint.

Specified by:
registerEndpoint in interface EndpointStrategy
Parameters:
uri - uri of endpoint
endpoint - the current endpoint to register
Returns:
the real endpoint to register, for instance a wrapped/enhanced endpoint.

matchPattern

protected boolean matchPattern(String uri,
                               Endpoint endpoint,
                               String pattern)
Does the pattern match the endpoint?

Parameters:
uri - the uri
endpoint - the endpoint
pattern - the pattern
Returns:
true to match and therefore intercept, false if not matched and should not intercept

onInterceptEndpoint

protected Producer onInterceptEndpoint(String uri,
                                       Endpoint endpoint,
                                       MockEndpoint mockEndpoint,
                                       Producer mockProducer)
Callback when an endpoint was intercepted with the given mock endpoint

Parameters:
uri - the uri
endpoint - the endpoint
mockEndpoint - the mocked endpoint
mockProducer - the mock producer
Returns:
the mock producer

toString

public String toString()
Overrides:
toString in class Object


Apache Camel