You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2014/09/07 09:22:48 UTC

[3/6] git commit: Also use the correct rfc number in unit test

Also use the correct rfc number in unit test


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/35eaafca
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/35eaafca
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/35eaafca

Branch: refs/heads/master
Commit: 35eaafca2d5f1d08e1c268fc6176bd687bc3dd21
Parents: c3663ef
Author: svenrienstra <sv...@topicus.nl>
Authored: Fri May 30 11:34:28 2014 +0200
Committer: svenrienstra <sv...@topicus.nl>
Committed: Fri May 30 11:34:28 2014 +0200

----------------------------------------------------------------------
 .../syslog/NettyRfc5425LongMessageTest.java     | 88 +++++++++++++++++++
 .../component/syslog/NettyRfc5425Test.java      | 91 ++++++++++++++++++++
 .../syslog/NettyRfc5426LongMessageTest.java     | 88 -------------------
 .../component/syslog/NettyRfc5426Test.java      | 91 --------------------
 4 files changed, 179 insertions(+), 179 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/35eaafca/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyRfc5425LongMessageTest.java
----------------------------------------------------------------------
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
new file mode 100644
index 0000000..0ef956e
--- /dev/null
+++ b/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyRfc5425LongMessageTest.java
@@ -0,0 +1,88 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.camel.component.syslog;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+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.test.AvailablePortFinder;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.jboss.netty.buffer.BigEndianHeapChannelBuffer;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class NettyRfc5425LongMessageTest extends CamelTestSupport {
+
+    private static String uri;
+    private static int serverPort;
+    private final String message = "<34>1 2003-10-11T22:14:15.003Z mymachine.example.com su - ID47 - Lorem ipsum dolor sit amet, tempor democritum vix ad, est partiendo laboramus ei. Munere laudem commune vis ad, et qui altera singulis. Ut assum deleniti sit, vix constituto assueverit appellantur at, et meis voluptua usu. Quem imperdiet in ius, mei ex dictas mandamus, ut pri tation appetere oportere. Et est harum dictas. \n Omnis quaestio mel te, ex duo autem molestie. Ei sed dico minim, nominavi facilisis evertitur quo an, te adipiscing contentiones his. Cum partem deseruisse at, ne iuvaret mediocritatem pro. Ex prima utinam convenire usu, volumus legendos nec et, natum putant quo ne. Invidunt necessitatibus at ius, ne eum wisi dicat mediocrem. \n Cu usu odio labores sententiae. Ex eos duis singulis necessitatibus, dico omittam vix at. Sit iudico option detracto an, sit no modus exerci oportere. Vix dicta munere at, no vis feugiat omnesque convenire. Duo at quod illum dolor, nec am
 et tantas iisque no, mei quod graece volutpat ea.\n Ornatus legendos theophrastus id mei. Cum alia assum abhorreant et, nam indoctum intellegebat ei. Unum constituto quo cu. Vero tritani sit ei, ea commodo menandri usu, ponderum hendrerit voluptatibus sed te. \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.";
+
+    @BeforeClass
+    public static void initPort() {
+        serverPort = AvailablePortFinder.getNextAvailable();
+        uri = "netty: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 {
+
+        MockEndpoint mock = getMockEndpoint("mock:syslogReceiver");
+        MockEndpoint mock2 = getMockEndpoint("mock:syslogReceiver2");
+        mock.expectedMessageCount(1);
+        mock2.expectedMessageCount(1);
+        mock2.expectedBodiesReceived(message);
+
+        template.sendBody(uri, new BigEndianHeapChannelBuffer(message.getBytes("UTF8")));
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        context().getRegistry(JndiRegistry.class).bind("rfc5426FrameDecoder", new Rfc5425FrameDecoder());
+
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                context.setTracing(true);
+                DataFormat syslogDataFormat = new SyslogDataFormat();
+
+                // we setup a Syslog listener on a random port.
+                from(uri).unmarshal(syslogDataFormat).process(new Processor() {
+                    @Override
+                    public void process(Exchange ex) {
+                        assertTrue(ex.getIn().getBody() instanceof SyslogMessage);
+                    }
+                }).to("mock:syslogReceiver").marshal(syslogDataFormat).to("mock:syslogReceiver2");
+            }
+        };
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/35eaafca/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyRfc5425Test.java
----------------------------------------------------------------------
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
new file mode 100644
index 0000000..e206833
--- /dev/null
+++ b/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyRfc5425Test.java
@@ -0,0 +1,91 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.camel.component.syslog;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+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.test.AvailablePortFinder;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.jboss.netty.buffer.BigEndianHeapChannelBuffer;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class NettyRfc5425Test extends CamelTestSupport {
+
+    private static String uri;
+    private static int serverPort;
+    private final String rfc3164Message = "<165>Aug  4 05:34:00 mymachine myproc[10]: %% It's\n         time to make the do-nuts.  %%  Ingredients: Mix=OK, Jelly=OK #\n"
+                                          + "         Devices: Mixer=OK, Jelly_Injector=OK, Frier=OK # Transport:\n" + "         Conveyer1=OK, Conveyer2=OK # %%";
+    private final String rfc5424Message = "<34>1 2003-10-11T22:14:15.003Z mymachine.example.com su - ID47 - BOM'su root' failed for lonvick on /dev/pts/8";
+
+    @BeforeClass
+    public static void initPort() {
+        serverPort = AvailablePortFinder.getNextAvailable();
+        uri = "netty: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 {
+
+        MockEndpoint mock = getMockEndpoint("mock:syslogReceiver");
+        MockEndpoint mock2 = getMockEndpoint("mock:syslogReceiver2");
+        mock.expectedMessageCount(2);
+        mock2.expectedMessageCount(2);
+        mock2.expectedBodiesReceived(rfc3164Message, rfc5424Message);
+
+        template.sendBody(uri, new BigEndianHeapChannelBuffer(rfc3164Message.getBytes("UTF8")));
+        template.sendBody(uri, new BigEndianHeapChannelBuffer(rfc5424Message.getBytes("UTF8")));
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        context().getRegistry(JndiRegistry.class).bind("rfc5426FrameDecoder", new Rfc5425FrameDecoder());
+
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                context.setTracing(true);
+                DataFormat syslogDataFormat = new SyslogDataFormat();
+
+                // we setup a Syslog listener on a random port.
+                from(uri).unmarshal(syslogDataFormat).process(new Processor() {
+                    @Override
+                    public void process(Exchange ex) {
+                        assertTrue(ex.getIn().getBody() instanceof SyslogMessage);
+                    }
+                }).to("mock:syslogReceiver").marshal(syslogDataFormat).to("mock:syslogReceiver2");
+            }
+        };
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/35eaafca/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyRfc5426LongMessageTest.java
----------------------------------------------------------------------
diff --git a/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyRfc5426LongMessageTest.java b/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyRfc5426LongMessageTest.java
deleted file mode 100644
index 859efdd..0000000
--- a/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyRfc5426LongMessageTest.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.camel.component.syslog;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
-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.test.AvailablePortFinder;
-import org.apache.camel.test.junit4.CamelTestSupport;
-import org.jboss.netty.buffer.BigEndianHeapChannelBuffer;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-public class NettyRfc5426LongMessageTest extends CamelTestSupport {
-
-    private static String uri;
-    private static int serverPort;
-    private final String message = "<34>1 2003-10-11T22:14:15.003Z mymachine.example.com su - ID47 - Lorem ipsum dolor sit amet, tempor democritum vix ad, est partiendo laboramus ei. Munere laudem commune vis ad, et qui altera singulis. Ut assum deleniti sit, vix constituto assueverit appellantur at, et meis voluptua usu. Quem imperdiet in ius, mei ex dictas mandamus, ut pri tation appetere oportere. Et est harum dictas. \n Omnis quaestio mel te, ex duo autem molestie. Ei sed dico minim, nominavi facilisis evertitur quo an, te adipiscing contentiones his. Cum partem deseruisse at, ne iuvaret mediocritatem pro. Ex prima utinam convenire usu, volumus legendos nec et, natum putant quo ne. Invidunt necessitatibus at ius, ne eum wisi dicat mediocrem. \n Cu usu odio labores sententiae. Ex eos duis singulis necessitatibus, dico omittam vix at. Sit iudico option detracto an, sit no modus exerci oportere. Vix dicta munere at, no vis feugiat omnesque convenire. Duo at quod illum dolor, nec am
 et tantas iisque no, mei quod graece volutpat ea.\n Ornatus legendos theophrastus id mei. Cum alia assum abhorreant et, nam indoctum intellegebat ei. Unum constituto quo cu. Vero tritani sit ei, ea commodo menandri usu, ponderum hendrerit voluptatibus sed te. \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.";
-
-    @BeforeClass
-    public static void initPort() {
-        serverPort = AvailablePortFinder.getNextAvailable();
-        uri = "netty: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 {
-
-        MockEndpoint mock = getMockEndpoint("mock:syslogReceiver");
-        MockEndpoint mock2 = getMockEndpoint("mock:syslogReceiver2");
-        mock.expectedMessageCount(1);
-        mock2.expectedMessageCount(1);
-        mock2.expectedBodiesReceived(message);
-
-        template.sendBody(uri, new BigEndianHeapChannelBuffer(message.getBytes("UTF8")));
-
-        assertMockEndpointsSatisfied();
-    }
-
-    @Override
-    protected RouteBuilder createRouteBuilder() throws Exception {
-        context().getRegistry(JndiRegistry.class).bind("rfc5426FrameDecoder", new Rfc5425FrameDecoder());
-
-        return new RouteBuilder() {
-            @Override
-            public void configure() throws Exception {
-                context.setTracing(true);
-                DataFormat syslogDataFormat = new SyslogDataFormat();
-
-                // we setup a Syslog listener on a random port.
-                from(uri).unmarshal(syslogDataFormat).process(new Processor() {
-                    @Override
-                    public void process(Exchange ex) {
-                        assertTrue(ex.getIn().getBody() instanceof SyslogMessage);
-                    }
-                }).to("mock:syslogReceiver").marshal(syslogDataFormat).to("mock:syslogReceiver2");
-            }
-        };
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/35eaafca/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyRfc5426Test.java
----------------------------------------------------------------------
diff --git a/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyRfc5426Test.java b/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyRfc5426Test.java
deleted file mode 100644
index 22b22bd..0000000
--- a/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyRfc5426Test.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.camel.component.syslog;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
-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.test.AvailablePortFinder;
-import org.apache.camel.test.junit4.CamelTestSupport;
-import org.jboss.netty.buffer.BigEndianHeapChannelBuffer;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-public class NettyRfc5426Test extends CamelTestSupport {
-
-    private static String uri;
-    private static int serverPort;
-    private final String rfc3164Message = "<165>Aug  4 05:34:00 mymachine myproc[10]: %% It's\n         time to make the do-nuts.  %%  Ingredients: Mix=OK, Jelly=OK #\n"
-                                          + "         Devices: Mixer=OK, Jelly_Injector=OK, Frier=OK # Transport:\n" + "         Conveyer1=OK, Conveyer2=OK # %%";
-    private final String rfc5424Message = "<34>1 2003-10-11T22:14:15.003Z mymachine.example.com su - ID47 - BOM'su root' failed for lonvick on /dev/pts/8";
-
-    @BeforeClass
-    public static void initPort() {
-        serverPort = AvailablePortFinder.getNextAvailable();
-        uri = "netty: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 {
-
-        MockEndpoint mock = getMockEndpoint("mock:syslogReceiver");
-        MockEndpoint mock2 = getMockEndpoint("mock:syslogReceiver2");
-        mock.expectedMessageCount(2);
-        mock2.expectedMessageCount(2);
-        mock2.expectedBodiesReceived(rfc3164Message, rfc5424Message);
-
-        template.sendBody(uri, new BigEndianHeapChannelBuffer(rfc3164Message.getBytes("UTF8")));
-        template.sendBody(uri, new BigEndianHeapChannelBuffer(rfc5424Message.getBytes("UTF8")));
-
-        assertMockEndpointsSatisfied();
-    }
-
-    @Override
-    protected RouteBuilder createRouteBuilder() throws Exception {
-        context().getRegistry(JndiRegistry.class).bind("rfc5426FrameDecoder", new Rfc5425FrameDecoder());
-
-        return new RouteBuilder() {
-            @Override
-            public void configure() throws Exception {
-                context.setTracing(true);
-                DataFormat syslogDataFormat = new SyslogDataFormat();
-
-                // we setup a Syslog listener on a random port.
-                from(uri).unmarshal(syslogDataFormat).process(new Processor() {
-                    @Override
-                    public void process(Exchange ex) {
-                        assertTrue(ex.getIn().getBody() instanceof SyslogMessage);
-                    }
-                }).to("mock:syslogReceiver").marshal(syslogDataFormat).to("mock:syslogReceiver2");
-            }
-        };
-    }
-}