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