1
2
3
4
5
6
7
8
9
10
11 package org.mule.module.cxf.jaxws;
12
13 import org.mule.api.MuleEventContext;
14 import org.mule.api.MuleMessage;
15 import org.mule.module.client.MuleClient;
16 import org.mule.tck.FunctionalTestCase;
17 import org.mule.tck.functional.EventCallback;
18 import org.mule.tck.functional.FunctionalTestComponent;
19
20 import java.util.HashMap;
21 import java.util.Map;
22
23 import org.apache.hello_world_soap_http.GreeterImpl;
24
25 public class HeaderPropertiesTestCase extends FunctionalTestCase
26 {
27
28 private GreeterImpl getGreeter() throws Exception
29 {
30 Object instance = getComponent("greeterService");
31
32 return (GreeterImpl) instance;
33 }
34
35 public void testClientWithMuleClient() throws Exception
36 {
37 FunctionalTestComponent testComponent = getFunctionalTestComponent("testService");
38 assertNotNull(testComponent);
39
40 EventCallback callback = new EventCallback()
41 {
42 public void eventReceived(final MuleEventContext context, final Object component) throws Exception
43 {
44 MuleMessage msg = context.getMessage();
45 assertEquals("BAR", msg.getInboundProperty("FOO"));
46 }
47 };
48 testComponent.setEventCallback(callback);
49
50 MuleClient client = new MuleClient(muleContext);
51 Map<String, Object> props = new HashMap<String, Object>();
52 props.put("operation", "greetMe");
53 props.put("FOO", "BAR");
54 MuleMessage result = client.send("clientEndpoint", "Dan", props);
55 assertEquals("Hello Dan Received", result.getPayload());
56
57 GreeterImpl impl = getGreeter();
58 assertEquals(1, impl.getInvocationCount());
59 }
60
61 protected String getConfigResources()
62 {
63 return "header-conf.xml";
64 }
65
66 }