Repository: camel Updated Branches: refs/heads/master 02903870e -> 62151db18
CAMEL-7998 renamed the option to UdpConnectionlessSending and fixed the CS errors Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/e11dded2 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/e11dded2 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/e11dded2 Branch: refs/heads/master Commit: e11dded29a14d0b3ee7bc9eac3ee54c4e40d6d4f Parents: 9ac4e74 Author: Willem Jiang <willem.ji...@gmail.com> Authored: Mon Nov 10 16:08:58 2014 +0800 Committer: Willem Jiang <willem.ji...@gmail.com> Committed: Mon Nov 10 21:11:41 2014 +0800 ---------------------------------------------------------------------- .../component/netty4/NettyConfiguration.java | 10 +++--- .../camel/component/netty4/NettyProducer.java | 4 +-- .../NettyComponentWithConfigurationTest.java | 6 ++-- .../netty4/NettyUdpConnectedSendTest.java | 35 +++++++++++++++----- .../netty4/NettyUdpConnectionlessSendTest.java | 35 +++++++++++++++----- 5 files changed, 64 insertions(+), 26 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/e11dded2/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyConfiguration.java ---------------------------------------------------------------------- diff --git a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyConfiguration.java b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyConfiguration.java index 38cb9e7..5e66b8d 100644 --- a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyConfiguration.java +++ b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyConfiguration.java @@ -91,7 +91,7 @@ public class NettyConfiguration extends NettyServerBootstrapConfiguration implem @UriParam private boolean producerPoolEnabled = true; @UriParam - private boolean udpConnectionlessSend = false; + private boolean udpConnectionlessSending; /** * Returns a copy of this configuration @@ -474,12 +474,12 @@ public class NettyConfiguration extends NettyServerBootstrapConfiguration implem this.producerPoolEnabled = producerPoolEnabled; } - public boolean isUdpConnectionlessSend() { - return udpConnectionlessSend; + public boolean isUdpConnectionlessSending() { + return udpConnectionlessSending; } - public void setUdpConnectionlessSend(boolean udpConnectionlessSend) { - this.udpConnectionlessSend = udpConnectionlessSend; + public void setUdpConnectionlessSending(boolean udpConnectionlessSending) { + this.udpConnectionlessSending = udpConnectionlessSending; } private static <T> void addToHandlersList(List<T> configured, List<T> handlers, Class<T> handlerType) { http://git-wip-us.apache.org/repos/asf/camel/blob/e11dded2/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyProducer.java ---------------------------------------------------------------------- diff --git a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyProducer.java b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyProducer.java index 53400ce..0ada300 100644 --- a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyProducer.java +++ b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyProducer.java @@ -385,11 +385,11 @@ public class NettyProducer extends DefaultAsyncProducer { answer.awaitUninterruptibly(); Channel channel = answer.channel(); allChannels.add(channel); - // if connectionless send is true we don't do a connect. + // if udp connectionless sending is true we don't do a connect. // we just send on the channel created with bind which means // really fire and forget. You wont get an PortUnreachableException // if no one is listen on the port - if (!configuration.isUdpConnectionlessSend()) { + if (!configuration.isUdpConnectionlessSending()) { answer = connectionlessClientBootstrap.connect(new InetSocketAddress(configuration.getHost(), configuration.getPort())); } http://git-wip-us.apache.org/repos/asf/camel/blob/e11dded2/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyComponentWithConfigurationTest.java ---------------------------------------------------------------------- diff --git a/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyComponentWithConfigurationTest.java b/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyComponentWithConfigurationTest.java index eae7519..cefa87a3 100644 --- a/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyComponentWithConfigurationTest.java +++ b/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyComponentWithConfigurationTest.java @@ -64,7 +64,7 @@ public class NettyComponentWithConfigurationTest extends CamelTestSupport { assertSame(cfg, comp.getConfiguration()); NettyEndpoint e1 = (NettyEndpoint) comp.createEndpoint("netty4://udp://localhost:8601?sync=false"); - NettyEndpoint e2 = (NettyEndpoint) comp.createEndpoint("netty4://udp://localhost:8602?sync=false&udpConnectionlessSend=true"); + NettyEndpoint e2 = (NettyEndpoint) comp.createEndpoint("netty4://udp://localhost:8602?sync=false&udpConnectionlessSending=true"); // should not be same assertNotSame(e1, e2); @@ -74,8 +74,8 @@ public class NettyComponentWithConfigurationTest extends CamelTestSupport { assertEquals(false, e1.getConfiguration().isSync()); assertEquals(false, e2.getConfiguration().isSync()); // if not set it should be false - assertEquals(false, e1.getConfiguration().isUdpConnectionlessSend()); - assertEquals(true, e2.getConfiguration().isUdpConnectionlessSend()); + assertEquals(false, e1.getConfiguration().isUdpConnectionlessSending()); + assertEquals(true, e2.getConfiguration().isUdpConnectionlessSending()); assertEquals(8601, e1.getConfiguration().getPort()); assertEquals(8602, e2.getConfiguration().getPort()); http://git-wip-us.apache.org/repos/asf/camel/blob/e11dded2/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyUdpConnectedSendTest.java ---------------------------------------------------------------------- diff --git a/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyUdpConnectedSendTest.java b/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyUdpConnectedSendTest.java index 97d62c5..b24ab82 100644 --- a/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyUdpConnectedSendTest.java +++ b/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyUdpConnectedSendTest.java @@ -1,25 +1,44 @@ +/** + * 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.netty4; +import java.net.InetSocketAddress; +import java.util.List; + import io.netty.bootstrap.Bootstrap; -import io.netty.channel.*; +import io.netty.channel.Channel; +import io.netty.channel.ChannelHandlerContext; +import io.netty.channel.ChannelInitializer; +import io.netty.channel.EventLoopGroup; +import io.netty.channel.SimpleChannelInboundHandler; import io.netty.channel.nio.NioEventLoopGroup; import io.netty.channel.socket.DatagramPacket; import io.netty.channel.socket.nio.NioDatagramChannel; import io.netty.handler.codec.MessageToMessageDecoder; import io.netty.util.CharsetUtil; + import org.apache.camel.builder.RouteBuilder; import org.junit.Test; -import java.net.InetSocketAddress; -import java.util.List; -/** - * Created by tterm on 06.11.14. - */ public class NettyUdpConnectedSendTest extends BaseNettyTest { private static final String SEND_STRING = "***<We all love camel>***"; private static final int SEND_COUNT = 20; - private int receivedCount = 0; + private int receivedCount; private EventLoopGroup group; private Bootstrap bootstrap; @@ -66,7 +85,7 @@ public class NettyUdpConnectedSendTest extends BaseNettyTest { } @Test - public void sendConnectedWithoutReceiver() throws Exception{ + public void sendConnectedWithoutReceiver() throws Exception { int exceptionCount = 0; for (int i = 0; i < SEND_COUNT; ++i) { try { http://git-wip-us.apache.org/repos/asf/camel/blob/e11dded2/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyUdpConnectionlessSendTest.java ---------------------------------------------------------------------- diff --git a/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyUdpConnectionlessSendTest.java b/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyUdpConnectionlessSendTest.java index 44cda0c..afbaa07 100644 --- a/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyUdpConnectionlessSendTest.java +++ b/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyUdpConnectionlessSendTest.java @@ -1,25 +1,44 @@ +/** + * 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.netty4; +import java.net.InetSocketAddress; +import java.util.List; + import io.netty.bootstrap.Bootstrap; -import io.netty.channel.*; +import io.netty.channel.Channel; +import io.netty.channel.ChannelHandlerContext; +import io.netty.channel.ChannelInitializer; +import io.netty.channel.EventLoopGroup; +import io.netty.channel.SimpleChannelInboundHandler; import io.netty.channel.nio.NioEventLoopGroup; import io.netty.channel.socket.DatagramPacket; import io.netty.channel.socket.nio.NioDatagramChannel; import io.netty.handler.codec.MessageToMessageDecoder; import io.netty.util.CharsetUtil; + import org.apache.camel.builder.RouteBuilder; import org.junit.Test; -import java.net.InetSocketAddress; -import java.util.List; -/** - * Created by tterm on 06.11.14. - */ public class NettyUdpConnectionlessSendTest extends BaseNettyTest { private static final String SEND_STRING = "***<We all love camel>***"; private static final int SEND_COUNT = 20; - private int receivedCount = 0; + private int receivedCount; private EventLoopGroup group; private Bootstrap bootstrap; @@ -67,7 +86,7 @@ public class NettyUdpConnectionlessSendTest extends BaseNettyTest { } @Test - public void sendWithoutReceiver() throws Exception{ + public void sendWithoutReceiver() throws Exception { int exceptionCount = 0; for (int i = 0; i < SEND_COUNT; ++i) { try {