use of com.vodafone360.people.datatypes.RegistrationDetails in project 360-Engine-for-Android by 360.
the class PeopleServiceTest method testRegistration.
/*
* List of APIs that are called in tests within this class:
* mPeopleService.fetchUsernameState(name);
* mPeopleService.fetchTermsOfService();
* mPeopleService.fetchPrivacyStatement();
* mPeopleService.register(details);
* mPeopleService.addEventCallback(mHandler);
* mPeopleService.removeEventCallback(mHandler);
* mPeopleService.getLoginRequired();
* mPeopleService.logon(loginDetails);
* mPeopleService.fetchAvailableIdentities(filter);
* mPeopleService.fetchMyIdentities(filter);
* mPeopleService.validateIdentityCredentials(false, "facebook", "testUser", "testPass", null);
* mPeopleService.setIdentityCapabilityStatus("facebook", "testUser", stat);
* mPeopleService.getRoamingNotificationType();
* mPeopleService.setForceConnection(true);
* mPeopleService.getForceConnection()
* mPeopleService.getRoamingDeviceSetting();
* mPeopleService.notifyDataSettingChanged(InternetAvail.ALWAYS_CONNECT);
* mPeopleService.setShowRoamingNotificationAgain(true);
* mPeopleService.setNetworkAgentState(sas);
* mPeopleService.getNetworkAgentState();
* mPeopleService.startActivitySync();
* mPeopleService.startBackgroundContactSync();
* mPeopleService.startContactSync();
*
* void checkForUpdates();
* void setNewUpdateFrequency();
* PresenceList getPresenceList();
*
*/
public void testRegistration() {
if (!ENABLE_REGISTRATION_TEST) {
Log.i(LOG_TAG, "Skipping registration tests...");
return;
}
Log.i(LOG_TAG, "**** testRegistration ****\n");
assertTrue("Unable to create People service", lazyLoadPeopleService());
String name = "scottkennedy1111";
Log.i(LOG_TAG, "Fetching username state for a name (" + name + ") - checking correct state is returned");
mPeopleService.fetchUsernameState(name);
ServiceStatus status = waitForEvent(WAIT_EVENT_TIMEOUT_MS, TEST_RESPONSE);
assertEquals("fetchUsernameState() failed with status = " + status.name(), ServiceStatus.ERROR_INTERNAL_SERVER_ERROR, status);
Log.i(LOG_TAG, "Fetching terms of service...");
mPeopleService.fetchTermsOfService();
status = waitForEvent(WAIT_EVENT_TIMEOUT_MS, TEST_RESPONSE);
assertEquals("fetchTermsOfService() failed with status = " + status.name(), ServiceStatus.ERROR_INTERNAL_SERVER_ERROR, status);
Log.i(LOG_TAG, "Fetching privacy statement...");
mPeopleService.fetchPrivacyStatement();
status = waitForEvent(WAIT_EVENT_TIMEOUT_MS, TEST_RESPONSE);
assertEquals("fetchPrivacyStatement() failed with status = " + status.name(), ServiceStatus.ERROR_INTERNAL_SERVER_ERROR, status);
Log.i(LOG_TAG, "Trying to register new account (username: " + name + ")");
RegistrationDetails details = new RegistrationDetails();
details.mFullname = "Gerry Rafferty";
details.mUsername = name;
details.mPassword = "TestTestTest";
details.mAcceptedTAndC = true;
details.mBirthdayDate = "1978-01-01";
details.mCountrycode = "En";
details.mEmail = "test@test.com";
details.mLanguage = "English";
details.mMobileModelId = 1L;
details.mMobileOperatorId = 1L;
details.mMsisdn = "447775128930";
details.mSendConfirmationMail = false;
details.mSendConfirmationSms = true;
details.mSubscribeToNewsLetter = false;
details.mTimezone = "GMT";
mPeopleService.register(details);
status = waitForEvent(WAIT_EVENT_TIMEOUT_MS, TEST_RESPONSE);
assertEquals("register() failed with status = " + status.name(), ServiceStatus.ERROR_INTERNAL_SERVER_ERROR, status);
Log.i(LOG_TAG, "**** testRegistration (SUCCESS) ****\n");
}
use of com.vodafone360.people.datatypes.RegistrationDetails in project 360-Engine-for-Android by 360.
the class LoginEngine method onReset.
/**
* Called by the framework before a remove user data operation takes place.
* Initiates a suitable UI request which will kick the worker thread.
*/
@Override
public void onReset() {
// reset the engine as if it was just created
super.onReset();
setRegistrationComplete(false);
mState = State.NOT_REGISTERED;
mRegistrationDetails = new RegistrationDetails();
mActivationCode = null;
onLoginStateChanged(false);
}
use of com.vodafone360.people.datatypes.RegistrationDetails in project 360-Engine-for-Android by 360.
the class NowPlusDBHelperLoginTest method testModifyFetchCredentials.
/*
* Modify and fetch credentials
*/
@MediumTest
public void testModifyFetchCredentials() {
Log.i(LOG_TAG, "***** EXECUTING testAddDeleteContactsDetails *****");
Log.i(LOG_TAG, "Test contact functionality (add delete contacts details)");
Log.i(LOG_TAG, "Test 1a: Initialise test environment and load database");
assertTrue(initialise());
Log.i(LOG_TAG, "Test 1b: Remove user data");
mDatabaseHelper.removeUserData();
ServiceStatus status = mTestUtility.waitForEvent(WAIT_EVENT_TIMEOUT_MS, DbTestUtility.CONTACTS_INT_EVENT_MASK);
assertEquals(ServiceStatus.SUCCESS, status);
RegistrationDetails registrationDetails = new RegistrationDetails();
registrationDetails.mUsername = TestModule.generateRandomString();
registrationDetails.mPassword = TestModule.generateRandomString();
registrationDetails.mMsisdn = TestModule.generateRandomString();
LoginDetails loginDetails = new LoginDetails();
loginDetails.mUsername = registrationDetails.mUsername;
loginDetails.mPassword = registrationDetails.mPassword;
loginDetails.mAutoConnect = TestModule.generateRandomBoolean();
loginDetails.mRememberMe = TestModule.generateRandomBoolean();
loginDetails.mMobileNo = registrationDetails.mMsisdn;
loginDetails.mSubscriberId = TestModule.generateRandomString();
LoginDetails fetchedLogin = new LoginDetails();
status = mDatabaseHelper.fetchLogonCredentials(fetchedLogin);
assertEquals(ServiceStatus.SUCCESS, status);
assertNull(fetchedLogin.mUsername);
assertNull(fetchedLogin.mPassword);
status = mDatabaseHelper.modifyCredentials(loginDetails);
assertEquals(ServiceStatus.SUCCESS, status);
status = mDatabaseHelper.fetchLogonCredentials(fetchedLogin);
assertEquals(ServiceStatus.SUCCESS, status);
assertEquals(loginDetails.mUsername, fetchedLogin.mUsername);
if (loginDetails.mRememberMe) {
assertEquals(loginDetails.mPassword, fetchedLogin.mPassword);
}
assertEquals(loginDetails.mAutoConnect, fetchedLogin.mAutoConnect);
assertEquals(loginDetails.mRememberMe, fetchedLogin.mRememberMe);
assertEquals(loginDetails.mMobileNo, fetchedLogin.mMobileNo);
assertEquals(loginDetails.mSubscriberId, fetchedLogin.mSubscriberId);
shutdown();
Log.i(LOG_TAG, "*************************************");
Log.i(LOG_TAG, "testModifyFetchCredentials has completed successfully");
Log.i(LOG_TAG, "**************************************");
}
Aggregations