You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2015/04/27 22:33:26 UTC

camel git commit: Fixed CS Camel-ElasticSearch component related to CAMEL-8706

Repository: camel
Updated Branches:
  refs/heads/master fba8aa47c -> 795cd7d61


Fixed CS Camel-ElasticSearch component related to CAMEL-8706


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

Branch: refs/heads/master
Commit: 795cd7d616b72b61dae99d780aea9dcb46ee6223
Parents: fba8aa4
Author: Andrea Cosentino <an...@gmail.com>
Authored: Mon Apr 27 22:31:01 2015 +0200
Committer: Andrea Cosentino <an...@gmail.com>
Committed: Mon Apr 27 22:31:01 2015 +0200

----------------------------------------------------------------------
 .../elasticsearch/ElasticsearchConfiguration.java   |  9 +++++----
 .../elasticsearch/ElasticsearchEndpoint.java        |  8 ++++----
 .../elasticsearch/ElasticsearchComponentTest.java   |  3 ++-
 .../ElasticsearchConfigurationTest.java             | 16 ++++++++--------
 4 files changed, 19 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/795cd7d6/components/camel-elasticsearch/src/main/java/org/apache/camel/component/elasticsearch/ElasticsearchConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-elasticsearch/src/main/java/org/apache/camel/component/elasticsearch/ElasticsearchConfiguration.java b/components/camel-elasticsearch/src/main/java/org/apache/camel/component/elasticsearch/ElasticsearchConfiguration.java
index d2568d3..f33105a 100644
--- a/components/camel-elasticsearch/src/main/java/org/apache/camel/component/elasticsearch/ElasticsearchConfiguration.java
+++ b/components/camel-elasticsearch/src/main/java/org/apache/camel/component/elasticsearch/ElasticsearchConfiguration.java
@@ -159,15 +159,16 @@ public class ElasticsearchConfiguration {
             return null;
         }
         List<String> addressesStr = Arrays.asList(ipsString.split(TRANSPORT_ADDRESSES_SEPARATOR_REGEX));
-        List<InetSocketTransportAddress> addressesTrAd = new ArrayList<>(addressesStr.size());
+        List<InetSocketTransportAddress> addressesTrAd = new ArrayList(addressesStr.size());
         for (String address : addressesStr) {
             String[] split = address.split(IP_PORT_SEPARATOR_REGEX);
             String hostname;
-            if (split.length > 0)
+            if (split.length > 0) {
                 hostname = split[0];
-            else
+            } else {
                 throw new IllegalArgumentException();
-            Integer port = (split.length > 1 ? Integer.parseInt(split[1]) : DEFAULT_PORT);
+            }
+            Integer port = split.length > 1 ? Integer.parseInt(split[1]) : DEFAULT_PORT;
             addressesTrAd.add(new InetSocketTransportAddress(hostname, port));
         }
         return addressesTrAd;

http://git-wip-us.apache.org/repos/asf/camel/blob/795cd7d6/components/camel-elasticsearch/src/main/java/org/apache/camel/component/elasticsearch/ElasticsearchEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-elasticsearch/src/main/java/org/apache/camel/component/elasticsearch/ElasticsearchEndpoint.java b/components/camel-elasticsearch/src/main/java/org/apache/camel/component/elasticsearch/ElasticsearchEndpoint.java
index 4a582ed..ec4e0c2 100644
--- a/components/camel-elasticsearch/src/main/java/org/apache/camel/component/elasticsearch/ElasticsearchEndpoint.java
+++ b/components/camel-elasticsearch/src/main/java/org/apache/camel/component/elasticsearch/ElasticsearchEndpoint.java
@@ -17,9 +17,9 @@
 package org.apache.camel.component.elasticsearch;
 
 import java.net.URI;
-import java.util.Map;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
 import org.apache.camel.Consumer;
 import org.apache.camel.Processor;
 import org.apache.camel.Producer;
@@ -79,9 +79,9 @@ public class ElasticsearchEndpoint extends DefaultEndpoint {
             this.client = new TransportClient(getSettings())
                     .addTransportAddress(new InetSocketTransportAddress(configuration.getIp(), configuration.getPort()));
 
-        } else if (configuration.getTransportAddresses() != null &&
-                !configuration.getTransportAddresses().isEmpty()) {
-            List<TransportAddress> addresses = new ArrayList<>(configuration.getTransportAddresses().size());
+        } else if (configuration.getTransportAddresses() != null 
+               && !configuration.getTransportAddresses().isEmpty()) {
+            List<TransportAddress> addresses = new ArrayList(configuration.getTransportAddresses().size());
             for (TransportAddress address : configuration.getTransportAddresses()) {
                 addresses.add(address);
             }

http://git-wip-us.apache.org/repos/asf/camel/blob/795cd7d6/components/camel-elasticsearch/src/test/java/org/apache/camel/component/elasticsearch/ElasticsearchComponentTest.java
----------------------------------------------------------------------
diff --git a/components/camel-elasticsearch/src/test/java/org/apache/camel/component/elasticsearch/ElasticsearchComponentTest.java b/components/camel-elasticsearch/src/test/java/org/apache/camel/component/elasticsearch/ElasticsearchComponentTest.java
index 27fa90f..11357c4 100644
--- a/components/camel-elasticsearch/src/test/java/org/apache/camel/component/elasticsearch/ElasticsearchComponentTest.java
+++ b/components/camel-elasticsearch/src/test/java/org/apache/camel/component/elasticsearch/ElasticsearchComponentTest.java
@@ -408,7 +408,8 @@ public class ElasticsearchComponentTest extends CamelTestSupport {
                 //from("direct:indexWithIp").to("elasticsearch://elasticsearch?operation=INDEX&indexName=twitter&indexType=tweet&ip=localhost");
                 //from("direct:indexWithIpAndPort").to("elasticsearch://elasticsearch?operation=INDEX&indexName=twitter&indexType=tweet&ip=localhost&port=9300");
                 //from("direct:indexWithTransportAddresses").to("elasticsearch://elasticsearch?operation=INDEX&indexName=twitter&indexType=tweet&transportAddresses=localhost:9300,localhost:9301");
-                //from("direct:indexWithIpAndTransportAddresses").to("elasticsearch://elasticsearch?operation=INDEX&indexName=twitter&indexType=tweet&ip=localhost&port=9300&transportAddresses=localhost:4444,localhost:5555");
+                //from("direct:indexWithIpAndTransportAddresses").
+                //to("elasticsearch://elasticsearch?operation=INDEX&indexName=twitter&indexType=tweet&ip=localhost&port=9300&transportAddresses=localhost:4444,localhost:5555");
             }
         };
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/795cd7d6/components/camel-elasticsearch/src/test/java/org/apache/camel/component/elasticsearch/ElasticsearchConfigurationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-elasticsearch/src/test/java/org/apache/camel/component/elasticsearch/ElasticsearchConfigurationTest.java b/components/camel-elasticsearch/src/test/java/org/apache/camel/component/elasticsearch/ElasticsearchConfigurationTest.java
index 294cd32..f025edf 100644
--- a/components/camel-elasticsearch/src/test/java/org/apache/camel/component/elasticsearch/ElasticsearchConfigurationTest.java
+++ b/components/camel-elasticsearch/src/test/java/org/apache/camel/component/elasticsearch/ElasticsearchConfigurationTest.java
@@ -141,8 +141,8 @@ public class ElasticsearchConfigurationTest extends CamelTestSupport {
 
     @Test
     public void transportAddressesSimpleHostnameTest() throws Exception {
-        URI uri = new URI("elasticsearch://local?operation=INDEX&indexName=twitter&" +
-                "indexType=tweet&transportAddresses=127.0.0.1");
+        URI uri = new URI("elasticsearch://local?operation=INDEX&indexName=twitter&" 
+              + "indexType=tweet&transportAddresses=127.0.0.1");
         Map<String, Object> parameters = URISupport.parseParameters(uri);
         ElasticsearchConfiguration conf = new ElasticsearchConfiguration(uri, parameters);
         assertDefaultConfigurationParameters(conf);
@@ -153,8 +153,8 @@ public class ElasticsearchConfigurationTest extends CamelTestSupport {
 
     @Test
     public void transportAddressesMultipleHostnameTest() throws Exception {
-        URI uri = new URI("elasticsearch://local?operation=INDEX&indexName=twitter&" +
-                "indexType=tweet&transportAddresses=127.0.0.1,127.0.0.2");
+        URI uri = new URI("elasticsearch://local?operation=INDEX&indexName=twitter&" 
+                + "indexType=tweet&transportAddresses=127.0.0.1,127.0.0.2");
         Map<String, Object> parameters = URISupport.parseParameters(uri);
         ElasticsearchConfiguration conf = new ElasticsearchConfiguration(uri, parameters);
         assertDefaultConfigurationParameters(conf);
@@ -167,8 +167,8 @@ public class ElasticsearchConfigurationTest extends CamelTestSupport {
 
     @Test
     public void transportAddressesSimpleHostnameAndPortTest() throws Exception {
-        URI uri = new URI("elasticsearch://local?operation=INDEX&indexName=twitter&" +
-                "indexType=tweet&transportAddresses=127.0.0.1:9305");
+        URI uri = new URI("elasticsearch://local?operation=INDEX&indexName=twitter&"
+                + "indexType=tweet&transportAddresses=127.0.0.1:9305");
         Map<String, Object> parameters = URISupport.parseParameters(uri);
         ElasticsearchConfiguration conf = new ElasticsearchConfiguration(uri, parameters);
         assertDefaultConfigurationParameters(conf);
@@ -179,8 +179,8 @@ public class ElasticsearchConfigurationTest extends CamelTestSupport {
 
     @Test
     public void transportAddressesMultipleHostnameAndPortTest() throws Exception {
-        URI uri = new URI("elasticsearch://local?operation=INDEX&indexName=twitter&" +
-                "indexType=tweet&transportAddresses=127.0.0.1:9400,127.0.0.2,127.0.0.3:9401");
+        URI uri = new URI("elasticsearch://local?operation=INDEX&indexName=twitter&"
+                + "indexType=tweet&transportAddresses=127.0.0.1:9400,127.0.0.2,127.0.0.3:9401");
         Map<String, Object> parameters = URISupport.parseParameters(uri);
         ElasticsearchConfiguration conf = new ElasticsearchConfiguration(uri, parameters);
         assertDefaultConfigurationParameters(conf);