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.tck.junit4.FunctionalTestCase;
15 import org.mule.transport.http.HttpConnector;
16 import org.mule.transport.http.HttpConstants;
17
18 import java.util.HashMap;
19 import java.util.Map;
20
21 import org.junit.Test;
22
23 import static org.junit.Assert.assertEquals;
24
25 public class SimpleServiceTestCase extends FunctionalTestCase
26 {
27 @Override
28 protected void doSetUp() throws Exception
29 {
30 setDisposeContextPerClass(true);
31 super.doSetUp();
32 }
33
34 @Override
35 protected String getConfigResources()
36 {
37 return "org/mule/test/integration/construct/simple-service-config.xml";
38 }
39
40 @Test
41 public void testJaxRsService() throws Exception
42 {
43 final Map<String, Object> props = new HashMap<String, Object>();
44 props.put(HttpConnector.HTTP_METHOD_PROPERTY, HttpConstants.METHOD_POST);
45 props.put(HttpConstants.HEADER_CONTENT_TYPE, "application/xml");
46 MuleMessage result = muleContext.getClient().send("http://localhost:6099/rest/weather-report",
47 "<fake_report/>", props);
48 assertEquals((Integer) 201, result.getInboundProperty(HttpConnector.HTTP_STATUS_PROPERTY, 0));
49 }
50 }
51
52