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 2018/11/20 13:40:39 UTC
[camel] branch master updated: CAMEL-12774 - Error during type
conversion from type: java.lang.String to the required type:
org.elasticsearch.action.update.UpdateRequest - Take 2
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
The following commit(s) were added to refs/heads/master by this push:
new 1ee596d CAMEL-12774 - Error during type conversion from type: java.lang.String to the required type: org.elasticsearch.action.update.UpdateRequest - Take 2
1ee596d is described below
commit 1ee596d7f85bd6dc4fd4f5e02aaac5dd3756e163
Author: Andrea Cosentino <an...@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
---
.../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 1347219..6572c96 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
@@ -61,7 +61,7 @@ public final class ElasticsearchActionRequestConverter {
} else if (document instanceof Map) {
updateRequest.doc((Map<String, Object>) document);
} else if (document instanceof String) {
- updateRequest.doc(XContentFactory.xContent((String) document), (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 96e994f..161e629 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
@@ -49,6 +49,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
@@ -303,12 +304,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