1
2
3
4
5
6
7
8
9
10
11 package org.mule.transport.http.issues;
12
13 import org.mule.api.MuleException;
14 import org.mule.api.MuleMessage;
15 import org.mule.module.client.MuleClient;
16 import org.mule.tck.DynamicPortTestCase;
17 import org.mule.tck.functional.StringAppendTestTransformer;
18
19 public class HttpTransformersMule1815TestCase extends DynamicPortTestCase
20 {
21
22 public static final String OUTBOUND_MESSAGE = "Test message";
23
24 protected String getConfigResources()
25 {
26 return "http-transformers-mule-1815-test.xml";
27 }
28
29 private MuleMessage sendTo(String uri) throws MuleException
30 {
31 MuleClient client = new MuleClient(muleContext);
32 MuleMessage message = client.send(uri, OUTBOUND_MESSAGE, null);
33 assertNotNull(message);
34 return message;
35 }
36
37
38
39
40
41
42 public void testBase() throws Exception
43 {
44 assertEquals(OUTBOUND_MESSAGE + " Received",
45 sendTo("base").getPayloadAsString());
46 }
47
48
49
50
51
52
53 public void testAdapted() throws Exception
54 {
55 assertEquals(OUTBOUND_MESSAGE + " Received",
56 sendTo("adapted").getPayloadAsString());
57 }
58
59
60
61
62
63
64
65 public void testIgnored() throws Exception
66 {
67 assertEquals(OUTBOUND_MESSAGE +" transformed" +" transformed 2" + " Received",
68 sendTo("ignored").getPayloadAsString());
69 }
70
71
72
73
74
75
76 public void testInbound() throws Exception
77 {
78 assertEquals(
79
80 StringAppendTestTransformer.append(" transformed 2",
81 StringAppendTestTransformer.appendDefault(OUTBOUND_MESSAGE)) + " Received",
82 sendTo("inbound").getPayloadAsString());
83 }
84
85 @Override
86 protected int getNumPortsToFind()
87 {
88 return 4;
89 }
90
91 }