Search in sources :

Example 26 with DecodedResponse

use of com.vodafone360.people.service.io.ResponseQueue.DecodedResponse in project 360-Engine-for-Android by 360.

the class HessianDecoderTest method testContactListResponse.

@MediumTest
public void testContactListResponse() {
    //boolean testPassed = true;
    List<BaseDataType> clist = new ArrayList<BaseDataType>();
    HessianDecoder hess = new HessianDecoder();
    try {
        DecodedResponse resp = hess.decodeHessianByteArray(3, testContactListData, Type.COMMON, false, EngineId.UNDEFINED);
        clist = resp.mDataTypes;
    } catch (IOException e) {
        e.printStackTrace();
        assertTrue("IOException thrown", false);
    }
    int size = clist.size();
    assertTrue(size == 3);
    assertTrue(clist.get(0) instanceof Contact);
}
Also used : DecodedResponse(com.vodafone360.people.service.io.ResponseQueue.DecodedResponse) ArrayList(java.util.ArrayList) HessianDecoder(com.vodafone360.people.service.utils.hessian.HessianDecoder) BaseDataType(com.vodafone360.people.datatypes.BaseDataType) IOException(java.io.IOException) Contact(com.vodafone360.people.datatypes.Contact) MediumTest(android.test.suitebuilder.annotation.MediumTest)

Example 27 with DecodedResponse

use of com.vodafone360.people.service.io.ResponseQueue.DecodedResponse in project 360-Engine-for-Android by 360.

the class HessianDecoderTest method testPushMessages.

/*
	@MediumTest
	public void testContactChangesResponse(){
		
	}
	*/
@MediumTest
public void testPushMessages() {
    List<BaseDataType> clist = new ArrayList<BaseDataType>();
    HessianDecoder hess = new HessianDecoder();
    try {
        DecodedResponse resp = hess.decodeHessianByteArray(7, testPcPushMsgData, Type.PUSH_MSG, false, EngineId.UNDEFINED);
        clist = resp.mDataTypes;
    } catch (IOException e) {
        e.printStackTrace();
        assertTrue("IOException thrown", false);
    }
    int size = clist.size();
    assertTrue(size == 1);
    assertTrue(clist.get(0) instanceof PushEvent);
    try {
        DecodedResponse resp = hess.decodeHessianByteArray(8, testCcPushMsgData, Type.PUSH_MSG, false, EngineId.UNDEFINED);
        clist = resp.mDataTypes;
    } catch (IOException e) {
        e.printStackTrace();
        assertTrue("IOException thrown", false);
    }
    size = clist.size();
    assertTrue(size == 1);
    assertTrue(clist.get(0) instanceof PushEvent);
    try {
        DecodedResponse resp = hess.decodeHessianByteArray(9, testSnPushMsgData, Type.PUSH_MSG, false, EngineId.UNDEFINED);
        clist = resp.mDataTypes;
    } catch (IOException e) {
        e.printStackTrace();
        assertTrue("IOException thrown", false);
    }
    size = clist.size();
    assertTrue(size == 1);
    assertTrue(clist.get(0) instanceof SystemNotification);
    try {
        DecodedResponse resp = hess.decodeHessianByteArray(10, testSnPushMsgData2, Type.PUSH_MSG, false, EngineId.UNDEFINED);
        clist = resp.mDataTypes;
    } catch (IOException e) {
        e.printStackTrace();
        assertTrue("IOException thrown", false);
    }
    size = clist.size();
    assertTrue(size == 1);
    assertTrue(clist.get(0) instanceof SystemNotification);
    try {
        DecodedResponse resp = hess.decodeHessianByteArray(11, testUnknownPushMsgData, Type.PUSH_MSG, false, EngineId.UNDEFINED);
        clist = resp.mDataTypes;
    } catch (IOException e) {
        e.printStackTrace();
        assertTrue("IOException thrown", false);
    }
    size = clist.size();
    assertTrue(size == 0);
//assertTrue(clist.get(0) instanceof PushEvent);
}
Also used : DecodedResponse(com.vodafone360.people.service.io.ResponseQueue.DecodedResponse) SystemNotification(com.vodafone360.people.datatypes.SystemNotification) PushEvent(com.vodafone360.people.datatypes.PushEvent) 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 28 with DecodedResponse

use of com.vodafone360.people.service.io.ResponseQueue.DecodedResponse in project 360-Engine-for-Android by 360.

the class HessianDecoderTest method testActivityListResponse.

@MediumTest
public void testActivityListResponse() {
    //boolean testPassed = true;
    List<BaseDataType> clist = new ArrayList<BaseDataType>();
    HessianDecoder hess = new HessianDecoder();
    try {
        DecodedResponse resp = hess.decodeHessianByteArray(5, testActivityList, Type.COMMON, false, EngineId.UNDEFINED);
        clist = resp.mDataTypes;
    } catch (IOException e) {
        e.printStackTrace();
        assertTrue("IOException thrown", false);
    }
    int size = clist.size();
    assertTrue(size == 2);
    assertTrue(clist.get(0) instanceof ActivityItem);
}
Also used : DecodedResponse(com.vodafone360.people.service.io.ResponseQueue.DecodedResponse) ArrayList(java.util.ArrayList) HessianDecoder(com.vodafone360.people.service.utils.hessian.HessianDecoder) BaseDataType(com.vodafone360.people.datatypes.BaseDataType) IOException(java.io.IOException) ActivityItem(com.vodafone360.people.datatypes.ActivityItem) MediumTest(android.test.suitebuilder.annotation.MediumTest)

Example 29 with DecodedResponse

use of com.vodafone360.people.service.io.ResponseQueue.DecodedResponse in project 360-Engine-for-Android by 360.

the class HessianDecoderTest method testIdentityListResponse.

@MediumTest
public void testIdentityListResponse() {
    //boolean testPassed = true;
    List<BaseDataType> clist = new ArrayList<BaseDataType>();
    HessianDecoder hess = new HessianDecoder();
    try {
        DecodedResponse resp = hess.decodeHessianByteArray(4, testIdentityListData, Type.COMMON, false, EngineId.UNDEFINED);
        clist = resp.mDataTypes;
    } catch (IOException e) {
        e.printStackTrace();
        assertTrue("IOException thrown", false);
    }
    int size = clist.size();
    assertTrue(size == 1);
    assertTrue(clist.get(0) instanceof Identity);
}
Also used : DecodedResponse(com.vodafone360.people.service.io.ResponseQueue.DecodedResponse) ArrayList(java.util.ArrayList) HessianDecoder(com.vodafone360.people.service.utils.hessian.HessianDecoder) BaseDataType(com.vodafone360.people.datatypes.BaseDataType) IOException(java.io.IOException) Identity(com.vodafone360.people.datatypes.Identity) MediumTest(android.test.suitebuilder.annotation.MediumTest)

Example 30 with DecodedResponse

use of com.vodafone360.people.service.io.ResponseQueue.DecodedResponse in project 360-Engine-for-Android by 360.

the class HessianDecoderTest method testUserProfileResponse.

@MediumTest
public void testUserProfileResponse() {
    //boolean testPassed = true;
    List<BaseDataType> ulist = new ArrayList<BaseDataType>();
    HessianDecoder hess = new HessianDecoder();
    try {
        DecodedResponse resp = hess.decodeHessianByteArray(2, testUserProfileData, Type.COMMON, false, EngineId.UNDEFINED);
        ulist = resp.mDataTypes;
    } catch (IOException e) {
        e.printStackTrace();
        assertTrue("IOException thrown", false);
    }
    int size = ulist.size();
    assertTrue(size == 1);
    assertTrue(ulist.get(0) instanceof UserProfile);
}
Also used : DecodedResponse(com.vodafone360.people.service.io.ResponseQueue.DecodedResponse) UserProfile(com.vodafone360.people.datatypes.UserProfile) 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)

Aggregations

DecodedResponse (com.vodafone360.people.service.io.ResponseQueue.DecodedResponse)26 BaseDataType (com.vodafone360.people.datatypes.BaseDataType)23 ArrayList (java.util.ArrayList)23 ServiceStatus (com.vodafone360.people.service.ServiceStatus)13 ServerError (com.vodafone360.people.datatypes.ServerError)12 IOException (java.io.IOException)10 MediumTest (android.test.suitebuilder.annotation.MediumTest)9 ResponseQueue (com.vodafone360.people.service.io.ResponseQueue)8 PushEvent (com.vodafone360.people.datatypes.PushEvent)7 HessianDecoder (com.vodafone360.people.service.utils.hessian.HessianDecoder)7 ContactChanges (com.vodafone360.people.datatypes.ContactChanges)6 Contact (com.vodafone360.people.datatypes.Contact)5 Suppress (android.test.suitebuilder.annotation.Suppress)4 Identity (com.vodafone360.people.datatypes.Identity)4 StatusMsg (com.vodafone360.people.datatypes.StatusMsg)4 AuthSessionHolder (com.vodafone360.people.datatypes.AuthSessionHolder)3 ExternalResponseObject (com.vodafone360.people.datatypes.ExternalResponseObject)3 Request (com.vodafone360.people.service.io.Request)3 ServerIdInfo (com.vodafone360.people.database.DatabaseHelper.ServerIdInfo)2 ContactChangeInfo (com.vodafone360.people.database.tables.ContactChangeLogTable.ContactChangeInfo)2