1   /*
2    * $Id: VMMessageAdapterTestCase.java 10787 2008-02-12 18:51:50Z dfeist $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.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.transport.vm;
12  
13  import org.mule.DefaultMuleMessage;
14  import org.mule.api.MuleException;
15  import org.mule.api.MuleMessage;
16  import org.mule.api.transport.MessageAdapter;
17  import org.mule.api.transport.MessageTypeNotSupportedException;
18  import org.mule.transport.AbstractMessageAdapterTestCase;
19  import org.mule.transport.DefaultMessageAdapter;
20  
21  /**
22   * <code>VMMessageAdapterTestCase</code> TODO (document class)
23   */
24  public class VMMessageAdapterTestCase extends AbstractMessageAdapterTestCase
25  {
26  
27      /*
28       * (non-Javadoc)
29       * 
30       * @see org.mule.tck.providers.AbstractMessageAdapterTestCase#createAdapter()
31       */
32      public MessageAdapter createAdapter(Object payload) throws MessageTypeNotSupportedException
33      {
34          if (payload instanceof MuleMessage)
35          {
36              return new DefaultMessageAdapter(payload);
37          }
38          else
39          {
40              throw new MessageTypeNotSupportedException(payload, DefaultMessageAdapter.class);
41          }
42      }
43  
44      /*
45       * (non-Javadoc)
46       * 
47       * @see org.mule.tck.providers.AbstractMessageAdapterTestCase#getValidMessage()
48       */
49      public Object getValidMessage() throws MuleException
50      {
51          return new DefaultMuleMessage("Valid Message");
52      }
53  
54      /*
55       * (non-Javadoc)
56       * 
57       * @see org.mule.tck.providers.AbstractMessageAdapterTestCase#getInvalidMessage()
58       */
59      public Object getInvalidMessage()
60      {
61          return "Invalid message";
62      }
63  
64  }