1
2
3
4
5
6
7
8
9
10
11 package org.mule.components.rest;
12
13 import org.mule.extras.client.MuleClient;
14 import org.mule.providers.NullPayload;
15 import org.mule.tck.FunctionalTestCase;
16 import org.mule.umo.UMOMessage;
17
18 public class RestErrorExpressionTestCase extends FunctionalTestCase
19 {
20 protected static String TEST_MESSAGE = "Test Http Request";
21
22 public static class EchoComponent
23 {
24 public String Echo(String echo) throws Exception
25 {
26 return echo;
27 }
28 }
29
30 protected String getConfigResources()
31 {
32 return "http-rest-error-expression-functional-test.xml";
33 }
34
35 public void testErrorExpressionOnRegexFilterFail() throws Exception
36 {
37 MuleClient client = new MuleClient();
38 UMOMessage result = client.send("restServiceEndpoint", TEST_MESSAGE, null);
39 assertTrue(result.getPayload() instanceof NullPayload);
40 }
41
42 public void testErrorExpressionOnRegexFilterPass() throws Exception
43 {
44 MuleClient client = new MuleClient();
45 UMOMessage result = client.send("restServiceEndpoint2", TEST_MESSAGE, null);
46 assertEquals("echo=" + TEST_MESSAGE,result.getPayloadAsString());
47 }
48 }