Search in sources :

Example 1 with ForceApi

use of com.force.api.ForceApi in project syndesis-qe by syndesisio.

the class SalesforceAccount method getInstance.

public static ForceApi getInstance() {
    if (salesforce == null) {
        final Account salesforceAccount = AccountsDirectory.getInstance().get(Account.Name.SALESFORCE);
        TestUtils.withRetry(() -> {
            try {
                salesforce = new ForceApi(new ApiConfig().setClientId(salesforceAccount.getProperty("clientId")).setClientSecret(salesforceAccount.getProperty("clientSecret")).setUsername(salesforceAccount.getProperty("userName")).setPassword(salesforceAccount.getProperty("password")).setForceURL(salesforceAccount.getProperty("loginUrl")));
                return true;
            } catch (Exception ex) {
                log.error("Unable to connect to salesforce, will retry in 5 minutes");
                return false;
            }
        }, 3, 300000L, "Unable to connect to SalesForce");
    }
    return salesforce;
}
Also used : Account(io.syndesis.qe.account.Account) ApiConfig(com.force.api.ApiConfig) ForceApi(com.force.api.ForceApi)

Aggregations

ApiConfig (com.force.api.ApiConfig)1 ForceApi (com.force.api.ForceApi)1 Account (io.syndesis.qe.account.Account)1