use of android.test.suitebuilder.annotation.Suppress in project 360-Engine-for-Android by 360.
the class UploadServerContactsTest method testRunWithAddDeleteGroupChange.
@Suppress
public // Breaks tests
void testRunWithAddDeleteGroupChange() {
final String fnName = "testRunWithAddDeleteGroupChange";
Log.i(LOG_TAG, "***** EXECUTING " + fnName + " *****");
mTestStep = 1;
startSubTest(fnName, "Checking change list is empty");
long noOfChanges = ContactChangeLogTable.fetchNoOfContactDetailChanges(null, mDb.getReadableDatabase());
assertEquals(0, noOfChanges);
noOfChanges = ContactDetailsTable.syncNativeFetchNoOfChanges(mDb.getReadableDatabase());
assertEquals(0, noOfChanges);
startSubTest(fnName, "Adding test contact to database");
Contact contact = mTestModule.createDummyContactData();
contact.contactID = TestModule.generateRandomLong();
contact.userID = generateTestUserID(contact.contactID);
List<Contact> contactList = new ArrayList<Contact>();
contact.groupList.clear();
contactList.add(contact);
ServiceStatus status = mDb.syncAddContactList(contactList, false, false);
assertEquals(ServiceStatus.SUCCESS, status);
startSubTest(fnName, "Adding group to contact");
status = mDb.addContactToGroup(contact.localContactID, TEST_GROUP_1);
assertEquals(ServiceStatus.SUCCESS, status);
startSubTest(fnName, "Removing group from contact");
status = mDb.deleteContactFromGroup(contact.localContactID, TEST_GROUP_1);
assertEquals(ServiceStatus.SUCCESS, status);
startSubTest(fnName, "Running processor");
runProcessor(0, State.IDLE);
assertEquals(State.IDLE, mState);
noOfChanges = ContactChangeLogTable.fetchNoOfContactDetailChanges(null, mDb.getReadableDatabase());
assertEquals(0, noOfChanges);
noOfChanges = ContactDetailsTable.syncNativeFetchNoOfChanges(mDb.getReadableDatabase());
assertEquals(0, noOfChanges);
startSubTest(fnName, "Running processor with no contact changes");
runProcessor(0, State.IDLE);
Log.i(LOG_TAG, "*************************************************************************");
Log.i(LOG_TAG, fnName + " has completed successfully");
Log.i(LOG_TAG, "*************************************************************************");
Log.i(LOG_TAG, "");
}
use of android.test.suitebuilder.annotation.Suppress in project 360-Engine-for-Android by 360.
the class UploadServerContactsTest method testRunWithContactDeletion.
@MediumTest
@Suppress
public // Breaks tests
void testRunWithContactDeletion() {
final String fnName = "testRunWithContactDeletion";
Log.i(LOG_TAG, "***** EXECUTING " + fnName + " *****");
mTestStep = 1;
startSubTest(fnName, "Checking change list is empty");
long noOfChanges = ContactChangeLogTable.fetchNoOfContactDetailChanges(null, mDb.getReadableDatabase());
assertEquals(0, noOfChanges);
noOfChanges = ContactDetailsTable.syncNativeFetchNoOfChanges(mDb.getReadableDatabase());
assertEquals(0, noOfChanges);
startSubTest(fnName, "Adding test contact to database - no sync");
Contact contact = mTestModule.createDummyContactData();
contact.contactID = TestModule.generateRandomLong();
contact.userID = generateTestUserID(contact.contactID);
List<Contact> contactList = new ArrayList<Contact>();
contactList.add(contact);
ServiceStatus status = mDb.syncAddContactList(contactList, false, false);
assertEquals(ServiceStatus.SUCCESS, status);
startSubTest(fnName, "Deleting contact");
status = mDb.deleteContact(contact.localContactID);
assertEquals(ServiceStatus.SUCCESS, status);
startSubTest(fnName, "Running processor");
runProcessor(1, State.DELETE_CONTACT_LIST);
assertEquals(State.IDLE, mState);
startSubTest(fnName, "Checking change list is empty");
noOfChanges = ContactChangeLogTable.fetchNoOfContactDetailChanges(null, mDb.getReadableDatabase());
assertEquals(0, noOfChanges);
noOfChanges = ContactDetailsTable.syncNativeFetchNoOfChanges(mDb.getReadableDatabase());
assertEquals(0, noOfChanges);
startSubTest(fnName, "Running processor with no contact changes");
runProcessor(0, State.IDLE);
Log.i(LOG_TAG, "*************************************************************************");
Log.i(LOG_TAG, fnName + " has completed successfully");
Log.i(LOG_TAG, "*************************************************************************");
Log.i(LOG_TAG, "");
}
use of android.test.suitebuilder.annotation.Suppress in project 360-Engine-for-Android by 360.
the class ResponseReaderThreadTest method testRun_exception.
@Suppress
@MediumTest
public void testRun_exception() {
DecoderThread decoder = new DecoderThread();
MockTcpConnectionThread mockThread = new MockTcpConnectionThread(decoder, null);
MockResponseReaderThread respReader = new MockResponseReaderThread(mockThread, decoder, // QUICKFIX: Not sure about this value
null);
MockOTAInputStream mIs = new MockOTAInputStream(new ByteArrayInputStream(new byte[] { 1, 2, 3, 4, 5 }));
respReader.setInputStream(new BufferedInputStream(mIs));
// IO Exception test
try {
mIs.close();
} catch (IOException e) {
}
respReader.startConnection();
try {
Thread.sleep(1000);
} catch (Exception e) {
}
assertTrue(mockThread.getDidErrorOccur());
respReader.stopConnection();
mockThread = null;
respReader = null;
// NP Exception test
mockThread = new MockTcpConnectionThread(new DecoderThread(), null);
respReader = new MockResponseReaderThread(mockThread, decoder, // QUICKFIX: Not sure about this value
null);
respReader.setInputStream(null);
respReader.startConnection();
try {
Thread.sleep(1000);
} catch (Exception e) {
}
assertTrue(mockThread.getDidErrorOccur());
respReader.stopConnection();
mockThread = null;
respReader = null;
// EOF Exception
mockThread = new MockTcpConnectionThread(new DecoderThread(), null);
respReader = new MockResponseReaderThread(mockThread, decoder, // QUICKFIX: Not sure about this value
null);
ByteArrayInputStream bais = new ByteArrayInputStream(new byte[] { 1 });
respReader.setInputStream(new BufferedInputStream(bais));
respReader.startConnection();
try {
Thread.sleep(1000);
} catch (Exception e) {
}
assertTrue(mockThread.getDidErrorOccur());
respReader.stopConnection();
mockThread = null;
respReader = null;
}
use of android.test.suitebuilder.annotation.Suppress in project 360-Engine-for-Android by 360.
the class NativeContactsApiTest method testAddGetRemoveContacts.
@MediumTest
@Suppress
public void testAddGetRemoveContacts() {
Account account = null;
if (mUsing2xApi) {
// Add Account for the case where we are in 2.X
mNabApi.addPeopleAccount(PEOPLE_USERNAME);
account = s360PeopleAccount;
threadWait(100);
}
long[] ids = getContactIdsForAllAccounts();
assertNull(ids);
final int numRandomContacts = 10;
long expectedContactId = ContactChange.INVALID_ID;
for (int i = 0; i < numRandomContacts; i++) {
long id = i;
final ContactChange[] newContactCcList = ContactChangeHelper.randomContact(id, id, -1);
final ContactChange[] newIds = mNabApi.addContact(account, newContactCcList);
// expected num ids is + 1 for contact id
verifyNewContactIds(expectedContactId, newContactCcList, newIds);
expectedContactId = newIds[0].getNabContactId() + 1;
// GET CONTACTS AND COMPARE
ids = getContactIdsForAllAccounts();
assertNotNull(ids);
assertEquals(i + 1, ids.length);
final ContactChange[] fetchedContactCcList = mNabApi.getContact(ids[i]);
assertNotNull(fetchedContactCcList);
if (!ContactChangeHelper.areChangeListsEqual(newContactCcList, fetchedContactCcList, false)) {
Log.e(LOG_TAG, "ADD FAILED: Print of contact to be added follows:");
ContactChangeHelper.printContactChangeList(newContactCcList);
Log.e(LOG_TAG, "ADD FAILED: Print of contact fetched follows:");
ContactChangeHelper.printContactChangeList(fetchedContactCcList);
// fail test at this point
assertFalse(true);
}
}
// DELETE
final int idCount = ids.length;
for (int i = 0; i < idCount; i++) {
mNabApi.removeContact(ids[i]);
}
ids = getContactIdsForAllAccounts();
assertNull(ids);
}
use of android.test.suitebuilder.annotation.Suppress in project 360-Engine-for-Android by 360.
the class NowPlusContactsTest method testAddContactDetail.
@SmallTest
@Suppress
public void testAddContactDetail() {
assertTrue(initialise());
mDatabaseHelper.removeUserData();
ServiceStatus status = mTestUtility.waitForEvent(WAIT_EVENT_TIMEOUT_MS, DbTestUtility.CONTACTS_INT_EVENT_MASK);
assertEquals(ServiceStatus.SUCCESS, status);
Contact addedContact = new Contact();
status = mDatabaseHelper.addContact(addedContact);
assertEquals(ServiceStatus.SUCCESS, status);
ContactDetail detail = new ContactDetail();
mTestModule.createDummyDetailsData(detail);
detail.localContactID = addedContact.localContactID;
status = mDatabaseHelper.addContactDetail(detail);
assertEquals(ServiceStatus.SUCCESS, status);
ContactDetail fetchedDetail = new ContactDetail();
status = mDatabaseHelper.fetchContactDetail(detail.localDetailID, fetchedDetail);
assertEquals(ServiceStatus.SUCCESS, status);
assertTrue(DatabaseHelper.doDetailsMatch(detail, fetchedDetail));
assertTrue(!DatabaseHelper.hasDetailChanged(detail, fetchedDetail));
assertEquals(ServiceStatus.SUCCESS, mDatabaseHelper.deleteAllGroups());
List<ServerIdInfo> serverIdList = new ArrayList<ServerIdInfo>();
ServerIdInfo info = new ServerIdInfo();
info.localId = fetchedDetail.localDetailID;
info.serverId = fetchedDetail.localDetailID + 1;
serverIdList.add(info);
status = ContactDetailsTable.syncSetServerIds(serverIdList, mDatabaseHelper.getWritableDatabase());
assertEquals(ServiceStatus.SUCCESS, status);
status = mDatabaseHelper.fetchContactDetail(detail.localDetailID, fetchedDetail);
assertEquals(ServiceStatus.SUCCESS, status);
assertEquals(info.serverId, fetchedDetail.unique_id);
shutdown();
}
Aggregations