Search in sources :

Example 6 with JsonDataIntegrityDetails

use of org.hisp.dhis.webapi.json.domain.JsonDataIntegrityDetails in project dhis2-core by dhis2.

the class AbstractDataIntegrityControllerTest method getDetails.

protected final JsonDataIntegrityDetails getDetails(String check) {
    JsonObject content = GET("/dataIntegrity/details?checks={check}&timeout=1000", check).content();
    JsonDataIntegrityDetails details = content.get(check.replace('-', '_'), JsonDataIntegrityDetails.class);
    assertTrue(details.exists(), "check " + check + " did not complete in time or threw an exception");
    assertTrue(details.isObject());
    return details;
}
Also used : JsonDataIntegrityDetails(org.hisp.dhis.webapi.json.domain.JsonDataIntegrityDetails) JsonObject(org.hisp.dhis.jsontree.JsonObject)

Example 7 with JsonDataIntegrityDetails

use of org.hisp.dhis.webapi.json.domain.JsonDataIntegrityDetails in project dhis2-core by dhis2.

the class DataIntegrityCategoriesControllerTest method testDetailsCategories_one_default_category_option_combo.

/**
 * Ideally we would have created a second category option combo named
 * default, but we have made this impossible by unique constraint. So the
 * best we can do is changing the UID of the existing default to some other
 * UID.
 */
@Test
void testDetailsCategories_one_default_category_option_combo() {
    String uid = CodeGenerator.generateUid();
    assertEquals(uid, updateDefaultCategoryOptionComboToUid(uid));
    postDetails("categories_one_default_category_option_combo");
    JsonDataIntegrityDetails details = getDetails("categories_one_default_category_option_combo");
    assertEquals(1, details.getIssues().size());
    assertEquals(uid, details.getIssues().get(0).getId());
    assertEquals("default", details.getIssues().get(0).getName());
}
Also used : JsonDataIntegrityDetails(org.hisp.dhis.webapi.json.domain.JsonDataIntegrityDetails) Test(org.junit.jupiter.api.Test)

Example 8 with JsonDataIntegrityDetails

use of org.hisp.dhis.webapi.json.domain.JsonDataIntegrityDetails in project dhis2-core by dhis2.

the class DataIntegrityDetailsControllerTest method testSingleCheckByPath.

@Test
void testSingleCheckByPath() {
    String uid = assertStatus(HttpStatus.CREATED, POST("/categories", "{'name': 'CatDog', 'shortName': 'CD', 'dataDimensionType': 'ATTRIBUTE'}"));
    postDetails("categories-no-options");
    JsonDataIntegrityDetails details = GET("/dataIntegrity/categories-no-options/details?timeout=1000").content().as(JsonDataIntegrityDetails.class);
    assertTrue(details.exists());
    assertTrue(details.isObject());
    JsonList<JsonDataIntegrityIssue> issues = details.getIssues();
    assertTrue(issues.exists());
    assertEquals(1, issues.size());
    assertEquals(uid, issues.get(0).getId());
    assertEquals("CatDog", issues.get(0).getName());
}
Also used : JsonDataIntegrityDetails(org.hisp.dhis.webapi.json.domain.JsonDataIntegrityDetails) JsonDataIntegrityIssue(org.hisp.dhis.webapi.json.domain.JsonDataIntegrityDetails.JsonDataIntegrityIssue) Test(org.junit.jupiter.api.Test)

Aggregations

JsonDataIntegrityDetails (org.hisp.dhis.webapi.json.domain.JsonDataIntegrityDetails)8 Test (org.junit.jupiter.api.Test)7 DataIntegrityCheckType (org.hisp.dhis.dataintegrity.DataIntegrityCheckType)1 JsonObject (org.hisp.dhis.jsontree.JsonObject)1 JsonDataIntegrityIssue (org.hisp.dhis.webapi.json.domain.JsonDataIntegrityDetails.JsonDataIntegrityIssue)1