camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acosent...@apache.org
Subject [camel] branch master updated: CAMEL-13801 - camel3 - Use @BindToRegistry wherever possible, Camel-Syslog
Date Thu, 01 Aug 2019 14:42:40 GMT
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


The following commit(s) were added to refs/heads/master by this push:
     new 64fd094  CAMEL-13801 - camel3 - Use @BindToRegistry wherever possible, Camel-Syslog
64fd094 is described below

commit 64fd0947e7a4c860d9c81bf9f7a9d4fd45326221
Author: Andrea Cosentino <ancosen@gmail.com>
AuthorDate: Thu Aug 1 16:39:46 2019 +0200

    CAMEL-13801 - camel3 - Use @BindToRegistry wherever possible, Camel-Syslog
---
 .../component/syslog/NettyRfc5425LongMessageTest.java  | 18 +++++++++---------
 .../camel/component/syslog/NettyRfc5425Test.java       | 17 ++++++++---------
 2 files changed, 17 insertions(+), 18 deletions(-)

diff --git a/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyRfc5425LongMessageTest.java
b/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyRfc5425LongMessageTest.java
index aabba9e..d93b28a 100644
--- a/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyRfc5425LongMessageTest.java
+++ b/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyRfc5425LongMessageTest.java
@@ -16,6 +16,8 @@
  */
 package org.apache.camel.component.syslog;
 import io.netty.buffer.ByteBuf;
+
+import org.apache.camel.BindToRegistry;
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
@@ -24,6 +26,7 @@ import org.apache.camel.component.syslog.netty.Rfc5425Encoder;
 import org.apache.camel.component.syslog.netty.Rfc5425FrameDecoder;
 import org.apache.camel.impl.JndiRegistry;
 import org.apache.camel.spi.DataFormat;
+import org.apache.camel.spi.Registry;
 import org.apache.camel.test.AvailablePortFinder;
 import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.BeforeClass;
@@ -46,20 +49,17 @@ public class NettyRfc5425LongMessageTest extends CamelTestSupport {
         + "\n Semper aliquid fabulas ei mel. Vix ei nullam malorum bonorum, movet nemore
scaevola cu vel. "
         + "Quo ut esse dictas incorrupte, ex denique splendide nec, mei dicit doming omnium
no. Nulla putent nec id, vis vide ignota eligendi in.";
 
+    @BindToRegistry("decoder")
+    private Rfc5425FrameDecoder decoder = new Rfc5425FrameDecoder();
+    @BindToRegistry("encoder")
+    private Rfc5425Encoder encoder = new Rfc5425Encoder();    
+    
     @BeforeClass
     public static void initPort() {
         serverPort = AvailablePortFinder.getNextAvailable();
         uri = "netty4:tcp://localhost:" + serverPort + "?sync=false&allowDefaultCodec=false&decoders=#decoder&encoder=#encoder";
     }
 
-    @Override
-    protected JndiRegistry createRegistry() throws Exception {
-        JndiRegistry jndi = super.createRegistry();
-        jndi.bind("decoder", new Rfc5425FrameDecoder());
-        jndi.bind("encoder", new Rfc5425Encoder());
-        return jndi;
-    }
-
     @Test
     public void testSendingCamel() throws Exception {
 
@@ -76,7 +76,7 @@ public class NettyRfc5425LongMessageTest extends CamelTestSupport {
 
     @Override
     protected RouteBuilder createRouteBuilder() throws Exception {
-        context().getRegistry(JndiRegistry.class).bind("rfc5426FrameDecoder", new Rfc5425FrameDecoder());
+        context().getRegistry(Registry.class).bind("rfc5426FrameDecoder", new Rfc5425FrameDecoder());
 
         return new RouteBuilder() {
             @Override
diff --git a/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyRfc5425Test.java
b/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyRfc5425Test.java
index 00f5817..9b9093a 100644
--- a/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyRfc5425Test.java
+++ b/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyRfc5425Test.java
@@ -15,6 +15,7 @@
  * limitations under the License.
  */
 package org.apache.camel.component.syslog;
+import org.apache.camel.BindToRegistry;
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
@@ -23,6 +24,7 @@ import org.apache.camel.component.syslog.netty.Rfc5425Encoder;
 import org.apache.camel.component.syslog.netty.Rfc5425FrameDecoder;
 import org.apache.camel.impl.JndiRegistry;
 import org.apache.camel.spi.DataFormat;
+import org.apache.camel.spi.Registry;
 import org.apache.camel.test.AvailablePortFinder;
 import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.BeforeClass;
@@ -39,6 +41,11 @@ public class NettyRfc5425Test extends CamelTestSupport {
     private final String rfc5424WithStructuredData = "<34>1 2003-10-11T22:14:15.003Z
mymachine.example.com su - ID47 "
         + "[exampleSDID@32473 iut=\"3\" eventSource=\"Application\" eventID=\"1011\"] BOM'su
root' failed for lonvick on /dev/pts/8";
 
+    @BindToRegistry("decoder")
+    private Rfc5425FrameDecoder decoder = new Rfc5425FrameDecoder();
+    @BindToRegistry("encoder")
+    private Rfc5425Encoder encoder = new Rfc5425Encoder(); 
+    
     @BeforeClass
     public static void initPort() {
         serverPort = AvailablePortFinder.getNextAvailable();
@@ -46,14 +53,6 @@ public class NettyRfc5425Test extends CamelTestSupport {
         uriClient = uri + "&useByteBuf=true";
     }
 
-    @Override
-    protected JndiRegistry createRegistry() throws Exception {
-        JndiRegistry jndi = super.createRegistry();
-        jndi.bind("decoder", new Rfc5425FrameDecoder());
-        jndi.bind("encoder", new Rfc5425Encoder());
-        return jndi;
-    }
-
     @Test
     public void testSendingCamel() throws Exception {
 
@@ -79,7 +78,7 @@ public class NettyRfc5425Test extends CamelTestSupport {
 
     @Override
     protected RouteBuilder createRouteBuilder() throws Exception {
-        context().getRegistry(JndiRegistry.class).bind("rfc5426FrameDecoder", new Rfc5425FrameDecoder());
+        context().getRegistry(Registry.class).bind("rfc5426FrameDecoder", new Rfc5425FrameDecoder());
 
         return new RouteBuilder() {
             @Override


Mime
View raw message