Search in sources :

Example 6 with PresenceList

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");
}
Also used : ServiceStatus(com.vodafone360.people.service.ServiceStatus) RegistrationDetails(com.vodafone360.people.datatypes.RegistrationDetails)

Example 7 with PresenceList

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();
}
Also used : User(com.vodafone360.people.engine.presence.User)

Aggregations

NetworkPresence (com.vodafone360.people.engine.presence.NetworkPresence)2 User (com.vodafone360.people.engine.presence.User)2 ArrayList (java.util.ArrayList)2 ContactChanges (com.vodafone360.people.datatypes.ContactChanges)1 ContactDetailDeletion (com.vodafone360.people.datatypes.ContactDetailDeletion)1 ContactListResponse (com.vodafone360.people.datatypes.ContactListResponse)1 OnlineStatus (com.vodafone360.people.datatypes.ContactSummary.OnlineStatus)1 Conversation (com.vodafone360.people.datatypes.Conversation)1 ExternalResponseObject (com.vodafone360.people.datatypes.ExternalResponseObject)1 IdentityDeletion (com.vodafone360.people.datatypes.IdentityDeletion)1 ItemList (com.vodafone360.people.datatypes.ItemList)1 PresenceList (com.vodafone360.people.datatypes.PresenceList)1 RegistrationDetails (com.vodafone360.people.datatypes.RegistrationDetails)1 SimpleText (com.vodafone360.people.datatypes.SimpleText)1 StatusMsg (com.vodafone360.people.datatypes.StatusMsg)1 SocialNetwork (com.vodafone360.people.engine.presence.NetworkPresence.SocialNetwork)1 ServiceStatus (com.vodafone360.people.service.ServiceStatus)1 Vector (java.util.Vector)1