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