Author: davsclaus
Date: Thu Apr 22 08:49:35 2010
New Revision: 936658

URL: http://svn.apache.org/viewvc?rev=936658&view=rev
Log:
CAMEL-2657: Applied patch with thanks to Stephen Gargan

Added:
    
camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/MultipleCodecsSpringTest.java
   (with props)
    camel/trunk/components/camel-netty/src/test/resources/org/
    camel/trunk/components/camel-netty/src/test/resources/org/apache/
    camel/trunk/components/camel-netty/src/test/resources/org/apache/camel/
    
camel/trunk/components/camel-netty/src/test/resources/org/apache/camel/component/
    
camel/trunk/components/camel-netty/src/test/resources/org/apache/camel/component/netty/
    
camel/trunk/components/camel-netty/src/test/resources/org/apache/camel/component/netty/multiple-codecs.xml
   (with props)

Added: 
camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/MultipleCodecsSpringTest.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/MultipleCodecsSpringTest.java?rev=936658&view=auto
==============================================================================
--- 
camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/MultipleCodecsSpringTest.java
 (added)
+++ 
camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/MultipleCodecsSpringTest.java
 Thu Apr 22 08:49:35 2010
@@ -0,0 +1,43 @@
+/**
+ * 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.netty;
+
+import java.util.concurrent.TimeUnit;
+
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit4.CamelSpringTestSupport;
+import org.junit.Test;
+import org.springframework.context.support.AbstractXmlApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+public class MultipleCodecsSpringTest extends CamelSpringTestSupport {
+
+    @Override
+    protected AbstractXmlApplicationContext createApplicationContext() {
+        return new 
ClassPathXmlApplicationContext("/org/apache/camel/component/netty/multiple-codecs.xml");
+    }
+
+    @Test
+    public void canSupplyMultipleCodecsToEndpointPipeline() throws Exception {
+        String poem = new Poetry().getPoem();
+        MockEndpoint mock = getMockEndpoint("mock:multiple-codec");
+        mock.expectedBodiesReceived(poem);
+        sendBody("direct:multiple-codec", poem);
+        mock.await(1, TimeUnit.SECONDS);
+        mock.assertIsSatisfied();
+    }
+}

Propchange: 
camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/MultipleCodecsSpringTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/MultipleCodecsSpringTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: 
camel/trunk/components/camel-netty/src/test/resources/org/apache/camel/component/netty/multiple-codecs.xml
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-netty/src/test/resources/org/apache/camel/component/netty/multiple-codecs.xml?rev=936658&view=auto
==============================================================================
--- 
camel/trunk/components/camel-netty/src/test/resources/org/apache/camel/component/netty/multiple-codecs.xml
 (added)
+++ 
camel/trunk/components/camel-netty/src/test/resources/org/apache/camel/component/netty/multiple-codecs.xml
 Thu Apr 22 08:49:35 2010
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+  xmlns:util="http://www.springframework.org/schema/util";
+  xsi:schemaLocation="
+       http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+       http://www.springframework.org/schema/util 
http://www.springframework.org/schema/util/spring-util-2.5.xsd
+       http://camel.apache.org/schema/spring 
http://camel.apache.org/schema/spring/camel-spring.xsd";>
+  
+  <!-- START SNIPPET: routes -->
+  <camelContext id="multiple-netty-codecs-context" 
xmlns="http://camel.apache.org/schema/spring";>
+    <route>
+      <from uri="direct:multiple-codec" />
+      <to uri="netty:tcp://localhost:5150?encoders=#encoders" />
+    </route>
+    <route>
+      <from 
uri="netty:tcp://localhost:5150?decoders=#length-decoder,#string-decoder" />
+      <to uri="mock:multiple-codec" />
+    </route>
+  </camelContext>
+  <!-- END SNIPPET: routes -->
+  
+  <!-- START SNIPPET: registry-beans -->
+  <util:list id="decoders" list-class="java.util.LinkedList">    
+    <bean 
class="org.jboss.netty.handler.codec.frame.LengthFieldBasedFrameDecoder">
+      <constructor-arg value="1048576" />
+      <constructor-arg value="0" />
+      <constructor-arg value="4" />
+      <constructor-arg value="0" />
+      <constructor-arg value="4" />
+    </bean>
+    <bean class="org.jboss.netty.handler.codec.string.StringDecoder" />
+  </util:list>
+  
+  <util:list id="encoders" list-class="java.util.LinkedList">
+    <bean class="org.jboss.netty.handler.codec.frame.LengthFieldPrepender">
+      <constructor-arg value="4" />
+    </bean>
+    <bean class="org.jboss.netty.handler.codec.string.StringEncoder" />
+  </util:list>
+  
+  <bean id="length-encoder" 
class="org.jboss.netty.handler.codec.frame.LengthFieldPrepender">
+      <constructor-arg value="4" />
+  </bean>
+  <bean id="string-encoder" 
class="org.jboss.netty.handler.codec.string.StringEncoder" />
+  
+  <bean id="length-decoder" 
class="org.jboss.netty.handler.codec.frame.LengthFieldBasedFrameDecoder">
+    <constructor-arg value="1048576" />
+    <constructor-arg value="0" />
+    <constructor-arg value="4" />
+    <constructor-arg value="0" />
+    <constructor-arg value="4" />
+  </bean>
+  <bean id="string-decoder" 
class="org.jboss.netty.handler.codec.string.StringDecoder" />
+  <!-- START SNIPPET: registry-beans -->
+</beans>

Propchange: 
camel/trunk/components/camel-netty/src/test/resources/org/apache/camel/component/netty/multiple-codecs.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
camel/trunk/components/camel-netty/src/test/resources/org/apache/camel/component/netty/multiple-codecs.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: 
camel/trunk/components/camel-netty/src/test/resources/org/apache/camel/component/netty/multiple-codecs.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml


Reply via email to