Search in sources :

Example 6 with AssetsFileReader

use of org.hisp.dhis.android.core.data.file.AssetsFileReader in project dhis2-android-sdk by dhis2.

the class LogoutCallMockIntegrationShould method setUp.

@Override
@Before
public void setUp() throws IOException {
    super.setUp();
    dhis2MockServer = new Dhis2MockServer(new AssetsFileReader());
    d2 = D2Factory.create(dhis2MockServer.getBaseEndpoint(), databaseAdapter());
}
Also used : Dhis2MockServer(org.hisp.dhis.android.core.data.server.Dhis2MockServer) AssetsFileReader(org.hisp.dhis.android.core.data.file.AssetsFileReader) Before(org.junit.Before)

Example 7 with AssetsFileReader

use of org.hisp.dhis.android.core.data.file.AssetsFileReader in project dhis2-android-sdk by dhis2.

the class SingleDataCallMockIntegrationShould method setUp.

@Override
@Before
public void setUp() throws IOException {
    super.setUp();
    dhis2MockServer = new Dhis2MockServer(new AssetsFileReader());
    d2 = D2Factory.create(dhis2MockServer.getBaseEndpoint(), databaseAdapter());
}
Also used : Dhis2MockServer(org.hisp.dhis.android.core.data.server.Dhis2MockServer) AssetsFileReader(org.hisp.dhis.android.core.data.file.AssetsFileReader) Before(org.junit.Before)

Example 8 with AssetsFileReader

use of org.hisp.dhis.android.core.data.file.AssetsFileReader in project dhis2-android-sdk by dhis2.

the class UserAuthenticateCallMockIntegrationShould method setUp.

@Before
@Override
public void setUp() throws IOException {
    super.setUp();
    dhis2MockServer = new Dhis2MockServer(new AssetsFileReader());
    D2 d2 = D2Factory.create(dhis2MockServer.getBaseEndpoint(), databaseAdapter());
    dhis2MockServer.enqueueMockResponse("user.json");
    genericCallData = GenericCallData.create(databaseAdapter(), d2.retrofit());
    authenticateUserCall = UserAuthenticateCall.create(genericCallData, "test_user", "test_password");
}
Also used : Dhis2MockServer(org.hisp.dhis.android.core.data.server.Dhis2MockServer) D2(org.hisp.dhis.android.core.D2) AssetsFileReader(org.hisp.dhis.android.core.data.file.AssetsFileReader) Before(org.junit.Before)

Example 9 with AssetsFileReader

use of org.hisp.dhis.android.core.data.file.AssetsFileReader in project dhis2-android-sdk by dhis2.

the class TrackedEntityInstanceCallMockIntegrationShould method parseTrackedEntityInstanceResponse.

private TrackedEntityInstance parseTrackedEntityInstanceResponse(String file) throws IOException {
    String expectedEventsResponseJson = new AssetsFileReader().getStringFromFile(file);
    ObjectMapper objectMapper = new ObjectMapper().setDateFormat(BaseIdentifiableObject.DATE_FORMAT.raw());
    TrackedEntityInstance trackedEntityInstance = objectMapper.readValue(expectedEventsResponseJson, new TypeReference<TrackedEntityInstance>() {
    });
    trackedEntityInstance = removeDeletedData(trackedEntityInstance);
    return trackedEntityInstance;
}
Also used : ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) AssetsFileReader(org.hisp.dhis.android.core.data.file.AssetsFileReader)

Example 10 with AssetsFileReader

use of org.hisp.dhis.android.core.data.file.AssetsFileReader in project dhis2-android-sdk by dhis2.

the class TrackedEntityInstanceCallMockIntegrationShould method setUp.

@Override
@Before
public void setUp() throws IOException {
    super.setUp();
    dhis2MockServer = new Dhis2MockServer(new AssetsFileReader());
    d2 = D2Factory.create(dhis2MockServer.getBaseEndpoint(), databaseAdapter());
}
Also used : Dhis2MockServer(org.hisp.dhis.android.core.data.server.Dhis2MockServer) AssetsFileReader(org.hisp.dhis.android.core.data.file.AssetsFileReader) Before(org.junit.Before)

Aggregations

AssetsFileReader (org.hisp.dhis.android.core.data.file.AssetsFileReader)11 Dhis2MockServer (org.hisp.dhis.android.core.data.server.Dhis2MockServer)9 Before (org.junit.Before)9 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)4 D2 (org.hisp.dhis.android.core.D2)3 ContentValues (android.content.ContentValues)2 Date (java.util.Date)2 ResourceStoreImpl (org.hisp.dhis.android.core.resource.ResourceStoreImpl)2 HashSet (java.util.HashSet)1 ObjectStyle (org.hisp.dhis.android.core.common.ObjectStyle)1 ObjectStyleModel (org.hisp.dhis.android.core.common.ObjectStyleModel)1 Payload (org.hisp.dhis.android.core.common.Payload)1 ValueTypeRendering (org.hisp.dhis.android.core.common.ValueTypeRendering)1 EnrollmentStoreImpl (org.hisp.dhis.android.core.enrollment.EnrollmentStoreImpl)1 RelationshipTypeStore (org.hisp.dhis.android.core.relationship.RelationshipTypeStore)1 RelationshipTypeStoreImpl (org.hisp.dhis.android.core.relationship.RelationshipTypeStoreImpl)1 ResourceStore (org.hisp.dhis.android.core.resource.ResourceStore)1 TrackedEntityAttributeStore (org.hisp.dhis.android.core.trackedentity.TrackedEntityAttributeStore)1 TrackedEntityAttributeStoreImpl (org.hisp.dhis.android.core.trackedentity.TrackedEntityAttributeStoreImpl)1 TrackedEntityInstanceStoreImpl (org.hisp.dhis.android.core.trackedentity.TrackedEntityInstanceStoreImpl)1