camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lburgazz...@apache.org
Subject camel git commit: CAMEL-11507: camel-servicenow : add an header to indicate the answer data type
Date Mon, 03 Jul 2017 15:10:43 GMT
Repository: camel
Updated Branches:
  refs/heads/master 2ee4ed126 -> 0996ee39f


CAMEL-11507: camel-servicenow : add an header to indicate the answer data type


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

Branch: refs/heads/master
Commit: 0996ee39f9d64f14c48469a804e2aa406d5caeb8
Parents: 2ee4ed1
Author: lburgazzoli <lburgazzoli@gmail.com>
Authored: Mon Jul 3 17:10:00 2017 +0200
Committer: lburgazzoli <lburgazzoli@gmail.com>
Committed: Mon Jul 3 17:10:23 2017 +0200

----------------------------------------------------------------------
 .../camel/component/servicenow/AbstractServiceNowProcessor.java    | 2 ++
 .../org/apache/camel/component/servicenow/ServiceNowConstants.java | 1 +
 .../apache/camel/component/servicenow/ServiceNowImportSetTest.java | 1 +
 .../org/apache/camel/component/servicenow/ServiceNowTableTest.java | 1 +
 4 files changed, 5 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/0996ee39/components/camel-servicenow/src/main/java/org/apache/camel/component/servicenow/AbstractServiceNowProcessor.java
----------------------------------------------------------------------
diff --git a/components/camel-servicenow/src/main/java/org/apache/camel/component/servicenow/AbstractServiceNowProcessor.java
b/components/camel-servicenow/src/main/java/org/apache/camel/component/servicenow/AbstractServiceNowProcessor.java
index b7d81d2..6dc66a3 100644
--- a/components/camel-servicenow/src/main/java/org/apache/camel/component/servicenow/AbstractServiceNowProcessor.java
+++ b/components/camel-servicenow/src/main/java/org/apache/camel/component/servicenow/AbstractServiceNowProcessor.java
@@ -143,6 +143,7 @@ public abstract class AbstractServiceNowProcessor implements Processor
{
     protected AbstractServiceNowProcessor setBody(Message message, Class<?> model,
Response response) throws Exception {
         if (message != null && response != null) {
             if (ObjectHelper.isNotEmpty(response.getHeaderString(HttpHeaders.CONTENT_TYPE)))
{
+
                 JsonNode root = response.readEntity(JsonNode.class);
                 Map<String, String> responseAttributes = null;
 
@@ -156,6 +157,7 @@ public abstract class AbstractServiceNowProcessor implements Processor
{
                         if (ObjectHelper.equal("result", key, true)) {
                             Object body = unwrap(node, model);
                             if (body != null) {
+                                message.setHeader(ServiceNowConstants.RESPONSE_TYPE, body.getClass());
                                 message.setBody(body);
                             }
                         } else {

http://git-wip-us.apache.org/repos/asf/camel/blob/0996ee39/components/camel-servicenow/src/main/java/org/apache/camel/component/servicenow/ServiceNowConstants.java
----------------------------------------------------------------------
diff --git a/components/camel-servicenow/src/main/java/org/apache/camel/component/servicenow/ServiceNowConstants.java
b/components/camel-servicenow/src/main/java/org/apache/camel/component/servicenow/ServiceNowConstants.java
index 13eb9cf..0f4b7ad 100644
--- a/components/camel-servicenow/src/main/java/org/apache/camel/component/servicenow/ServiceNowConstants.java
+++ b/components/camel-servicenow/src/main/java/org/apache/camel/component/servicenow/ServiceNowConstants.java
@@ -34,6 +34,7 @@ public final class ServiceNowConstants {
     public static final String CONTENT_META = "CamelServiceNowContentMeta";
     public static final String RESPONSE_META = "CamelServiceNowResponseMeta";
     public static final String API_VERSION = "CamelServiceNowApiVersion";
+    public static final String RESPONSE_TYPE = "CamelServiceNowResponseType";
 
     public static final String ATTACHMENT_META_HEADER = "X-Attachment-Metadata";
 

http://git-wip-us.apache.org/repos/asf/camel/blob/0996ee39/components/camel-servicenow/src/test/java/org/apache/camel/component/servicenow/ServiceNowImportSetTest.java
----------------------------------------------------------------------
diff --git a/components/camel-servicenow/src/test/java/org/apache/camel/component/servicenow/ServiceNowImportSetTest.java
b/components/camel-servicenow/src/test/java/org/apache/camel/component/servicenow/ServiceNowImportSetTest.java
index c46758c..df924df 100644
--- a/components/camel-servicenow/src/test/java/org/apache/camel/component/servicenow/ServiceNowImportSetTest.java
+++ b/components/camel-servicenow/src/test/java/org/apache/camel/component/servicenow/ServiceNowImportSetTest.java
@@ -53,6 +53,7 @@ public class ServiceNowImportSetTest extends ServiceNowTestSupport {
 
         mock.reset();
         mock.expectedMessageCount(1);
+        mock.expectedHeaderReceived(ServiceNowConstants.RESPONSE_TYPE, List.class);
 
         IncidentImportRequest incident = new IncidentImportRequest();
         incident.shortDescription = "test";

http://git-wip-us.apache.org/repos/asf/camel/blob/0996ee39/components/camel-servicenow/src/test/java/org/apache/camel/component/servicenow/ServiceNowTableTest.java
----------------------------------------------------------------------
diff --git a/components/camel-servicenow/src/test/java/org/apache/camel/component/servicenow/ServiceNowTableTest.java
b/components/camel-servicenow/src/test/java/org/apache/camel/component/servicenow/ServiceNowTableTest.java
index b5403b0..62ba190 100644
--- a/components/camel-servicenow/src/test/java/org/apache/camel/component/servicenow/ServiceNowTableTest.java
+++ b/components/camel-servicenow/src/test/java/org/apache/camel/component/servicenow/ServiceNowTableTest.java
@@ -50,6 +50,7 @@ public class ServiceNowTableTest extends ServiceNowTestSupport {
 
         assertNotNull(items);
         assertTrue(items.size() <= 10);
+        assertNotNull(exchange.getIn().getHeader(ServiceNowConstants.RESPONSE_TYPE));
         assertNotNull(exchange.getIn().getHeader(ServiceNowConstants.OFFSET_FIRST));
         assertNotNull(exchange.getIn().getHeader(ServiceNowConstants.OFFSET_NEXT));
         assertNotNull(exchange.getIn().getHeader(ServiceNowConstants.OFFSET_LAST));


Mime
View raw message