1
2
3
4
5
6
7
8
9
10
11 package org.mule.tck.testmodels.mule;
12
13 import org.mule.api.MuleEvent;
14 import org.mule.api.MuleMessage;
15 import org.mule.api.endpoint.OutboundEndpoint;
16 import org.mule.api.routing.RoutingException;
17 import org.mule.transport.AbstractMessageDispatcher;
18
19 public class TestMessageDispatcher extends AbstractMessageDispatcher
20 {
21
22 public TestMessageDispatcher(final OutboundEndpoint endpoint)
23 {
24 super(endpoint);
25 }
26
27 protected void doDispose()
28 {
29
30 }
31
32 protected void doDispatch(MuleEvent event) throws Exception
33 {
34 if (event.getEndpoint().getEndpointURI().toString().equals("test://AlwaysFail"))
35 {
36 throw new RoutingException(event.getMessage(), event.getEndpoint());
37 }
38 }
39
40 protected MuleMessage doSend(MuleEvent event) throws Exception
41 {
42 if (event.getEndpoint().getEndpointURI().toString().equals("test://AlwaysFail"))
43 {
44 throw new RoutingException(event.getMessage(), event.getEndpoint());
45 }
46 return event.getMessage();
47 }
48
49 protected void doConnect() throws Exception
50 {
51
52 }
53
54 protected void doDisconnect() throws Exception
55 {
56
57 }
58
59 }