use of com.vodafone360.people.datatypes.PresenceList 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.PresenceList in project 360-Engine-for-Android by 360.
the class PresenceList method toString.
// /**
// * This method is called by the Engine to update the presence list state
// and refresh user statuses
// * @param changes is a Hashtable<String - UserId, Hashtable -
// presenceStatus in communities>
// */
// @SuppressWarnings("unchecked")
// public void addUsers(List<User> changes) {
// if (changes != null) {
// for (User user: changes) {
// if (users.contains(user))
// users.remove(user);
// if (user.isOnline() != OnlineStatus.OFFLINE.ordinal())
// users.add(user);
// }
// }
// }
@Override
public String toString() {
final StringBuffer sb = new StringBuffer("PresenceList - mUserId[");
sb.append(mUserId);
sb.append("] mType[");
sb.append(mType);
sb.append("] users[");
if (users != null) {
for (User user : users) {
sb.append("[");
sb.append(user.toString());
sb.append("]");
}
}
sb.append("]");
return sb.toString();
}
Aggregations