Search in sources :

Example 6 with ClientInfo

use of com.salesforce.androidsdk.rest.RestClient.ClientInfo in project SalesforceMobileSDK-Android by forcedotcom.

the class RestClientTest method testClientInfoResolveRequestWithCommunity.

@Test
public void testClientInfoResolveRequestWithCommunity() throws Exception {
    final ClientInfo info = 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, TestCredentials.COMMUNITY_URL, null, null, null, null, null, null, testOauthValues, null, null, null, null, null, null, null);
    RestRequest r = new RestRequest(RestMethod.GET, RestRequest.RestEndpoint.LOGIN, "/a", (JSONObject) null, null);
    Assert.assertEquals("Community URL should take precedence over login or instance endpoint", TestCredentials.COMMUNITY_URL + "/a", info.resolveUrl(r).toString());
}
Also used : ClientInfo(com.salesforce.androidsdk.rest.RestClient.ClientInfo) URI(java.net.URI) LargeTest(androidx.test.filters.LargeTest) Test(org.junit.Test)

Example 7 with ClientInfo

use of com.salesforce.androidsdk.rest.RestClient.ClientInfo 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

ClientInfo (com.salesforce.androidsdk.rest.RestClient.ClientInfo)7 URI (java.net.URI)7 LargeTest (androidx.test.filters.LargeTest)3 Test (org.junit.Test)3 HttpAccess (com.salesforce.androidsdk.auth.HttpAccess)2 TokenEndpointResponse (com.salesforce.androidsdk.auth.OAuth2.TokenEndpointResponse)2 RestClient (com.salesforce.androidsdk.rest.RestClient)2 ClientManager (com.salesforce.androidsdk.rest.ClientManager)1 AccMgrAuthTokenProvider (com.salesforce.androidsdk.rest.ClientManager.AccMgrAuthTokenProvider)1 IOException (java.io.IOException)1 URISyntaxException (java.net.URISyntaxException)1 Before (org.junit.Before)1