Search in sources :

Example 76 with JsonObject

use of org.hisp.dhis.jsontree.JsonObject in project dhis2-core by dhis2.

the class JobConfigurationControllerTest method testDATA_INTEGRITY.

@Test
void testDATA_INTEGRITY() {
    String jobId = assertStatus(HttpStatus.CREATED, POST("/jobConfigurations", "{'name':'test','jobType':'DATA_INTEGRITY','cronExpression':'0 0 12 ? * MON-FRI'}"));
    JsonObject parameters = assertJobConfigurationExists(jobId, "DATA_INTEGRITY");
    assertTrue(parameters.exists());
}
Also used : JsonObject(org.hisp.dhis.jsontree.JsonObject) Test(org.junit.jupiter.api.Test) DhisControllerConvenienceTest(org.hisp.dhis.webapi.DhisControllerConvenienceTest)

Example 77 with JsonObject

use of org.hisp.dhis.jsontree.JsonObject in project dhis2-core by dhis2.

the class JobConfigurationControllerTest method testPROGRAM_NOTIFICATIONS.

@Test
void testPROGRAM_NOTIFICATIONS() {
    String jobId = assertStatus(HttpStatus.CREATED, POST("/jobConfigurations", "{'name':'test','jobType':'PROGRAM_NOTIFICATIONS','cronExpression':'0 0 1 ? * *'}"));
    JsonObject parameters = assertJobConfigurationExists(jobId, "PROGRAM_NOTIFICATIONS");
    assertFalse(parameters.exists());
}
Also used : JsonObject(org.hisp.dhis.jsontree.JsonObject) Test(org.junit.jupiter.api.Test) DhisControllerConvenienceTest(org.hisp.dhis.webapi.DhisControllerConvenienceTest)

Example 78 with JsonObject

use of org.hisp.dhis.jsontree.JsonObject in project dhis2-core by dhis2.

the class FileResourceControllerTest method testSaveOrgUnitImage.

@Test
void testSaveOrgUnitImage() {
    MockMultipartFile image = new MockMultipartFile("file", "OU_profile_image.png", "image/png", "<<png data>>".getBytes());
    HttpResponse response = POST_MULTIPART("/fileResources?domain=ORG_UNIT", image);
    JsonObject savedObject = response.content(HttpStatus.ACCEPTED).getObject("response").getObject("fileResource");
    assertEquals("OU_profile_image.png", savedObject.getString("name").string());
}
Also used : MockMultipartFile(org.springframework.mock.web.MockMultipartFile) JsonObject(org.hisp.dhis.jsontree.JsonObject) Test(org.junit.jupiter.api.Test) DhisControllerConvenienceTest(org.hisp.dhis.webapi.DhisControllerConvenienceTest)

Example 79 with JsonObject

use of org.hisp.dhis.jsontree.JsonObject in project dhis2-core by dhis2.

the class GistDescribeControllerTest method testDescribe_Error_PlanningFailed.

@Test
void testDescribe_Error_PlanningFailed() {
    JsonObject description = GET("/users/{uid}/userGroups/gist?describe=true&filter=foo:eq:bar", getSuperuserUid()).content();
    assertTrue(description.has("error", "unplanned", "status"));
    assertTrue(description.getObject("error").has("type", "message"));
    assertTrue(description.getObject("unplanned").has("fields", "filters", "orders"));
    assertEquals("planning-failed", description.getString("status").string());
}
Also used : JsonObject(org.hisp.dhis.jsontree.JsonObject) Test(org.junit.jupiter.api.Test)

Example 80 with JsonObject

use of org.hisp.dhis.jsontree.JsonObject in project dhis2-core by dhis2.

the class GistFilterControllerTest method testFilter_In.

@Test
void testFilter_In() {
    createDataSetsForOrganisationUnit(10, orgUnitId, "plus");
    String url = "/organisationUnits/{id}/dataSets/gist?filter=name:in:[plus3,plus5]&fields=name&order=name";
    JsonObject gist = GET(url, orgUnitId).content();
    assertEquals(asList("plus3", "plus5"), gist.getArray("dataSets").stringValues());
}
Also used : JsonObject(org.hisp.dhis.jsontree.JsonObject) Test(org.junit.jupiter.api.Test)

Aggregations

JsonObject (org.hisp.dhis.jsontree.JsonObject)106 Test (org.junit.jupiter.api.Test)92 DhisControllerConvenienceTest (org.hisp.dhis.webapi.DhisControllerConvenienceTest)51 JsonArray (org.hisp.dhis.jsontree.JsonArray)16 ProgramInstance (org.hisp.dhis.program.ProgramInstance)6 TrackedEntityInstance (org.hisp.dhis.trackedentity.TrackedEntityInstance)6 Relationship (org.hisp.dhis.relationship.Relationship)5 RelationshipType (org.hisp.dhis.relationship.RelationshipType)5 GeoJsonObject (org.geojson.GeoJsonObject)3 JsonString (org.hisp.dhis.jsontree.JsonString)3 HttpStatus (org.springframework.http.HttpStatus)3 ObjectType (org.hisp.dhis.attribute.Attribute.ObjectType)2 ProgramStageInstance (org.hisp.dhis.program.ProgramStageInstance)2 Arrays.stream (java.util.Arrays.stream)1 Date (java.util.Date)1 JsonResponse (org.hisp.dhis.jsontree.JsonResponse)1 OrganisationUnit (org.hisp.dhis.organisationunit.OrganisationUnit)1 Program (org.hisp.dhis.program.Program)1 ApiToken (org.hisp.dhis.security.apikey.ApiToken)1 SettingKey (org.hisp.dhis.setting.SettingKey)1