1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.openehealth.ipf.platform.camel.core.adapter;
17
18 import static org.junit.Assert.assertEquals;
19
20 import java.io.ByteArrayInputStream;
21 import java.io.StringReader;
22
23 import javax.xml.transform.stream.StreamSource;
24
25 import org.apache.camel.ExchangePattern;
26 import org.junit.Test;
27 import org.openehealth.ipf.platform.camel.core.AbstractRouteTest;
28
29
30
31
32
33 public class ParserRouteTest extends AbstractRouteTest {
34
35 @Test
36 public void testParser1() throws InterruptedException {
37 String result = (String) producerTemplate.sendBody("direct:parser-test",
38 ExchangePattern.InOut, "input");
39 assertEquals("string: input", result);
40 }
41
42 @Test
43 public void testParser2() throws InterruptedException {
44 String result = (String) producerTemplate.sendBody("direct:parser-test",
45 ExchangePattern.InOut, new ByteArrayInputStream("input".getBytes()));
46 assertEquals("stream: input", result);
47 }
48
49 @Test
50 public void testParser3() throws InterruptedException {
51 String result = (String) producerTemplate.sendBody("direct:parser-test",
52 ExchangePattern.InOut, new StringReader("input"));
53 assertEquals("reader: input", result);
54 }
55
56 @Test
57 public void testParser4() throws InterruptedException {
58 String result = (String) producerTemplate.sendBody("direct:parser-test",
59 ExchangePattern.InOut, new StreamSource(new StringReader("input")));
60 assertEquals("source: input", result);
61 }
62
63 }