1
2
3
4
5
6
7
8
9
10
11 package org.mule.test.integration.construct;
12
13 import org.mule.api.MuleMessage;
14 import org.mule.api.client.LocalMuleClient;
15 import org.mule.tck.FunctionalTestCase;
16 import org.mule.transport.http.HttpConnector;
17 import org.mule.transport.http.HttpConstants;
18
19 import java.util.HashMap;
20 import java.util.Map;
21
22 public class SimpleServiceTestCase extends FunctionalTestCase
23 {
24 private LocalMuleClient muleClient;
25
26 @Override
27 protected void doSetUp() throws Exception
28 {
29 super.setDisposeManagerPerSuite(true);
30 super.doSetUp();
31 muleClient = muleContext.getClient();
32 }
33
34 @Override
35 protected String getConfigResources()
36 {
37 return "org/mule/test/integration/construct/simple-service-config.xml";
38 }
39
40 public void testJaxRsService() throws Exception
41 {
42 final Map<String, Object> props = new HashMap<String, Object>();
43 props.put(HttpConnector.HTTP_METHOD_PROPERTY, HttpConstants.METHOD_POST);
44 props.put(HttpConstants.HEADER_CONTENT_TYPE, "application/xml");
45 final MuleMessage result = muleClient.send("http://localhost:6099/rest/weather-report",
46 "<fake_report/>", props);
47 assertEquals((Integer) 201, result.getInboundProperty(HttpConnector.HTTP_STATUS_PROPERTY, 0));
48 }
49 }
50
51