use of com.vodafone360.people.datatypes.BaseDataType in project 360-Engine-for-Android by 360.
the class DownloadServerContactsTest method reportBackWithDeletedContacts.
private void reportBackWithDeletedContacts(int reqId, List<BaseDataType> data) {
Log.d(LOG_TAG, "reportBackWithDeletedContacts");
Integer pageNo = mProcessor.testGetPageFromReqId(reqId);
int pageSize = mProcessor.getDownloadPageSize();
assertTrue(pageNo != null);
assertEquals(Integer.valueOf(mPageCount), pageNo);
ContactChanges contactChanges = new ContactChanges();
data.add(contactChanges);
contactChanges.mCurrentServerVersion = CURRENT_SERVER_VERSION;
contactChanges.mServerRevisionBefore = CURRENT_SERVER_VERSION;
contactChanges.mServerRevisionAfter = CURRENT_SERVER_VERSION;
contactChanges.mVersionAnchor = CURRENT_SERVER_VERSION;
assertTrue(pageSize > 0);
if (pageSize > 0) {
contactChanges.mNumberOfPages = 1 + mPageCount + (mItemCount / pageSize);
}
int noOfContacts = Math.min(pageSize, mItemCount);
for (int i = 0; i < noOfContacts; i++) {
Contact deletedContact = new Contact();
deletedContact.contactID = FIRST_MODIFIED_CONTACT_ID + mItemCount - 1;
deletedContact.deleted = true;
contactChanges.mContacts.add(deletedContact);
mItemCount--;
}
mPageCount++;
assertTrue(mItemCount >= 0);
if (mItemCount == 0) {
nextState(State.IDLE);
}
}
use of com.vodafone360.people.datatypes.BaseDataType in project 360-Engine-for-Android by 360.
the class UploadServerContactsTest method reportModifyContactSuccess.
private void reportModifyContactSuccess(int reqId, List<BaseDataType> data) {
Log.d(LOG_TAG, "reportModifyContactSuccess");
mProcessor.verifyModifyDetailsState();
List<Contact> contactChangeList = new ArrayList<Contact>();
mProcessor.testFetchContactChangeList(contactChangeList);
assertEquals(Math.min(mItemCount, mProcessor.testGetPageSize()), contactChangeList.size());
ContactChanges contactChanges = new ContactChanges();
contactChanges.mServerRevisionAfter = 1;
contactChanges.mServerRevisionBefore = 0;
data.add(contactChanges);
for (int i = 0; i < contactChangeList.size(); i++) {
Contact actualContact = contactChangeList.get(i);
assertTrue(actualContact.contactID != null);
assertEquals(null, actualContact.aboutMe);
assertEquals(null, actualContact.profilePath);
assertEquals(null, actualContact.deleted);
assertEquals(null, actualContact.friendOfMine);
assertEquals(null, actualContact.gender);
assertEquals(null, actualContact.groupList);
assertEquals(null, actualContact.sources);
assertEquals(null, actualContact.synctophone);
assertEquals(null, actualContact.updated);
assertEquals(null, actualContact.userID);
assertEquals(2, actualContact.details.size());
// Modified
ContactDetail modDetail = actualContact.details.get(0);
// detail
// always
// first
ContactDetail newDetail = actualContact.details.get(1);
assertEquals(NEW_DETAIL_VALUE, newDetail.value);
assertEquals(NEW_DETAIL_KEY, newDetail.key);
assertEquals(NEW_DETAIL_TYPE, newDetail.keyType);
assertEquals(MOD_DETAIL_VALUE, modDetail.value);
assertEquals(MOD_DETAIL_KEY, modDetail.key);
assertEquals(MOD_DETAIL_TYPE, modDetail.keyType);
mReplyContact = new Contact();
mReplyContact.contactID = actualContact.contactID;
mReplyContact.userID = generateTestUserID(mReplyContact.contactID);
ContactDetail replyDetail1 = new ContactDetail();
ContactDetail replyDetail2 = new ContactDetail();
replyDetail1.key = modDetail.key;
replyDetail1.unique_id = modDetail.unique_id;
replyDetail2.key = newDetail.key;
replyDetail2.unique_id = newDetail.localDetailID + 2;
mReplyContact.details.add(replyDetail1);
mReplyContact.details.add(replyDetail2);
contactChanges.mContacts.add(mReplyContact);
}
mItemCount -= contactChangeList.size();
assertTrue(mItemCount >= 0);
if (mItemCount == 0) {
nextState(State.IDLE);
}
}
use of com.vodafone360.people.datatypes.BaseDataType in project 360-Engine-for-Android by 360.
the class HessianDecoder method parsePushMessage.
private void parsePushMessage(List<BaseDataType> list, Hashtable<String, Object> hash) {
RpgPushMessage push = RpgPushMessage.createFromHashtable(hash);
parsePushPayload(push, list);
}
use of com.vodafone360.people.datatypes.BaseDataType in project 360-Engine-for-Android by 360.
the class SyncMeEngine method processPushEvent.
/**
* This method process the "pc" push event.
* @param resp Response - server response normally containing a "pc"
* PushEvent data type
* @return boolean - TRUE if a push event was found in the response
*/
private boolean processPushEvent(final DecodedResponse resp) {
if (resp.mDataTypes == null || resp.mDataTypes.size() == 0) {
return false;
}
BaseDataType dataType = resp.mDataTypes.get(0);
if ((dataType == null) || dataType.getType() != BaseDataType.PUSH_EVENT_DATA_TYPE) {
return false;
}
PushEvent pushEvent = (PushEvent) dataType;
LogUtils.logV("SyncMeEngine processPushMessage():" + pushEvent.mMessageType);
switch(pushEvent.mMessageType) {
case PROFILE_CHANGE:
addGetMeProfileContactRequest();
break;
default:
break;
}
return true;
}
use of com.vodafone360.people.datatypes.BaseDataType in project 360-Engine-for-Android by 360.
the class IdentityEngine method handleGetAvailableIdentitiesResponse.
/**
* Handle Server response to request for available Identities. The response
* should be a list of Identity items. The request is completed with
* ServiceStatus.SUCCESS or ERROR_UNEXPECTED_RESPONSE if the data-type
* retrieved are not Identity items.
*
* @param data List of BaseDataTypes generated from Server response.
*/
private void handleGetAvailableIdentitiesResponse(List<BaseDataType> data) {
LogUtils.logD("IdentityEngine: handleServerGetAvailableIdentitiesResponse");
ServiceStatus errorStatus = getResponseStatus(BaseDataType.AVAILABLE_IDENTITY_DATA_TYPE, data);
if (errorStatus == ServiceStatus.SUCCESS) {
synchronized (mAvailableIdentityList) {
mAvailableIdentityList.clear();
for (BaseDataType item : data) {
Identity identity = (Identity) item;
if (!identity.isIdentityFieldBlankorNull()) {
mAvailableIdentityList.add(identity);
}
}
}
}
pushIdentitiesToUi(ServiceUiRequest.GET_AVAILABLE_IDENTITIES);
LogUtils.logD("IdentityEngine: handleGetAvailableIdentitiesResponse complete request.");
}
Aggregations