use of com.vodafone360.people.datatypes.LoginDetails in project 360-Engine-for-Android by 360.
the class PeopleServiceImpl method logon.
/**
* @see com.vodafone360.people.service.interfaces.IPeopleService#logon(LoginDetails)
*/
@Override
public void logon(LoginDetails loginDetails) {
EngineManager manager = EngineManager.getInstance();
manager.getLoginEngine().addUiLoginRequest(loginDetails);
}
use of com.vodafone360.people.datatypes.LoginDetails in project 360-Engine-for-Android by 360.
the class LoginEngineTest method testLoginNullDetails.
@MediumTest
// Breaks tests.
@Suppress
public void testLoginNullDetails() {
mState = LoginTestState.LOGIN_REQUEST;
LoginDetails loginDetails = null;
NetworkAgent.setAgentState(NetworkAgent.AgentState.CONNECTED);
try {
synchronized (mEngineTester) {
mEng.addUiLoginRequest(loginDetails);
ServiceStatus status = mEngineTester.waitForEvent();
assertEquals(ServiceStatus.ERROR_BAD_SERVER_PARAMETER, status);
}
} catch (Exception e) {
displayException(e);
fail("testLoginNullDetails test 1 failed with exception");
}
loginDetails = new LoginDetails();
try {
synchronized (mEngineTester) {
mEng.addUiLoginRequest(loginDetails);
ServiceStatus status = mEngineTester.waitForEvent();
assertEquals(ServiceStatus.ERROR_COMMS, status);
}
} catch (Exception e) {
displayException(e);
fail("testLoginNullDetails test 2 failed with exception");
}
}
use of com.vodafone360.people.datatypes.LoginDetails in project 360-Engine-for-Android by 360.
the class LoginEngineTest method testLoginValidDetails.
@MediumTest
// Breaks tests.
@Suppress
public void testLoginValidDetails() {
mState = LoginTestState.LOGIN_REQUEST;
LoginDetails loginDetails = new LoginDetails();
loginDetails.mMobileNo = "123456789";
loginDetails.mUsername = "bob";
loginDetails.mPassword = "ajob";
try {
synchronized (mEngineTester) {
mEng.addUiLoginRequest(loginDetails);
ServiceStatus status = mEngineTester.waitForEvent(120000);
assertEquals(ServiceStatus.ERROR_SMS_CODE_NOT_RECEIVED, status);
}
// test actually receiving the SMS
} catch (Exception e) {
displayException(e);
fail("testLoginValidDetails test 1 failed with exception");
}
}
use of com.vodafone360.people.datatypes.LoginDetails 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.LoginDetails in project 360-Engine-for-Android by 360.
the class PeopleServiceTest method testLogin.
public void testLogin() {
Log.i(LOG_TAG, "**** testLogin ****\n");
if (!lazyLoadPeopleService()) {
throw (new RuntimeException("Unable to create People service"));
}
try {
boolean ret = mPeopleService.getLoginRequired();
Log.i(LOG_TAG, "getLoginRequired returned = " + ret);
} catch (Exception e) {
Log.e(LOG_TAG, "getLoginRequired() failed with exception = " + e.getLocalizedMessage());
e.printStackTrace();
}
Log.i(LOG_TAG, "logon with test credentials");
LoginDetails loginDetails = new LoginDetails();
loginDetails.mUsername = "testUser";
loginDetails.mPassword = "testPass";
loginDetails.mMobileNo = "+447502272981";
mPeopleService.logon(loginDetails);
ServiceStatus status = waitForEvent(WAIT_EVENT_TIMEOUT_MS, TEST_RESPONSE);
assertEquals("logon() failed with status = " + status.name(), ServiceStatus.ERROR_INTERNAL_SERVER_ERROR, status);
Log.i(LOG_TAG, "**** testLogin (SUCCESS) ****\n");
}
Aggregations