use of org.hisp.dhis.tracker.report.TrackerImportReport in project dhis2-core by dhis2.
the class TeTaValidationTest method testTeaMaxTextValueLength.
@Test
void testTeaMaxTextValueLength() throws IOException {
setUpMetadata("tracker/validations/te-program_with_tea_fileresource_metadata.json");
TrackerImportParams trackerImportParams = createBundleFromJson("tracker/validations/te-program_with_tea_too_long_text_value.json");
TrackerImportReport trackerImportReport = trackerImportService.importTracker(trackerImportParams);
assertEquals(1, trackerImportReport.getValidationReport().getErrors().size());
assertThat(trackerImportReport.getValidationReport().getErrors(), everyItem(hasProperty("errorCode", equalTo(TrackerErrorCode.E1077))));
}
use of org.hisp.dhis.tracker.report.TrackerImportReport in project dhis2-core by dhis2.
the class TrackedEntityImportValidationTest method testTeAttrNonExistentAttr.
@Test
void testTeAttrNonExistentAttr() throws IOException {
TrackerImportParams params = createBundleFromJson("tracker/validations/te-data_error_attr-non-existing.json");
params.setImportStrategy(TrackerImportStrategy.CREATE);
TrackerImportReport trackerImportReport = trackerImportService.importTracker(params);
assertEquals(2, trackerImportReport.getValidationReport().getErrors().size());
assertThat(trackerImportReport.getValidationReport().getErrors(), everyItem(hasProperty("errorCode", equalTo(TrackerErrorCode.E1006))));
}
use of org.hisp.dhis.tracker.report.TrackerImportReport in project dhis2-core by dhis2.
the class TrackedEntityImportValidationTest method testNoUpdateAccessOutsideSearchScopeOu.
@Test
void testNoUpdateAccessOutsideSearchScopeOu() throws IOException {
TrackerImportParams params = createBundleFromJson("tracker/validations/te-data_with_different_ou.json");
params.setImportStrategy(TrackerImportStrategy.CREATE);
TrackerImportReport trackerImportReport = trackerImportService.importTracker(params);
assertEquals(TrackerStatus.OK, trackerImportReport.getStatus());
assertEquals(0, trackerImportReport.getValidationReport().getErrors().size());
assertEquals(3, trackerImportReport.getStats().getCreated());
dbmsManager.clearSession();
params = createBundleFromJson("tracker/validations/te-data_with_different_ou.json");
User user = userService.getUser(USER_7);
params.setUser(user);
params.setImportStrategy(TrackerImportStrategy.CREATE_AND_UPDATE);
params.setAtomicMode(AtomicMode.OBJECT);
trackerImportReport = trackerImportService.importTracker(params);
assertEquals(1, trackerImportReport.getValidationReport().getErrors().size());
assertEquals(2, trackerImportReport.getStats().getUpdated());
assertEquals(1, trackerImportReport.getStats().getIgnored());
assertThat(trackerImportReport.getValidationReport().getErrors(), IsCollectionContaining.hasItem(hasProperty("errorCode", equalTo(TrackerErrorCode.E1003))));
}
use of org.hisp.dhis.tracker.report.TrackerImportReport in project dhis2-core by dhis2.
the class TrackedEntityImportValidationTest method testTeValidationOkAll.
@Test
void testTeValidationOkAll() throws IOException {
TrackerImportParams params = createBundleFromJson("tracker/validations/te-data_with_different_ou.json");
params.setImportStrategy(TrackerImportStrategy.CREATE);
TrackerImportReport trackerImportReport = trackerImportService.importTracker(params);
assertEquals(0, trackerImportReport.getValidationReport().getErrors().size());
assertEquals(TrackerStatus.OK, trackerImportReport.getStatus());
}
use of org.hisp.dhis.tracker.report.TrackerImportReport in project dhis2-core by dhis2.
the class TrackedEntityImportValidationTest method testGeoOk.
@Test
void testGeoOk() throws IOException {
TrackerImportParams params = createBundleFromJson("tracker/validations/te-data_error_geo-ok.json");
params.setImportStrategy(TrackerImportStrategy.CREATE);
TrackerImportReport trackerImportReport = trackerImportService.importTracker(params);
assertEquals(0, trackerImportReport.getValidationReport().getErrors().size());
}
Aggregations