Search in sources :

Example 1 with HttpAccess

use of com.salesforce.androidsdk.auth.HttpAccess in project SalesforceMobileSDK-Android by forcedotcom.

the class RestClientTest method setUp.

@Before
public void setUp() throws Exception {
    TestCredentials.init(InstrumentationRegistry.getInstrumentation().getContext());
    httpAccess = new HttpAccess(null, "dummy-agent");
    TokenEndpointResponse refreshResponse = OAuth2.refreshAuthToken(httpAccess, new URI(TestCredentials.LOGIN_URL), TestCredentials.CLIENT_ID, TestCredentials.REFRESH_TOKEN, null);
    authToken = refreshResponse.authToken;
    instanceUrl = refreshResponse.instanceUrl;
    testOauthKeys = new ArrayList<>();
    testOauthKeys.add(TEST_CUSTOM_KEY);
    testOauthValues = new HashMap<>();
    testOauthValues.put(TEST_CUSTOM_KEY, TEST_CUSTOM_VALUE);
    SalesforceSDKManager.getInstance().setAdditionalOauthKeys(testOauthKeys);
    clientInfo = new ClientInfo(new URI(TestCredentials.INSTANCE_URL), new URI(TestCredentials.LOGIN_URL), new URI(TestCredentials.IDENTITY_URL), TestCredentials.ACCOUNT_NAME, TestCredentials.USERNAME, TestCredentials.USER_ID, TestCredentials.ORG_ID, null, null, TEST_FIRST_NAME, TEST_LAST_NAME, TEST_DISPLAY_NAME, TEST_EMAIL, TestCredentials.PHOTO_URL, TEST_THUMBNAIL_URL, testOauthValues, null, null, null, null, null, null, null);
    restClient = new RestClient(clientInfo, authToken, httpAccess, null);
}
Also used : HttpAccess(com.salesforce.androidsdk.auth.HttpAccess) ClientInfo(com.salesforce.androidsdk.rest.RestClient.ClientInfo) TokenEndpointResponse(com.salesforce.androidsdk.auth.OAuth2.TokenEndpointResponse) URI(java.net.URI) Before(org.junit.Before)

Example 2 with HttpAccess

use of com.salesforce.androidsdk.auth.HttpAccess in project SalesforceMobileSDK-Android by forcedotcom.

the class ManagerTestCase method initRestClient.

private RestClient initRestClient() throws Exception {
    httpAccess = new HttpAccess(null, "dummy-agent");
    final TokenEndpointResponse refreshResponse = OAuth2.refreshAuthToken(httpAccess, new URI(TestCredentials.LOGIN_URL), TestCredentials.CLIENT_ID, TestCredentials.REFRESH_TOKEN, null);
    final String authToken = refreshResponse.authToken;
    final ClientInfo clientInfo = new ClientInfo(new URI(TestCredentials.INSTANCE_URL), new URI(TestCredentials.LOGIN_URL), new URI(TestCredentials.IDENTITY_URL), TestCredentials.ACCOUNT_NAME, TestCredentials.USERNAME, TestCredentials.USER_ID, TestCredentials.ORG_ID, null, null, null, null, null, null, TestCredentials.PHOTO_URL, null, null, null, null, null, null, null, null, null);
    return new RestClient(clientInfo, authToken, httpAccess, null);
}
Also used : HttpAccess(com.salesforce.androidsdk.auth.HttpAccess) RestClient(com.salesforce.androidsdk.rest.RestClient) ClientInfo(com.salesforce.androidsdk.rest.RestClient.ClientInfo) TokenEndpointResponse(com.salesforce.androidsdk.auth.OAuth2.TokenEndpointResponse) URI(java.net.URI)

Aggregations

HttpAccess (com.salesforce.androidsdk.auth.HttpAccess)2 TokenEndpointResponse (com.salesforce.androidsdk.auth.OAuth2.TokenEndpointResponse)2 ClientInfo (com.salesforce.androidsdk.rest.RestClient.ClientInfo)2 URI (java.net.URI)2 RestClient (com.salesforce.androidsdk.rest.RestClient)1 Before (org.junit.Before)1