camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acosent...@apache.org
Subject [1/2] camel git commit: TcpDataWriter should use TcpInput class to attach to socket
Date Sat, 25 Jul 2015 13:39:10 GMT
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 <preben.asmussen@gmail.com>
Authored: Sat Jul 25 14:32:18 2015 +0200
Committer: Andrea Cosentino <ancosen@gmail.com>
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);


Mime
View raw message