use of com.vodafone360.people.datatypes.BaseDataType 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);
}
use of com.vodafone360.people.datatypes.BaseDataType 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);
}
use of com.vodafone360.people.datatypes.BaseDataType in project 360-Engine-for-Android by 360.
the class ActivitiesEngine method handleGetActivitiesResponse.
/**
* Handle GetActivities response message received from Server
*
* @param reqId Request ID contained in response. This should match an ID of
* a request we have issued to the Server.
* @param data List array of ActivityItem items returned from Server.
*/
private void handleGetActivitiesResponse(List<BaseDataType> data) {
/**
* Array of Activities retrieved from Server.
*/
ArrayList<ActivityItem> activityList = new ArrayList<ActivityItem>();
ServiceStatus errorStatus = getResponseStatus(BaseDataType.ACTIVITY_ITEM_DATA_TYPE, data);
LogUtils.logE("ActivityEngine.handleGetActivitiesResponse status from generic = " + errorStatus);
if (ServiceStatus.SUCCESS == errorStatus) {
for (BaseDataType item : data) {
if (item.getType() == BaseDataType.ACTIVITY_ITEM_DATA_TYPE) {
activityList.add((ActivityItem) item);
} else {
LogUtils.logE("ActivityEngine.handleGetActivitiesResponse will not handle strange type = " + item.getType());
}
}
errorStatus = updateDatabase(activityList);
// we set timeout for the next execution
}
// this method will then call completeUiRequest(status, null);
onSyncHelperComplete(errorStatus);
}
Aggregations