use of org.hisp.dhis.helpers.QueryParamsBuilder 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.helpers.QueryParamsBuilder 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.helpers.QueryParamsBuilder 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"));
}
use of org.hisp.dhis.helpers.QueryParamsBuilder in project dhis2-core by dhis2.
the class TrackerExportTests method singleTeiAndCollectionTeiShouldReturnSameResult.
@Test
public void singleTeiAndCollectionTeiShouldReturnSameResult() throws JSONException {
TrackerApiResponse trackedEntity = trackerActions.getTrackedEntity("Kj6vYde4LHh", new QueryParamsBuilder().add("fields", "*").add("includeAllAttributes", "true"));
TrackerApiResponse trackedEntities = trackerActions.getTrackedEntities(new QueryParamsBuilder().add("fields", "*").add("includeAllAttributes", "true").add("trackedEntity", "Kj6vYde4LHh").add("orgUnit", "O6uvpzGd5pu"));
JSONAssert.assertEquals(trackedEntity.getBody().toString(), trackedEntities.extractJsonObject("instances[0]").toString(), false);
}
use of org.hisp.dhis.helpers.QueryParamsBuilder in project dhis2-core by dhis2.
the class TrackerExportTests method shouldReturnTeisMatchingAttributeCriteria.
@MethodSource()
@ParameterizedTest
public void shouldReturnTeisMatchingAttributeCriteria(String operator, String searchCriteria, Matcher everyItemMatcher) {
QueryParamsBuilder queryParamsBuilder = new QueryParamsBuilder().add("orgUnit", "O6uvpzGd5pu").add("program", Constants.TRACKER_PROGRAM_ID).add("attribute", String.format("kZeSYCgaHTk:%s:%s", operator, searchCriteria));
trackerActions.getTrackedEntities(queryParamsBuilder).validate().statusCode(200).body("instances", hasSize(greaterThanOrEqualTo(1))).body("instances.attributes.flatten().findAll { it.attribute == 'kZeSYCgaHTk' }.value", everyItem(everyItemMatcher));
}
Aggregations