Search in sources :

Example 16 with AuthSessionHolder

use of com.vodafone360.people.datatypes.AuthSessionHolder in project 360-Engine-for-Android by 360.

the class HessianDecoderTest method testSessionResponse.

/*
	 * 
	 * r{1}{0}fS{0}{4}codeS{0}{14}INTERNAL_ERRORS{0}{7}
	 * messageS{0}hError occured while getting contacts. Message was: Object reference not set to an instance of an object.S{0}{7}detailsMt{0}{0}S{0}{5}classS{0}Dcom.vodafone.next.api.common.APIStructures$APIInternalErrorExceptionzzz
	 */
@MediumTest
public void testSessionResponse() {
    // boolean testPassed = true;
    List<BaseDataType> slist = new ArrayList<BaseDataType>();
    HessianDecoder hess = new HessianDecoder();
    try {
        DecodedResponse resp = hess.decodeHessianByteArray(1, testSessionData, Type.COMMON, false, EngineId.UNDEFINED);
        slist = resp.mDataTypes;
    } catch (IOException e) {
        e.printStackTrace();
        assertTrue("IOException thrown", false);
    }
    int size = slist.size();
    assertTrue(size == 1);
    assertTrue(slist.get(0) instanceof AuthSessionHolder);
}
Also used : DecodedResponse(com.vodafone360.people.service.io.ResponseQueue.DecodedResponse) AuthSessionHolder(com.vodafone360.people.datatypes.AuthSessionHolder) ArrayList(java.util.ArrayList) HessianDecoder(com.vodafone360.people.service.utils.hessian.HessianDecoder) BaseDataType(com.vodafone360.people.datatypes.BaseDataType) IOException(java.io.IOException) MediumTest(android.test.suitebuilder.annotation.MediumTest)

Example 17 with AuthSessionHolder

use of com.vodafone360.people.datatypes.AuthSessionHolder 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

AuthSessionHolder (com.vodafone360.people.datatypes.AuthSessionHolder)15 IOException (java.io.IOException)6 MediumTest (android.test.suitebuilder.annotation.MediumTest)4 ServiceStatus (com.vodafone360.people.service.ServiceStatus)4 ArrayList (java.util.ArrayList)4 BaseDataType (com.vodafone360.people.datatypes.BaseDataType)3 DecodedResponse (com.vodafone360.people.service.io.ResponseQueue.DecodedResponse)3 Hashtable (java.util.Hashtable)3 ServerError (com.vodafone360.people.datatypes.ServerError)2 RpgHeader (com.vodafone360.people.service.io.rpg.RpgHeader)2 DecoderThread (com.vodafone360.people.service.transport.DecoderThread)2 ByteArrayInputStream (java.io.ByteArrayInputStream)2 Cursor (android.database.Cursor)1 SQLException (android.database.SQLException)1 SQLiteDatabase (android.database.sqlite.SQLiteDatabase)1 SQLiteException (android.database.sqlite.SQLiteException)1 Bundle (android.os.Bundle)1 ExternalResponseObject (com.vodafone360.people.datatypes.ExternalResponseObject)1 Identity (com.vodafone360.people.datatypes.Identity)1 SimpleText (com.vodafone360.people.datatypes.SimpleText)1