use of org.hisp.dhis.jsontree.JsonObject in project dhis2-core by dhis2.
the class SystemSettingControllerTest method testGetSystemSettingsJson_AllKeys.
@Test
void testGetSystemSettingsJson_AllKeys() {
assertStatus(HttpStatus.OK, POST("/systemSettings/keyUiLocale?value=de"));
JsonObject setting = GET("/systemSettings").content(HttpStatus.OK);
assertTrue(setting.isObject());
stream(SettingKey.values()).filter(key -> !key.isConfidential() && key.getDefaultValue() != null).forEach(key -> assertTrue(setting.get(key.getName()).exists(), key.getName()));
stream(SettingKey.values()).filter(SettingKey::isConfidential).forEach(key -> assertFalse(setting.get(key.getName()).exists(), key.getName()));
}
use of org.hisp.dhis.jsontree.JsonObject in project dhis2-core by dhis2.
the class TrackerEnrollmentsExportControllerTest method testGetEnrollmentByIdContainsFollowUp.
@Test
void testGetEnrollmentByIdContainsFollowUp() {
OrganisationUnit orgUnit = createOrganisationUnit('A');
manager.save(orgUnit);
Program program = createProgram('A');
manager.save(program);
TrackedEntityType trackedEntityType = createTrackedEntityType('A');
manager.save(trackedEntityType);
TrackedEntityInstance tei = createTrackedEntityInstance(orgUnit);
tei.setTrackedEntityType(trackedEntityType);
manager.save(tei);
ProgramInstance programInstance = new ProgramInstance(program, tei, orgUnit);
programInstance.setAutoFields();
programInstance.setEnrollmentDate(new Date());
programInstance.setIncidentDate(new Date());
programInstance.setStatus(ProgramStatus.COMPLETED);
programInstance.setFollowup(true);
manager.save(programInstance);
JsonObject enrollment = GET("/tracker/enrollments/{id}", programInstance.getUid()).content(HttpStatus.OK);
assertTrue(enrollment.isObject());
assertFalse(enrollment.isEmpty());
assertEquals(programInstance.getUid(), enrollment.getString("enrollment").string());
assertEquals(tei.getUid(), enrollment.getString("trackedEntity").string());
assertEquals(program.getUid(), enrollment.getString("program").string());
assertEquals("COMPLETED", enrollment.getString("status").string());
assertEquals(orgUnit.getUid(), enrollment.getString("orgUnit").string());
assertEquals(orgUnit.getName(), enrollment.getString("orgUnitName").string());
assertTrue(enrollment.has("enrolledAt", "occurredAt"));
assertTrue(enrollment.getBoolean("followUp").booleanValue());
assertFalse(enrollment.getBoolean("deleted").booleanValue());
assertTrue(enrollment.getArray("events").isEmpty());
assertTrue(enrollment.getArray("relationships").isEmpty());
assertTrue(enrollment.getArray("attributes").isEmpty());
assertTrue(enrollment.getArray("notes").isEmpty());
}
use of org.hisp.dhis.jsontree.JsonObject in project dhis2-core by dhis2.
the class SystemControllerTest method testGetTasksExtendedJson.
@Test
void testGetTasksExtendedJson() {
JsonObject tasks = GET("/system/tasks/{jobType}", "META_DATA_SYNC").content(HttpStatus.OK);
assertTrue(tasks.isObject());
assertEquals(0, tasks.size());
}
use of org.hisp.dhis.jsontree.JsonObject in project dhis2-core by dhis2.
the class SystemControllerTest method assertObjectMembers.
private static void assertObjectMembers(JsonObject root, String... members) {
for (String member : members) {
JsonObject memberObj = root.getObject(member);
assertTrue(memberObj.isObject(), member + " is not an object");
}
}
use of org.hisp.dhis.jsontree.JsonObject in project dhis2-core by dhis2.
the class SystemControllerTest method testGetTaskSummaryJson.
@Test
void testGetTaskSummaryJson() {
JsonObject summary = GET("/system/taskSummaries/META_DATA_SYNC/xyz").content(HttpStatus.OK);
assertTrue(summary.isObject());
assertEquals(0, summary.size());
}
Aggregations