FAQ
Repository: camel
Updated Branches:
   refs/heads/master b02925175 -> 8ce5a2b2f


Added a fix to the LoginToken class to ensure future new SF fields dont cause the login to fail, added a testcase for it


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

Branch: refs/heads/master
Commit: 440bd9467f56848b9958b0f674a096914900d251
Parents: a6c5418
Author: Devendra Khanolkar <devendra.khanolkar@sixtree.com.au>
Authored: Mon Sep 21 11:30:41 2015 +1000
Committer: Dhiraj Bokde <dhirajsb@yahoo.com>
Committed: Tue Sep 22 16:11:45 2015 -0700

----------------------------------------------------------------------
  .../salesforce/internal/dto/LoginToken.java | 2 +
  .../salesforce/internal/LoginTokenTest.java | 45 ++++++++++++++++++++
  2 files changed, 47 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/440bd946/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/dto/LoginToken.java
----------------------------------------------------------------------
diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/dto/LoginToken.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/dto/LoginToken.java
index be6942a..e429bc5 100644
--- a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/dto/LoginToken.java
+++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/dto/LoginToken.java
@@ -16,11 +16,13 @@
   */
  package org.apache.camel.component.salesforce.internal.dto;

+import org.codehaus.jackson.annotate.JsonIgnoreProperties;
  import org.codehaus.jackson.annotate.JsonProperty;

  /**
   * DTO for Salesforce login
   */
+@JsonIgnoreProperties(ignoreUnknown=true)
  public class LoginToken {

      private String accessToken;

http://git-wip-us.apache.org/repos/asf/camel/blob/440bd946/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/internal/LoginTokenTest.java
----------------------------------------------------------------------
diff --git a/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/internal/LoginTokenTest.java b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/internal/LoginTokenTest.java
new file mode 100644
index 0000000..d20b662
--- /dev/null
+++ b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/internal/LoginTokenTest.java
@@ -0,0 +1,45 @@
+package org.apache.camel.component.salesforce.internal;
+
+import org.apache.camel.component.salesforce.internal.dto.LoginToken;
+import org.codehaus.jackson.map.ObjectMapper;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import static org.junit.Assert.*;
+
+public class LoginTokenTest {
+
+ private static final Logger LOG = LoggerFactory.getLogger(SessionIntegrationTest.class);
+
+ @Test
+ public void testLoginTokenWithUnknownFields() throws Exception {
+
+ String salesforceOAuthResponse = "{\n" +
+ " \"access_token\": \"00XXXXXXXXXXXX!ARMAQKg_lg_hGaRElvizVFBQHoCpvX8tzwGnROQ0_MDPXSceMeZHtm3JHkPmMhlgK0Km3rpJkwxwHInd_8o022KsDy.p4O.X\",\n" +
+ " \"is_readonly\": \"false\",\n" +
+ " \"signature\": \"XXXXXXXXXX+MYU+JrOXPSbpHa2ihMpSvUqow1iTPh7Q=\",\n" +
+ " \"instance_url\": \"https://xxxxxxxx--xxxxxxx.cs5.my.salesforce.com\",\n" +
+ " \"id\": \"https://test.salesforce.com/id/00DO00000054tO8MAI/005O0000001cmmdIAA\",\n" +
+ " \"token_type\": \"Bearer\",\n" +
+ " \"issued_at\": \"1442798068621\",\n" +
+ " \"an_unrecognised_field\": \"foo\"\n" +
+ "}";
+ ObjectMapper mapper = new ObjectMapper();
+ Exception e = null;
+ LoginToken token = null;
+ try {
+ token = mapper.readValue(salesforceOAuthResponse, LoginToken.class);
+ } catch (Exception ex) {
+ e = ex;
+ }
+
+ //assert ObjectMapper deserialized the SF OAuth response and returned a valid token back
+ assertNotNull("An invalid token was returned" , token);
+ //assert No exception was thrown during the JSON deserialization process
+ assertNull("Exception was thrown during JSON deserialisation" , e);
+ //assert one of the token fields
+ assertEquals("false", token.getIsReadOnly());
+
+ }
+
+}

Search Discussions

  • Dhirajsb at Sep 22, 2015 at 11:40 pm
    Fix for login failure post Salesforce Non Prod patch


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

    Branch: refs/heads/master
    Commit: a6c54186a8f226e9b5edc48a1df0d7048a3ef7a6
    Parents: b029251
    Author: Devendra Khanolkar <devendra.khanolkar@sixtree.com.au>
    Authored: Wed Sep 16 21:16:05 2015 +1000
    Committer: Dhiraj Bokde <dhirajsb@yahoo.com>
    Committed: Tue Sep 22 16:11:45 2015 -0700

    ----------------------------------------------------------------------
      .../apache/camel/component/salesforce/internal/dto/LoginToken.java | 2 +-
      1 file changed, 1 insertion(+), 1 deletion(-)
    ----------------------------------------------------------------------


    http://git-wip-us.apache.org/repos/asf/camel/blob/a6c54186/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/dto/LoginToken.java
    ----------------------------------------------------------------------
    diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/dto/LoginToken.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/dto/LoginToken.java
    index 32a316f..be6942a 100644
    --- a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/dto/LoginToken.java
    +++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/dto/LoginToken.java
    @@ -34,7 +34,7 @@ public class LoginToken {
          private String issuedAt;

          private String tokenType;
    -
    +
          private String isReadOnly;

          @JsonProperty("access_token")
  • Dhirajsb at Sep 22, 2015 at 11:40 pm
    Polished formatting


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

    Branch: refs/heads/master
    Commit: 883b8cffb1db531cfb46dfcd346eed11e6148a00
    Parents: 440bd94
    Author: Dhiraj Bokde <dhirajsb@yahoo.com>
    Authored: Tue Sep 22 16:39:00 2015 -0700
    Committer: Dhiraj Bokde <dhirajsb@yahoo.com>
    Committed: Tue Sep 22 16:39:00 2015 -0700

    ----------------------------------------------------------------------
      .../salesforce/internal/dto/LoginToken.java | 4 +-
      .../salesforce/internal/LoginTokenTest.java | 83 ++++++++++++--------
      2 files changed, 52 insertions(+), 35 deletions(-)
    ----------------------------------------------------------------------


    http://git-wip-us.apache.org/repos/asf/camel/blob/883b8cff/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/dto/LoginToken.java
    ----------------------------------------------------------------------
    diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/dto/LoginToken.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/dto/LoginToken.java
    index e429bc5..7f7e2c6 100644
    --- a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/dto/LoginToken.java
    +++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/dto/LoginToken.java
    @@ -22,7 +22,7 @@ import org.codehaus.jackson.annotate.JsonProperty;
      /**
       * DTO for Salesforce login
       */
    -@JsonIgnoreProperties(ignoreUnknown=true)
    +@JsonIgnoreProperties(ignoreUnknown = true)
      public class LoginToken {

          private String accessToken;
    @@ -36,7 +36,7 @@ public class LoginToken {
          private String issuedAt;

          private String tokenType;
    -
    +
          private String isReadOnly;

          @JsonProperty("access_token")

    http://git-wip-us.apache.org/repos/asf/camel/blob/883b8cff/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/internal/LoginTokenTest.java
    ----------------------------------------------------------------------
    diff --git a/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/internal/LoginTokenTest.java b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/internal/LoginTokenTest.java
    index d20b662..5d08d49 100644
    --- a/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/internal/LoginTokenTest.java
    +++ b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/internal/LoginTokenTest.java
    @@ -1,3 +1,19 @@
    +/**
    + * 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.salesforce.internal;

      import org.apache.camel.component.salesforce.internal.dto.LoginToken;
    @@ -5,41 +21,42 @@ import org.codehaus.jackson.map.ObjectMapper;
      import org.junit.Test;
      import org.slf4j.Logger;
      import org.slf4j.LoggerFactory;
    +
      import static org.junit.Assert.*;

      public class LoginTokenTest {
    -
    - private static final Logger LOG = LoggerFactory.getLogger(SessionIntegrationTest.class);
    -
    - @Test
    - public void testLoginTokenWithUnknownFields() throws Exception {
    -
    - String salesforceOAuthResponse = "{\n" +
    - " \"access_token\": \"00XXXXXXXXXXXX!ARMAQKg_lg_hGaRElvizVFBQHoCpvX8tzwGnROQ0_MDPXSceMeZHtm3JHkPmMhlgK0Km3rpJkwxwHInd_8o022KsDy.p4O.X\",\n" +
    - " \"is_readonly\": \"false\",\n" +
    - " \"signature\": \"XXXXXXXXXX+MYU+JrOXPSbpHa2ihMpSvUqow1iTPh7Q=\",\n" +
    - " \"instance_url\": \"https://xxxxxxxx--xxxxxxx.cs5.my.salesforce.com\",\n" +
    - " \"id\": \"https://test.salesforce.com/id/00DO00000054tO8MAI/005O0000001cmmdIAA\",\n" +
    - " \"token_type\": \"Bearer\",\n" +
    - " \"issued_at\": \"1442798068621\",\n" +
    - " \"an_unrecognised_field\": \"foo\"\n" +
    - "}";
    - ObjectMapper mapper = new ObjectMapper();
    - Exception e = null;
    - LoginToken token = null;
    - try {
    - token = mapper.readValue(salesforceOAuthResponse, LoginToken.class);
    - } catch (Exception ex) {
    - e = ex;
    - }
    -
    - //assert ObjectMapper deserialized the SF OAuth response and returned a valid token back
    - assertNotNull("An invalid token was returned" , token);
    - //assert No exception was thrown during the JSON deserialization process
    - assertNull("Exception was thrown during JSON deserialisation" , e);
    - //assert one of the token fields
    - assertEquals("false", token.getIsReadOnly());
    -
    - }
    +
    + private static final Logger LOG = LoggerFactory.getLogger(SessionIntegrationTest.class);
    +
    + @Test
    + public void testLoginTokenWithUnknownFields() throws Exception {
    +
    + String salesforceOAuthResponse = "{\n"
    + + " \"access_token\": \"00XXXXXXXXXXXX!ARMAQKg_lg_hGaRElvizVFBQHoCpvX8tzwGnROQ0_MDPXSceMeZHtm3JHkPmMhlgK0Km3rpJkwxwHInd_8o022KsDy.p4O.X\",\n"
    + + " \"is_readonly\": \"false\",\n"
    + + " \"signature\": \"XXXXXXXXXX+MYU+JrOXPSbpHa2ihMpSvUqow1iTPh7Q=\",\n"
    + + " \"instance_url\": \"https://xxxxxxxx--xxxxxxx.cs5.my.salesforce.com\",\n"
    + + " \"id\": \"https://test.salesforce.com/id/00DO00000054tO8MAI/005O0000001cmmdIAA\",\n"
    + + " \"token_type\": \"Bearer\",\n"
    + + " \"issued_at\": \"1442798068621\",\n"
    + + " \"an_unrecognised_field\": \"foo\"\n"
    + + "}";
    + ObjectMapper mapper = new ObjectMapper();
    + Exception e = null;
    + LoginToken token = null;
    + try {
    + token = mapper.readValue(salesforceOAuthResponse, LoginToken.class);
    + } catch (Exception ex) {
    + e = ex;
    + }
    +
    + //assert ObjectMapper deserialized the SF OAuth response and returned a valid token back
    + assertNotNull("An invalid token was returned", token);
    + //assert No exception was thrown during the JSON deserialization process
    + assertNull("Exception was thrown during JSON deserialisation", e);
    + //assert one of the token fields
    + assertEquals("false", token.getIsReadOnly());
    +
    + }

      }
  • Dhirajsb at Sep 22, 2015 at 11:40 pm
    Merge pull request #617 from dkhanolkar/master

    * PR-617:
       Polished formatting
       Added a fix to the LoginToken class to ensure future new SF fields dont cause the login to fail, added a testcase for it
       Fix for login failure post Salesforce Non Prod patch


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

    Branch: refs/heads/master
    Commit: 8ce5a2b2f4b0c8ee599af156b5c93f52c66ed127
    Parents: b029251 883b8cf
    Author: Dhiraj Bokde <dhirajsb@yahoo.com>
    Authored: Tue Sep 22 16:39:25 2015 -0700
    Committer: Dhiraj Bokde <dhirajsb@yahoo.com>
    Committed: Tue Sep 22 16:39:25 2015 -0700

    ----------------------------------------------------------------------
      .../salesforce/internal/dto/LoginToken.java | 2 +
      .../salesforce/internal/LoginTokenTest.java | 62 ++++++++++++++++++++
      2 files changed, 64 insertions(+)
    ----------------------------------------------------------------------
  • Dhirajsb at Sep 22, 2015 at 11:44 pm
    Repository: camel
    Updated Branches:
       refs/heads/camel-2.15.x d7cea3adf -> 2dd6f6880


    Added a fix to the LoginToken class to ensure future new SF fields dont cause the login to fail, added a testcase for it


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

    Branch: refs/heads/camel-2.15.x
    Commit: c13656d52535428e6d9fd09255c55ce703af0ae2
    Parents: d7cea3a
    Author: Devendra Khanolkar <devendra.khanolkar@sixtree.com.au>
    Authored: Mon Sep 21 11:30:41 2015 +1000
    Committer: Dhiraj Bokde <dhirajsb@yahoo.com>
    Committed: Tue Sep 22 16:43:28 2015 -0700

    ----------------------------------------------------------------------
      .../salesforce/internal/dto/LoginToken.java | 2 +
      .../salesforce/internal/LoginTokenTest.java | 45 ++++++++++++++++++++
      2 files changed, 47 insertions(+)
    ----------------------------------------------------------------------


    http://git-wip-us.apache.org/repos/asf/camel/blob/c13656d5/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/dto/LoginToken.java
    ----------------------------------------------------------------------
    diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/dto/LoginToken.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/dto/LoginToken.java
    index 32a316f..cf4d212 100644
    --- a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/dto/LoginToken.java
    +++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/dto/LoginToken.java
    @@ -16,11 +16,13 @@
       */
      package org.apache.camel.component.salesforce.internal.dto;

    +import org.codehaus.jackson.annotate.JsonIgnoreProperties;
      import org.codehaus.jackson.annotate.JsonProperty;

      /**
       * DTO for Salesforce login
       */
    +@JsonIgnoreProperties(ignoreUnknown=true)
      public class LoginToken {

          private String accessToken;

    http://git-wip-us.apache.org/repos/asf/camel/blob/c13656d5/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/internal/LoginTokenTest.java
    ----------------------------------------------------------------------
    diff --git a/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/internal/LoginTokenTest.java b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/internal/LoginTokenTest.java
    new file mode 100644
    index 0000000..d20b662
    --- /dev/null
    +++ b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/internal/LoginTokenTest.java
    @@ -0,0 +1,45 @@
    +package org.apache.camel.component.salesforce.internal;
    +
    +import org.apache.camel.component.salesforce.internal.dto.LoginToken;
    +import org.codehaus.jackson.map.ObjectMapper;
    +import org.junit.Test;
    +import org.slf4j.Logger;
    +import org.slf4j.LoggerFactory;
    +import static org.junit.Assert.*;
    +
    +public class LoginTokenTest {
    +
    + private static final Logger LOG = LoggerFactory.getLogger(SessionIntegrationTest.class);
    +
    + @Test
    + public void testLoginTokenWithUnknownFields() throws Exception {
    +
    + String salesforceOAuthResponse = "{\n" +
    + " \"access_token\": \"00XXXXXXXXXXXX!ARMAQKg_lg_hGaRElvizVFBQHoCpvX8tzwGnROQ0_MDPXSceMeZHtm3JHkPmMhlgK0Km3rpJkwxwHInd_8o022KsDy.p4O.X\",\n" +
    + " \"is_readonly\": \"false\",\n" +
    + " \"signature\": \"XXXXXXXXXX+MYU+JrOXPSbpHa2ihMpSvUqow1iTPh7Q=\",\n" +
    + " \"instance_url\": \"https://xxxxxxxx--xxxxxxx.cs5.my.salesforce.com\",\n" +
    + " \"id\": \"https://test.salesforce.com/id/00DO00000054tO8MAI/005O0000001cmmdIAA\",\n" +
    + " \"token_type\": \"Bearer\",\n" +
    + " \"issued_at\": \"1442798068621\",\n" +
    + " \"an_unrecognised_field\": \"foo\"\n" +
    + "}";
    + ObjectMapper mapper = new ObjectMapper();
    + Exception e = null;
    + LoginToken token = null;
    + try {
    + token = mapper.readValue(salesforceOAuthResponse, LoginToken.class);
    + } catch (Exception ex) {
    + e = ex;
    + }
    +
    + //assert ObjectMapper deserialized the SF OAuth response and returned a valid token back
    + assertNotNull("An invalid token was returned" , token);
    + //assert No exception was thrown during the JSON deserialization process
    + assertNull("Exception was thrown during JSON deserialisation" , e);
    + //assert one of the token fields
    + assertEquals("false", token.getIsReadOnly());
    +
    + }
    +
    +}
  • Dhirajsb at Sep 22, 2015 at 11:44 pm
    Polished formatting. This closes #617.


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

    Branch: refs/heads/camel-2.15.x
    Commit: 2dd6f688051b750ef45896cea82df6feb189bc31
    Parents: c13656d
    Author: Dhiraj Bokde <dhirajsb@yahoo.com>
    Authored: Tue Sep 22 16:39:00 2015 -0700
    Committer: Dhiraj Bokde <dhirajsb@yahoo.com>
    Committed: Tue Sep 22 16:43:54 2015 -0700

    ----------------------------------------------------------------------
      .../salesforce/internal/dto/LoginToken.java | 2 +-
      .../salesforce/internal/LoginTokenTest.java | 83 ++++++++++++--------
      2 files changed, 51 insertions(+), 34 deletions(-)
    ----------------------------------------------------------------------


    http://git-wip-us.apache.org/repos/asf/camel/blob/2dd6f688/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/dto/LoginToken.java
    ----------------------------------------------------------------------
    diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/dto/LoginToken.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/dto/LoginToken.java
    index cf4d212..7f7e2c6 100644
    --- a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/dto/LoginToken.java
    +++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/dto/LoginToken.java
    @@ -22,7 +22,7 @@ import org.codehaus.jackson.annotate.JsonProperty;
      /**
       * DTO for Salesforce login
       */
    -@JsonIgnoreProperties(ignoreUnknown=true)
    +@JsonIgnoreProperties(ignoreUnknown = true)
      public class LoginToken {

          private String accessToken;

    http://git-wip-us.apache.org/repos/asf/camel/blob/2dd6f688/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/internal/LoginTokenTest.java
    ----------------------------------------------------------------------
    diff --git a/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/internal/LoginTokenTest.java b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/internal/LoginTokenTest.java
    index d20b662..5d08d49 100644
    --- a/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/internal/LoginTokenTest.java
    +++ b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/internal/LoginTokenTest.java
    @@ -1,3 +1,19 @@
    +/**
    + * 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.salesforce.internal;

      import org.apache.camel.component.salesforce.internal.dto.LoginToken;
    @@ -5,41 +21,42 @@ import org.codehaus.jackson.map.ObjectMapper;
      import org.junit.Test;
      import org.slf4j.Logger;
      import org.slf4j.LoggerFactory;
    +
      import static org.junit.Assert.*;

      public class LoginTokenTest {
    -
    - private static final Logger LOG = LoggerFactory.getLogger(SessionIntegrationTest.class);
    -
    - @Test
    - public void testLoginTokenWithUnknownFields() throws Exception {
    -
    - String salesforceOAuthResponse = "{\n" +
    - " \"access_token\": \"00XXXXXXXXXXXX!ARMAQKg_lg_hGaRElvizVFBQHoCpvX8tzwGnROQ0_MDPXSceMeZHtm3JHkPmMhlgK0Km3rpJkwxwHInd_8o022KsDy.p4O.X\",\n" +
    - " \"is_readonly\": \"false\",\n" +
    - " \"signature\": \"XXXXXXXXXX+MYU+JrOXPSbpHa2ihMpSvUqow1iTPh7Q=\",\n" +
    - " \"instance_url\": \"https://xxxxxxxx--xxxxxxx.cs5.my.salesforce.com\",\n" +
    - " \"id\": \"https://test.salesforce.com/id/00DO00000054tO8MAI/005O0000001cmmdIAA\",\n" +
    - " \"token_type\": \"Bearer\",\n" +
    - " \"issued_at\": \"1442798068621\",\n" +
    - " \"an_unrecognised_field\": \"foo\"\n" +
    - "}";
    - ObjectMapper mapper = new ObjectMapper();
    - Exception e = null;
    - LoginToken token = null;
    - try {
    - token = mapper.readValue(salesforceOAuthResponse, LoginToken.class);
    - } catch (Exception ex) {
    - e = ex;
    - }
    -
    - //assert ObjectMapper deserialized the SF OAuth response and returned a valid token back
    - assertNotNull("An invalid token was returned" , token);
    - //assert No exception was thrown during the JSON deserialization process
    - assertNull("Exception was thrown during JSON deserialisation" , e);
    - //assert one of the token fields
    - assertEquals("false", token.getIsReadOnly());
    -
    - }
    +
    + private static final Logger LOG = LoggerFactory.getLogger(SessionIntegrationTest.class);
    +
    + @Test
    + public void testLoginTokenWithUnknownFields() throws Exception {
    +
    + String salesforceOAuthResponse = "{\n"
    + + " \"access_token\": \"00XXXXXXXXXXXX!ARMAQKg_lg_hGaRElvizVFBQHoCpvX8tzwGnROQ0_MDPXSceMeZHtm3JHkPmMhlgK0Km3rpJkwxwHInd_8o022KsDy.p4O.X\",\n"
    + + " \"is_readonly\": \"false\",\n"
    + + " \"signature\": \"XXXXXXXXXX+MYU+JrOXPSbpHa2ihMpSvUqow1iTPh7Q=\",\n"
    + + " \"instance_url\": \"https://xxxxxxxx--xxxxxxx.cs5.my.salesforce.com\",\n"
    + + " \"id\": \"https://test.salesforce.com/id/00DO00000054tO8MAI/005O0000001cmmdIAA\",\n"
    + + " \"token_type\": \"Bearer\",\n"
    + + " \"issued_at\": \"1442798068621\",\n"
    + + " \"an_unrecognised_field\": \"foo\"\n"
    + + "}";
    + ObjectMapper mapper = new ObjectMapper();
    + Exception e = null;
    + LoginToken token = null;
    + try {
    + token = mapper.readValue(salesforceOAuthResponse, LoginToken.class);
    + } catch (Exception ex) {
    + e = ex;
    + }
    +
    + //assert ObjectMapper deserialized the SF OAuth response and returned a valid token back
    + assertNotNull("An invalid token was returned", token);
    + //assert No exception was thrown during the JSON deserialization process
    + assertNull("Exception was thrown during JSON deserialisation", e);
    + //assert one of the token fields
    + assertEquals("false", token.getIsReadOnly());
    +
    + }

      }

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcommits @
categoriescamel
postedSep 22, '15 at 11:40p
activeSep 22, '15 at 11:44p
posts6
users1
websitecamel.apache.org

1 user in discussion

Dhirajsb: 6 posts

People

Translate

site design / logo © 2018 Grokbase