use of com.salesforce.androidsdk.rest.ClientManager in project SalesforceMobileSDK-Android by forcedotcom.
the class SalesforceSDKManagerTest method compareAiltnAppNames.
private void compareAiltnAppNames(String expectedAppName) {
final UserAccountManager userAccMgr = SalesforceSDKTestManager.getInstance().getUserAccountManager();
final Context targetContext = getInstrumentation().getTargetContext();
final ClientManager clientManager = new ClientManager(targetContext, ClientManagerTest.TEST_ACCOUNT_TYPE, null, true);
clientManager.createNewAccount(ClientManagerTest.TEST_ACCOUNT_NAME, ClientManagerTest.TEST_USERNAME, ClientManagerTest.TEST_REFRESH_TOKEN, ClientManagerTest.TEST_AUTH_TOKEN, ClientManagerTest.TEST_INSTANCE_URL, ClientManagerTest.TEST_LOGIN_URL, ClientManagerTest.TEST_IDENTITY_URL, ClientManagerTest.TEST_CLIENT_ID, ClientManagerTest.TEST_ORG_ID, ClientManagerTest.TEST_USER_ID, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null);
final AccountManager accMgr = AccountManager.get(targetContext);
final UserAccount curUser = userAccMgr.getCurrentUser();
Assert.assertNotNull("Current user should NOT be null", curUser);
SalesforceAnalyticsManager.reset(curUser);
final SalesforceAnalyticsManager analyticsManager = SalesforceAnalyticsManager.getInstance(userAccMgr.getCurrentUser());
Assert.assertNotNull("SalesforceAnalyticsManager instance should NOT be null", analyticsManager);
final AnalyticsManager manager = analyticsManager.getAnalyticsManager();
Assert.assertNotNull("AnalyticsManager instance should NOT be null", manager);
final DeviceAppAttributes deviceAppAttributes = analyticsManager.getAnalyticsManager().getDeviceAppAttributes();
Assert.assertNotNull("Device attributes should NOT be null", deviceAppAttributes);
final String ailtnAppName = deviceAppAttributes.getAppName();
Assert.assertEquals("DeviceAppAttributes - App names do NOT match", expectedAppName, ailtnAppName);
Assert.assertEquals("SalesforceSDKManager - App names do NOT match", expectedAppName, SalesforceSDKTestManager.getAiltnAppName());
SalesforceAnalyticsManager.reset(curUser);
clientManager.removeAccounts(accMgr.getAccountsByType(ClientManagerTest.TEST_ACCOUNT_TYPE));
SalesforceSDKTestManager.resetAiltnAppName();
SalesforceSDKTestManager.resetInstance();
}
use of com.salesforce.androidsdk.rest.ClientManager in project SalesforceMobileSDK-Android by forcedotcom.
the class SalesforceHybridTestActivity method buildClientManager.
@Override
public ClientManager buildClientManager() {
final ClientManager clientManager = super.buildClientManager();
clientManager.createNewAccount(accountName, username, refreshToken, authToken, instanceUrl, loginUrl, identityUrl, clientId, orgId, userId, null, null, null, null, null, null, photoUrl, null, null, null, null, null, null, null, null, null);
return clientManager;
}
use of com.salesforce.androidsdk.rest.ClientManager in project SalesforceMobileSDK-Android by forcedotcom.
the class ReactTestActivity method buildClientManager.
@Override
public ClientManager buildClientManager() {
final ClientManager clientManager = super.buildClientManager();
clientManager.createNewAccount(accountName, username, refreshToken, authToken, instanceUrl, loginUrl, identityUrl, clientId, orgId, userId, null, null, null, null, null, null, photoUrl, null, null, null, null, null, null, null, null, null);
return clientManager;
}
use of com.salesforce.androidsdk.rest.ClientManager in project SalesforceMobileSDK-Android by forcedotcom.
the class ScreenLockManagerTest method testCleanUp.
@Test
public void testCleanUp() {
final ClientManager.LoginOptions loginOptions = new ClientManager.LoginOptions(TEST_LOGIN_URL, TEST_CALLBACK_URL, TEST_CLIENT_ID, TEST_SCOPES);
ClientManager clientManager = new ClientManager(ctx, TEST_ACCOUNT_TYPE, loginOptions, true);
clientManager.createNewAccount(userAccount.getAccountName(), userAccount.getUsername(), userAccount.getRefreshToken(), userAccount.getAuthToken(), userAccount.getInstanceServer(), userAccount.getLoginServer(), userAccount.getIdUrl(), userAccount.getUserId(), userAccount.getOrgId(), userAccount.getUserId(), userAccount.getCommunityId(), userAccount.getCommunityId(), userAccount.getFirstName(), userAccount.getLastName(), userAccount.getDisplayName(), userAccount.getEmail(), userAccount.getPhotoUrl(), userAccount.getThumbnailUrl(), userAccount.getAdditionalOauthValues(), userAccount.getLightningDomain(), userAccount.getLightningSid(), userAccount.getVFDomain(), userAccount.getVFSid(), userAccount.getContentDomain(), userAccount.getContentSid(), userAccount.getCSRFToken());
UserAccount storedUser = SalesforceSDKManager.getInstance().getUserAccountManager().getAuthenticatedUsers().get(0);
SharedPreferences storedUserPrefs = ctx.getSharedPreferences(MOBILE_POLICY_PREF + storedUser.getUserLevelFilenameSuffix(), Context.MODE_PRIVATE);
screenLockManager.storeMobilePolicy(storedUser, true);
screenLockManager.cleanUp(storedUser);
Assert.assertFalse("User Mobile Policy should not be set.", storedUserPrefs.getBoolean(SCREEN_LOCK, false));
Assert.assertFalse("Org Mobile Policy should not be set.", sharedPrefs.getBoolean(SCREEN_LOCK, false));
}
use of com.salesforce.androidsdk.rest.ClientManager in project SalesforceMobileSDK-Android by forcedotcom.
the class UserAccountManagerTest method setUp.
@Before
public void setUp() throws Exception {
final Context targetContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
final Application app = Instrumentation.newApplication(TestForceApp.class, targetContext);
InstrumentationRegistry.getInstrumentation().callApplicationOnCreate(app);
eq = new EventsListenerQueue();
if (!SalesforceSDKManager.hasInstance()) {
eq.waitForEvent(EventType.AppCreateComplete, 5000);
}
userAccMgr = SalesforceSDKManager.getInstance().getUserAccountManager();
loginOptions = new LoginOptions(ClientManagerTest.TEST_LOGIN_URL, ClientManagerTest.TEST_CALLBACK_URL, ClientManagerTest.TEST_CLIENT_ID, ClientManagerTest.TEST_SCOPES);
clientManager = new ClientManager(targetContext, ClientManagerTest.TEST_ACCOUNT_TYPE, loginOptions, true);
accMgr = clientManager.getAccountManager();
}
Aggregations