View Javadoc

1   /*
2    * $Id: ExceptionThrowingVMMessageDispatcherFactory.java 19191 2010-08-25 21:05:23Z tcarlson $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.test.integration.streaming;
12  
13  import org.mule.api.MuleEvent;
14  import org.mule.api.MuleException;
15  import org.mule.api.MuleMessage;
16  import org.mule.api.endpoint.OutboundEndpoint;
17  import org.mule.api.transport.MessageDispatcher;
18  import org.mule.api.transport.MessageDispatcherFactory;
19  import org.mule.transport.vm.VMMessageDispatcher;
20  
21  public class ExceptionThrowingVMMessageDispatcherFactory implements MessageDispatcherFactory
22  {
23  
24      public void activate(OutboundEndpoint endpoint, MessageDispatcher dispatcher) throws MuleException
25      {
26      }
27  
28      public MessageDispatcher create(OutboundEndpoint endpoint) throws MuleException
29      {
30          return new ExceptionThrowingVMMessageDispatcher(endpoint);
31      }
32  
33      public void destroy(OutboundEndpoint endpoint, MessageDispatcher dispatcher)
34      {
35          // TODO Auto-generated method stub
36  
37      }
38  
39      public boolean isCreateDispatcherPerRequest()
40      {
41          // TODO Auto-generated method stub
42          return false;
43      }
44  
45      public void passivate(OutboundEndpoint endpoint, MessageDispatcher dispatcher)
46      {
47          // TODO Auto-generated method stub
48  
49      }
50  
51      public boolean validate(OutboundEndpoint endpoint, MessageDispatcher dispatcher)
52      {
53          return true;
54      }
55  
56      class ExceptionThrowingVMMessageDispatcher extends VMMessageDispatcher
57      {
58  
59          public ExceptionThrowingVMMessageDispatcher(OutboundEndpoint endpoint)
60          {
61              super(endpoint);
62          }
63  
64          @Override
65          protected MuleMessage doSend(MuleEvent event) throws Exception
66          {
67              throw new RuntimeException("");
68          }
69  
70          @Override
71          protected void doDispatch(MuleEvent event) throws Exception
72          {
73              throw new RuntimeException("");
74          }
75      }
76  
77  }