1   /*
2    * $Id: JmsMessageAdapterTestCase.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.jms;
12  
13  import org.mule.api.MessagingException;
14  import org.mule.api.transport.MessageAdapter;
15  import org.mule.transport.AbstractMessageAdapterTestCase;
16  import org.mule.transport.jms.JmsConstants;
17  import org.mule.transport.jms.JmsMessageAdapter;
18  
19  public class JmsMessageAdapterTestCase extends AbstractMessageAdapterTestCase
20  {  
21      /*
22       * (non-Javadoc)
23       * 
24       * @see org.mule.tck.providers.AbstractMessageAdapterTestCase#createAdapter()
25       */
26      public MessageAdapter createAdapter(Object payload) throws MessagingException
27      {
28          return new JmsMessageAdapter(payload);
29      }
30  
31      /*
32       * (non-Javadoc)
33       * 
34       * @see org.mule.tck.providers.AbstractMessageAdapterTestCase#getValidMessage()
35       */
36      public Object getValidMessage() throws Exception
37      {
38          return JmsConnectorTestCase.getMessage();
39      }
40  
41      public void testIllegalSpecification() throws Exception
42      {
43          JmsMessageAdapter a = (JmsMessageAdapter)this.createAdapter(this.getValidMessage());
44  
45          // these will work
46          a.setSpecification(JmsConstants.JMS_SPECIFICATION_102B);
47          a.setSpecification(JmsConstants.JMS_SPECIFICATION_11);
48  
49          try
50          {
51              // this will not :)
52              a.setSpecification("1.2");
53          }
54          catch (IllegalArgumentException iax)
55          {
56              // OK
57          }
58      }
59  
60  }