Search in sources :

Example 6 with EngineTestFramework

use of com.vodafone360.people.tests.engine.EngineTestFramework in project 360-Engine-for-Android by 360.

the class FetchNativeContactsTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    mApplication = (MainApplication) Instrumentation.newApplication(MainApplication.class, getInstrumentation().getTargetContext());
    mApplication.onCreate();
    mDb = mApplication.getDatabase();
    mDb.removeUserData();
    mCr = mApplication.getContentResolver();
    mEngineTester = new EngineTestFramework(this);
    mEng = new DummyContactSyncEngine(mEngineTester);
    mProcessor = new FetchNativeContactsProcessorTest(mEng, mApplication.getDatabase(), mApplication, mCr);
    mEng.setProcessor(mProcessor);
    mEngineTester.setEngine(mEng);
    try {
        mCr.delete(People.CONTENT_URI, null, null);
    } catch (IllegalArgumentException e) {
        Cursor c = mCr.query(People.CONTENT_URI, new String[] { People._ID }, null, null, null);
        while (c.moveToNext()) {
            Uri uri = ContentUris.withAppendedId(Contacts.People.CONTENT_URI, c.getInt(0));
            mCr.delete(uri, null, null);
        }
        c.close();
    }
}
Also used : EngineTestFramework(com.vodafone360.people.tests.engine.EngineTestFramework) DummyContactSyncEngine(com.vodafone360.people.tests.engine.contactsync.DummyContactSyncEngine) Cursor(android.database.Cursor) Uri(android.net.Uri)

Example 7 with EngineTestFramework

use of com.vodafone360.people.tests.engine.EngineTestFramework in project 360-Engine-for-Android by 360.

the class SyncMeEngineTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    // delete the database
    getInstrumentation().getTargetContext().deleteDatabase(HelperClasses.getDatabaseName());
    // create an application instance
    mApplication = (MainApplication) Instrumentation.newApplication(MainApplication.class, getInstrumentation().getTargetContext());
    mApplication.onCreate();
    mEngineTester = new EngineTestFramework(this);
    mEngine = new SyncMeEngine(getInstrumentation().getTargetContext(), mEngineTester, mApplication.getDatabase());
    mEngineTester.setEngine(mEngine);
    Log.i(LOG_TAG, "**** setUp() end ****");
}
Also used : SyncMeEngine(com.vodafone360.people.engine.meprofile.SyncMeEngine)

Example 8 with EngineTestFramework

use of com.vodafone360.people.tests.engine.EngineTestFramework in project 360-Engine-for-Android by 360.

the class ActivitiesEngineTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    mApplication = (MainApplication) Instrumentation.newApplication(MainApplication.class, getInstrumentation().getTargetContext());
    mApplication.onCreate();
    // EngineManager.createEngineManager(getInstrumentation().getTargetContext(),
    // null);
    mEngineTester = new EngineTestFramework(this);
    mEng = new ActivitiesEngine(getInstrumentation().getTargetContext(), mEngineTester, mApplication.getDatabase());
    mEngineTester.setEngine(mEng);
    mState = ActivityTestState.IDLE;
}
Also used : ActivitiesEngine(com.vodafone360.people.engine.activities.ActivitiesEngine)

Example 9 with EngineTestFramework

use of com.vodafone360.people.tests.engine.EngineTestFramework in project 360-Engine-for-Android by 360.

the class EngineTestFramework method waitForEvent.

public ServiceStatus waitForEvent(int ts) {
    Log.d("TAG", "EngineTestFramework waitForEvent");
    NetworkAgent.setAgentState(NetworkAgent.AgentState.CONNECTED);
    kickWorkerThread();
    long endTime = System.nanoTime() + (((long) ts) * 1000000);
    ServiceStatus returnStatus = ServiceStatus.ERROR_UNEXPECTED_RESPONSE;
    // ERROR_COMMS_TIMEOUT
    mStatus = 5;
    synchronized (mEngReqLock) {
        while (!mRequestCompleted && System.nanoTime() < endTime) {
            try {
                mEngReqLock.wait(ts);
            } catch (InterruptedException e) {
            }
        }
        returnStatus = ServiceStatus.fromInteger(mStatus);
    }
    mRequestCompleted = false;
    return returnStatus;
}
Also used : ServiceStatus(com.vodafone360.people.service.ServiceStatus)

Example 10 with EngineTestFramework

use of com.vodafone360.people.tests.engine.EngineTestFramework in project 360-Engine-for-Android by 360.

the class IdentityEngineTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    mApplication = (MainApplication) Instrumentation.newApplication(MainApplication.class, getInstrumentation().getTargetContext());
    mApplication.onCreate();
    mEngineTester = new EngineTestFramework(this);
    mEng = new IdentityEngine(mEngineTester, mApplication.getDatabase());
    mEngineTester.setEngine(mEng);
    mState = IdentityTestState.IDLE;
}
Also used : IdentityEngine(com.vodafone360.people.engine.identities.IdentityEngine)

Aggregations

EngineTestFramework (com.vodafone360.people.tests.engine.EngineTestFramework)5 Cursor (android.database.Cursor)1 Uri (android.net.Uri)1 ActivitiesEngine (com.vodafone360.people.engine.activities.ActivitiesEngine)1 ContactSyncEngine (com.vodafone360.people.engine.contactsync.ContactSyncEngine)1 IdentityEngine (com.vodafone360.people.engine.identities.IdentityEngine)1 LoginEngine (com.vodafone360.people.engine.login.LoginEngine)1 SyncMeEngine (com.vodafone360.people.engine.meprofile.SyncMeEngine)1 PresenceEngine (com.vodafone360.people.engine.presence.PresenceEngine)1 ServiceStatus (com.vodafone360.people.service.ServiceStatus)1 DummyContactSyncEngine (com.vodafone360.people.tests.engine.contactsync.DummyContactSyncEngine)1