This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit d88eb0de5f3f110874cbb69caed75a65fb1c4106
Author: Andrea Cosentino <anco...@gmail.com>
AuthorDate: Thu Jul 25 11:04:07 2019 +0200

    Camel-Hl7: Fixed CS
---
 .../camel/component/hl7/HL7ByteArrayRouteTest.java | 43 +++++++++----------
 .../component/hl7/HL7MLLPCodecBoundaryTest.java    |  4 +-
 .../camel/component/hl7/HL7MLLPCodecLongTest.java  | 11 +++--
 .../hl7/HL7MLLPCodecMessageFloodingTest.java       | 29 ++++++-------
 .../component/hl7/HL7MLLPCodecPlainStringTest.java | 24 +++++------
 .../hl7/HL7MLLPCodecStandAndEndBytesTest.java      | 30 +++++++-------
 .../camel/component/hl7/HL7MLLPCodecTest.java      | 29 ++++++-------
 .../hl7/HL7MLLPNettyCodecBoundaryTest.java         | 14 +++----
 .../hl7/HL7MLLPNettyCodecByteArrayRouteTest.java   | 48 +++++++++++-----------
 .../component/hl7/HL7MLLPNettyCodecLongTest.java   |  8 ++--
 .../hl7/HL7MLLPNettyCodecStandAndEndBytesTest.java | 32 +++++++--------
 .../camel/component/hl7/HL7MLLPNettyCodecTest.java | 32 +++++++--------
 .../hl7/HL7MLLPNettyDecoderResourceLeakTest.java   | 27 ++++++------
 .../component/hl7/HL7MLLPNettyRouteToTest.java     | 42 +++++++++----------
 .../camel/component/hl7/HL7NettyRouteTest.java     | 39 +++++++++---------
 .../apache/camel/component/hl7/HL7RouteTest.java   | 35 ++++++++--------
 16 files changed, 216 insertions(+), 231 deletions(-)

diff --git 
a/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7ByteArrayRouteTest.java
 
b/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7ByteArrayRouteTest.java
index fc913f5..306db97 100644
--- 
a/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7ByteArrayRouteTest.java
+++ 
b/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7ByteArrayRouteTest.java
@@ -33,23 +33,23 @@ import org.apache.camel.spi.DataFormat;
 import org.junit.Test;
 
 /**
- * Unit test for HL7 routing where the mina endpoint passes on a byte array 
instead of a string
- * and leaves charset interpretation to the dataformat.
+ * Unit test for HL7 routing where the mina endpoint passes on a byte array
+ * instead of a string and leaves charset interpretation to the dataformat.
  */
 public class HL7ByteArrayRouteTest extends HL7TestSupport {
 
-       @BindToRegistry("hl7codec")
+    @BindToRegistry("hl7codec")
     public HL7MLLPCodec addHl7MllpCodec() throws Exception {
         HL7MLLPCodec codec = new HL7MLLPCodec();
         codec.setProduceString(false);
         return codec;
     }
-       
+
     @BindToRegistry("hl7service")
     public MyHL7BusinessLogic addHl7MllpService() throws Exception {
 
-     return new MyHL7BusinessLogic();
-     }
+        return new MyHL7BusinessLogic();
+    }
 
     @Test
     public void testSendA19() throws Exception {
@@ -121,25 +121,25 @@ public class HL7ByteArrayRouteTest extends HL7TestSupport 
{
             public void configure() throws Exception {
                 // START SNIPPET: e1
                 DataFormat hl7 = new HL7DataFormat();
-                // we setup or HL7 listener on port 8888 (using the hl7codec) 
and in sync mode so we can return a response
+                // we setup or HL7 listener on port 8888 (using the hl7codec)
+                // and in sync mode so we can return a response
                 from("mina2:tcp://127.0.0.1:" + getPort() + 
"?sync=true&codec=#hl7codec")
-                    // we use the HL7 data format to unmarshal from HL7 stream 
to the HAPI Message model
-                    // this ensures that the camel message has been enriched 
with hl7 specific headers to
+                    // we use the HL7 data format to unmarshal from HL7 stream
+                    // to the HAPI Message model
+                    // this ensures that the camel message has been enriched
+                    // with hl7 specific headers to
                     // make the routing much easier (see below)
                     .unmarshal(hl7)
                     // using choice as the content base router
                     .choice()
-                        // where we choose that A19 queries invoke the 
handleA19 method on our hl7service bean
-                        .when(header("CamelHL7TriggerEvent").isEqualTo("A19"))
-                            .bean("hl7service", "handleA19")
-                            .to("mock:a19")
-                        // and A01 should invoke the handleA01 method on our 
hl7service bean
-                        
.when(header("CamelHL7TriggerEvent").isEqualTo("A01")).to("mock:a01")
-                            .bean("hl7service", "handleA01")
-                            .to("mock:a19")
-                        // other types should go to mock:unknown
-                        .otherwise()
-                            .to("mock:unknown")
+                    // where we choose that A19 queries invoke the handleA19
+                    // method on our hl7service bean
+                    
.when(header("CamelHL7TriggerEvent").isEqualTo("A19")).bean("hl7service", 
"handleA19").to("mock:a19")
+                    // and A01 should invoke the handleA01 method on our
+                    // hl7service bean
+                    
.when(header("CamelHL7TriggerEvent").isEqualTo("A01")).to("mock:a01").bean("hl7service",
 "handleA01").to("mock:a19")
+                    // other types should go to mock:unknown
+                    .otherwise().to("mock:unknown")
                     // end choice block
                     .end()
                     // marshal response back
@@ -152,7 +152,8 @@ public class HL7ByteArrayRouteTest extends HL7TestSupport {
     public class MyHL7BusinessLogic {
 
         // This is a plain POJO that has NO imports whatsoever on Apache Camel.
-        // its a plain POJO only importing the HAPI library so we can much 
easier work with the HL7 format.
+        // its a plain POJO only importing the HAPI library so we can much
+        // easier work with the HL7 format.
 
         public Message handleA19(Message msg) throws Exception {
             // here you can have your business logic for A19 messages
diff --git 
a/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7MLLPCodecBoundaryTest.java
 
b/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7MLLPCodecBoundaryTest.java
index 56e53cc..a191d31 100644
--- 
a/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7MLLPCodecBoundaryTest.java
+++ 
b/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7MLLPCodecBoundaryTest.java
@@ -36,7 +36,7 @@ import org.junit.Test;
  */
 public class HL7MLLPCodecBoundaryTest extends HL7TestSupport {
 
-       @BindToRegistry("hl7codec")
+    @BindToRegistry("hl7codec")
     public HL7MLLPCodec addHl7MllpCodec() throws Exception {
         HL7MLLPCodec codec = new HL7MLLPCodec();
         codec.setCharset("iso-8859-1");
@@ -56,7 +56,7 @@ public class HL7MLLPCodecBoundaryTest extends HL7TestSupport {
         };
     }
 
-    @Test 
+    @Test
     public void testSendHL7Message() throws Exception {
         BufferedReader in = IOHelper.buffered(new 
InputStreamReader(getClass().getResourceAsStream("/mdm_t02-1022.txt")));
         String line = "";
diff --git 
a/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7MLLPCodecLongTest.java
 
b/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7MLLPCodecLongTest.java
index f24db6d..5c13b5b 100644
--- 
a/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7MLLPCodecLongTest.java
+++ 
b/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7MLLPCodecLongTest.java
@@ -31,18 +31,17 @@ import org.apache.camel.impl.JndiRegistry;
 import org.apache.camel.util.IOHelper;
 import org.junit.Test;
 
-
 /**
  * Unit test for the HL7MLLP Codec.
  */
 public class HL7MLLPCodecLongTest extends HL7TestSupport {
 
     @BindToRegistry("hl7codec")
-public HL7MLLPCodec addHl7MllpCodec() throws Exception {
-    HL7MLLPCodec codec = new HL7MLLPCodec();
-    codec.setCharset("iso-8859-1");
-    return codec;
-}
+    public HL7MLLPCodec addHl7MllpCodec() throws Exception {
+        HL7MLLPCodec codec = new HL7MLLPCodec();
+        codec.setCharset("iso-8859-1");
+        return codec;
+    }
 
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
diff --git 
a/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7MLLPCodecMessageFloodingTest.java
 
b/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7MLLPCodecMessageFloodingTest.java
index 4db63f6..b4ec72d 100644
--- 
a/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7MLLPCodecMessageFloodingTest.java
+++ 
b/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7MLLPCodecMessageFloodingTest.java
@@ -38,7 +38,7 @@ import org.junit.Test;
  * Unit test for the HL7MLLP Codec.
  */
 public class HL7MLLPCodecMessageFloodingTest extends HL7TestSupport {
-    
+
     @BindToRegistry("hl7codec")
     public HL7MLLPCodec addHl7MllpCodec() throws Exception {
         HL7MLLPCodec codec = new HL7MLLPCodec();
@@ -50,17 +50,14 @@ public class HL7MLLPCodecMessageFloodingTest extends 
HL7TestSupport {
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             public void configure() throws Exception {
-                from("mina2:tcp://127.0.0.1:" + getPort() + 
"?sync=true&codec=#hl7codec")
-                    .unmarshal().hl7()
-                    .process(new Processor() {
-                        public void process(Exchange exchange) throws 
Exception {
-                            Message input = 
exchange.getIn().getBody(Message.class);
-                            Message response = input.generateACK();
-                            exchange.getOut().setBody(response);
-                            Thread.sleep(50); // simulate some processing time
-                        }
-                    })
-                    .to("mock:result");
+                from("mina2:tcp://127.0.0.1:" + getPort() + 
"?sync=true&codec=#hl7codec").unmarshal().hl7().process(new Processor() {
+                    public void process(Exchange exchange) throws Exception {
+                        Message input = 
exchange.getIn().getBody(Message.class);
+                        Message response = input.generateACK();
+                        exchange.getOut().setBody(response);
+                        Thread.sleep(50); // simulate some processing time
+                    }
+                }).to("mock:result");
             }
         };
     }
@@ -86,7 +83,8 @@ public class HL7MLLPCodecMessageFloodingTest extends 
HL7TestSupport {
                     boolean cont = true;
                     while (cont && (response = inputStream.read()) >= 0) {
                         if (response == 28) {
-                            response = inputStream.read(); // read second end 
byte
+                            response = inputStream.read(); // read second end
+                                                           // byte
                             if (response == 13) {
                                 // Responses must arrive in same order
                                 cont = 
s.toString().contains(String.format("X%dX", i++));
@@ -94,7 +92,7 @@ public class HL7MLLPCodecMessageFloodingTest extends 
HL7TestSupport {
                                 latch.countDown();
                             }
                         } else {
-                            s.append((char) response);
+                            s.append((char)response);
                         }
                     }
                 } catch (IOException ignored) {
@@ -103,8 +101,7 @@ public class HL7MLLPCodecMessageFloodingTest extends 
HL7TestSupport {
         });
         t.start();
 
-        String in = 
"MSH|^~\\&|MYSENDER|MYRECEIVER|MYAPPLICATION||200612211200||QRY^A19|X%dX|P|2.4\r"
-                + "QRD|200612211200|R|I|GetPatient|||1^RD|0101701234|DEM||";
+        String in = 
"MSH|^~\\&|MYSENDER|MYRECEIVER|MYAPPLICATION||200612211200||QRY^A19|X%dX|P|2.4\r"
 + "QRD|200612211200|R|I|GetPatient|||1^RD|0101701234|DEM||";
         for (int i = 0; i < messageCount; i++) {
             String msg = String.format(in, i);
             outputStream.write(11);
diff --git 
a/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7MLLPCodecPlainStringTest.java
 
b/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7MLLPCodecPlainStringTest.java
index 09eb252..8755c94 100644
--- 
a/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7MLLPCodecPlainStringTest.java
+++ 
b/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7MLLPCodecPlainStringTest.java
@@ -24,8 +24,8 @@ import org.apache.camel.impl.JndiRegistry;
 import org.junit.Test;
 
 /**
- * Unit test to demonstrate the HL7MLLPCodec is message format agnostic (don't 
require the HAPI library).
- * The message format can be java.lang.String.
+ * Unit test to demonstrate the HL7MLLPCodec is message format agnostic (don't
+ * require the HAPI library). The message format can be java.lang.String.
  */
 public class HL7MLLPCodecPlainStringTest extends HL7TestSupport {
 
@@ -60,18 +60,16 @@ public class HL7MLLPCodecPlainStringTest extends 
HL7TestSupport {
         return new RouteBuilder() {
             public void configure() throws Exception {
                 // START SNIPPET: e2
-                from("mina2:tcp://127.0.0.1:" + getPort() + 
"?sync=true&codec=#hl7codec")
-                    .process(new Processor() {
-                        public void process(Exchange exchange) throws 
Exception {
-                            // use plain String as message format
-                            String body = 
exchange.getIn().getBody(String.class);
-                            assertEquals("Hello World", body);
+                from("mina2:tcp://127.0.0.1:" + getPort() + 
"?sync=true&codec=#hl7codec").process(new Processor() {
+                    public void process(Exchange exchange) throws Exception {
+                        // use plain String as message format
+                        String body = exchange.getIn().getBody(String.class);
+                        assertEquals("Hello World", body);
 
-                            // return the response as plain string
-                            exchange.getOut().setBody("Bye World");
-                        }
-                    })
-                    .to("mock:result");
+                        // return the response as plain string
+                        exchange.getOut().setBody("Bye World");
+                    }
+                }).to("mock:result");
                 // END SNIPPET: e2
             }
         };
diff --git 
a/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7MLLPCodecStandAndEndBytesTest.java
 
b/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7MLLPCodecStandAndEndBytesTest.java
index dcace7d..4389602 100644
--- 
a/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7MLLPCodecStandAndEndBytesTest.java
+++ 
b/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7MLLPCodecStandAndEndBytesTest.java
@@ -34,7 +34,7 @@ import org.junit.Test;
  */
 public class HL7MLLPCodecStandAndEndBytesTest extends HL7TestSupport {
 
-       @BindToRegistry("hl7codec")
+    @BindToRegistry("hl7codec")
     public HL7MLLPCodec addCodec() throws Exception {
 
         HL7MLLPCodec codec = new HL7MLLPCodec();
@@ -50,20 +50,18 @@ public class HL7MLLPCodecStandAndEndBytesTest extends 
HL7TestSupport {
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             public void configure() throws Exception {
-                from("mina2:tcp://127.0.0.1:" + getPort() + 
"?sync=true&codec=#hl7codec")
-                    .process(new Processor() {
-                        public void process(Exchange exchange) throws 
Exception {
-                            Message input = 
exchange.getIn().getBody(Message.class);
-
-                            assertEquals("2.4", input.getVersion());
-                            QRD qrd = (QRD)input.get("QRD");
-                            assertEquals("0101701234", 
qrd.getWhoSubjectFilter(0).getIDNumber().getValue());
-
-                            Message response = createHL7AsMessage();
-                            exchange.getOut().setBody(response);
-                        }
-                    })
-                    .to("mock:result");
+                from("mina2:tcp://127.0.0.1:" + getPort() + 
"?sync=true&codec=#hl7codec").process(new Processor() {
+                    public void process(Exchange exchange) throws Exception {
+                        Message input = 
exchange.getIn().getBody(Message.class);
+
+                        assertEquals("2.4", input.getVersion());
+                        QRD qrd = (QRD)input.get("QRD");
+                        assertEquals("0101701234", 
qrd.getWhoSubjectFilter(0).getIDNumber().getValue());
+
+                        Message response = createHL7AsMessage();
+                        exchange.getOut().setBody(response);
+                    }
+                }).to("mock:result");
             }
         };
     }
@@ -109,4 +107,4 @@ public class HL7MLLPCodecStandAndEndBytesTest extends 
HL7TestSupport {
         return adr;
     }
 
-}
\ No newline at end of file
+}
diff --git 
a/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7MLLPCodecTest.java
 
b/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7MLLPCodecTest.java
index b5d45c1..cfa3818 100644
--- 
a/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7MLLPCodecTest.java
+++ 
b/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7MLLPCodecTest.java
@@ -33,9 +33,8 @@ import org.junit.Test;
  * Unit test for the HL7MLLP Codec.
  */
 public class HL7MLLPCodecTest extends HL7TestSupport {
-    
 
-       @BindToRegistry("hl7codec")
+    @BindToRegistry("hl7codec")
     public HL7MLLPCodec addCodec() throws Exception {
         HL7MLLPCodec codec = new HL7MLLPCodec();
         codec.setCharset("iso-8859-1");
@@ -47,20 +46,18 @@ public class HL7MLLPCodecTest extends HL7TestSupport {
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             public void configure() throws Exception {
-                from("mina2:tcp://127.0.0.1:" + getPort() + 
"?sync=true&codec=#hl7codec")
-                    .process(new Processor() {
-                        public void process(Exchange exchange) throws 
Exception {
-                            Message input = 
exchange.getIn().getBody(Message.class);
-
-                            assertEquals("2.4", input.getVersion());
-                            QRD qrd = (QRD)input.get("QRD");
-                            assertEquals("0101701234", 
qrd.getWhoSubjectFilter(0).getIDNumber().getValue());
-
-                            Message response = createHL7AsMessage();
-                            exchange.getOut().setBody(response);
-                        }
-                    })
-                    .to("mock:result");
+                from("mina2:tcp://127.0.0.1:" + getPort() + 
"?sync=true&codec=#hl7codec").process(new Processor() {
+                    public void process(Exchange exchange) throws Exception {
+                        Message input = 
exchange.getIn().getBody(Message.class);
+
+                        assertEquals("2.4", input.getVersion());
+                        QRD qrd = (QRD)input.get("QRD");
+                        assertEquals("0101701234", 
qrd.getWhoSubjectFilter(0).getIDNumber().getValue());
+
+                        Message response = createHL7AsMessage();
+                        exchange.getOut().setBody(response);
+                    }
+                }).to("mock:result");
             }
         };
     }
diff --git 
a/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7MLLPNettyCodecBoundaryTest.java
 
b/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7MLLPNettyCodecBoundaryTest.java
index 5e36515..50f6031 100644
--- 
a/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7MLLPNettyCodecBoundaryTest.java
+++ 
b/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7MLLPNettyCodecBoundaryTest.java
@@ -36,21 +36,21 @@ import org.junit.Test;
  */
 public class HL7MLLPNettyCodecBoundaryTest extends HL7TestSupport {
 
-       @BindToRegistry("hl7decoder")
+    @BindToRegistry("hl7decoder")
     public HL7MLLPNettyDecoderFactory addNettyDecoder() throws Exception {
 
         HL7MLLPNettyDecoderFactory decoder = new HL7MLLPNettyDecoderFactory();
         decoder.setCharset("iso-8859-1");
-        
+
         return decoder;
 
     }
-       
+
     @BindToRegistry("hl7encoder")
     public HL7MLLPNettyEncoderFactory addNettyEncoder() throws Exception {
-    HL7MLLPNettyEncoderFactory encoder = new HL7MLLPNettyEncoderFactory();
-    encoder.setCharset("iso-8859-1");
-    return encoder;
+        HL7MLLPNettyEncoderFactory encoder = new HL7MLLPNettyEncoderFactory();
+        encoder.setCharset("iso-8859-1");
+        return encoder;
     }
 
     protected RouteBuilder createRouteBuilder() throws Exception {
@@ -66,7 +66,7 @@ public class HL7MLLPNettyCodecBoundaryTest extends 
HL7TestSupport {
         };
     }
 
-    @Test 
+    @Test
     public void testSendHL7Message() throws Exception {
         BufferedReader in = IOHelper.buffered(new 
InputStreamReader(getClass().getResourceAsStream("/mdm_t02-1022.txt")));
         String line = "";
diff --git 
a/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7MLLPNettyCodecByteArrayRouteTest.java
 
b/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7MLLPNettyCodecByteArrayRouteTest.java
index e0b707e..cf2fde3 100644
--- 
a/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7MLLPNettyCodecByteArrayRouteTest.java
+++ 
b/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7MLLPNettyCodecByteArrayRouteTest.java
@@ -33,25 +33,24 @@ import org.apache.camel.spi.DataFormat;
 import org.junit.Test;
 
 /**
- * Unit test for HL7 routing where the netty4 endpoint passes on a byte array 
instead of a string
- * and leaves charset interpretation to the dataformat.
+ * Unit test for HL7 routing where the netty4 endpoint passes on a byte array
+ * instead of a string and leaves charset interpretation to the dataformat.
  */
 public class HL7MLLPNettyCodecByteArrayRouteTest extends HL7TestSupport {
 
-       @BindToRegistry("hl7encoder")
-       private HL7MLLPNettyEncoderFactory encoder = new 
HL7MLLPNettyEncoderFactory();
-       
+    @BindToRegistry("hl7encoder")
+    private HL7MLLPNettyEncoderFactory encoder = new 
HL7MLLPNettyEncoderFactory();
+
     @BindToRegistry("hl7service")
     private MyHL7BusinessLogic logic = new MyHL7BusinessLogic();
-       
-       @BindToRegistry("hl7decoder")
+
+    @BindToRegistry("hl7decoder")
     public HL7MLLPNettyDecoderFactory addDecoder() throws Exception {
 
         HL7MLLPNettyDecoderFactory decoder = new HL7MLLPNettyDecoderFactory();
         decoder.setProduceString(false);
         return decoder;
-       }
-
+    }
 
     @Test
     public void testSendA19() throws Exception {
@@ -123,25 +122,25 @@ public class HL7MLLPNettyCodecByteArrayRouteTest extends 
HL7TestSupport {
             public void configure() throws Exception {
                 // START SNIPPET: e1
                 DataFormat hl7 = new HL7DataFormat();
-                // we setup or HL7 listener on port 8888 (using the hl7codec) 
and in sync mode so we can return a response
+                // we setup or HL7 listener on port 8888 (using the hl7codec)
+                // and in sync mode so we can return a response
                 from("netty4:tcp://127.0.0.1:" + getPort() + 
"?sync=true&encoder=#hl7encoder&decoder=#hl7decoder")
-                    // we use the HL7 data format to unmarshal from HL7 stream 
to the HAPI Message model
-                    // this ensures that the camel message has been enriched 
with hl7 specific headers to
+                    // we use the HL7 data format to unmarshal from HL7 stream
+                    // to the HAPI Message model
+                    // this ensures that the camel message has been enriched
+                    // with hl7 specific headers to
                     // make the routing much easier (see below)
                     .unmarshal(hl7)
                     // using choice as the content base router
                     .choice()
-                        // where we choose that A19 queries invoke the 
handleA19 method on our hl7service bean
-                        .when(header("CamelHL7TriggerEvent").isEqualTo("A19"))
-                            .bean("hl7service", "handleA19")
-                            .to("mock:a19")
-                        // and A01 should invoke the handleA01 method on our 
hl7service bean
-                        
.when(header("CamelHL7TriggerEvent").isEqualTo("A01")).to("mock:a01")
-                            .bean("hl7service", "handleA01")
-                            .to("mock:a19")
-                        // other types should go to mock:unknown
-                        .otherwise()
-                            .to("mock:unknown")
+                    // where we choose that A19 queries invoke the handleA19
+                    // method on our hl7service bean
+                    
.when(header("CamelHL7TriggerEvent").isEqualTo("A19")).bean("hl7service", 
"handleA19").to("mock:a19")
+                    // and A01 should invoke the handleA01 method on our
+                    // hl7service bean
+                    
.when(header("CamelHL7TriggerEvent").isEqualTo("A01")).to("mock:a01").bean("hl7service",
 "handleA01").to("mock:a19")
+                    // other types should go to mock:unknown
+                    .otherwise().to("mock:unknown")
                     // end choice block
                     .end()
                     // marshal response back
@@ -154,7 +153,8 @@ public class HL7MLLPNettyCodecByteArrayRouteTest extends 
HL7TestSupport {
     public class MyHL7BusinessLogic {
 
         // This is a plain POJO that has NO imports whatsoever on Apache Camel.
-        // its a plain POJO only importing the HAPI library so we can much 
easier work with the HL7 format.
+        // its a plain POJO only importing the HAPI library so we can much
+        // easier work with the HL7 format.
 
         public Message handleA19(Message msg) throws Exception {
             // here you can have your business logic for A19 messages
diff --git 
a/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7MLLPNettyCodecLongTest.java
 
b/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7MLLPNettyCodecLongTest.java
index ea770f2..d1b779c 100644
--- 
a/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7MLLPNettyCodecLongTest.java
+++ 
b/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7MLLPNettyCodecLongTest.java
@@ -36,21 +36,21 @@ import org.junit.Test;
  */
 public class HL7MLLPNettyCodecLongTest extends HL7TestSupport {
 
-       @BindToRegistry("hl7decoder")
+    @BindToRegistry("hl7decoder")
     public HL7MLLPNettyDecoderFactory addDecoder() throws Exception {
 
         HL7MLLPNettyDecoderFactory decoder = new HL7MLLPNettyDecoderFactory();
         decoder.setCharset("iso-8859-1");
         return decoder;
-       }
+    }
 
     @BindToRegistry("hl7encoder")
- public HL7MLLPNettyEncoderFactory addEncoder() throws Exception {
+    public HL7MLLPNettyEncoderFactory addEncoder() throws Exception {
 
         HL7MLLPNettyEncoderFactory encoder = new HL7MLLPNettyEncoderFactory();
         encoder.setCharset("iso-8859-1");
         return encoder;
-     }
+    }
 
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
diff --git 
a/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7MLLPNettyCodecStandAndEndBytesTest.java
 
b/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7MLLPNettyCodecStandAndEndBytesTest.java
index e8a1e63..844c746 100644
--- 
a/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7MLLPNettyCodecStandAndEndBytesTest.java
+++ 
b/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7MLLPNettyCodecStandAndEndBytesTest.java
@@ -33,7 +33,7 @@ import org.junit.Test;
  * Unit test for the HL7MLLP Codec using different start and end bytes.
  */
 public class HL7MLLPNettyCodecStandAndEndBytesTest extends HL7TestSupport {
-    
+
     @BindToRegistry("hl7decoder")
     public HL7MLLPNettyDecoderFactory addDecoder() throws Exception {
 
@@ -45,7 +45,7 @@ public class HL7MLLPNettyCodecStandAndEndBytesTest extends 
HL7TestSupport {
         decoder.setEndByte2('*');
         decoder.setConvertLFtoCR(false);
         return decoder;
-        }
+    }
 
     @BindToRegistry("hl7encoder")
     public HL7MLLPNettyEncoderFactory addEncoder() throws Exception {
@@ -58,25 +58,23 @@ public class HL7MLLPNettyCodecStandAndEndBytesTest extends 
HL7TestSupport {
         encoder.setEndByte2('*');
         encoder.setConvertLFtoCR(false);
         return encoder;
-     }
+    }
 
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             public void configure() throws Exception {
-                from("netty4:tcp://127.0.0.1:" + getPort() + 
"?sync=true&decoder=#hl7decoder&encoder=#hl7encoder")
-                    .process(new Processor() {
-                        public void process(Exchange exchange) throws 
Exception {
-                            Message input = 
exchange.getIn().getBody(Message.class);
-
-                            assertEquals("2.4", input.getVersion());
-                            QRD qrd = (QRD)input.get("QRD");
-                            assertEquals("0101701234", 
qrd.getWhoSubjectFilter(0).getIDNumber().getValue());
-
-                            Message response = createHL7AsMessage();
-                            exchange.getOut().setBody(response);
-                        }
-                    })
-                    .to("mock:result");
+                from("netty4:tcp://127.0.0.1:" + getPort() + 
"?sync=true&decoder=#hl7decoder&encoder=#hl7encoder").process(new Processor() {
+                    public void process(Exchange exchange) throws Exception {
+                        Message input = 
exchange.getIn().getBody(Message.class);
+
+                        assertEquals("2.4", input.getVersion());
+                        QRD qrd = (QRD)input.get("QRD");
+                        assertEquals("0101701234", 
qrd.getWhoSubjectFilter(0).getIDNumber().getValue());
+
+                        Message response = createHL7AsMessage();
+                        exchange.getOut().setBody(response);
+                    }
+                }).to("mock:result");
             }
         };
     }
diff --git 
a/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7MLLPNettyCodecTest.java
 
b/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7MLLPNettyCodecTest.java
index 2aeb6cd..92718a6 100644
--- 
a/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7MLLPNettyCodecTest.java
+++ 
b/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7MLLPNettyCodecTest.java
@@ -33,7 +33,7 @@ import org.junit.Test;
  * Unit test for the HL7MLLPNetty Codec.
  */
 public class HL7MLLPNettyCodecTest extends HL7TestSupport {
-    
+
     @BindToRegistry("hl7decoder")
     public HL7MLLPNettyDecoderFactory addDecoder() throws Exception {
 
@@ -41,7 +41,7 @@ public class HL7MLLPNettyCodecTest extends HL7TestSupport {
         decoder.setCharset("iso-8859-1");
         decoder.setConvertLFtoCR(true);
         return decoder;
-        }
+    }
 
     @BindToRegistry("hl7encoder")
     public HL7MLLPNettyEncoderFactory addEncoder() throws Exception {
@@ -50,25 +50,23 @@ public class HL7MLLPNettyCodecTest extends HL7TestSupport {
         encoder.setCharset("iso-8859-1");
         encoder.setConvertLFtoCR(true);
         return encoder;
-     }
+    }
 
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             public void configure() throws Exception {
-                from("netty4:tcp://127.0.0.1:" + getPort() + 
"?sync=true&decoder=#hl7decoder&encoder=#hl7encoder")
-                    .process(new Processor() {
-                        public void process(Exchange exchange) throws 
Exception {
-                            Message input = 
exchange.getIn().getBody(Message.class);
-
-                            assertEquals("2.4", input.getVersion());
-                            QRD qrd = (QRD)input.get("QRD");
-                            assertEquals("0101701234", 
qrd.getWhoSubjectFilter(0).getIDNumber().getValue());
-
-                            Message response = createHL7AsMessage();
-                            exchange.getOut().setBody(response);
-                        }
-                    })
-                    .to("mock:result");
+                from("netty4:tcp://127.0.0.1:" + getPort() + 
"?sync=true&decoder=#hl7decoder&encoder=#hl7encoder").process(new Processor() {
+                    public void process(Exchange exchange) throws Exception {
+                        Message input = 
exchange.getIn().getBody(Message.class);
+
+                        assertEquals("2.4", input.getVersion());
+                        QRD qrd = (QRD)input.get("QRD");
+                        assertEquals("0101701234", 
qrd.getWhoSubjectFilter(0).getIDNumber().getValue());
+
+                        Message response = createHL7AsMessage();
+                        exchange.getOut().setBody(response);
+                    }
+                }).to("mock:result");
             }
         };
     }
diff --git 
a/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7MLLPNettyDecoderResourceLeakTest.java
 
b/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7MLLPNettyDecoderResourceLeakTest.java
index 9777021..30db18d 100644
--- 
a/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7MLLPNettyDecoderResourceLeakTest.java
+++ 
b/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7MLLPNettyDecoderResourceLeakTest.java
@@ -15,6 +15,7 @@
  * limitations under the License.
  */
 package org.apache.camel.component.hl7;
+
 import ca.uhn.hl7v2.model.Message;
 import io.netty.util.ResourceLeakDetector;
 
@@ -28,15 +29,15 @@ import org.junit.Test;
 
 public class HL7MLLPNettyDecoderResourceLeakTest extends HL7TestSupport {
 
-       @BindToRegistry("hl7decoder")
-       HL7MLLPNettyDecoderFactory decoder = new HL7MLLPNettyDecoderFactory();
-       
+    @BindToRegistry("hl7decoder")
+    HL7MLLPNettyDecoderFactory decoder = new HL7MLLPNettyDecoderFactory();
+
     @BindToRegistry("hl7encoder")
     HL7MLLPNettyEncoderFactory encoder = new HL7MLLPNettyEncoderFactory();
-    
+
     @BeforeClass
-    // As the ResourceLeakDetector just write error log when it find the leak, 
 
-    // We need to check the log file to see if there is a leak. 
+    // As the ResourceLeakDetector just write error log when it find the leak,
+    // We need to check the log file to see if there is a leak.
     public static void enableNettyResourceLeakDetector() {
         ResourceLeakDetector.setLevel(ResourceLeakDetector.Level.PARANOID);
     }
@@ -44,14 +45,12 @@ public class HL7MLLPNettyDecoderResourceLeakTest extends 
HL7TestSupport {
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             public void configure() throws Exception {
-                from("netty4:tcp://127.0.0.1:" + getPort() + 
"?decoder=#hl7decoder&encoder=#hl7encoder")
-                        .process(new Processor() {
-                            public void process(Exchange exchange) throws 
Exception {
-                                Message input = 
exchange.getIn().getBody(Message.class);
-                                exchange.getOut().setBody(input.generateACK());
-                            }
-                        })
-                        .to("mock:result");
+                from("netty4:tcp://127.0.0.1:" + getPort() + 
"?decoder=#hl7decoder&encoder=#hl7encoder").process(new Processor() {
+                    public void process(Exchange exchange) throws Exception {
+                        Message input = 
exchange.getIn().getBody(Message.class);
+                        exchange.getOut().setBody(input.generateACK());
+                    }
+                }).to("mock:result");
             }
         };
     }
diff --git 
a/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7MLLPNettyRouteToTest.java
 
b/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7MLLPNettyRouteToTest.java
index 15a790b..39969ad 100644
--- 
a/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7MLLPNettyRouteToTest.java
+++ 
b/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7MLLPNettyRouteToTest.java
@@ -33,7 +33,7 @@ import org.junit.Test;
  * Unit test for the HL7MLLPNetty Codec.
  */
 public class HL7MLLPNettyRouteToTest extends HL7TestSupport {
-    
+
     @BindToRegistry("hl7decoder")
     public HL7MLLPNettyDecoderFactory addDecoder() throws Exception {
 
@@ -41,7 +41,7 @@ public class HL7MLLPNettyRouteToTest extends HL7TestSupport {
         decoder.setCharset("iso-8859-1");
         decoder.setConvertLFtoCR(true);
         return decoder;
-        }
+    }
 
     @BindToRegistry("hl7encoder")
     public HL7MLLPNettyEncoderFactory addEncoder() throws Exception {
@@ -50,30 +50,28 @@ public class HL7MLLPNettyRouteToTest extends HL7TestSupport 
{
         encoder.setCharset("iso-8859-1");
         encoder.setConvertLFtoCR(true);
         return encoder;
-     }
+    }
 
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             public void configure() throws Exception {
-                from("direct:start")
-                    .to("netty4:tcp://127.0.0.1:" + getPort() + 
"?sync=true&decoder=#hl7decoder&encoder=#hl7encoder")
-                    // because HL7 message contains a bunch of control chars 
then the logger do not log all of the data
-                    .log("HL7 message: ${body}")
-                    .to("mock:result");
-
-                from("netty4:tcp://127.0.0.1:" + getPort() + 
"?sync=true&decoder=#hl7decoder&encoder=#hl7encoder")
-                    .process(new Processor() {
-                        public void process(Exchange exchange) throws 
Exception {
-                            Message input = 
exchange.getIn().getBody(Message.class);
-
-                            assertEquals("2.4", input.getVersion());
-                            QRD qrd = (QRD)input.get("QRD");
-                            assertEquals("0101701234", 
qrd.getWhoSubjectFilter(0).getIDNumber().getValue());
-
-                            Message response = createHL7AsMessage();
-                            exchange.getOut().setBody(response);
-                        }
-                    });
+                from("direct:start").to("netty4:tcp://127.0.0.1:" + getPort() 
+ "?sync=true&decoder=#hl7decoder&encoder=#hl7encoder")
+                    // because HL7 message contains a bunch of control chars
+                    // then the logger do not log all of the data
+                    .log("HL7 message: ${body}").to("mock:result");
+
+                from("netty4:tcp://127.0.0.1:" + getPort() + 
"?sync=true&decoder=#hl7decoder&encoder=#hl7encoder").process(new Processor() {
+                    public void process(Exchange exchange) throws Exception {
+                        Message input = 
exchange.getIn().getBody(Message.class);
+
+                        assertEquals("2.4", input.getVersion());
+                        QRD qrd = (QRD)input.get("QRD");
+                        assertEquals("0101701234", 
qrd.getWhoSubjectFilter(0).getIDNumber().getValue());
+
+                        Message response = createHL7AsMessage();
+                        exchange.getOut().setBody(response);
+                    }
+                });
             }
         };
     }
diff --git 
a/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7NettyRouteTest.java
 
b/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7NettyRouteTest.java
index 2945dae..047f803 100644
--- 
a/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7NettyRouteTest.java
+++ 
b/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7NettyRouteTest.java
@@ -36,17 +36,17 @@ import org.junit.Test;
  * Unit test for HL7 routing.
  */
 public class HL7NettyRouteTest extends HL7TestSupport {
-    
+
     @BindToRegistry("hl7service")
     MyHL7BusinessLogic logic = new MyHL7BusinessLogic();
-    
+
     @BindToRegistry("hl7decoder")
     public HL7MLLPNettyDecoderFactory addDecoder() throws Exception {
 
         HL7MLLPNettyDecoderFactory decoder = new HL7MLLPNettyDecoderFactory();
         decoder.setCharset("iso-8859-1");
         return decoder;
-        }
+    }
 
     @BindToRegistry("hl7encoder")
     public HL7MLLPNettyEncoderFactory addEncoder() throws Exception {
@@ -54,7 +54,7 @@ public class HL7NettyRouteTest extends HL7TestSupport {
         HL7MLLPNettyEncoderFactory encoder = new HL7MLLPNettyEncoderFactory();
         encoder.setCharset("iso-8859-1");
         return encoder;
-     }
+    }
 
     @Test
     public void testSendA19() throws Exception {
@@ -126,25 +126,25 @@ public class HL7NettyRouteTest extends HL7TestSupport {
             public void configure() throws Exception {
                 // START SNIPPET: e1
                 DataFormat hl7 = new HL7DataFormat();
-                // we setup or HL7 listener on port 8888 (using the hl7codec) 
and in sync mode so we can return a response
+                // we setup or HL7 listener on port 8888 (using the hl7codec)
+                // and in sync mode so we can return a response
                 from("netty4:tcp://127.0.0.1:" + getPort() + 
"?sync=true&decoder=#hl7decoder&encoder=#hl7encoder")
-                    // we use the HL7 data format to unmarshal from HL7 stream 
to the HAPI Message model
-                    // this ensures that the camel message has been enriched 
with hl7 specific headers to
+                    // we use the HL7 data format to unmarshal from HL7 stream
+                    // to the HAPI Message model
+                    // this ensures that the camel message has been enriched
+                    // with hl7 specific headers to
                     // make the routing much easier (see below)
                     .unmarshal(hl7)
                     // using choice as the content base router
                     .choice()
-                        // where we choose that A19 queries invoke the 
handleA19 method on our hl7service bean
-                        .when(header("CamelHL7TriggerEvent").isEqualTo("A19"))
-                            .bean("hl7service", "handleA19")
-                            .to("mock:a19")
-                        // and A01 should invoke the handleA01 method on our 
hl7service bean
-                        
.when(header("CamelHL7TriggerEvent").isEqualTo("A01")).to("mock:a01")
-                            .bean("hl7service", "handleA01")
-                            .to("mock:a19")
-                        // other types should go to mock:unknown
-                        .otherwise()
-                            .to("mock:unknown")
+                    // where we choose that A19 queries invoke the handleA19
+                    // method on our hl7service bean
+                    
.when(header("CamelHL7TriggerEvent").isEqualTo("A19")).bean("hl7service", 
"handleA19").to("mock:a19")
+                    // and A01 should invoke the handleA01 method on our
+                    // hl7service bean
+                    
.when(header("CamelHL7TriggerEvent").isEqualTo("A01")).to("mock:a01").bean("hl7service",
 "handleA01").to("mock:a19")
+                    // other types should go to mock:unknown
+                    .otherwise().to("mock:unknown")
                     // end choice block
                     .end()
                     // marshal response back
@@ -158,7 +158,8 @@ public class HL7NettyRouteTest extends HL7TestSupport {
     public class MyHL7BusinessLogic {
 
         // This is a plain POJO that has NO imports whatsoever on Apache Camel.
-        // its a plain POJO only importing the HAPI library so we can much 
easier work with the HL7 format.
+        // its a plain POJO only importing the HAPI library so we can much
+        // easier work with the HL7 format.
 
         public Message handleA19(Message msg) throws Exception {
             // here you can have your business logic for A19 messages
diff --git 
a/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7RouteTest.java
 
b/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7RouteTest.java
index c673ca5..3a42ede 100644
--- 
a/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7RouteTest.java
+++ 
b/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7RouteTest.java
@@ -37,8 +37,8 @@ import org.junit.Test;
  */
 public class HL7RouteTest extends HL7TestSupport {
     @BindToRegistry("hl7service")
-       MyHL7BusinessLogic logic = new MyHL7BusinessLogic();
-    
+    MyHL7BusinessLogic logic = new MyHL7BusinessLogic();
+
     @BindToRegistry("hl7codec")
     public HL7MLLPCodec addCodec() throws Exception {
 
@@ -118,25 +118,25 @@ public class HL7RouteTest extends HL7TestSupport {
             public void configure() throws Exception {
                 // START SNIPPET: e1
                 DataFormat hl7 = new HL7DataFormat();
-                // we setup or HL7 listener on port 8888 (using the hl7codec) 
and in sync mode so we can return a response
+                // we setup or HL7 listener on port 8888 (using the hl7codec)
+                // and in sync mode so we can return a response
                 from("mina2:tcp://127.0.0.1:" + getPort() + 
"?sync=true&codec=#hl7codec")
-                    // we use the HL7 data format to unmarshal from HL7 stream 
to the HAPI Message model
-                    // this ensures that the camel message has been enriched 
with hl7 specific headers to
+                    // we use the HL7 data format to unmarshal from HL7 stream
+                    // to the HAPI Message model
+                    // this ensures that the camel message has been enriched
+                    // with hl7 specific headers to
                     // make the routing much easier (see below)
                     .unmarshal(hl7)
                     // using choice as the content base router
                     .choice()
-                        // where we choose that A19 queries invoke the 
handleA19 method on our hl7service bean
-                        .when(header("CamelHL7TriggerEvent").isEqualTo("A19"))
-                            .bean("hl7service", "handleA19")
-                            .to("mock:a19")
-                        // and A01 should invoke the handleA01 method on our 
hl7service bean
-                        
.when(header("CamelHL7TriggerEvent").isEqualTo("A01")).to("mock:a01")
-                            .bean("hl7service", "handleA01")
-                            .to("mock:a19")
-                        // other types should go to mock:unknown
-                        .otherwise()
-                            .to("mock:unknown")
+                    // where we choose that A19 queries invoke the handleA19
+                    // method on our hl7service bean
+                    
.when(header("CamelHL7TriggerEvent").isEqualTo("A19")).bean("hl7service", 
"handleA19").to("mock:a19")
+                    // and A01 should invoke the handleA01 method on our
+                    // hl7service bean
+                    
.when(header("CamelHL7TriggerEvent").isEqualTo("A01")).to("mock:a01").bean("hl7service",
 "handleA01").to("mock:a19")
+                    // other types should go to mock:unknown
+                    .otherwise().to("mock:unknown")
                     // end choice block
                     .end()
                     // marshal response back
@@ -150,7 +150,8 @@ public class HL7RouteTest extends HL7TestSupport {
     public class MyHL7BusinessLogic {
 
         // This is a plain POJO that has NO imports whatsoever on Apache Camel.
-        // its a plain POJO only importing the HAPI library so we can much 
easier work with the HL7 format.
+        // its a plain POJO only importing the HAPI library so we can much
+        // easier work with the HL7 format.
 
         public Message handleA19(Message msg) throws Exception {
             // here you can have your business logic for A19 messages

Reply via email to