// Path: src/main/java/org/springframework/social/salesforce/api/Salesforce.java
// public interface Salesforce extends ApiBinding {
// 
//     public ApiOperations apiOperations();
// 
//     public ApiOperations apiOperations(String instanceUrl);
// 
//     public ChatterOperations chatterOperations();
// 
//     public ChatterOperations chatterOperations(String instanceUrl);
// 
//     public QueryOperations queryOperations();
// 
//     public QueryOperations queryOperations(String instanceUrl);
// 
//     public RecentOperations recentOperations();
// 
//     public RecentOperations recentOperations(String instanceUrl);
// 
//     public SearchOperations searchOperations();
// 
//     public SearchOperations searchOperations(String instanceUrl);
// 
//     public SObjectOperations sObjectsOperations();
// 
//     public SObjectOperations sObjectsOperations(String instanceUrl);
// 
//     public UserOperations userOperations();
// 
//     public UserOperations userOperations(String gatewayUrl);
// 
//     public LimitsOperations limitsOperations();
// 
//     public LimitsOperations limitsOperations(String instanceUrl);
// 
//     public <T> List<T> readList(JsonNode jsonNode, Class<T> type);
// 
//     public <T> T readObject(JsonNode jsonNode, Class<T> type);
// 
//     public String getBaseUrl();
// 
//     public String getInstanceUrl();
// 
//     public void setInstanceUrl(String instanceUrl);
// 
//     public String getUserInfoUrl();
// 
//     public String getAuthGatewayUrl();
// 
//     public void setAuthGatewayBaseUrl(String gatewayUrl);
// 
//     public ConnectOperations connectOperations();
// 
//     public ConnectOperations connectOperations(String instanceUrl);
//     
//     public CustomApiOperations customApiOperations();
// 
//     public CustomApiOperations customApiOperations(String instanceUrl);
// }
// 
// Path: src/main/java/org/springframework/social/salesforce/api/SalesforceProfile.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class SalesforceProfile implements Serializable {
//     protected String id;
// 
//     protected String email;
// 
//     protected String firstName;
// 
//     protected String lastName;
// 
//     protected Photo photo;
//     
//     protected String name;
// 
// 
//     /*public SalesforceProfile(String id, String firstName, String lastName, String email) {
//         this.id = id;
//         this.firstName = firstName;
//         this.lastName = lastName;
//         this.email = email;
//     }*/
// 
// 
//     public String getId() {
//         return id;
//     }
// 
//     public String getEmail() {
//         return email;
//     }
// 
//     public String getFirstName() {
//         return firstName;
//     }
// 
//     public String getLastName() {
//         return lastName;
//     }
// 
//     public Photo getPhoto() {
//         return this.photo;
//     }
// 
//     public String getName() {
//         return this.name;
//     }
// 
//     public String getUsername() {
//         return this.id;
//     }
// }
// 
// Path: src/main/java/org/springframework/social/salesforce/api/SalesforceUserDetails.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class SalesforceUserDetails extends SalesforceProfile {
//     private String organizationId;
// 
//     private String nickname;
// 
//     private String preferredUsername;
// 
//     public SalesforceUserDetails(String id, String firstName, String lastName,
//         String email, String name, String organizationId, String nickname,
//         String preferredUsername) {
//         super();
//         this.id = id;
//         this.firstName = firstName;
//         this.lastName = lastName;
//         this.email = email;
//         this.name = name;
//         this.organizationId = organizationId;
//         this.nickname = nickname;
//         this.preferredUsername = preferredUsername;
//     }
// 
//     public String getOrganizationId() {
//         return organizationId;
//     }
// 
//     public String getNickname() {
//         return nickname;
//     }
// 
//     public String getPreferredUsername() {
//         return preferredUsername;
//     }
// }


import org.springframework.social.ApiException;
import org.springframework.social.connect.ApiAdapter;
import org.springframework.social.connect.ConnectionValues;
import org.springframework.social.connect.UserProfile;
import org.springframework.social.connect.UserProfileBuilder;
import org.springframework.social.salesforce.api.Salesforce;
import org.springframework.social.salesforce.api.SalesforceProfile;
import org.springframework.social.salesforce.api.SalesforceUserDetails;
import org.springframework.util.StringUtils;
    
    public SalesforceAdapter(String instanceUrl, boolean sandbox)
    {
        this.instanceUrl = instanceUrl;
        
        if (sandbox)
        {
            this.gatewayUrl = SalesforceServiceProvider.SANDBOX_GATEWAY_URL;
        }
    }
    
    @Deprecated
    public SalesforceAdapter(String instanceUrl, String gatewayUrl)
    {
        this.instanceUrl = instanceUrl;
        this.gatewayUrl = gatewayUrl;
    }
    
    public SalesforceAdapter(boolean sandbox)
    {
        if (sandbox)
        {
            this.gatewayUrl = SalesforceServiceProvider.SANDBOX_GATEWAY_URL;
        }
    }

    public boolean test(Salesforce salesForce)
    {
        try
        {
// Path: src/main/java/org/springframework/social/salesforce/api/Salesforce.java
// public interface Salesforce extends ApiBinding {
// 
//     public ApiOperations apiOperations();
// 
//     public ApiOperations apiOperations(String instanceUrl);
// 
//     public ChatterOperations chatterOperations();
// 
//     public ChatterOperations chatterOperations(String instanceUrl);
// 
//     public QueryOperations queryOperations();
// 
//     public QueryOperations queryOperations(String instanceUrl);
// 
//     public RecentOperations recentOperations();
// 
//     public RecentOperations recentOperations(String instanceUrl);
// 
//     public SearchOperations searchOperations();
// 
//     public SearchOperations searchOperations(String instanceUrl);
// 
//     public SObjectOperations sObjectsOperations();
// 
//     public SObjectOperations sObjectsOperations(String instanceUrl);
// 
//     public UserOperations userOperations();
// 
//     public UserOperations userOperations(String gatewayUrl);
// 
//     public LimitsOperations limitsOperations();
// 
//     public LimitsOperations limitsOperations(String instanceUrl);
// 
//     public <T> List<T> readList(JsonNode jsonNode, Class<T> type);
// 
//     public <T> T readObject(JsonNode jsonNode, Class<T> type);
// 
//     public String getBaseUrl();
// 
//     public String getInstanceUrl();
// 
//     public void setInstanceUrl(String instanceUrl);
// 
//     public String getUserInfoUrl();
// 
//     public String getAuthGatewayUrl();
// 
//     public void setAuthGatewayBaseUrl(String gatewayUrl);
// 
//     public ConnectOperations connectOperations();
// 
//     public ConnectOperations connectOperations(String instanceUrl);
//     
//     public CustomApiOperations customApiOperations();
// 
//     public CustomApiOperations customApiOperations(String instanceUrl);
// }
// 
// Path: src/main/java/org/springframework/social/salesforce/api/SalesforceProfile.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class SalesforceProfile implements Serializable {
//     protected String id;
// 
//     protected String email;
// 
//     protected String firstName;
// 
//     protected String lastName;
// 
//     protected Photo photo;
//     
//     protected String name;
// 
// 
//     /*public SalesforceProfile(String id, String firstName, String lastName, String email) {
//         this.id = id;
//         this.firstName = firstName;
//         this.lastName = lastName;
//         this.email = email;
//     }*/
// 
// 
//     public String getId() {
//         return id;
//     }
// 
//     public String getEmail() {
//         return email;
//     }
// 
//     public String getFirstName() {
//         return firstName;
//     }
// 
//     public String getLastName() {
//         return lastName;
//     }
// 
//     public Photo getPhoto() {
//         return this.photo;
//     }
// 
//     public String getName() {
//         return this.name;
//     }
// 
//     public String getUsername() {
//         return this.id;
//     }
// }
// 
// Path: src/main/java/org/springframework/social/salesforce/api/SalesforceUserDetails.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class SalesforceUserDetails extends SalesforceProfile {
//     private String organizationId;
// 
//     private String nickname;
// 
//     private String preferredUsername;
// 
//     public SalesforceUserDetails(String id, String firstName, String lastName,
//         String email, String name, String organizationId, String nickname,
//         String preferredUsername) {
//         super();
//         this.id = id;
//         this.firstName = firstName;
//         this.lastName = lastName;
//         this.email = email;
//         this.name = name;
//         this.organizationId = organizationId;
//         this.nickname = nickname;
//         this.preferredUsername = preferredUsername;
//     }
// 
//     public String getOrganizationId() {
//         return organizationId;
//     }
// 
//     public String getNickname() {
//         return nickname;
//     }
// 
//     public String getPreferredUsername() {
//         return preferredUsername;
//     }
// }


// Path: src/main/java/org/springframework/social/salesforce/connect/SalesforceAdapter.java
import org.springframework.social.ApiException;
import org.springframework.social.connect.ApiAdapter;
import org.springframework.social.connect.ConnectionValues;
import org.springframework.social.connect.UserProfile;
import org.springframework.social.connect.UserProfileBuilder;
import org.springframework.social.salesforce.api.Salesforce;
import org.springframework.social.salesforce.api.SalesforceProfile;
import org.springframework.social.salesforce.api.SalesforceUserDetails;
import org.springframework.util.StringUtils;

    
    public SalesforceAdapter(String instanceUrl, boolean sandbox)
    {
        this.instanceUrl = instanceUrl;
        
        if (sandbox)
        {
            this.gatewayUrl = SalesforceServiceProvider.SANDBOX_GATEWAY_URL;
        }
    }
    
    @Deprecated
    public SalesforceAdapter(String instanceUrl, String gatewayUrl)
    {
        this.instanceUrl = instanceUrl;
        this.gatewayUrl = gatewayUrl;
    }
    
    public SalesforceAdapter(boolean sandbox)
    {
        if (sandbox)
        {
            this.gatewayUrl = SalesforceServiceProvider.SANDBOX_GATEWAY_URL;
        }
    }

    public boolean test(Salesforce salesForce)
    {
        try
        {
            if (StringUtils.isEmpty(instanceUrl))