use of org.hisp.dhis.jsontree.JsonObject in project dhis2-core by dhis2.
the class GistValidationControllerTest method testValidation_Access_CollectionOwnerSharing.
@Test
void testValidation_Access_CollectionOwnerSharing() {
JsonObject group = GET("/userGroups/{id}", userGroupId).content();
String sharing = group.getObject("sharing").node().extract().members().get("public").replaceWith("\"--------\"").toString();
assertStatus(HttpStatus.NO_CONTENT, PUT("/userGroups/" + userGroupId + "/sharing", sharing));
switchToGuestUser();
assertEquals("User not allowed to view UserGroup " + userGroupId, GET("/userGroups/{id}/users/gist", userGroupId).error(HttpStatus.FORBIDDEN).getMessage());
switchToSuperuser();
assertStatus(HttpStatus.OK, GET("/userGroups/{id}/users/gist", userGroupId));
}
use of org.hisp.dhis.jsontree.JsonObject in project dhis2-core by dhis2.
the class JobConfigurationControllerTest method testCONTINUOUS_ANALYTICS_TABLE.
@Test
void testCONTINUOUS_ANALYTICS_TABLE() {
String jobId = assertStatus(HttpStatus.CREATED, POST("/jobConfigurations", "{'name':'test','jobType':'CONTINUOUS_ANALYTICS_TABLE','delay':'1'," + "'jobParameters':{'fullUpdateHourOfDay':'1','lastYears':'2'," + "'skipTableTypes':['DATA_VALUE','COMPLETENESS','COMPLETENESS_TARGET','ORG_UNIT_TARGET','EVENT','ENROLLMENT','VALIDATION_RESULT']}}"));
JsonObject parameters = assertJobConfigurationExists(jobId, "CONTINUOUS_ANALYTICS_TABLE");
assertEquals(1, parameters.getNumber("fullUpdateHourOfDay").intValue());
assertEquals(2, parameters.getNumber("lastYears").intValue());
assertContainsOnly(parameters.getArray("skipTableTypes").stringValues(), "ENROLLMENT", "VALIDATION_RESULT", "DATA_VALUE", "COMPLETENESS", "EVENT", "ORG_UNIT_TARGET", "COMPLETENESS_TARGET");
}
use of org.hisp.dhis.jsontree.JsonObject in project dhis2-core by dhis2.
the class JobConfigurationControllerTest method assertJobConfigurationExists.
private JsonObject assertJobConfigurationExists(String jobId, String expectedJobType) {
JsonObject jobConfiguration = GET("/jobConfigurations/{id}", jobId).content();
assertEquals(jobId, jobConfiguration.getString("id").string());
assertEquals("test", jobConfiguration.getString("name").string());
assertEquals("SCHEDULED", jobConfiguration.getString("jobStatus").string());
assertTrue(jobConfiguration.getBoolean("enabled").booleanValue());
assertEquals(expectedJobType, jobConfiguration.getString("jobType").string());
return jobConfiguration.getObject("jobParameters");
}
use of org.hisp.dhis.jsontree.JsonObject in project dhis2-core by dhis2.
the class JobConfigurationControllerTest method testGetJobTypesExtended.
@Test
void testGetJobTypesExtended() {
JsonObject types = GET("/jobConfigurations/jobTypesExtended").content();
JsonObject param = types.getObject("ANALYTICS_TABLE").getObject("skipTableTypes");
assertEquals(List.of("DATA_VALUE", "COMPLETENESS", "COMPLETENESS_TARGET", "ORG_UNIT_TARGET", "EVENT", "ENROLLMENT", "VALIDATION_RESULT"), param.getArray("constants").stringValues());
}
use of org.hisp.dhis.jsontree.JsonObject in project dhis2-core by dhis2.
the class JobConfigurationControllerTest method testDISABLE_INACTIVE_USERS.
@Test
void testDISABLE_INACTIVE_USERS() {
String jobId = assertStatus(HttpStatus.CREATED, POST("/jobConfigurations", "{'name':'test','jobType':'DISABLE_INACTIVE_USERS','cronExpression':'0 0 1 ? * *','jobParameters':{'inactiveMonths':'3'}}"));
JsonObject parameters = assertJobConfigurationExists(jobId, "DISABLE_INACTIVE_USERS");
assertEquals(3, parameters.getNumber("inactiveMonths").intValue());
}
Aggregations