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 2013/09/24 11:53:39 UTC

git commit: CAMEL-6584: Applied 2nd patch to camel-splunk. Thanks to Preben Asmussen for the patch.

Updated Branches:
  refs/heads/master 988c0a7c7 -> 6400ac025


CAMEL-6584: Applied 2nd patch to camel-splunk. Thanks to Preben Asmussen for the patch.


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

Branch: refs/heads/master
Commit: 6400ac0256a47568f2d6cf4e5d74c1c6f195d9f8
Parents: 988c0a7
Author: Claus Ibsen <da...@apache.org>
Authored: Tue Sep 24 11:53:31 2013 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue Sep 24 11:53:31 2013 +0200

----------------------------------------------------------------------
 components/camel-splunk/pom.xml                 |   2 +-
 .../camel/component/splunk/ConsumerType.java    |   4 +-
 .../DefaultSplunkConfigurationFactory.java      |  11 +-
 .../camel/component/splunk/ProducerType.java    |   4 +-
 .../component/splunk/SplunkConfiguration.java   | 121 +++++++---------
 .../splunk/SplunkConnectionFactory.java         | 137 +++++++++++++++++++
 .../camel/component/splunk/SplunkEndpoint.java  |   4 +-
 .../camel/component/splunk/SplunkProducer.java  |   9 +-
 .../component/splunk/event/SplunkEvent.java     |  59 ++++----
 .../splunk/support/SplunkDataReader.java        |  82 ++++++-----
 .../splunk/support/SplunkDataWriter.java        |   5 +-
 .../splunk/support/StreamDataWriter.java        |   7 +-
 .../camel/component/splunk/ConsumerTest.java    |  10 +-
 .../apache/camel/component/splunk/Helper.java   |  20 ++-
 .../SplunkComponentConfigurationTest.java       |  40 ++++--
 .../splunk/integration/SplunkProducerTest.java  |   8 +-
 16 files changed, 337 insertions(+), 186 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/6400ac02/components/camel-splunk/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-splunk/pom.xml b/components/camel-splunk/pom.xml
index dc8566a..0fdca67 100644
--- a/components/camel-splunk/pom.xml
+++ b/components/camel-splunk/pom.xml
@@ -45,7 +45,7 @@
     <dependency>
       <groupId>com.splunk</groupId>
       <artifactId>splunk</artifactId>
-      <version>1.1.0</version>
+      <version>1.2.0</version>
     </dependency>
 
     <dependency>

http://git-wip-us.apache.org/repos/asf/camel/blob/6400ac02/components/camel-splunk/src/main/java/org/apache/camel/component/splunk/ConsumerType.java
----------------------------------------------------------------------
diff --git a/components/camel-splunk/src/main/java/org/apache/camel/component/splunk/ConsumerType.java b/components/camel-splunk/src/main/java/org/apache/camel/component/splunk/ConsumerType.java
index fe5f10b..dbed689 100644
--- a/components/camel-splunk/src/main/java/org/apache/camel/component/splunk/ConsumerType.java
+++ b/components/camel-splunk/src/main/java/org/apache/camel/component/splunk/ConsumerType.java
@@ -17,7 +17,7 @@
 package org.apache.camel.component.splunk;
 
 public enum ConsumerType {
-    NORMAL, REALTIME, SAVEDSEARCH, UNKNOWN;
+    NORMAL, REALTIME, SAVEDSEARCH;
 
     public static ConsumerType fromUri(String uri) {
         for (ConsumerType consumerType : ConsumerType.values()) {
@@ -25,7 +25,7 @@ public enum ConsumerType {
                 return consumerType;
             }
         }
-        return ConsumerType.UNKNOWN;
+        throw new RuntimeException("Unable to construct consumerType from uri : " + uri);
     }
 
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/6400ac02/components/camel-splunk/src/main/java/org/apache/camel/component/splunk/DefaultSplunkConfigurationFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-splunk/src/main/java/org/apache/camel/component/splunk/DefaultSplunkConfigurationFactory.java b/components/camel-splunk/src/main/java/org/apache/camel/component/splunk/DefaultSplunkConfigurationFactory.java
index 867b76d..6ee510f 100644
--- a/components/camel-splunk/src/main/java/org/apache/camel/component/splunk/DefaultSplunkConfigurationFactory.java
+++ b/components/camel-splunk/src/main/java/org/apache/camel/component/splunk/DefaultSplunkConfigurationFactory.java
@@ -23,17 +23,12 @@ import org.apache.camel.util.ObjectHelper;
 public class DefaultSplunkConfigurationFactory implements SplunkConfigurationFactory {
 
     public SplunkConfiguration parseMap(Map<String, Object> parameters) {
-        String host = (String) parameters.get("host");
-        String port = (String) parameters.get("port");
-        String username = (String) parameters.get("username");
-        String password = (String) parameters.get("password");
+        String username = (String)parameters.get("username");
+        String password = (String)parameters.get("password");
         if (ObjectHelper.isEmpty(username) || ObjectHelper.isEmpty(password)) {
             throw new IllegalArgumentException("Username and password has to be specified");
         }
-        if (ObjectHelper.isNotEmpty(host) && ObjectHelper.isNotEmpty(port)) {
-            return new SplunkConfiguration(host, Integer.valueOf(port), username, password);
-        }
-        return new SplunkConfiguration(username, password);
+        return new SplunkConfiguration();
     }
 
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/6400ac02/components/camel-splunk/src/main/java/org/apache/camel/component/splunk/ProducerType.java
----------------------------------------------------------------------
diff --git a/components/camel-splunk/src/main/java/org/apache/camel/component/splunk/ProducerType.java b/components/camel-splunk/src/main/java/org/apache/camel/component/splunk/ProducerType.java
index e73def3..7634125 100644
--- a/components/camel-splunk/src/main/java/org/apache/camel/component/splunk/ProducerType.java
+++ b/components/camel-splunk/src/main/java/org/apache/camel/component/splunk/ProducerType.java
@@ -17,7 +17,7 @@
 package org.apache.camel.component.splunk;
 
 public enum ProducerType {
-    TCP, SUBMIT, STREAM, UNKNOWN;
+    TCP, SUBMIT, STREAM;
 
     public static ProducerType fromUri(String uri) {
         for (ProducerType producerType : ProducerType.values()) {
@@ -25,6 +25,6 @@ public enum ProducerType {
                 return producerType;
             }
         }
-        return ProducerType.UNKNOWN;
+        throw new RuntimeException("Unable to construct prodcucerType from uri : " + uri);
     }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/6400ac02/components/camel-splunk/src/main/java/org/apache/camel/component/splunk/SplunkConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-splunk/src/main/java/org/apache/camel/component/splunk/SplunkConfiguration.java b/components/camel-splunk/src/main/java/org/apache/camel/component/splunk/SplunkConfiguration.java
index 20de08c..dc4900c 100644
--- a/components/camel-splunk/src/main/java/org/apache/camel/component/splunk/SplunkConfiguration.java
+++ b/components/camel-splunk/src/main/java/org/apache/camel/component/splunk/SplunkConfiguration.java
@@ -16,54 +16,56 @@
  */
 package org.apache.camel.component.splunk;
 
-import java.util.HashMap;
-import java.util.Map;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
-
 import com.splunk.Service;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
-public class SplunkConfiguration {
+import org.apache.camel.spi.UriParam;
+import org.apache.camel.spi.UriParams;
+import org.apache.camel.util.ObjectHelper;
 
-    private static final Logger LOG = LoggerFactory.getLogger(SplunkConfiguration.class);
+@UriParams
+public class SplunkConfiguration {
 
+    @UriParam
     private String host = Service.DEFAULT_HOST;
+    @UriParam
     private int port = Service.DEFAULT_PORT;
+    @UriParam
     private String scheme = Service.DEFAULT_SCHEME;
+    @UriParam
     private String app;
+    @UriParam
     private String owner;
+    @UriParam
     private String username;
+    @UriParam
     private String password;
+    @UriParam
     private int connectionTimeout = 5000;
+    @UriParam
+    private boolean useSunHttpsHandler;
+    @UriParam
     private String index;
+    @UriParam
     private String sourceType;
+    @UriParam
     private String source;
+    @UriParam
     private int tcpReceiverPort;
 
     // consumer properties
+    @UriParam
     private int count;
-    private String fieldList;
+    @UriParam
     private String search;
+    @UriParam
     private String savedSearch;
+    @UriParam
     private String earliestTime;
+    @UriParam
     private String latestTime;
+    @UriParam
     private String initEarliestTime;
-
-    public SplunkConfiguration(final String host, final int port, final String username, final String password) {
-        this.host = host;
-        this.port = port;
-        this.username = username;
-        this.password = password;
-    }
-
-    public SplunkConfiguration(final String username, final String password) {
-        this(Service.DEFAULT_HOST, Service.DEFAULT_PORT, username, password);
-    }
+    private SplunkConnectionFactory connectionFactory;
 
     public String getInitEarliestTime() {
         return initEarliestTime;
@@ -81,14 +83,6 @@ public class SplunkConfiguration {
         this.count = count;
     }
 
-    public String getFieldList() {
-        return fieldList;
-    }
-
-    public void setFieldList(String fieldList) {
-        this.fieldList = fieldList;
-    }
-
     public String getSearch() {
         return search;
     }
@@ -209,6 +203,14 @@ public class SplunkConfiguration {
         this.connectionTimeout = timeout;
     }
 
+    public boolean isUseSunHttpsHandler() {
+        return useSunHttpsHandler;
+    }
+
+    public void setUseSunHttpsHandler(boolean useSunHttpsHandler) {
+        this.useSunHttpsHandler = useSunHttpsHandler;
+    }
+
     public String getSavedSearch() {
         return this.savedSearch;
     }
@@ -217,44 +219,25 @@ public class SplunkConfiguration {
         this.savedSearch = savedSearch;
     }
 
-    public Service createService() {
-        final Map<String, Object> args = new HashMap<String, Object>();
-        if (host != null) {
-            args.put("host", host);
-        }
-        if (port > 0) {
-            args.put("port", port);
-        }
-        if (scheme != null) {
-            args.put("scheme", scheme);
-        }
-        if (app != null) {
-            args.put("app", app);
-        }
-        if (owner != null) {
-            args.put("owner", owner);
-        }
+    public SplunkConnectionFactory getConnectionFactory() {
+        return connectionFactory != null ? connectionFactory : createDefaultConnectionFactory();
+    }
+
+    public void setConnectionFactory(SplunkConnectionFactory connectionFactory) {
+        this.connectionFactory = connectionFactory;
+    }
 
-        args.put("username", username);
-        args.put("password", password);
-        ExecutorService executor = Executors.newSingleThreadExecutor();
-
-        Future<Service> future = executor.submit(new Callable<Service>() {
-            public Service call() throws Exception {
-                return Service.connect(args);
-            }
-        });
-        try {
-            Service service;
-            if (connectionTimeout > 0) {
-                service = future.get(connectionTimeout, TimeUnit.MILLISECONDS);
-            } else {
-                service = future.get();
-            }
-            LOG.info("Successfully connected to Splunk");
-            return service;
-        } catch (Exception e) {
-            throw new RuntimeException(String.format("could not connect to Splunk Server @ %s:%d - %s", host, port, e.getMessage()));
+    private SplunkConnectionFactory createDefaultConnectionFactory() {
+        SplunkConnectionFactory splunkConnectionFactory;
+        if (ObjectHelper.isNotEmpty(getHost()) && getPort() > 0) {
+            splunkConnectionFactory = new SplunkConnectionFactory(getHost(), getPort(), getUsername(), getPassword());
+        } else {
+            splunkConnectionFactory = new SplunkConnectionFactory(getUsername(), getPassword());
         }
+        splunkConnectionFactory.setApp(getApp());
+        splunkConnectionFactory.setConnectionTimeout(getConnectionTimeout());
+        splunkConnectionFactory.setScheme(getScheme());
+        splunkConnectionFactory.setUseSunHttpsHandler(isUseSunHttpsHandler());
+        return splunkConnectionFactory;
     }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/6400ac02/components/camel-splunk/src/main/java/org/apache/camel/component/splunk/SplunkConnectionFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-splunk/src/main/java/org/apache/camel/component/splunk/SplunkConnectionFactory.java b/components/camel-splunk/src/main/java/org/apache/camel/component/splunk/SplunkConnectionFactory.java
new file mode 100644
index 0000000..e23a9b3
--- /dev/null
+++ b/components/camel-splunk/src/main/java/org/apache/camel/component/splunk/SplunkConnectionFactory.java
@@ -0,0 +1,137 @@
+/**
+ * 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.splunk;
+
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+
+import com.splunk.Service;
+import com.splunk.ServiceArgs;
+
+import org.apache.camel.CamelContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class SplunkConnectionFactory {
+    private static final Logger LOG = LoggerFactory.getLogger(SplunkConnectionFactory.class);
+
+    private String host;
+    private int port;
+    private String scheme;
+    private String app;
+    private String owner;
+    private String username;
+    private String password;
+    private int connectionTimeout;
+    private boolean useSunHttpsHandler;
+
+    public SplunkConnectionFactory(final String host, final int port, final String username, final String password) {
+        this.host = host;
+        this.port = port;
+        this.username = username;
+        this.password = password;
+    }
+
+    public SplunkConnectionFactory(final String username, final String password) {
+        this(Service.DEFAULT_HOST, Service.DEFAULT_PORT, username, password);
+    }
+
+    public String getApp() {
+        return app;
+    }
+
+    public void setApp(String app) {
+        this.app = app;
+    }
+
+    public int getConnectionTimeout() {
+        return connectionTimeout;
+    }
+
+    public void setConnectionTimeout(int connectionTimeout) {
+        this.connectionTimeout = connectionTimeout;
+    }
+
+    public String getScheme() {
+        return scheme;
+    }
+
+    public void setScheme(String scheme) {
+        this.scheme = scheme;
+    }
+
+    public boolean isUseSunHttpsHandler() {
+        return useSunHttpsHandler;
+    }
+
+    public void setUseSunHttpsHandler(boolean useSunHttpsHandler) {
+        this.useSunHttpsHandler = useSunHttpsHandler;
+    }
+
+    @SuppressWarnings("restriction")
+    public Service createService(CamelContext camelContext) {
+        final ServiceArgs args = new ServiceArgs();
+        if (host != null) {
+            args.setHost(host);
+        }
+        if (port > 0) {
+            args.setPort(port);
+        }
+        if (scheme != null) {
+            args.setScheme(scheme);
+        }
+        if (app != null) {
+            args.setApp(app);
+        }
+        if (owner != null) {
+            args.setOwner(owner);
+        }
+
+        args.setUsername(username);
+        args.setPassword(password);
+        // useful in cases where you want to bypass app. servers https handling
+        // (wls i'm looking at you)
+        if (isUseSunHttpsHandler()) {
+            args.setHTTPSHandler(new sun.net.www.protocol.https.Handler());
+        }
+        ExecutorService executor = camelContext.getExecutorServiceManager().newSingleThreadExecutor(this, "DefaultSplunkConnectionFactory");
+
+        Future<Service> future = executor.submit(new Callable<Service>() {
+            public Service call() throws Exception {
+                return Service.connect(args);
+            }
+        });
+        try {
+            Service service = null;
+            if (connectionTimeout > 0) {
+                service = future.get(connectionTimeout, TimeUnit.MILLISECONDS);
+            } else {
+                service = future.get();
+            }
+            LOG.info("Successfully connected to Splunk");
+            return service;
+        } catch (Exception e) {
+            throw new RuntimeException(String.format("could not connect to Splunk Server @ %s:%d - %s", host, port, e.getMessage()));
+        } finally {
+            if (executor != null) {
+                camelContext.getExecutorServiceManager().shutdownNow(executor);
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/6400ac02/components/camel-splunk/src/main/java/org/apache/camel/component/splunk/SplunkEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-splunk/src/main/java/org/apache/camel/component/splunk/SplunkEndpoint.java b/components/camel-splunk/src/main/java/org/apache/camel/component/splunk/SplunkEndpoint.java
index 6e0d571..ad1f6ab 100644
--- a/components/camel-splunk/src/main/java/org/apache/camel/component/splunk/SplunkEndpoint.java
+++ b/components/camel-splunk/src/main/java/org/apache/camel/component/splunk/SplunkEndpoint.java
@@ -81,7 +81,7 @@ public class SplunkEndpoint extends ScheduledPollEndpoint {
 
     public Service getService() {
         if (service == null) {
-            this.service = configuration.createService();
+            this.service = configuration.getConnectionFactory().createService(getCamelContext());
         }
         return service;
     }
@@ -102,7 +102,7 @@ public class SplunkEndpoint extends ScheduledPollEndpoint {
 
     public synchronized boolean reconnectIfPossible(Exception e) {
         boolean answer = false;
-        if (e instanceof HttpException && ((HttpException) e).getStatus() == 401 || ((e instanceof SocketException) || (e instanceof SSLException))) {
+        if (e instanceof HttpException && ((HttpException)e).getStatus() == 401 || ((e instanceof SocketException) || (e instanceof SSLException))) {
             // try and reconnect
             LOG.warn("Got exception from Splunk. Will try to reconnect");
             this.service = null;

http://git-wip-us.apache.org/repos/asf/camel/blob/6400ac02/components/camel-splunk/src/main/java/org/apache/camel/component/splunk/SplunkProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-splunk/src/main/java/org/apache/camel/component/splunk/SplunkProducer.java b/components/camel-splunk/src/main/java/org/apache/camel/component/splunk/SplunkProducer.java
index bfea70c..4bf22f6 100644
--- a/components/camel-splunk/src/main/java/org/apache/camel/component/splunk/SplunkProducer.java
+++ b/components/camel-splunk/src/main/java/org/apache/camel/component/splunk/SplunkProducer.java
@@ -69,27 +69,24 @@ public class SplunkProducer extends DefaultProducer {
         case TCP: {
             LOG.debug("Creating TcpDataWriter");
             dataWriter = new TcpDataWriter(endpoint, buildSplunkArgs());
-            ((TcpDataWriter) dataWriter).setPort(endpoint.getConfiguration().getTcpReceiverPort());
+            ((TcpDataWriter)dataWriter).setPort(endpoint.getConfiguration().getTcpReceiverPort());
             LOG.debug("TcpDataWriter created for endpoint {}", endpoint);
             break;
         }
         case SUBMIT: {
             LOG.debug("Creating SubmitDataWriter");
             dataWriter = new SubmitDataWriter(endpoint, buildSplunkArgs());
-            ((SubmitDataWriter) dataWriter).setIndex(endpoint.getConfiguration().getIndex());
+            ((SubmitDataWriter)dataWriter).setIndex(endpoint.getConfiguration().getIndex());
             LOG.debug("SubmitDataWriter created for endpoint {}", endpoint);
             break;
         }
         case STREAM: {
             LOG.debug("Creating StreamDataWriter");
             dataWriter = new StreamDataWriter(endpoint, buildSplunkArgs());
-            ((StreamDataWriter) dataWriter).setIndex(endpoint.getConfiguration().getIndex());
+            ((StreamDataWriter)dataWriter).setIndex(endpoint.getConfiguration().getIndex());
             LOG.debug("StreamDataWriter created for endpoint {}", endpoint);
             break;
         }
-        case UNKNOWN: {
-            throw new RuntimeException("unknown producerType");
-        }
         default: {
             throw new RuntimeException("unknown producerType");
         }

http://git-wip-us.apache.org/repos/asf/camel/blob/6400ac02/components/camel-splunk/src/main/java/org/apache/camel/component/splunk/event/SplunkEvent.java
----------------------------------------------------------------------
diff --git a/components/camel-splunk/src/main/java/org/apache/camel/component/splunk/event/SplunkEvent.java b/components/camel-splunk/src/main/java/org/apache/camel/component/splunk/event/SplunkEvent.java
index 589a784..8bfcc6d 100644
--- a/components/camel-splunk/src/main/java/org/apache/camel/component/splunk/event/SplunkEvent.java
+++ b/components/camel-splunk/src/main/java/org/apache/camel/component/splunk/event/SplunkEvent.java
@@ -172,48 +172,48 @@ public class SplunkEvent implements Serializable {
     /**
      * default key value delimiter
      */
-    protected static final String KVDELIM = "=";
+    private static final String KVDELIM = "=";
     /**
      * default pair delimiter
      */
-    protected static final String PAIRDELIM = " ";
+    private static final String PAIRDELIM = " ";
     /**
      * default quote char
      */
-    protected static final char QUOTE = '"';
+    private static final char QUOTE = '"';
     /**
      * default date format is using internal generated date
      */
-    protected static final String DATEFORMATPATTERN = "yyyy-MM-dd\tHH:mm:ss:SSSZ";
+    private static final String DATEFORMATPATTERN = "yyyy-MM-dd\tHH:mm:ss:SSSZ";
     /**
      * Date Formatter
      */
-    protected static final DateTimeFormatter DATE_FORMATTER = DateTimeFormat.forPattern(DATEFORMATPATTERN);
+    private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormat.forPattern(DATEFORMATPATTERN);
 
     /**
      * Event prefix fields
      */
-    protected static final String PREFIX_NAME = "name";
-    protected static final String PREFIX_EVENT_ID = "event_id";
+    private static final String PREFIX_NAME = "name";
+    private static final String PREFIX_EVENT_ID = "event_id";
 
     /**
      * Java Throwable type fields
      */
-    protected static final String THROWABLE_CLASS = "throwable_class";
-    protected static final String THROWABLE_MESSAGE = "throwable_message";
-    protected static final String THROWABLE_STACKTRACE_ELEMENTS = "stacktrace_elements";
+    private static final String THROWABLE_CLASS = "throwable_class";
+    private static final String THROWABLE_MESSAGE = "throwable_message";
+    private static final String THROWABLE_STACKTRACE_ELEMENTS = "stacktrace_elements";
 
-    protected static final String LINEBREAK = "\n";
+    private static final String LINEBREAK = "\n";
 
     /**
      * Whether or not to put quotes around values
      */
-    protected boolean quoteValues = true;
+    private boolean quoteValues = true;
 
     /**
      * Whether or not to add a date to the event string
      */
-    protected boolean useInternalDate = true;
+    private boolean useInternalDate = true;
 
     /**
      * Contents of the event message
@@ -222,7 +222,7 @@ public class SplunkEvent implements Serializable {
 
     /**
      * A Constructor to load data from a Map
-     *
+     * 
      * @param data the map
      */
     public SplunkEvent(Map<String, String> data) {
@@ -243,11 +243,11 @@ public class SplunkEvent implements Serializable {
 
     /**
      * Constructor to create a generic event
-     *
-     * @param eventName       the event name
-     * @param eventID         the event id
+     * 
+     * @param eventName the event name
+     * @param eventID the event id
      * @param useInternalDate whether or not to add a date to the event string
-     * @param quoteValues     whether or not to put quotes around values
+     * @param quoteValues whether or not to put quotes around values
      */
     public SplunkEvent(String eventName, String eventID, boolean useInternalDate, boolean quoteValues) {
 
@@ -256,14 +256,17 @@ public class SplunkEvent implements Serializable {
         this.useInternalDate = useInternalDate;
 
         addPair(PREFIX_NAME, eventName);
-        addPair(PREFIX_EVENT_ID, eventID);
+        if (eventID != null) {
+            addPair(PREFIX_EVENT_ID, eventID);
+        }
+
     }
 
     /**
      * Constructor to create a generic event with the default format
-     *
+     * 
      * @param eventName the event name
-     * @param eventID   the event ID
+     * @param eventID the event ID
      */
     public SplunkEvent(String eventName, String eventID) {
         this(eventName, eventID, true, true);
@@ -282,7 +285,7 @@ public class SplunkEvent implements Serializable {
 
         String[] entries = eventEntries.split(PAIRDELIM);
 
-        String quote = new String(new char[]{QUOTE});
+        String quote = new String(new char[] {QUOTE});
 
         for (String entry : entries) {
             String[] pair = entry.split(KVDELIM);
@@ -347,7 +350,7 @@ public class SplunkEvent implements Serializable {
     /**
      * Utility method for formatting Throwable,Error,Exception objects in a more
      * linear and Splunk friendly manner than printStackTrace
-     *
+     * 
      * @param throwable the Throwable object to add to the event
      */
     public void addThrowable(Throwable throwable) {
@@ -357,8 +360,8 @@ public class SplunkEvent implements Serializable {
     /**
      * Utility method for formatting Throwable,Error,Exception objects in a more
      * linear and Splunk friendly manner than printStackTrace
-     *
-     * @param throwable       the Throwable object to add to the event
+     * 
+     * @param throwable the Throwable object to add to the event
      * @param stackTraceDepth maximum number of stacktrace elements to log
      */
     public void addThrowable(Throwable throwable, int stackTraceDepth) {
@@ -368,10 +371,10 @@ public class SplunkEvent implements Serializable {
     /**
      * Internal private method for formatting Throwable,Error,Exception objects
      * in a more linear and Splunk friendly manner than printStackTrace
-     *
-     * @param throwable       the Throwable object to add to the event
+     * 
+     * @param throwable the Throwable object to add to the event
      * @param stackTraceDepth maximum number of stacktrace elements to log, -1
-     *                        for all
+     *            for all
      */
 
     private void addThrowableObject(Throwable throwable, int stackTraceDepth) {

http://git-wip-us.apache.org/repos/asf/camel/blob/6400ac02/components/camel-splunk/src/main/java/org/apache/camel/component/splunk/support/SplunkDataReader.java
----------------------------------------------------------------------
diff --git a/components/camel-splunk/src/main/java/org/apache/camel/component/splunk/support/SplunkDataReader.java b/components/camel-splunk/src/main/java/org/apache/camel/component/splunk/support/SplunkDataReader.java
index f3a0afd..1e3b906 100644
--- a/components/camel-splunk/src/main/java/org/apache/camel/component/splunk/support/SplunkDataReader.java
+++ b/components/camel-splunk/src/main/java/org/apache/camel/component/splunk/support/SplunkDataReader.java
@@ -23,15 +23,21 @@ import java.util.ArrayList;
 import java.util.Calendar;
 import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 
-import com.splunk.Args;
 import com.splunk.Job;
+import com.splunk.JobArgs;
+import com.splunk.JobArgs.ExecutionMode;
+import com.splunk.JobArgs.SearchMode;
+import com.splunk.JobResultsArgs;
+import com.splunk.JobResultsArgs.OutputMode;
 import com.splunk.ResultsReader;
 import com.splunk.ResultsReaderJson;
 import com.splunk.SavedSearch;
 import com.splunk.SavedSearchCollection;
+import com.splunk.SavedSearchDispatchArgs;
 import com.splunk.Service;
+import com.splunk.ServiceArgs;
+
 import org.apache.camel.component.splunk.ConsumerType;
 import org.apache.camel.component.splunk.SplunkEndpoint;
 import org.apache.camel.component.splunk.event.SplunkEvent;
@@ -58,10 +64,6 @@ public class SplunkDataReader {
         return endpoint.getConfiguration().getCount();
     }
 
-    public String getFieldList() {
-        return endpoint.getConfiguration().getFieldList();
-    }
-
     public String getSearch() {
         return endpoint.getConfiguration().getSearch();
     }
@@ -101,9 +103,9 @@ public class SplunkDataReader {
 
     /**
      * Get the earliestTime of range search.
-     *
+     * 
      * @param startTime the time where search start
-     * @param realtime  if this is realtime search
+     * @param realtime if this is realtime search
      * @return The time of last successful read if not realtime; Time difference
      *         between last successful read and start time;
      */
@@ -128,22 +130,19 @@ public class SplunkDataReader {
         return result;
     }
 
-    private void populateArgs(Args queryArgs, Calendar startTime, boolean realtime) {
+    private void populateArgs(JobArgs queryArgs, Calendar startTime, boolean realtime) {
         String earliestTime = getEarliestTime(startTime, realtime);
         if (ObjectHelper.isNotEmpty(earliestTime)) {
-            queryArgs.put("earliest_time", earliestTime);
+            queryArgs.setEarliestTime(earliestTime);
         }
 
         String latestTime = getLatestTime(startTime, realtime);
         if (ObjectHelper.isNotEmpty(latestTime)) {
-            queryArgs.put("latest_time", latestTime);
+            queryArgs.setLatestTime(latestTime);
         }
 
-        queryArgs.put("time_format", SPLUNK_TIME_FORMAT);
+        queryArgs.setTimeFormat(SPLUNK_TIME_FORMAT);
 
-        if (ObjectHelper.isNotEmpty(getFieldList())) {
-            queryArgs.put("field_list", getFieldList());
-        }
     }
 
     private String getLatestTime(Calendar startTime, boolean realtime) {
@@ -186,13 +185,13 @@ public class SplunkDataReader {
     private List<SplunkEvent> savedSearch() throws Exception {
         LOG.trace("saved search start");
 
-        Args queryArgs = new Args();
-        queryArgs.put("app", "search");
+        ServiceArgs queryArgs = new ServiceArgs();
+        queryArgs.setApp("search");
         if (ObjectHelper.isNotEmpty(endpoint.getConfiguration().getOwner())) {
-            queryArgs.put("owner", endpoint.getConfiguration().getOwner());
+            queryArgs.setOwner(endpoint.getConfiguration().getOwner());
         }
         if (ObjectHelper.isNotEmpty(endpoint.getConfiguration().getApp())) {
-            queryArgs.put("app", endpoint.getConfiguration().getApp());
+            queryArgs.setApp(endpoint.getConfiguration().getApp());
         }
 
         Calendar startTime = Calendar.getInstance();
@@ -211,10 +210,10 @@ public class SplunkDataReader {
             }
         }
         if (search != null) {
-            Map<String, String> args = new HashMap<String, String>();
-            args.put("force_dispatch", "true");
-            args.put("dispatch.earliest_time", earliestTime);
-            args.put("dispatch.latest_time", latestTime);
+            SavedSearchDispatchArgs args = new SavedSearchDispatchArgs();
+            args.setForceDispatch(true);
+            args.setDispatchEarliestTime(earliestTime);
+            args.setDispatchLatestTime(latestTime);
             job = search.dispatch(args);
         }
         while (!job.isDone()) {
@@ -229,8 +228,8 @@ public class SplunkDataReader {
     private List<SplunkEvent> nonBlockingSearch() throws Exception {
         LOG.debug("non block search start");
 
-        Args queryArgs = new Args();
-        queryArgs.put("exec_mode", "normal");
+        JobArgs queryArgs = new JobArgs();
+        queryArgs.setExecutionMode(ExecutionMode.NORMAL);
         Calendar startTime = Calendar.getInstance();
         populateArgs(queryArgs, startTime, false);
 
@@ -240,11 +239,11 @@ public class SplunkDataReader {
     }
 
     private List<SplunkEvent> realtimeSearch() throws Exception {
-        LOG.trace("realtime search start");
+        LOG.debug("realtime search start");
 
-        Args queryArgs = new Args();
-        // queryArgs.put("exec_mode", "normal");
-        queryArgs.put("search_mode", "realtime");
+        JobArgs queryArgs = new JobArgs();
+        queryArgs.setExecutionMode(ExecutionMode.NORMAL);
+        queryArgs.setSearchMode(SearchMode.REALTIME);
         Calendar startTime = Calendar.getInstance();
         populateArgs(queryArgs, startTime, true);
 
@@ -253,16 +252,19 @@ public class SplunkDataReader {
         return data;
     }
 
-    private List<SplunkEvent> runQuery(Args queryArgs, boolean realtime) throws Exception {
+    private List<SplunkEvent> runQuery(JobArgs queryArgs, boolean realtime) throws Exception {
         Service service = endpoint.getService();
         Job job = service.getJobs().create(getSearch(), queryArgs);
         if (realtime) {
             while (!job.isReady()) {
-                Thread.sleep(2000);
+                Thread.sleep(500);
             }
+            // Besides job.isReady there must be some delay before real time job
+            // is ready
+            Thread.sleep(1000);
         } else {
             while (!job.isDone()) {
-                Thread.sleep(2000);
+                Thread.sleep(500);
             }
         }
         return extractData(job, realtime);
@@ -281,9 +283,12 @@ public class SplunkDataReader {
         }
         if (getCount() == 0 || total < getCount()) {
             InputStream stream = null;
-            Args outputArgs = new Args();
-            outputArgs.put("output_mode", "json");
+            JobResultsArgs outputArgs = new JobResultsArgs();
+            outputArgs.setOutputMode(OutputMode.JSON);
             if (realtime) {
+                if (getCount() > 0) {
+                    outputArgs.setCount(getCount());
+                }
                 stream = job.getResultsPreview(outputArgs);
             } else {
                 stream = job.getResults(outputArgs);
@@ -299,10 +304,10 @@ public class SplunkDataReader {
             int offset = 0;
             while (offset < total) {
                 InputStream stream;
-                Args outputArgs = new Args();
-                outputArgs.put("output_mode", "json");
-                outputArgs.put("count", getCount());
-                outputArgs.put("offset", offset);
+                JobResultsArgs outputArgs = new JobResultsArgs();
+                outputArgs.setOutputMode(OutputMode.JSON);
+                outputArgs.setCount(getCount());
+                outputArgs.setOffset(offset);
                 if (realtime) {
                     stream = job.getResultsPreview(outputArgs);
                 } else {
@@ -320,6 +325,7 @@ public class SplunkDataReader {
         if (resultsReader != null) {
             resultsReader.close();
         }
+        job.cancel();
         return result;
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/6400ac02/components/camel-splunk/src/main/java/org/apache/camel/component/splunk/support/SplunkDataWriter.java
----------------------------------------------------------------------
diff --git a/components/camel-splunk/src/main/java/org/apache/camel/component/splunk/support/SplunkDataWriter.java b/components/camel-splunk/src/main/java/org/apache/camel/component/splunk/support/SplunkDataWriter.java
index 46dba18..6a5b881 100644
--- a/components/camel-splunk/src/main/java/org/apache/camel/component/splunk/support/SplunkDataWriter.java
+++ b/components/camel-splunk/src/main/java/org/apache/camel/component/splunk/support/SplunkDataWriter.java
@@ -24,13 +24,14 @@ import java.net.Socket;
 
 import com.splunk.Args;
 import com.splunk.Service;
+
 import org.apache.camel.component.splunk.SplunkEndpoint;
 import org.apache.camel.component.splunk.event.SplunkEvent;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 public abstract class SplunkDataWriter implements DataWriter {
-    protected final Logger logger = LoggerFactory.getLogger(getClass());
+    private static final Logger LOG = LoggerFactory.getLogger(SplunkDataWriter.class);
 
     protected Socket socket;
     protected SplunkEndpoint endpoint;
@@ -44,7 +45,7 @@ public abstract class SplunkDataWriter implements DataWriter {
     protected abstract Socket createSocket(Service service) throws IOException;
 
     public void write(SplunkEvent event) throws Exception {
-        logger.debug("writing event to splunk:" + event);
+        LOG.debug("writing event to splunk:" + event);
         doWrite(event, socket);
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/6400ac02/components/camel-splunk/src/main/java/org/apache/camel/component/splunk/support/StreamDataWriter.java
----------------------------------------------------------------------
diff --git a/components/camel-splunk/src/main/java/org/apache/camel/component/splunk/support/StreamDataWriter.java b/components/camel-splunk/src/main/java/org/apache/camel/component/splunk/support/StreamDataWriter.java
index ffc4102..53aea00 100644
--- a/components/camel-splunk/src/main/java/org/apache/camel/component/splunk/support/StreamDataWriter.java
+++ b/components/camel-splunk/src/main/java/org/apache/camel/component/splunk/support/StreamDataWriter.java
@@ -23,10 +23,15 @@ import com.splunk.Args;
 import com.splunk.Index;
 import com.splunk.Receiver;
 import com.splunk.Service;
+
 import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.component.splunk.SplunkEndpoint;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class StreamDataWriter extends SplunkDataWriter {
+    private static final Logger LOG = LoggerFactory.getLogger(StreamDataWriter.class);
+
     private String index;
 
     public StreamDataWriter(SplunkEndpoint endpoint, Args args) {
@@ -54,7 +59,7 @@ public class StreamDataWriter extends SplunkDataWriter {
             socket = receiver.attach(args);
         }
         socket.setTcpNoDelay(true);
-        logger.trace(String.format("created a socket on %s", socket.getRemoteSocketAddress()));
+        LOG.trace(String.format("created a socket on %s", socket.getRemoteSocketAddress()));
         return socket;
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/6400ac02/components/camel-splunk/src/test/java/org/apache/camel/component/splunk/ConsumerTest.java
----------------------------------------------------------------------
diff --git a/components/camel-splunk/src/test/java/org/apache/camel/component/splunk/ConsumerTest.java b/components/camel-splunk/src/test/java/org/apache/camel/component/splunk/ConsumerTest.java
index c16813f..ee6bbf3 100644
--- a/components/camel-splunk/src/test/java/org/apache/camel/component/splunk/ConsumerTest.java
+++ b/components/camel-splunk/src/test/java/org/apache/camel/component/splunk/ConsumerTest.java
@@ -20,20 +20,22 @@ import java.io.InputStream;
 import java.util.Map;
 
 import com.splunk.Job;
+import com.splunk.JobArgs;
 import com.splunk.JobCollection;
+import com.splunk.JobResultsArgs;
+
 import org.apache.camel.Exchange;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.component.splunk.event.SplunkEvent;
 import org.junit.Test;
 
-import static org.mockito.Matchers.anyMap;
+import static org.mockito.Matchers.any;
 import static org.mockito.Matchers.anyString;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
 public class ConsumerTest extends SplunkMockTestSupport {
-
     @Test
     public void testSearch() throws Exception {
         MockEndpoint searchMock = getMockEndpoint("mock:search-result");
@@ -42,10 +44,10 @@ public class ConsumerTest extends SplunkMockTestSupport {
         JobCollection jobCollection = mock(JobCollection.class);
         Job jobMock = mock(Job.class);
         when(service.getJobs()).thenReturn(jobCollection);
-        when(jobCollection.create(anyString(), anyMap())).thenReturn(jobMock);
+        when(jobCollection.create(anyString(), any(JobArgs.class))).thenReturn(jobMock);
         when(jobMock.isDone()).thenReturn(Boolean.TRUE);
         InputStream stream = ConsumerTest.class.getResourceAsStream("/resultsreader_test_data.json");
-        when(jobMock.getResults(anyMap())).thenReturn(stream);
+        when(jobMock.getResults(any(JobResultsArgs.class))).thenReturn(stream);
 
         assertMockEndpointsSatisfied();
         SplunkEvent recieved = searchMock.getReceivedExchanges().get(0).getIn().getBody(SplunkEvent.class);

http://git-wip-us.apache.org/repos/asf/camel/blob/6400ac02/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 cd9194c..87ecb01 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
@@ -27,6 +27,8 @@ import com.splunk.Input;
 import com.splunk.InputCollection;
 import com.splunk.Service;
 
+import org.apache.camel.CamelContext;
+
 import static org.mockito.Matchers.anyInt;
 import static org.mockito.Matchers.anyString;
 import static org.mockito.Matchers.isA;
@@ -54,10 +56,10 @@ final class MockConnectionSettings extends SplunkConfiguration {
     private Socket socket;
 
     public MockConnectionSettings(Service service, Socket socket) {
-        super("foo", "bar");
         this.service = service;
         this.socket = socket;
         mockSplunkWriterApi();
+        setConnectionFactory(new MockConnectionFactory(service));
     }
 
     private void mockSplunkWriterApi() {
@@ -78,9 +80,17 @@ final class MockConnectionSettings extends SplunkConfiguration {
         }
     }
 
-    @Override
-    public Service createService() {
-        return service;
-    }
+    class MockConnectionFactory extends SplunkConnectionFactory {
+        private Service service;
+
+        public MockConnectionFactory(Service service) {
+            super("foo", "bar");
+            this.service = service;
+        }
 
+        @Override
+        public Service createService(CamelContext camelContext) {
+            return service;
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/6400ac02/components/camel-splunk/src/test/java/org/apache/camel/component/splunk/SplunkComponentConfigurationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-splunk/src/test/java/org/apache/camel/component/splunk/SplunkComponentConfigurationTest.java b/components/camel-splunk/src/test/java/org/apache/camel/component/splunk/SplunkComponentConfigurationTest.java
index a027455..06e9bd9 100644
--- a/components/camel-splunk/src/test/java/org/apache/camel/component/splunk/SplunkComponentConfigurationTest.java
+++ b/components/camel-splunk/src/test/java/org/apache/camel/component/splunk/SplunkComponentConfigurationTest.java
@@ -16,6 +16,8 @@
  */
 package org.apache.camel.component.splunk;
 
+import com.splunk.Service;
+
 import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;
 
@@ -25,21 +27,29 @@ public class SplunkComponentConfigurationTest extends CamelTestSupport {
     public void createProducerEndpointWithMinimalConfiguration() throws Exception {
         SplunkComponent component = context.getComponent("splunk", SplunkComponent.class);
 
-        SplunkEndpoint endpoint = (SplunkEndpoint) component.createEndpoint("splunk://test?username=test&password=pw");
-        assertEquals("localhost", endpoint.getConfiguration().getHost());
-        assertEquals(8089, endpoint.getConfiguration().getPort());
+        SplunkEndpoint endpoint = (SplunkEndpoint)component.createEndpoint("splunk://test?username=test&password=pw");
+        assertEquals(Service.DEFAULT_HOST, endpoint.getConfiguration().getHost());
+        assertEquals(Service.DEFAULT_PORT, endpoint.getConfiguration().getPort());
         assertEquals("test", endpoint.getConfiguration().getUsername());
         assertEquals("pw", endpoint.getConfiguration().getPassword());
-        assertEquals("https", endpoint.getConfiguration().getScheme());
+        assertEquals(Service.DEFAULT_SCHEME, endpoint.getConfiguration().getScheme());
         assertEquals(5000, endpoint.getConfiguration().getConnectionTimeout());
+        assertFalse(endpoint.getConfiguration().isUseSunHttpsHandler());
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void createProducerWithoutUserAndPassword() throws Exception {
+        SplunkComponent component = context.getComponent("splunk", SplunkComponent.class);
+        component.createEndpoint("splunk://test");
     }
 
     @Test
     public void createProducerEndpointWithMaximalConfiguration() throws Exception {
         SplunkComponent component = context.getComponent("splunk", SplunkComponent.class);
 
-        SplunkEndpoint endpoint = (SplunkEndpoint) component.createEndpoint("splunk://tcp?username=test&password=pw&host=myhost&port=3333&"
-                + "tcpReceiverPort=4444&index=myindex&sourceType=testSource&" + "source=test&owner=me&app=fantasticapp");
+        SplunkEndpoint endpoint = (SplunkEndpoint)component.createEndpoint("splunk://tcp?username=test&password=pw&host=myhost&port=3333&"
+                                                                           + "tcpReceiverPort=4444&index=myindex&sourceType=testSource&"
+                                                                           + "source=test&owner=me&app=fantasticapp&useSunHttpsHandler=true");
         assertEquals("myhost", endpoint.getConfiguration().getHost());
         assertEquals(3333, endpoint.getConfiguration().getPort());
         assertEquals("test", endpoint.getConfiguration().getUsername());
@@ -50,18 +60,19 @@ public class SplunkComponentConfigurationTest extends CamelTestSupport {
         assertEquals("test", endpoint.getConfiguration().getSource());
         assertEquals("me", endpoint.getConfiguration().getOwner());
         assertEquals("fantasticapp", endpoint.getConfiguration().getApp());
+        assertTrue(endpoint.getConfiguration().isUseSunHttpsHandler());
     }
 
     @Test
     public void createConsumerEndpointWithMinimalConfiguration() throws Exception {
         SplunkComponent component = context.getComponent("splunk", SplunkComponent.class);
 
-        SplunkEndpoint endpoint = (SplunkEndpoint) component.createEndpoint("splunk://realtime?username=test&" + "password=pw&search=Splunk search query goes here");
-        assertEquals("localhost", endpoint.getConfiguration().getHost());
-        assertEquals(8089, endpoint.getConfiguration().getPort());
+        SplunkEndpoint endpoint = (SplunkEndpoint)component.createEndpoint("splunk://realtime?username=test&" + "password=pw&search=Splunk search query goes here");
+        assertEquals(Service.DEFAULT_HOST, endpoint.getConfiguration().getHost());
+        assertEquals(Service.DEFAULT_PORT, endpoint.getConfiguration().getPort());
         assertEquals("test", endpoint.getConfiguration().getUsername());
         assertEquals("pw", endpoint.getConfiguration().getPassword());
-        assertEquals("https", endpoint.getConfiguration().getScheme());
+        assertEquals(Service.DEFAULT_SCHEME, endpoint.getConfiguration().getScheme());
         assertEquals(5000, endpoint.getConfiguration().getConnectionTimeout());
         assertEquals("Splunk search query goes here", endpoint.getConfiguration().getSearch());
     }
@@ -70,19 +81,20 @@ public class SplunkComponentConfigurationTest extends CamelTestSupport {
     public void createConsumerEndpointWithMaximalConfiguration() throws Exception {
         SplunkComponent component = context.getComponent("splunk", SplunkComponent.class);
 
-        SplunkEndpoint endpoint = (SplunkEndpoint) component.createEndpoint("splunk://normal?username=test&password=pw&host=myhost&port=3333&delay=10s&"
-                + "search=Splunk search query goes here&initEarliestTime=-1d"
-                + "&latestTime=now&fieldList=field1,field2&count=10&" + "owner=me&app=fantasticapp");
+        SplunkEndpoint endpoint = (SplunkEndpoint)component.createEndpoint("splunk://normal?username=test&password=pw&host=myhost&port=3333&delay=10s&"
+                                                                           + "search=Splunk search query goes here&initEarliestTime=-1d" + "&latestTime=now&count=10&"
+                                                                           + "owner=me&app=fantasticapp");
         assertEquals("myhost", endpoint.getConfiguration().getHost());
         assertEquals(3333, endpoint.getConfiguration().getPort());
         assertEquals("test", endpoint.getConfiguration().getUsername());
         assertEquals("pw", endpoint.getConfiguration().getPassword());
         assertEquals("-1d", endpoint.getConfiguration().getInitEarliestTime());
         assertEquals("now", endpoint.getConfiguration().getLatestTime());
-        assertEquals("field1,field2", endpoint.getConfiguration().getFieldList());
         assertEquals(10, endpoint.getConfiguration().getCount());
         assertEquals("me", endpoint.getConfiguration().getOwner());
         assertEquals("fantasticapp", endpoint.getConfiguration().getApp());
+        assertEquals(Service.DEFAULT_SCHEME, endpoint.getConfiguration().getScheme());
+        assertEquals("Splunk search query goes here", endpoint.getConfiguration().getSearch());
     }
 
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/6400ac02/components/camel-splunk/src/test/java/org/apache/camel/component/splunk/integration/SplunkProducerTest.java
----------------------------------------------------------------------
diff --git a/components/camel-splunk/src/test/java/org/apache/camel/component/splunk/integration/SplunkProducerTest.java b/components/camel-splunk/src/test/java/org/apache/camel/component/splunk/integration/SplunkProducerTest.java
index a92dac8..12817f7 100644
--- a/components/camel-splunk/src/test/java/org/apache/camel/component/splunk/integration/SplunkProducerTest.java
+++ b/components/camel-splunk/src/test/java/org/apache/camel/component/splunk/integration/SplunkProducerTest.java
@@ -69,13 +69,13 @@ public class SplunkProducerTest extends SplunkTest {
         return new RouteBuilder() {
             public void configure() {
                 from("direct:stream").to("splunk://stream?username=" + SPLUNK_USERNAME + "&password=" + SPLUNK_PASSWORD + "&index=" + INDEX
-                        + "&sourceType=StreamSourceType&source=StreamSource").to("mock:stream-result");
+                                             + "&sourceType=StreamSourceType&source=StreamSource").to("mock:stream-result");
 
                 from("direct:submit").to("splunk://submit?username=" + SPLUNK_USERNAME + "&password=" + SPLUNK_PASSWORD + "&index=" + INDEX + "&sourceType=testSource&source=test")
-                        .to("mock:submitresult");
+                    .to("mock:submitresult");
 
-                from("direct:tcp").to("splunk://tcp?username=" + SPLUNK_USERNAME + "&password=" + SPLUNK_PASSWORD + "&tcpRecieverPort=" + TCP_RECIEVER_PORT + "&index=" + INDEX
-                        + "&sourceType=testSource&source=test").to("mock:tcpresult");
+                from("direct:tcp").to("splunk://tcp?username=" + SPLUNK_USERNAME + "&password=" + SPLUNK_PASSWORD + "&tcpReceiverPort=" + TCP_RECIEVER_PORT + "&index=" + INDEX
+                                          + "&sourceType=testSource&source=test").to("mock:tcpresult");
             }
         };
     }