Search in sources :

Example 6 with TrackerIdentifier

use of org.hisp.dhis.tracker.TrackerIdentifier in project dhis2-core by dhis2.

the class TrackerPreheatIdentifiersTest method testProgramStageIdentifiers.

@Test
void testProgramStageIdentifiers() {
    List<Pair<String, TrackerIdentifier>> data = buildDataSet("NpsdDv6kKSO", "PRGA", "ProgramA");
    for (Pair<String, TrackerIdentifier> pair : data) {
        Event event = new Event();
        event.setProgramStage(pair.getLeft());
        TrackerImportParams params = buildParams(event, builder().programStageIdScheme(pair.getRight()).build());
        TrackerPreheat preheat = trackerPreheatService.preheat(params);
        assertPreheatedObjectExists(preheat, ProgramStage.class, pair.getRight(), pair.getLeft());
    }
}
Also used : TrackerImportParams(org.hisp.dhis.tracker.TrackerImportParams) TrackerIdentifier(org.hisp.dhis.tracker.TrackerIdentifier) Event(org.hisp.dhis.tracker.domain.Event) ImmutablePair(org.apache.commons.lang3.tuple.ImmutablePair) Pair(org.apache.commons.lang3.tuple.Pair) Test(org.junit.jupiter.api.Test) TrackerTest(org.hisp.dhis.tracker.TrackerTest)

Example 7 with TrackerIdentifier

use of org.hisp.dhis.tracker.TrackerIdentifier in project dhis2-core by dhis2.

the class TrackerPreheatIdentifiersTest method testCategoryOptionComboIdentifiers.

@Test
void testCategoryOptionComboIdentifiers() {
    List<Pair<String, TrackerIdentifier>> data = buildDataSet("XXXvX50cXC0", "COCA", "COCAname");
    for (Pair<String, TrackerIdentifier> pair : data) {
        Event event = new Event();
        event.setAttributeOptionCombo(pair.getLeft());
        TrackerImportParams params = buildParams(event, builder().categoryOptionComboIdScheme(pair.getRight()).build());
        TrackerPreheat preheat = trackerPreheatService.preheat(params);
        assertPreheatedObjectExists(preheat, CategoryOptionCombo.class, pair.getRight(), pair.getLeft());
    }
}
Also used : TrackerImportParams(org.hisp.dhis.tracker.TrackerImportParams) TrackerIdentifier(org.hisp.dhis.tracker.TrackerIdentifier) Event(org.hisp.dhis.tracker.domain.Event) ImmutablePair(org.apache.commons.lang3.tuple.ImmutablePair) Pair(org.apache.commons.lang3.tuple.Pair) Test(org.junit.jupiter.api.Test) TrackerTest(org.hisp.dhis.tracker.TrackerTest)

Aggregations

TrackerIdentifier (org.hisp.dhis.tracker.TrackerIdentifier)7 ImmutablePair (org.apache.commons.lang3.tuple.ImmutablePair)5 Pair (org.apache.commons.lang3.tuple.Pair)5 TrackerImportParams (org.hisp.dhis.tracker.TrackerImportParams)5 TrackerTest (org.hisp.dhis.tracker.TrackerTest)5 Event (org.hisp.dhis.tracker.domain.Event)5 Test (org.junit.jupiter.api.Test)5 CategoryOptionCombo (org.hisp.dhis.category.CategoryOptionCombo)1 Schema (org.hisp.dhis.schema.Schema)1 DataValue (org.hisp.dhis.tracker.domain.DataValue)1 TrackerPreheat (org.hisp.dhis.tracker.preheat.TrackerPreheat)1