Search in sources :

Example 11 with ServiceStatus

use of com.vodafone360.people.service.ServiceStatus in project 360-Engine-for-Android by 360.

the class IdentityEngineTest method testFetchIdentitiesPopulated.

@MediumTest
// Breaks tests.
@Suppress
public void testFetchIdentitiesPopulated() {
    mState = IdentityTestState.FETCH_IDENTITIES_POPULATED;
    NetworkAgent.setAgentState(NetworkAgent.AgentState.CONNECTED);
    mEng.getAvailableThirdPartyIdentities();
    // mEng.run();
    ServiceStatus status = mEngineTester.waitForEvent();
    assertEquals(ServiceStatus.SUCCESS, status);
    Object data = mEngineTester.data();
    assertTrue(data != null);
}
Also used : ServiceStatus(com.vodafone360.people.service.ServiceStatus) Suppress(android.test.suitebuilder.annotation.Suppress) MediumTest(android.test.suitebuilder.annotation.MediumTest)

Example 12 with ServiceStatus

use of com.vodafone360.people.service.ServiceStatus in project 360-Engine-for-Android by 360.

the class IdentityEngineTest method testFetchIdentitiesFail.

@MediumTest
// Takes to long
@Suppress
public void testFetchIdentitiesFail() {
    mState = IdentityTestState.FETCH_IDENTITIES_FAIL;
    NetworkAgent.setAgentState(NetworkAgent.AgentState.CONNECTED);
    mEng.getAvailableThirdPartyIdentities();
    // mEng.run();
    ServiceStatus status = mEngineTester.waitForEvent();
    assertFalse(ServiceStatus.SUCCESS == status);
    Object data = mEngineTester.data();
    assertNull(data);
}
Also used : ServiceStatus(com.vodafone360.people.service.ServiceStatus) Suppress(android.test.suitebuilder.annotation.Suppress) MediumTest(android.test.suitebuilder.annotation.MediumTest)

Example 13 with ServiceStatus

use of com.vodafone360.people.service.ServiceStatus in project 360-Engine-for-Android by 360.

the class LoginEngineTest method testFetchPrivacy.

@MediumTest
// Breaks tests.
@Suppress
public void testFetchPrivacy() {
    boolean testPassed = true;
    mState = LoginTestState.FETCH_PRIVACY;
    NetworkAgent.setAgentState(NetworkAgent.AgentState.DISCONNECTED);
    try {
        synchronized (mEngineTester) {
            mEng.addUiFetchPrivacyStatementRequest();
            ServiceStatus status = mEngineTester.waitForEvent();
            if (status != ServiceStatus.SUCCESS) {
                throw (new RuntimeException("Expected SUCCESS"));
            }
        }
    } catch (Exception e) {
        testPassed = false;
    }
    NetworkAgent.setAgentState(NetworkAgent.AgentState.CONNECTED);
    try {
        synchronized (mEngineTester) {
            mEng.addUiFetchPrivacyStatementRequest();
            ServiceStatus status = mEngineTester.waitForEvent();
            if (status != ServiceStatus.SUCCESS) {
                throw (new RuntimeException("Expected SUCCESS"));
            }
        }
    } catch (Exception e) {
        testPassed = false;
    }
    assertTrue(testPassed == true);
}
Also used : ServiceStatus(com.vodafone360.people.service.ServiceStatus) Suppress(android.test.suitebuilder.annotation.Suppress) MediumTest(android.test.suitebuilder.annotation.MediumTest)

Example 14 with ServiceStatus

use of com.vodafone360.people.service.ServiceStatus in project 360-Engine-for-Android by 360.

the class ActivitiesEngineTest method testGetActivitiesServerErr.

@MediumTest
// Takes too long.
@Suppress
public void testGetActivitiesServerErr() {
    boolean testPass = true;
    mState = ActivityTestState.GET_ACTIVITIES_SERVER_ERR;
    NetworkAgent.setAgentState(NetworkAgent.AgentState.CONNECTED);
    mEng.addStatusesSyncRequest();
    ServiceStatus status = mEngineTester.waitForEvent();
    if (status == ServiceStatus.SUCCESS) {
        throw (new RuntimeException("Did not expect SUCCESS"));
    }
    Object data = mEngineTester.data();
    assertTrue(data == null);
    assertTrue("testGetActivitiesServerErr() failed", testPass);
    Log.i(LOG_TAG, "**** testGetActivitiesServerErr (SUCCESS) ****\n");
}
Also used : ServiceStatus(com.vodafone360.people.service.ServiceStatus) Suppress(android.test.suitebuilder.annotation.Suppress) MediumTest(android.test.suitebuilder.annotation.MediumTest)

Example 15 with ServiceStatus

use of com.vodafone360.people.service.ServiceStatus in project 360-Engine-for-Android by 360.

the class LoginEngineTest method testRemoveUserData.

@MediumTest
public void testRemoveUserData() {
    boolean testPassed = true;
    mState = LoginTestState.REMOVE_USER_DATA_REQ;
    try {
        synchronized (mEngineTester) {
            mEng.addUiRemoveUserDataRequest();
            ServiceStatus status = mEngineTester.waitForEvent();
            if (status != ServiceStatus.SUCCESS) {
                throw (new RuntimeException("SUCCESS"));
            }
        }
    // test actually receiving the SMS
    } catch (Exception e) {
        testPassed = false;
    }
    try {
        synchronized (mEngineTester) {
            mEng.onReset();
            ServiceStatus status = mEngineTester.waitForEvent();
            if (status != ServiceStatus.SUCCESS) {
                throw (new RuntimeException("SUCCESS"));
            }
        }
    // test actually receiving the SMS
    } catch (Exception e) {
        testPassed = false;
    }
    assertTrue(testPassed == true);
}
Also used : ServiceStatus(com.vodafone360.people.service.ServiceStatus) MediumTest(android.test.suitebuilder.annotation.MediumTest)

Aggregations

ServiceStatus (com.vodafone360.people.service.ServiceStatus)190 Contact (com.vodafone360.people.datatypes.Contact)71 ContactDetail (com.vodafone360.people.datatypes.ContactDetail)63 MediumTest (android.test.suitebuilder.annotation.MediumTest)62 SQLiteDatabase (android.database.sqlite.SQLiteDatabase)43 ArrayList (java.util.ArrayList)43 Suppress (android.test.suitebuilder.annotation.Suppress)40 Cursor (android.database.Cursor)17 SmallTest (android.test.suitebuilder.annotation.SmallTest)17 ContactSummary (com.vodafone360.people.datatypes.ContactSummary)16 Bundle (android.os.Bundle)12 ContentValues (android.content.ContentValues)11 VCardHelper (com.vodafone360.people.datatypes.VCardHelper)11 SQLException (android.database.SQLException)9 ServerIdInfo (com.vodafone360.people.database.DatabaseHelper.ServerIdInfo)9 ContactsTable (com.vodafone360.people.database.tables.ContactsTable)9 ContactIdInfo (com.vodafone360.people.database.tables.ContactsTable.ContactIdInfo)9 ActivityItem (com.vodafone360.people.datatypes.ActivityItem)8 LoginDetails (com.vodafone360.people.datatypes.LoginDetails)8 PersistSettings (com.vodafone360.people.service.PersistSettings)8