This is an automated email from the ASF dual-hosted git repository. acosentino pushed a commit to branch camel-2.22.x in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/camel-2.22.x by this push: new 621c32b CAMEL-12774 - Error during type conversion from type: java.lang.String to the required type: org.elasticsearch.action.update.UpdateRequest - Take 2 621c32b is described below commit 621c32bea81d7d6b4d50ebca31154829cf83023d 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 aea664e..577c48e 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 @@ -59,7 +59,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 be4d98b..f7e3746 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