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 2017/10/26 13:31:55 UTC

[camel] branch master updated (ef27ba6 -> 927af95)

This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git.


    from ef27ba6  Upgrade Chronicle Wire to version 1.9.26
     new 9c12472  CAMEL-11949 - Camel-Elasticsearch5-Rest: Add a Ping Operation to Producer
     new 927af95  CAMEL-11949 - Update docs

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../src/main/docs/elasticsearch5-rest-component.adoc      |  2 ++
 .../component/elasticsearch5/ElasticsearchOperation.java  |  3 ++-
 .../component/elasticsearch5/ElasticsearchProducer.java   |  3 ++-
 .../component/elasticsearch5/ElasticsearchPingTest.java   | 15 +++++++--------
 4 files changed, 13 insertions(+), 10 deletions(-)
 copy tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/MyRouteTest.java => components/camel-elasticsearch5-rest/src/test/java/org/apache/camel/component/elasticsearch5/ElasticsearchPingTest.java (68%)

-- 
To stop receiving notification emails like this one, please contact
['"commits@camel.apache.org" <co...@camel.apache.org>'].

[camel] 02/02: CAMEL-11949 - Update docs

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 927af954b758b5e6c0af17d067dceec20cdf83a4
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Thu Oct 26 15:28:20 2017 +0200

    CAMEL-11949 - Update docs
---
 .../src/main/docs/elasticsearch5-rest-component.adoc                    | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/components/camel-elasticsearch5-rest/src/main/docs/elasticsearch5-rest-component.adoc b/components/camel-elasticsearch5-rest/src/main/docs/elasticsearch5-rest-component.adoc
index cbca9c6..e678c6d 100644
--- a/components/camel-elasticsearch5-rest/src/main/docs/elasticsearch5-rest-component.adoc
+++ b/components/camel-elasticsearch5-rest/src/main/docs/elasticsearch5-rest-component.adoc
@@ -126,6 +126,8 @@ object in the body
 
 |Update |*Map*, *UpdateRequest*, *String*, *byte[]* or *XContentBuilder* content to update |Updates content to an index and returns the content's
 indexId in the body.
+
+|Ping |None  |Pings the remote Elasticsearch cluster and returns true if the ping succeeded, false otherwise
 |===
 
 === Configure the component and enable basic authentication

-- 
To stop receiving notification emails like this one, please contact
"commits@camel.apache.org" <co...@camel.apache.org>.

[camel] 01/02: CAMEL-11949 - Camel-Elasticsearch5-Rest: Add a Ping Operation to Producer

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 9c12472b671a94efd9a83a7af721797612a5f32a
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Thu Oct 26 15:25:46 2017 +0200

    CAMEL-11949 - Camel-Elasticsearch5-Rest: Add a Ping Operation to Producer
---
 .../elasticsearch5/ElasticsearchOperation.java     |  3 +-
 .../elasticsearch5/ElasticsearchProducer.java      |  3 +-
 .../elasticsearch5/ElasticsearchPingTest.java      | 39 ++++++++++++++++++++++
 3 files changed, 43 insertions(+), 2 deletions(-)

diff --git a/components/camel-elasticsearch5-rest/src/main/java/org/apache/camel/component/elasticsearch5/ElasticsearchOperation.java b/components/camel-elasticsearch5-rest/src/main/java/org/apache/camel/component/elasticsearch5/ElasticsearchOperation.java
index 11b57f8..fee5cff 100644
--- a/components/camel-elasticsearch5-rest/src/main/java/org/apache/camel/component/elasticsearch5/ElasticsearchOperation.java
+++ b/components/camel-elasticsearch5-rest/src/main/java/org/apache/camel/component/elasticsearch5/ElasticsearchOperation.java
@@ -40,7 +40,8 @@ public enum ElasticsearchOperation {
     Delete("Delete"),
     DeleteIndex("DeleteIndex"),
     Search("Search"),
-    Exists("Exists");
+    Exists("Exists"),
+    Ping("Ping");
 
     private final String text;
 
diff --git a/components/camel-elasticsearch5-rest/src/main/java/org/apache/camel/component/elasticsearch5/ElasticsearchProducer.java b/components/camel-elasticsearch5-rest/src/main/java/org/apache/camel/component/elasticsearch5/ElasticsearchProducer.java
index 620174d..a6daf57 100644
--- a/components/camel-elasticsearch5-rest/src/main/java/org/apache/camel/component/elasticsearch5/ElasticsearchProducer.java
+++ b/components/camel-elasticsearch5-rest/src/main/java/org/apache/camel/component/elasticsearch5/ElasticsearchProducer.java
@@ -201,10 +201,11 @@ public class ElasticsearchProducer extends DefaultProducer {
         } else if (operation == ElasticsearchOperation.Search) {
             SearchRequest searchRequest = ElasticsearchActionRequestConverter.toSearchRequest(message.getBody(), exchange);
             message.setBody(restHighLevelClient.search(searchRequest).getHits());
+        } else if (operation == ElasticsearchOperation.Ping) {
+            message.setBody(restHighLevelClient.ping());
         } else {
             throw new IllegalArgumentException(ElasticsearchConstants.PARAM_OPERATION + " value '" + operation + "' is not supported");
         }
-
         // If we set params via the configuration on this exchange, remove them
         // now. This preserves legacy behavior for this component and enables a
         // use case where one message can be sent to multiple elasticsearch
diff --git a/components/camel-elasticsearch5-rest/src/test/java/org/apache/camel/component/elasticsearch5/ElasticsearchPingTest.java b/components/camel-elasticsearch5-rest/src/test/java/org/apache/camel/component/elasticsearch5/ElasticsearchPingTest.java
new file mode 100644
index 0000000..f350670
--- /dev/null
+++ b/components/camel-elasticsearch5-rest/src/test/java/org/apache/camel/component/elasticsearch5/ElasticsearchPingTest.java
@@ -0,0 +1,39 @@
+/**
+ * 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.elasticsearch5;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Test;
+
+public class ElasticsearchPingTest extends ElasticsearchBaseTest {
+
+    @Test
+    public void testPing() throws Exception {
+        boolean pingResult = template.requestBody("direct:ping", "test", Boolean.class);
+        assertTrue("indexId should be set", pingResult);
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() {
+                from("direct:ping").to("elasticsearch5-rest://elasticsearch?operation=Ping&hostAddresses=localhost:" + ES_BASE_HTTP_PORT);
+            }
+        };
+    }
+}

-- 
To stop receiving notification emails like this one, please contact
"commits@camel.apache.org" <co...@camel.apache.org>.