Search in sources :

Example 1 with IPeopleService

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

the class DatabaseHelper method deleteTimelineActivity.

/***
     * Removes the selected timeline activity from the database.
     * 
     * @param application The MainApplication
     * @param timelineItem TimelineSummaryItem to be deleted
     * @return SUCCESS or a suitable error code
     */
public ServiceStatus deleteTimelineActivity(MainApplication application, TimelineSummaryItem timelineItem, boolean isTimelineAll) {
    if (Settings.ENABLED_DATABASE_TRACE)
        trace(false, "DatabaseHelper.deleteTimelineActivity()");
    ServiceStatus status = ServiceStatus.SUCCESS;
    if (isTimelineAll) {
        status = ActivitiesTable.deleteTimelineActivities(mContext, timelineItem, getWritableDatabase(), getReadableDatabase());
    } else {
        status = ActivitiesTable.deleteTimelineActivity(mContext, timelineItem, getWritableDatabase(), getReadableDatabase());
    }
    if (status == ServiceStatus.SUCCESS) {
        // Update Notifications in the Notification Bar
        IPeopleService peopleService = application.getServiceInterface();
        long localContactId = 0L;
        if (timelineItem.mLocalContactId != null) {
            localContactId = timelineItem.mLocalContactId;
        }
        peopleService.updateChatNotification(localContactId);
    }
    fireDatabaseChangedEvent(DatabaseChangeType.ACTIVITIES, true);
    return status;
}
Also used : ServiceStatus(com.vodafone360.people.service.ServiceStatus) IPeopleService(com.vodafone360.people.service.interfaces.IPeopleService)

Example 2 with IPeopleService

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

the class RemoteServiceTest method testGetServiceInterface.

/**
     * Test getServiceInterface() from RemoteService.
     *
     * @throws Exception Issue setting up the service.
     */
@MediumTest
public final void testGetServiceInterface() throws Exception {
    /** Setup test preconditions (i.e. startService). **/
    startService(new Intent(getContext(), RemoteService.class));
    /** Perform test (i.e. getServiceInterface). **/
    IPeopleService mPeopleService = mApplication.getServiceInterface();
    /** Test if mPeopleService is correctly initialised. **/
    assertNotNull("IPeopleService should not be NULL", mPeopleService);
    IWorkerThreadControl workerThreadControl = (IWorkerThreadControl) FrameworkUtils.get(mPeopleService, "mWorkerThreadControl");
    assertNotNull("Expecting mWorkerThreadControl not to be NULL", workerThreadControl);
    RemoteService service = (RemoteService) FrameworkUtils.get(mPeopleService, "mService");
    assertNotNull("Expecting mService not to be NULL", service);
    UiAgent handlerAgent = (UiAgent) FrameworkUtils.get(mPeopleService, "mHandlerAgent");
    assertNotNull("Expecting mHandlerAgent not to be NULL", handlerAgent);
    ApplicationCache applicationCache = (ApplicationCache) FrameworkUtils.get(mPeopleService, "mApplicationCache");
    assertNotNull("Expecting mApplicationCache not to be NULL", applicationCache);
}
Also used : IWorkerThreadControl(com.vodafone360.people.service.interfaces.IWorkerThreadControl) UiAgent(com.vodafone360.people.service.agent.UiAgent) RemoteService(com.vodafone360.people.service.RemoteService) Intent(android.content.Intent) IPeopleService(com.vodafone360.people.service.interfaces.IPeopleService) ApplicationCache(com.vodafone360.people.ApplicationCache) MediumTest(android.test.suitebuilder.annotation.MediumTest)

Aggregations

IPeopleService (com.vodafone360.people.service.interfaces.IPeopleService)2 Intent (android.content.Intent)1 MediumTest (android.test.suitebuilder.annotation.MediumTest)1 ApplicationCache (com.vodafone360.people.ApplicationCache)1 RemoteService (com.vodafone360.people.service.RemoteService)1 ServiceStatus (com.vodafone360.people.service.ServiceStatus)1 UiAgent (com.vodafone360.people.service.agent.UiAgent)1 IWorkerThreadControl (com.vodafone360.people.service.interfaces.IWorkerThreadControl)1