Return-Path: X-Original-To: apmail-camel-commits-archive@www.apache.org Delivered-To: apmail-camel-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7C22718A0E for ; Tue, 22 Sep 2015 23:44:58 +0000 (UTC) Received: (qmail 9990 invoked by uid 500); 22 Sep 2015 23:44:58 -0000 Delivered-To: apmail-camel-commits-archive@camel.apache.org Received: (qmail 9852 invoked by uid 500); 22 Sep 2015 23:44:58 -0000 Mailing-List: contact commits-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list commits@camel.apache.org Received: (qmail 9836 invoked by uid 99); 22 Sep 2015 23:44:58 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 22 Sep 2015 23:44:58 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 39B14E03E8; Tue, 22 Sep 2015 23:44:58 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: dhirajsb@apache.org To: commits@camel.apache.org Date: Tue, 22 Sep 2015 23:44:59 -0000 Message-Id: In-Reply-To: <0d7ae1faf70c49259c5001ad61c46fac@git.apache.org> References: <0d7ae1faf70c49259c5001ad61c46fac@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [2/2] camel git commit: Polished formatting. This closes #617. 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 Authored: Tue Sep 22 16:39:00 2015 -0700 Committer: Dhiraj Bokde 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()); + + } }