Search in sources :

Example 6 with HessianDecoder

use of com.vodafone360.people.service.utils.hessian.HessianDecoder 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 7 with HessianDecoder

use of com.vodafone360.people.service.utils.hessian.HessianDecoder 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 8 with HessianDecoder

use of com.vodafone360.people.service.utils.hessian.HessianDecoder 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)

Aggregations

HessianDecoder (com.vodafone360.people.service.utils.hessian.HessianDecoder)8 IOException (java.io.IOException)8 MediumTest (android.test.suitebuilder.annotation.MediumTest)7 BaseDataType (com.vodafone360.people.datatypes.BaseDataType)7 DecodedResponse (com.vodafone360.people.service.io.ResponseQueue.DecodedResponse)7 ArrayList (java.util.ArrayList)7 Intent (android.content.Intent)1 Bundle (android.os.Bundle)1 SmsMessage (android.telephony.gsm.SmsMessage)1 ActivityItem (com.vodafone360.people.datatypes.ActivityItem)1 AuthSessionHolder (com.vodafone360.people.datatypes.AuthSessionHolder)1 Contact (com.vodafone360.people.datatypes.Contact)1 Identity (com.vodafone360.people.datatypes.Identity)1 PushEvent (com.vodafone360.people.datatypes.PushEvent)1 ServerError (com.vodafone360.people.datatypes.ServerError)1 SystemNotification (com.vodafone360.people.datatypes.SystemNotification)1 UserProfile (com.vodafone360.people.datatypes.UserProfile)1 Hashtable (java.util.Hashtable)1