1
2
3
4
5
6
7
8
9
10
11 package org.mule.module.cxf.jaxws;
12
13 import org.mule.api.MuleMessage;
14 import org.mule.module.client.MuleClient;
15 import org.mule.tck.FunctionalTestCase;
16
17 import java.util.HashMap;
18 import java.util.Map;
19
20 import org.apache.cxf.BusFactory;
21 import org.apache.hello_world_soap_http.GreeterImpl;
22
23 public class JettyTestCase extends FunctionalTestCase
24 {
25
26 @Override
27 protected void suitePreSetUp() throws Exception
28 {
29 BusFactory.setDefaultBus(null);
30 super.suitePreSetUp();
31 }
32
33 private GreeterImpl getGreeter() throws Exception
34 {
35 Object instance = getComponent("greeterService");
36
37 return (GreeterImpl) instance;
38 }
39
40 public void testClientWithMuleClient() throws Exception
41 {
42 MuleClient client = new MuleClient(muleContext);
43 Map<String, Object> props = new HashMap<String, Object>();
44 props.put("operation", "greetMe");
45 MuleMessage result = client.send("clientEndpoint", "Dan", props);
46 assertEquals("Hello Dan", result.getPayload());
47
48 GreeterImpl impl = getGreeter();
49
50 Thread.sleep(3000);
51
52 assertEquals(1, impl.getInvocationCount());
53 }
54
55 protected String getConfigResources()
56 {
57 return "jetty-conf.xml";
58 }
59
60 }