use of org.hisp.dhis.dxf2.events.importer.shared.ImmutableEvent in project dhis2-core by dhis2.
the class AttributeOptionComboDateCheckTest method failOnCategoryOptionEndDateBeforeEventDate.
@Test
void failOnCategoryOptionEndDateBeforeEventDate() {
event.setEventDate("2019-05-01");
event.setDueDate("2019-05-10");
CategoryOptionCombo categoryOptionCombo = createCategoryOptionCombo("2019-04-01", false);
mockContext(categoryOptionCombo);
ImportSummary importSummary = rule.check(new ImmutableEvent(event), this.workContext);
assertHasError(importSummary, event, "Event date 2019-05-01 is after end date 2019-04-01 for attributeOption 'test' in program 'TestProgram'");
}
use of org.hisp.dhis.dxf2.events.importer.shared.ImmutableEvent in project dhis2-core by dhis2.
the class AttributeOptionComboDateCheckTest method succeedBeforeOpenDaysAfterCoEndDate.
@Test
void succeedBeforeOpenDaysAfterCoEndDate() {
event.setEventDate("2019-05-01");
event.setDueDate("2019-05-10");
program.setOpenDaysAfterCoEndDate(31);
CategoryOptionCombo categoryOptionCombo = createCategoryOptionCombo("2019-04-01", false);
mockContext(categoryOptionCombo);
ImportSummary importSummary = rule.check(new ImmutableEvent(event), this.workContext);
assertNoError(importSummary);
}
use of org.hisp.dhis.dxf2.events.importer.shared.ImmutableEvent in project dhis2-core by dhis2.
the class AttributeOptionComboDateCheckTest method failOnCategoryOptionStartDateBeforeEventDate.
@Test
void failOnCategoryOptionStartDateBeforeEventDate() {
event.setEventDate("2019-05-01");
event.setDueDate("2019-05-10");
CategoryOptionCombo categoryOptionCombo = createCategoryOptionCombo("2020-01-01", true);
mockContext(categoryOptionCombo);
ImportSummary importSummary = rule.check(new ImmutableEvent(event), this.workContext);
assertHasError(importSummary, event, "Event date 2019-05-01 is before start date 2020-01-01 for attributeOption 'test'");
}
use of org.hisp.dhis.dxf2.events.importer.shared.ImmutableEvent in project dhis2-core by dhis2.
the class EventBaseCheckTest method verifyErrorOnInvalidLastUpdatedAtClientDate.
@Test
void verifyErrorOnInvalidLastUpdatedAtClientDate() {
event.setEvent(event.getUid());
event.setLastUpdatedAtClient("111-12-122");
ImportSummary importSummary = rule.check(new ImmutableEvent(event), workContext);
assertHasError(importSummary, event, null);
assertHasConflict(importSummary, event, "Invalid event last updated at client date: " + event.getLastUpdatedAtClient());
}
use of org.hisp.dhis.dxf2.events.importer.shared.ImmutableEvent in project dhis2-core by dhis2.
the class EventBaseCheckTest method verifyNoErrorOnNonCompletedProgramInstance.
@Test
void verifyNoErrorOnNonCompletedProgramInstance() {
event.setEvent(event.getUid());
Map<String, ProgramInstance> programInstanceMap = new HashMap<>();
ProgramInstance programInstance = new ProgramInstance();
programInstanceMap.put(event.getUid(), programInstance);
when(workContext.getProgramInstanceMap()).thenReturn(programInstanceMap);
ImportSummary importSummary = rule.check(new ImmutableEvent(event), workContext);
assertNoError(importSummary);
}
Aggregations