Search in sources :

Example 1 with WebResponse

use of org.hisp.dhis.android.core.imports.WebResponse in project dhis2-android-sdk by dhis2.

the class EventPostCall method handleWebResponse.

private void handleWebResponse(Response<WebResponse> response) {
    WebResponse webResponse = response.body();
    EventImportHandler eventImportHandler = new EventImportHandler(eventStore);
    eventImportHandler.handleEventImportSummaries(webResponse.importSummaries().importSummaries());
}
Also used : WebResponse(org.hisp.dhis.android.core.imports.WebResponse)

Example 2 with WebResponse

use of org.hisp.dhis.android.core.imports.WebResponse in project dhis2-android-sdk by dhis2.

the class TrackedEntityInstancePostCallRealIntegrationShould method response_true_when_data_sync.

/*
    * If you want run this test you need config the correct uids in the server side.
    * At this moment is necessary add into the "child programme" program the category combo : Implementing Partner
    * */
// @Test
public void response_true_when_data_sync() throws Exception {
    Response response = null;
    downloadMetadata();
    createDummyDataToPost(orgUnitUid, programUid, programStageUid, trackedEntityUid, coordinates, featureType, eventUid, enrollmentUid, trackedEntityInstanceUid, trackedEntityAttributeUid, dataElementUid);
    createDummyDataToPost(orgUnitUid, programUid, programStageUid, trackedEntityUid, coordinates, featureType, event1Uid, enrollment1Uid, trackedEntityInstance1Uid, trackedEntityAttributeUid, dataElementUid);
    Call<Response<WebResponse>> call = d2.syncTrackedEntityInstances();
    response = call.call();
    assertThat(response.isSuccessful()).isTrue();
}
Also used : Response(retrofit2.Response) WebResponse(org.hisp.dhis.android.core.imports.WebResponse)

Example 3 with WebResponse

use of org.hisp.dhis.android.core.imports.WebResponse in project dhis2-android-sdk by dhis2.

the class TrackedEntityInstancePostCall method handleWebResponse.

private void handleWebResponse(Response<WebResponse> response) {
    WebResponse webResponse = response.body();
    EventImportHandler eventImportHandler = new EventImportHandler(eventStore);
    EnrollmentImportHandler enrollmentImportHandler = new EnrollmentImportHandler(enrollmentStore, eventImportHandler);
    TrackedEntityInstanceImportHandler trackedEntityInstanceImportHandler = new TrackedEntityInstanceImportHandler(trackedEntityInstanceStore, enrollmentImportHandler, eventImportHandler);
    WebResponseHandler webResponseHandler = new WebResponseHandler(trackedEntityInstanceImportHandler);
    webResponseHandler.handleWebResponse(webResponse);
}
Also used : TrackedEntityInstanceImportHandler(org.hisp.dhis.android.core.trackedentity.TrackedEntityInstanceImportHandler) WebResponse(org.hisp.dhis.android.core.imports.WebResponse) EventImportHandler(org.hisp.dhis.android.core.event.EventImportHandler) WebResponseHandler(org.hisp.dhis.android.core.imports.WebResponseHandler) EnrollmentImportHandler(org.hisp.dhis.android.core.enrollment.EnrollmentImportHandler)

Example 4 with WebResponse

use of org.hisp.dhis.android.core.imports.WebResponse in project dhis2-android-sdk by dhis2.

the class EventPostCallRealIntegrationShould method pushDummyEvent.

private void pushDummyEvent() throws Exception {
    Response response;
    Call<Response<WebResponse>> call = d2.syncSingleEvents();
    response = call.call();
    assertThat(response.isSuccessful()).isTrue();
}
Also used : Response(retrofit2.Response) WebResponse(org.hisp.dhis.android.core.imports.WebResponse)

Example 5 with WebResponse

use of org.hisp.dhis.android.core.imports.WebResponse in project dhis2-android-sdk by dhis2.

the class EventPostCallRealIntegrationShould method successful_response_after_sync_events.

// commented out since it is a flaky test that works against a real server.
// @Test
public void successful_response_after_sync_events() throws Exception {
    retrofit2.Response response = null;
    response = d2.logIn(user, password).call();
    assertThat(response.isSuccessful()).isTrue();
    response = d2.syncMetaData().call();
    assertThat(response.isSuccessful()).isTrue();
    createDummyDataToPost(orgUnitUid, programUid, programStageUid, eventUid, dataElementUid, attributeCategoryOption, attributeOptionCombo, null);
    Call<Response<WebResponse>> call = d2.syncSingleEvents();
    response = call.call();
    assertThat(response.isSuccessful()).isTrue();
}
Also used : Response(retrofit2.Response) WebResponse(org.hisp.dhis.android.core.imports.WebResponse) Response(retrofit2.Response)

Aggregations

WebResponse (org.hisp.dhis.android.core.imports.WebResponse)7 Response (retrofit2.Response)4 EnrollmentImportHandler (org.hisp.dhis.android.core.enrollment.EnrollmentImportHandler)1 EventImportHandler (org.hisp.dhis.android.core.event.EventImportHandler)1 WebResponseHandler (org.hisp.dhis.android.core.imports.WebResponseHandler)1 TrackedEntityInstance (org.hisp.dhis.android.core.trackedentity.TrackedEntityInstance)1 TrackedEntityInstanceImportHandler (org.hisp.dhis.android.core.trackedentity.TrackedEntityInstanceImportHandler)1 TrackedEntityInstancePayload (org.hisp.dhis.android.core.trackedentity.TrackedEntityInstancePayload)1