1   /*
2    * $Id: AxisConnectorJmsEndpointFormatTestCase.java 7976 2007-08-21 14:26:13Z dirk.olmes $
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.providers.soap.axis;
12  
13  import org.mule.extras.client.MuleClient;
14  import org.mule.impl.MuleMessage;
15  import org.mule.tck.FunctionalTestCase;
16  import org.mule.umo.UMOMessage;
17  import org.mule.umo.provider.DispatchException;
18  
19  public class AxisConnectorJmsEndpointFormatTestCase extends FunctionalTestCase
20  {
21  
22      public void testAxisOverJmsWithQueueNameSameAsComponentName() throws Exception
23      {
24          MuleClient client = new MuleClient();
25          UMOMessage result = client.send("componentName", new MuleMessage("test"));
26          assertNotNull(result.getPayload());
27          assertTrue(result.getPayloadAsString().equalsIgnoreCase("test"));
28      }
29      
30      public void testAxisOverJmsWithQueueNameDifferentFromComponentName() throws Exception
31      {
32          MuleClient client = new MuleClient();
33          UMOMessage result = client.send("soapActionDefined", new MuleMessage("test"));
34          assertNotNull(result.getPayload());
35          assertTrue(result.getPayloadAsString().equalsIgnoreCase("test"));
36      }
37      
38      public void testAxisOverJmsWithoutSettingMethodOnEndpoint() throws Exception
39      {
40          MuleClient client = new MuleClient();
41          Exception exception = null;
42          try
43          {
44              client.send("noMethodDefined", new MuleMessage("test"));
45          }
46          catch (Exception e)
47          {
48              exception = e;
49          }
50          assertNotNull(exception);
51          assertTrue(exception instanceof DispatchException);
52          assertTrue(exception.getMessage().startsWith("Cannot invoke WS call without an Operation."));
53      }
54      
55      public void testAxisOverJmsWithoutSettingSoapAction() throws Exception
56      {
57          MuleClient client = new MuleClient();
58          Exception exception = null;
59          try
60          {
61              client.send("noSoapActionDefined", new MuleMessage("test"));
62          }
63          catch (Exception e)
64          {
65              exception = e;
66          }
67          assertNotNull(exception);
68          assertTrue(exception instanceof DispatchException);
69          assertTrue(exception.getCause().getMessage().startsWith("The AXIS engine could not find a target service to invoke!"));
70      }
71      
72      protected String getConfigResources()
73      {
74          return "axis-jms-endpoint-format-config.xml";
75      }
76  
77  }
78  
79