use of org.hisp.dhis.helpers.QueryParamsBuilder in project dhis2-core by dhis2.
the class AtomicModeTests method shouldImportWhenErrorsWithAtomicMode.
@Test
public void shouldImportWhenErrorsWithAtomicMode() throws Exception {
TrackerApiResponse response = trackerActions.postAndGetJobReport(createWrongPayload(), new QueryParamsBuilder().addAll("atomicMode=OBJECT"));
response.validate().body("status", equalTo("OK")).body("stats.ignored", equalTo(2)).body("stats.created", equalTo(1));
response.validateErrorReport().body("", hasSize(2)).body("trackerType", contains("TRACKED_ENTITY", "RELATIONSHIP"));
}
use of org.hisp.dhis.helpers.QueryParamsBuilder in project dhis2-core by dhis2.
the class AtomicModeTests method shouldNotImportWhenErrorsWithoutAtomicMode.
@Test
public void shouldNotImportWhenErrorsWithoutAtomicMode() throws Exception {
TrackerApiResponse response = trackerActions.postAndGetJobReport(createWrongPayload(), new QueryParamsBuilder().add("atomicMode=ALL"));
response.validate().body("status", equalTo("ERROR")).body("stats.ignored", equalTo(3));
response.validateErrorReport().body("", hasSize(2)).body("trackerType", contains("TRACKED_ENTITY", "RELATIONSHIP"));
}
use of org.hisp.dhis.helpers.QueryParamsBuilder in project dhis2-core by dhis2.
the class OwnershipTests method beforeAll.
@BeforeAll
public void beforeAll() throws Exception {
userActions = new UserActions();
programActions = new ProgramActions();
loginActions.loginAsSuperUser();
username = createUserWithAccessToOu();
protectedProgram = programActions.createProgramWithAccessLevel("PROTECTED", captureOu, searchOu);
openProgram = programActions.createProgramWithAccessLevel("OPEN", captureOu, searchOu);
String protectedProgramStageId = programActions.get(protectedProgram, new QueryParamsBuilder().add("fields=programStages")).validateStatus(200).extractString("programStages.id[0]");
teiInCaptureScope = super.importTeiWithEnrollmentAndEvent(captureOu, protectedProgram, protectedProgramStageId).extractImportedTeis().get(0);
teiInSearchScope = super.importTeiWithEnrollmentAndEvent(searchOu, protectedProgram, protectedProgramStageId).extractImportedTeis().get(0);
enrollment = trackerActions.getTrackedEntity(teiInSearchScope + "?fields=enrollments").validateStatus(200).getBody();
trackerActions.update(String.format("/ownership/transfer?trackedEntityInstance=%s&program=%s&ou=%s", teiInCaptureScope, protectedProgram, searchOu), new JsonObject()).validateStatus(200);
}
use of org.hisp.dhis.helpers.QueryParamsBuilder in project dhis2-core by dhis2.
the class SideEffectsTests method shouldSendNotificationIfNotSkipSideEffects.
@ParameterizedTest
@ValueSource(strings = { "true", "false" })
public void shouldSendNotificationIfNotSkipSideEffects(Boolean shouldSkipSideEffects) {
JsonObject object = new TeiDataBuilder().buildWithEnrollmentAndEvent(Constants.TRACKED_ENTITY_TYPE, Constants.ORG_UNIT_IDS[0], trackerProgramId, trackerProgramStageId, "COMPLETED");
ApiResponse response = new RestApiActions("/messageConversations").get("", new QueryParamsBuilder().add("fields=*"));
int size = response.getBody().getAsJsonArray("messageConversations").size();
trackerActions.postAndGetJobReport(object, new QueryParamsBuilder().add("skipSideEffects=" + shouldSkipSideEffects)).validateSuccessfulImport();
int expectedCount = (shouldSkipSideEffects) ? size : size + 1;
response = messageConversationsActions.waitForNotification(expectedCount);
response.validate().statusCode(200).body("messageConversations", hasSize(expectedCount));
if (shouldSkipSideEffects) {
return;
}
response.validate().body("messageConversations.subject", hasItem("TA program stage completion"));
}
use of org.hisp.dhis.helpers.QueryParamsBuilder in project dhis2-core by dhis2.
the class MetadataPatchTests method shouldReturnErrors.
@Disabled("DHIS2-11434")
@Test
public void shouldReturnErrors() {
JsonObject object = JsonObjectBuilder.jsonObject().addProperty("op", "remove").addProperty("path", "/dataElementGroups").build();
dataElementActions.patch(dataElementId, Arrays.asList(object), new QueryParamsBuilder().add("importReportMode", "ERRORS_NOT_OWNER")).validate().statusCode(200).body("response.errorReports", hasSize(1));
dataElementActions.get(dataElementId).validate().body("dataElementGroups", hasSize(0));
}
Aggregations