Search in sources :

Example 6 with EngineManager

use of com.vodafone360.people.engine.EngineManager in project 360-Engine-for-Android by 360.

the class PeopleServiceTest method testIdentities.

public void testIdentities() {
    Log.i(LOG_TAG, "**** testIdentities ****\n");
    assertTrue("Unable to create People service", lazyLoadPeopleService());
    AuthSessionHolder ash = new AuthSessionHolder();
    ash.sessionID = "adf32419086bc23";
    ash.sessionSecret = "234789123678234";
    ash.userID = 10;
    ash.userName = "testUser";
    EngineManager em = EngineManager.getInstance();
    if (em != null) {
        Log.i(LOG_TAG, "Creating login Engine");
        em.getLoginEngine().setActivatedSession(ash);
    } else {
        Log.e(LOG_TAG, "Failed to get EngineManager");
        assertTrue("Failed to get EngineManager", false);
    }
    if (LoginEngine.getSession() == null) {
        Log.e(LOG_TAG, "Failed to set fake session");
        assertTrue("Can't set fake session", false);
    }
    Bundle filter = new Bundle();
    ArrayList<String> l = new ArrayList<String>();
    l.add(IdentityCapability.CapabilityID.chat.name());
    l.add(IdentityCapability.CapabilityID.get_own_status.name());
    filter.putStringArrayList("capability", l);
    mPeopleService.getAvailableThirdPartyIdentities();
    ServiceStatus status = waitForEvent(WAIT_EVENT_TIMEOUT_MS, TEST_RESPONSE);
    assertEquals("fetchAvailableIdentities() failed with status = " + status.name(), ServiceStatus.ERROR_INTERNAL_SERVER_ERROR, status);
    mPeopleService.getMyThirdPartyIdentities();
    status = waitForEvent(WAIT_EVENT_TIMEOUT_MS, TEST_RESPONSE);
    assertEquals("fetchMyIdentities() failed with status = " + status.name(), ServiceStatus.ERROR_INTERNAL_SERVER_ERROR, status);
    Log.i(LOG_TAG, "**** testIdentities (SUCCESS) ****\n");
}
Also used : AuthSessionHolder(com.vodafone360.people.datatypes.AuthSessionHolder) EngineManager(com.vodafone360.people.engine.EngineManager) Bundle(android.os.Bundle) ServiceStatus(com.vodafone360.people.service.ServiceStatus) ArrayList(java.util.ArrayList)

Aggregations

EngineManager (com.vodafone360.people.engine.EngineManager)4 ServiceStatus (com.vodafone360.people.service.ServiceStatus)2 Bundle (android.os.Bundle)1 AuthSessionHolder (com.vodafone360.people.datatypes.AuthSessionHolder)1 PushEvent (com.vodafone360.people.datatypes.PushEvent)1 ResponseQueue (com.vodafone360.people.service.io.ResponseQueue)1 ArrayList (java.util.ArrayList)1