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

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


The following commit(s) were added to refs/heads/camel-2.21.x by this push:
     new da796fb  CAMEL-12774 - Error during type conversion from type: 
java.lang.String to the required type: 
org.elasticsearch.action.update.UpdateRequest - Take 2
da796fb is described below

commit da796fb6c07c2899dcbc9236f2bcd4d6a67bc31f
Author: Andrea Cosentino <anco...@gmail.com>
AuthorDate: Tue Nov 20 14:38:30 2018 +0100

    CAMEL-12774 - Error during type conversion from type: java.lang.String to 
the required type: org.elasticsearch.action.update.UpdateRequest - Take 2
    
    Conflicts:
        
components/camel-elasticsearch-rest/src/main/java/org/apache/camel/component/elasticsearch/converter/ElasticsearchActionRequestConverter.java
---
 .../converter/ElasticsearchActionRequestConverter.java              | 2 +-
 .../elasticsearch/ElasticsearchGetSearchDeleteExistsUpdateTest.java | 6 +++++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git 
a/components/camel-elasticsearch-rest/src/main/java/org/apache/camel/component/elasticsearch/converter/ElasticsearchActionRequestConverter.java
 
b/components/camel-elasticsearch-rest/src/main/java/org/apache/camel/component/elasticsearch/converter/ElasticsearchActionRequestConverter.java
index 3f4c120..f44063d 100644
--- 
a/components/camel-elasticsearch-rest/src/main/java/org/apache/camel/component/elasticsearch/converter/ElasticsearchActionRequestConverter.java
+++ 
b/components/camel-elasticsearch-rest/src/main/java/org/apache/camel/component/elasticsearch/converter/ElasticsearchActionRequestConverter.java
@@ -62,7 +62,7 @@ public final class ElasticsearchActionRequestConverter {
         } else if (document instanceof Map) {
             updateRequest.doc((Map<String, Object>) document);
         } else if (document instanceof String) {
-            updateRequest.doc((String) document, 
XContentFactory.xContent((String) document));
+            updateRequest.doc((String) document, 
XContentFactory.xContentType((String) document));
         } else if (document instanceof XContentBuilder) {
             updateRequest.doc((XContentBuilder) document);
         } else {
diff --git 
a/components/camel-elasticsearch-rest/src/test/java/org/apache/camel/component/elasticsearch/ElasticsearchGetSearchDeleteExistsUpdateTest.java
 
b/components/camel-elasticsearch-rest/src/test/java/org/apache/camel/component/elasticsearch/ElasticsearchGetSearchDeleteExistsUpdateTest.java
index c99263a..49008c4 100644
--- 
a/components/camel-elasticsearch-rest/src/test/java/org/apache/camel/component/elasticsearch/ElasticsearchGetSearchDeleteExistsUpdateTest.java
+++ 
b/components/camel-elasticsearch-rest/src/test/java/org/apache/camel/component/elasticsearch/ElasticsearchGetSearchDeleteExistsUpdateTest.java
@@ -47,6 +47,7 @@ public class ElasticsearchGetSearchDeleteExistsUpdateTest 
extends ElasticsearchB
         GetResponse response = template.requestBody("direct:get", indexId, 
GetResponse.class);
         assertNotNull("response should not be null", response);
         assertNotNull("response source should not be null", 
response.getSource());
+        System.err.println(response.getSource());
     }
 
     @Test
@@ -277,12 +278,15 @@ public class ElasticsearchGetSearchDeleteExistsUpdateTest 
extends ElasticsearchB
         String indexId = template.requestBody("direct:index", map, 
String.class);
         assertNotNull("indexId should be set", indexId);
 
-        String body = "{\"id\" : 1}";
+        String body = "{\"teststringupdate-key\" : 
\"teststringupdate-updated\"}";
 
         Map<String, Object> headers = new HashMap<>();
         headers.put(ElasticsearchConstants.PARAM_INDEX_ID, indexId);
         indexId = template.requestBodyAndHeaders("direct:update", body, 
headers, String.class);
         assertNotNull("indexId should be set", indexId);
+        
+        GetResponse response = template.requestBody("direct:get", indexId, 
GetResponse.class);
+        assertEquals("teststringupdate-updated", 
response.getSource().get("teststringupdate-key"));
     }
 
     @Override

Reply via email to