View Javadoc

1   /*
2    * $Id: AxisConnectorJmsEndpointFormatTestCase.java 19327 2010-09-03 13:09:47Z 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.transport.soap.axis;
12  
13  import org.mule.DefaultMuleMessage;
14  import org.mule.api.MuleMessage;
15  import org.mule.api.transport.DispatchException;
16  import org.mule.module.client.MuleClient;
17  import org.mule.tck.FunctionalTestCase;
18  
19  import org.apache.axis.AxisFault;
20  
21  public class AxisConnectorJmsEndpointFormatTestCase extends FunctionalTestCase
22  {
23  
24      public void testAxisOverJmsWithQueueNameSameAsComponentName() throws Exception
25      {
26          MuleClient client = new MuleClient(muleContext);
27          MuleMessage result = client.send("componentName", new DefaultMuleMessage("test1", muleContext));
28          assertNotNull(result.getPayload());
29          assertEquals("test1", result.getPayloadAsString());
30      }
31      
32      public void testAxisOverJmsWithQueueNameDifferentFromComponentName() throws Exception
33      {
34          MuleClient client = new MuleClient(muleContext);
35          MuleMessage result = client.send("soapActionDefined", new DefaultMuleMessage("test2", muleContext));
36          assertNotNull(result.getPayload());
37          assertEquals("test2", result.getPayloadAsString());
38      }
39      
40      public void testAxisOverJmsWithoutSettingMethodOnEndpoint() throws Exception
41      {
42          try
43          {
44              new MuleClient(muleContext).send("noMethodDefined", new DefaultMuleMessage("test3", muleContext));
45              fail("Exception expected");
46          }
47          catch (DispatchException e)
48          {
49              assertTrue(e.getMessage().startsWith("Cannot invoke WS call without an Operation."));
50          }
51      }
52      
53      public void testAxisOverJmsWithoutSettingSoapAction() throws Exception
54      {
55          try
56          {
57              new MuleClient(muleContext).send("noSoapActionDefined", new DefaultMuleMessage("test4", muleContext));
58              fail("Exception expected");
59          }
60          catch (DispatchException e)
61          {
62              assertTrue(e.getCause() instanceof AxisFault);
63              assertTrue(e.getCause().getMessage().startsWith("The AXIS engine could not find a target service to invoke!"));
64          }
65      }
66      
67      protected String getConfigResources()
68      {
69          return "axis-jms-endpoint-format-config.xml";
70      }
71  
72  }