Exemplo n.º 1
0
 @Override
 public void marshal(Exchange exchange, Object graph, OutputStream stream) throws Exception {
   BufferedWriter writer =
       IOHelper.buffered(new OutputStreamWriter(stream, IOHelper.getCharsetName(exchange)));
   objectMapper.toJson(graph, writer);
   writer.close();
 }
Exemplo n.º 2
0
 @Override
 public Object unmarshal(Exchange exchange, InputStream stream) throws Exception {
   BufferedReader reader =
       IOHelper.buffered(new InputStreamReader(stream, IOHelper.getCharsetName(exchange)));
   Object result = objectMapper.fromJson(reader, this.unmarshalType);
   reader.close();
   return result;
 }
 @Test
 public void testNextPatientIdInResultMessage() throws Exception {
   BufferedReader in =
       IOHelper.buffered(
           new InputStreamReader(this.getClass().getResourceAsStream("/oru_r01.txt")));
   String line = "";
   String message = "";
   while (line != null) {
     if ((line = in.readLine()) != null) {
       message += line + "\r";
     }
   }
   MockEndpoint mock = getMockEndpoint("mock:test6");
   mock.expectedMessageCount(1);
   mock.expectedBodiesReceived("V208155");
   template.sendBody("direct:test6", message);
   assertMockEndpointsSatisfied();
 }