1
2
3
4
5
6
7
8
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.tck.testmodels.services.TestComponent;
17 import org.mule.tck.testmodels.services.TestComponentException;
18 import org.mule.umo.UMOMessage;
19 import org.mule.umo.provider.DispatchException;
20
21 public class AxisExceptionTestCase extends FunctionalTestCase
22 {
23
24 public AxisExceptionTestCase()
25 {
26 super();
27 this.setDisposeManagerPerSuite(true);
28 }
29
30 protected String getConfigResources()
31 {
32 return "axis-using-xfire-config.xml";
33 }
34
35 public void testSuccessCall() throws Exception
36 {
37 MuleClient client = new MuleClient();
38 UMOMessage reply = client.send("axis:http://localhost:63381/services/AxisService?method=receive",
39 new MuleMessage("test"));
40
41 assertNotNull(reply);
42 assertNotNull(reply.getPayload());
43 assertTrue(reply.getPayload() instanceof String);
44 assertEquals("Received: test", reply.getPayloadAsString());
45 }
46
47 public void testExceptionCall() throws Exception
48 {
49 try
50 {
51 MuleClient client = new MuleClient();
52 client.send("axis:http://localhost:63381/services/AxisService?method=throwsException",
53 new MuleMessage("test"));
54
55 fail("should have thrown exception");
56 }
57 catch (DispatchException dispatchExc)
58 {
59 Throwable t = dispatchExc.getCause();
60
61 assertNotNull(t);
62 assertEquals(TestComponentException.class.getName() + ": "
63 + TestComponentException.MESSAGE_PREFIX + TestComponent.EXCEPTION_MESSAGE,
64 t.getMessage());
65 }
66 }
67
68 public void testExceptionBasedRoutingForAxis() throws Exception
69 {
70 MuleClient client = new MuleClient();
71 UMOMessage reply = client.send("vm://localhost.test", new MuleMessage("test"));
72
73 assertNotNull(reply);
74 assertNotNull(reply.getPayload());
75 assertTrue(reply.getPayload() instanceof String);
76 assertEquals("Received: test", reply.getPayloadAsString());
77 }
78
79 }