1
2
3
4
5
6
7
8
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.junit4.FunctionalTestCase;
18
19 import org.apache.axis.AxisFault;
20 import org.junit.Test;
21
22 import static org.junit.Assert.assertEquals;
23 import static org.junit.Assert.assertNotNull;
24 import static org.junit.Assert.assertTrue;
25 import static org.junit.Assert.fail;
26
27 public class AxisConnectorJmsEndpointFormatTestCase extends FunctionalTestCase
28 {
29
30 @Override
31 protected String getConfigResources()
32 {
33 return "axis-jms-endpoint-format-config.xml";
34 }
35
36 @Test
37 public void testAxisOverJmsWithQueueNameSameAsComponentName() throws Exception
38 {
39 MuleClient client = new MuleClient(muleContext);
40 MuleMessage result = client.send("componentName", new DefaultMuleMessage("test1", muleContext));
41 assertNotNull(result.getPayload());
42 assertEquals("test1", result.getPayloadAsString());
43 }
44
45 @Test
46 public void testAxisOverJmsWithQueueNameDifferentFromComponentName() throws Exception
47 {
48 MuleClient client = new MuleClient(muleContext);
49 MuleMessage result = client.send("soapActionDefined", new DefaultMuleMessage("test2", muleContext));
50 assertNotNull(result.getPayload());
51 assertEquals("test2", result.getPayloadAsString());
52 }
53
54 @Test
55 public void testAxisOverJmsWithoutSettingMethodOnEndpoint() throws Exception
56 {
57 try
58 {
59 new MuleClient(muleContext).send("noMethodDefined", new DefaultMuleMessage("test3", muleContext));
60 fail("Exception expected");
61 }
62 catch (DispatchException e)
63 {
64 assertTrue(e.getMessage().startsWith("Cannot invoke WS call without an Operation."));
65 }
66 }
67
68 @Test
69 public void testAxisOverJmsWithoutSettingSoapAction() throws Exception
70 {
71 try
72 {
73 new MuleClient(muleContext).send("noSoapActionDefined", new DefaultMuleMessage("test4", muleContext));
74 fail("Exception expected");
75 }
76 catch (DispatchException e)
77 {
78 assertTrue(e.getCause() instanceof AxisFault);
79 assertTrue(e.getCause().getMessage().startsWith("The AXIS engine could not find a target service to invoke!"));
80 }
81 }
82
83 }