1
2
3
4
5
6
7 package org.mule.test.integration.streaming;
8
9 import org.mule.api.MuleEvent;
10 import org.mule.api.MuleException;
11 import org.mule.api.MuleMessage;
12 import org.mule.api.endpoint.OutboundEndpoint;
13 import org.mule.api.transport.MessageDispatcher;
14 import org.mule.api.transport.MessageDispatcherFactory;
15 import org.mule.transport.vm.VMMessageDispatcher;
16
17 public class ExceptionThrowingVMMessageDispatcherFactory implements MessageDispatcherFactory
18 {
19
20 public void activate(OutboundEndpoint endpoint, MessageDispatcher dispatcher) throws MuleException
21 {
22 }
23
24 public MessageDispatcher create(OutboundEndpoint endpoint) throws MuleException
25 {
26 return new ExceptionThrowingVMMessageDispatcher(endpoint);
27 }
28
29 public void destroy(OutboundEndpoint endpoint, MessageDispatcher dispatcher)
30 {
31
32
33 }
34
35 public boolean isCreateDispatcherPerRequest()
36 {
37
38 return false;
39 }
40
41 public void passivate(OutboundEndpoint endpoint, MessageDispatcher dispatcher)
42 {
43
44
45 }
46
47 public boolean validate(OutboundEndpoint endpoint, MessageDispatcher dispatcher)
48 {
49 return true;
50 }
51
52 class ExceptionThrowingVMMessageDispatcher extends VMMessageDispatcher
53 {
54
55 public ExceptionThrowingVMMessageDispatcher(OutboundEndpoint endpoint)
56 {
57 super(endpoint);
58 }
59
60 @Override
61 protected MuleMessage doSend(MuleEvent event) throws Exception
62 {
63 throw new RuntimeException("");
64 }
65
66 @Override
67 protected void doDispatch(MuleEvent event) throws Exception
68 {
69 throw new RuntimeException("");
70 }
71 }
72
73 }