Search in sources :

Example 1 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.

/**
 * Ideally we would have created a second category option 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() {
    String uid = CodeGenerator.generateUid();
    assertEquals(uid, updateDefaultCategoryOptionToUid(uid));
    postDetails("categories_one_default_category_option");
    JsonDataIntegrityDetails details = getDetails("categories_one_default_category_option");
    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 2 with JsonDataIntegrityDetails

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

the class DataIntegrityCategoriesControllerTest method testDetailsCategories_no_options.

@Test
void testDetailsCategories_no_options() {
    String uid = assertStatus(HttpStatus.CREATED, POST("/categories", "{'name': 'CatDog', 'shortName': 'CD', 'dataDimensionType': 'ATTRIBUTE'}"));
    postDetails("categories-no-options");
    JsonDataIntegrityDetails details = getDetails("categories-no-options");
    assertEquals(1, details.getIssues().size());
    assertEquals(uid, details.getIssues().get(0).getId());
    assertEquals("CatDog", details.getIssues().get(0).getName());
}
Also used : JsonDataIntegrityDetails(org.hisp.dhis.webapi.json.domain.JsonDataIntegrityDetails) Test(org.junit.jupiter.api.Test)

Example 3 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.

/**
 * Ideally we would have created a second category 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() {
    String uid = CodeGenerator.generateUid();
    assertEquals(uid, updateDefaultCategoryToUid(uid));
    postDetails("categories_one_default_category");
    JsonDataIntegrityDetails details = getDetails("categories_one_default_category");
    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 4 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_combo.

/**
 * Ideally we would have created a second category 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_combo() {
    String uid = CodeGenerator.generateUid();
    assertEquals(uid, updateDefaultCategoryComboToUid(uid));
    postDetails("categories_one_default_category_combo");
    JsonDataIntegrityDetails details = getDetails("categories_one_default_category_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 5 with JsonDataIntegrityDetails

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

the class DataIntegrityDetailsControllerTest method testLegacyChecksOnly.

@Test
void testLegacyChecksOnly() {
    for (DataIntegrityCheckType type : DataIntegrityCheckType.values()) {
        String check = type.getName();
        postDetails(check);
        JsonDataIntegrityDetails details = getDetails(check);
        assertTrue(details.getIssues().isEmpty());
    }
}
Also used : JsonDataIntegrityDetails(org.hisp.dhis.webapi.json.domain.JsonDataIntegrityDetails) DataIntegrityCheckType(org.hisp.dhis.dataintegrity.DataIntegrityCheckType) 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