use of org.hisp.dhis.tracker.importer.databuilder.EventDataBuilder in project dhis2-core by dhis2.
the class RuleEngineTests method shouldShowErrorOnCompleteOnEvents.
@Test
public void shouldShowErrorOnCompleteOnEvents() {
JsonObject payload = new EventDataBuilder().setStatus("COMPLETED").array(Constants.ORG_UNIT_IDS[0], eventProgramId, "Mt6Ac5brjoK");
TrackerApiResponse response = trackerActions.postAndGetJobReport(payload);
response.validateErrorReport().body("trackerType", hasItem("EVENT")).body("message", hasItem(stringContainsInOrder("ERROR ON COMPLETE ")));
}
use of org.hisp.dhis.tracker.importer.databuilder.EventDataBuilder in project dhis2-core by dhis2.
the class RuleEngineTests method shouldSendProgramRuleNotification.
@Test
public void shouldSendProgramRuleNotification() {
JsonObject payload = new EventDataBuilder().addDataValue("ILRgzHhzFkg", "true").addDataValue("z3Z4TD3oBCP", "true").addDataValue("BuZ5LGNfGEU", "40").array(Constants.ORG_UNIT_IDS[0], eventProgramId, "Mt6Ac5brjoK");
loginActions.loginAsAdmin();
ApiResponse response = new RestApiActions("/messageConversations").get("", new QueryParamsBuilder().add("fields=*"));
int size = response.getBody().getAsJsonArray("messageConversations").size();
loginActions.loginAsSuperUser();
trackerActions.postAndGetJobReport(payload).validateSuccessfulImport();
loginActions.loginAsAdmin();
messageConversationsActions.waitForNotification(size + 1);
messageConversationsActions.get("", new QueryParamsBuilder().add("fields=*")).validate().statusCode(200).body("messageConversations", hasSize(size + 1)).body("messageConversations.subject", hasItem("Program rule triggered"));
}
use of org.hisp.dhis.tracker.importer.databuilder.EventDataBuilder in project dhis2-core by dhis2.
the class RuleEngineTests method shouldBeSkippedWhenSkipRuleEngineFlag.
@Test
public void shouldBeSkippedWhenSkipRuleEngineFlag() {
JsonObject payload = new EventDataBuilder().setStatus("COMPLETED").array(Constants.ORG_UNIT_IDS[0], eventProgramId, "Mt6Ac5brjoK");
TrackerApiResponse response = trackerActions.postAndGetJobReport(payload, new QueryParamsBuilder().add("skipRuleEngine=true"));
response.validateSuccessfulImport();
}
use of org.hisp.dhis.tracker.importer.databuilder.EventDataBuilder in project dhis2-core by dhis2.
the class RuleEngineTests method shouldShowErrorOnCompleteInTrackerEvents.
@Test
public void shouldShowErrorOnCompleteInTrackerEvents() throws Exception {
String tei = importTei();
JsonObject enrollment = new EnrollmentDataBuilder().setTei(tei).setEnrollmentDate(Instant.now().plus(1, ChronoUnit.DAYS).toString()).array(trackerProgramId, Constants.ORG_UNIT_IDS[0]);
String enrollmentId = trackerActions.postAndGetJobReport(enrollment).validateSuccessfulImport().extractImportedEnrollments().get(0);
JsonObject payload = new EventDataBuilder().setEnrollment(enrollmentId).setStatus("COMPLETED").array(Constants.ORG_UNIT_IDS[0], trackerProgramId, "nH8zfPSUSN1");
trackerActions.postAndGetJobReport(payload, new QueryParamsBuilder().add("async=false")).validateErrorReport().body("trackerType", hasItem("EVENT")).body("message", hasItem(stringContainsInOrder("ERROR ON COMPLETE ")));
}
use of org.hisp.dhis.tracker.importer.databuilder.EventDataBuilder in project dhis2-core by dhis2.
the class RuleEngineTests method shouldAssignValue.
@Test
public void shouldAssignValue() {
JsonObject payload = new EventDataBuilder().array(Constants.ORG_UNIT_IDS[0], eventProgramId, "Mt6Ac5brjoK");
TrackerApiResponse response = trackerActions.postAndGetJobReport(payload, new QueryParamsBuilder().addAll("skipSideEffects=true"));
response.validateSuccessfulImport().validateWarningReport().body("warningCode", contains("E1308"));
String eventId = response.extractImportedEvents().get(0);
trackerActions.get("/events/" + eventId).validate().body("dataValues", hasSize(1)).body("dataValues.value", contains("AUTO_ASSIGNED_COMMENT"));
}
Aggregations