Return-Path: X-Original-To: apmail-camel-commits-archive@www.apache.org Delivered-To: apmail-camel-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 259AE17936 for ; Sat, 25 Jul 2015 13:39:11 +0000 (UTC) Received: (qmail 98101 invoked by uid 500); 25 Jul 2015 13:39:11 -0000 Delivered-To: apmail-camel-commits-archive@camel.apache.org Received: (qmail 98054 invoked by uid 500); 25 Jul 2015 13:39:11 -0000 Mailing-List: contact commits-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list commits@camel.apache.org Received: (qmail 97957 invoked by uid 99); 25 Jul 2015 13:39:11 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 25 Jul 2015 13:39:11 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id C8730E00D5; Sat, 25 Jul 2015 13:39:10 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: acosentino@apache.org To: commits@camel.apache.org Date: Sat, 25 Jul 2015 13:39:10 -0000 Message-Id: <3f75343191ba436dafa93b684e3920c1@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [1/2] camel git commit: TcpDataWriter should use TcpInput class to attach to socket Repository: camel Updated Branches: refs/heads/master 18e89e77c -> bcaddc146 TcpDataWriter should use TcpInput class to attach to socket Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/bcaddc14 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/bcaddc14 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/bcaddc14 Branch: refs/heads/master Commit: bcaddc146fc74b3299d89f3532f9a657e4469487 Parents: b170152 Author: Preben Asmussen Authored: Sat Jul 25 14:32:18 2015 +0200 Committer: Andrea Cosentino Committed: Sat Jul 25 15:34:27 2015 +0200 ---------------------------------------------------------------------- .../apache/camel/component/splunk/support/TcpDataWriter.java | 8 ++++---- .../test/java/org/apache/camel/component/splunk/Helper.java | 7 +++---- 2 files changed, 7 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/bcaddc14/components/camel-splunk/src/main/java/org/apache/camel/component/splunk/support/TcpDataWriter.java ---------------------------------------------------------------------- diff --git a/components/camel-splunk/src/main/java/org/apache/camel/component/splunk/support/TcpDataWriter.java b/components/camel-splunk/src/main/java/org/apache/camel/component/splunk/support/TcpDataWriter.java index 511d39b..4f2cb16 100644 --- a/components/camel-splunk/src/main/java/org/apache/camel/component/splunk/support/TcpDataWriter.java +++ b/components/camel-splunk/src/main/java/org/apache/camel/component/splunk/support/TcpDataWriter.java @@ -20,8 +20,9 @@ import java.io.IOException; import java.net.Socket; import com.splunk.Args; -import com.splunk.Input; import com.splunk.Service; +import com.splunk.TcpInput; + import org.apache.camel.component.splunk.SplunkEndpoint; public class TcpDataWriter extends SplunkDataWriter { @@ -37,14 +38,13 @@ public class TcpDataWriter extends SplunkDataWriter { @Override protected Socket createSocket(Service service) throws IOException { - Input input = service.getInputs().get(String.valueOf(port)); + TcpInput input = (TcpInput)service.getInputs().get(String.valueOf(port)); if (input == null) { throw new RuntimeException("no input defined for port " + port); } if (input.isDisabled()) { throw new RuntimeException(String.format("input on port %d is disabled", port)); } - Socket socket = service.open(port); - return socket; + return input.attach(); } } http://git-wip-us.apache.org/repos/asf/camel/blob/bcaddc14/components/camel-splunk/src/test/java/org/apache/camel/component/splunk/Helper.java ---------------------------------------------------------------------- diff --git a/components/camel-splunk/src/test/java/org/apache/camel/component/splunk/Helper.java b/components/camel-splunk/src/test/java/org/apache/camel/component/splunk/Helper.java index 87ecb01..55b5b81 100644 --- a/components/camel-splunk/src/test/java/org/apache/camel/component/splunk/Helper.java +++ b/components/camel-splunk/src/test/java/org/apache/camel/component/splunk/Helper.java @@ -23,13 +23,12 @@ import java.util.Map; import com.splunk.Args; import com.splunk.Index; import com.splunk.IndexCollection; -import com.splunk.Input; import com.splunk.InputCollection; import com.splunk.Service; +import com.splunk.TcpInput; import org.apache.camel.CamelContext; -import static org.mockito.Matchers.anyInt; import static org.mockito.Matchers.anyString; import static org.mockito.Matchers.isA; import static org.mockito.Mockito.mock; @@ -69,8 +68,8 @@ final class MockConnectionSettings extends SplunkConfiguration { when(service.getIndexes()).thenReturn(indexColl); InputCollection inputCollection = mock(InputCollection.class); when(service.getInputs()).thenReturn(inputCollection); - Input input = mock(Input.class); - when(service.open(anyInt())).thenReturn(socket); + TcpInput input = mock(TcpInput.class); + when(input.attach()).thenReturn(socket); when(inputCollection.get(anyString())).thenReturn(input); when(indexColl.get(anyString())).thenReturn(index); when(index.attach(isA(Args.class))).thenReturn(socket);