use of com.vodafone360.people.datatypes.StatusMsg in project 360-Engine-for-Android by 360.
the class UploadServerContactsTest method reportDeleteGroupListSuccess.
private void reportDeleteGroupListSuccess(int reqId, List<BaseDataType> data) {
Log.d(LOG_TAG, "reportDeleteGroupListSuccess");
mProcessor.verifyGroupDelsState();
final List<Long> contactIdList = new ArrayList<Long>();
Long activeGroupId = mProcessor.testFetchDeleteGroupList(contactIdList);
if (mItemCount == 1) {
assertEquals(Long.valueOf(TEST_GROUP_2), activeGroupId);
} else if (mItemCount == 2) {
assertEquals(Long.valueOf(TEST_GROUP_1), activeGroupId);
} else {
fail("Unexpected number of groups in delete group list");
}
StatusMsg statusMsg = new StatusMsg();
statusMsg.mStatus = true;
data.add(statusMsg);
mItemCount--;
assertTrue(mItemCount >= 0);
if (mItemCount == 0) {
nextState(State.IDLE);
}
}
use of com.vodafone360.people.datatypes.StatusMsg in project 360-Engine-for-Android by 360.
the class UploadServerContacts method processGroupDeletionsResp.
/**
* Called when a server response is received during a group/contact delete
* relation sync. The server change log is updated. Possibly server errors
* are also handled.
*
* @param resp Response from server.
*/
private void processGroupDeletionsResp(final DecodedResponse resp) {
ServiceStatus status = BaseEngine.getResponseStatus(BaseDataType.STATUS_MSG_DATA_TYPE, resp.mDataTypes);
if (status == ServiceStatus.SUCCESS) {
if (resp.mDataTypes.size() == 0) {
LogUtils.logE("UploadServerContacts." + "processGroupDeletionsResp() " + "Response cannot be empty");
complete(ServiceStatus.ERROR_COMMS_BAD_RESPONSE);
return;
}
StatusMsg result = (StatusMsg) resp.mDataTypes.get(0);
if (!result.mStatus.booleanValue()) {
LogUtils.logE("UploadServerContacts." + "processGroupDeletionsResp() Error deleting group " + "relation, error = " + result.mError);
complete(ServiceStatus.ERROR_COMMS_BAD_RESPONSE);
}
LogUtils.logV("UploadServerContacts." + "processGroupDeletionsResp() Deleted relation");
long startTime = System.nanoTime();
mDb.deleteContactChanges(mContactChangeInfoList);
mDbSyncTime += (System.nanoTime() - startTime);
mContactChangeInfoList.clear();
updateProgress();
sendNextDelGroupRelationsPage();
return;
}
LogUtils.logE("UploadServerContacts.processGroupDeletionsResp() " + "Error deleting group relation, error = " + status);
complete(status);
}
use of com.vodafone360.people.datatypes.StatusMsg in project 360-Engine-for-Android by 360.
the class LoginEngineTest method reportBackToEngine.
@Override
public void reportBackToEngine(int reqId, EngineId engine) {
Log.d("TAG", "LoginEngineTest.reportBackToEngine");
ResponseQueue respQueue = ResponseQueue.getInstance();
List<BaseDataType> data = new ArrayList<BaseDataType>();
switch(mState) {
case IDLE:
break;
case LOGIN_REQUEST:
case SMS_RESPONSE_SIGNIN:
Log.d("TAG", "IdentityEngineTest.reportBackToEngine FETCH ids");
StatusMsg msg = new StatusMsg();
data.add(msg);
respQueue.addToResponseQueue(new DecodedResponse(reqId, data, engine, DecodedResponse.ResponseType.LOGIN_RESPONSE.ordinal()));
mEng.onCommsInMessage();
mState = LoginTestState.LOGIN_REQUEST_VALID;
break;
case LOGIN_REQUEST_VALID:
Log.d("TAG", "IdentityEngineTest.reportBackToEngine FETCH ids");
AuthSessionHolder sesh = new AuthSessionHolder();
data.add(sesh);
respQueue.addToResponseQueue(new DecodedResponse(reqId, data, engine, DecodedResponse.ResponseType.LOGIN_RESPONSE.ordinal()));
mEng.onCommsInMessage();
mState = LoginTestState.SMS_RESPONSE_SIGNIN;
break;
case REGISTRATION:
Log.d("TAG", "IdentityEngineTest.reportBackToEngine Registration");
data.add(mTestModule.createDummyContactData());
respQueue.addToResponseQueue(new DecodedResponse(reqId, data, engine, DecodedResponse.ResponseType.SIGNUP_RESPONSE.ordinal()));
mEng.onCommsInMessage();
break;
case REGISTRATION_ERROR:
data.add(new ServerError(ServerError.ErrorType.UNKNOWN));
respQueue.addToResponseQueue(new DecodedResponse(reqId, data, engine, DecodedResponse.ResponseType.SERVER_ERROR.ordinal()));
mEng.onCommsInMessage();
break;
case GET_T_AND_C:
case FETCH_PRIVACY:
case USER_NAME_STATE:
SimpleText txt = new SimpleText();
txt.addText("Simple text");
data.add(txt);
respQueue.addToResponseQueue(new DecodedResponse(reqId, data, engine, DecodedResponse.ResponseType.GET_T_AND_C_RESPONSE.ordinal()));
mEng.onCommsInMessage();
break;
case SERVER_ERROR:
data.add(new ServerError(ServerError.ErrorType.UNKNOWN));
respQueue.addToResponseQueue(new DecodedResponse(reqId, data, engine, DecodedResponse.ResponseType.SERVER_ERROR.ordinal()));
mEng.onCommsInMessage();
break;
default:
}
}
use of com.vodafone360.people.datatypes.StatusMsg in project 360-Engine-for-Android by 360.
the class IdentityEngineTest method testSetIdentityCapability.
@MediumTest
// Breaks tests.
@Suppress
public void testSetIdentityCapability() {
mState = IdentityTestState.SET_IDENTITY_CAPABILTY;
String network = "facebook";
// Bundle fbund = new Bundle();
// fbund.putBoolean("sync_contacts", true);
String identityId = "mikeyb";
NetworkAgent.setAgentState(NetworkAgent.AgentState.CONNECTED);
// AA mEng.addUiSetIdentityCapabilityStatus(network, identityId, fbund);
mEng.addUiSetIdentityStatus(network, identityId, true);
ServiceStatus status = mEngineTester.waitForEvent();
assertEquals(ServiceStatus.SUCCESS, status);
Object data = mEngineTester.data();
assertTrue(data != null);
try {
ArrayList<StatusMsg> identityList = ((Bundle) data).getParcelableArrayList("data");
assertTrue(identityList.size() == 1);
} catch (Exception e) {
throw (new RuntimeException("Expected identity list with 1 item"));
}
}
use of com.vodafone360.people.datatypes.StatusMsg in project 360-Engine-for-Android by 360.
the class NowPlusDatatypesTests method testStatusMsg.
public void testStatusMsg() {
boolean status = true;
boolean dryRun = true;
StatusMsg input = new StatusMsg();
input.mStatus = (Boolean) status;
input.mDryRun = (Boolean) dryRun;
Hashtable<String, Object> hash = new Hashtable<String, Object>();
hash.put("status", status);
hash.put("dryrun", dryRun);
StatusMsg helper = new StatusMsg();
StatusMsg output = helper.createFromHashtable(hash);
assertEquals(BaseDataType.STATUS_MSG_DATA_TYPE, output.getType());
assertEquals(input.toString(), output.toString());
assertEquals(input.mStatus, output.mStatus);
assertEquals(input.mDryRun, output.mDryRun);
}
Aggregations