use of org.hisp.dhis.webapi.json.domain.JsonDataIntegritySummary in project dhis2-core by dhis2.
the class AbstractDataIntegrityControllerTest method getSummary.
protected final JsonDataIntegritySummary getSummary(String check) {
JsonObject content = GET("/dataIntegrity/summary?checks={check}&timeout=1000", check).content();
JsonDataIntegritySummary summary = content.get(check.replace('-', '_'), JsonDataIntegritySummary.class);
assertTrue(summary.exists());
assertTrue(summary.isObject());
return summary;
}
use of org.hisp.dhis.webapi.json.domain.JsonDataIntegritySummary in project dhis2-core by dhis2.
the class DataIntegrityCategoriesControllerTest method testSummaryCategories_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 testSummaryCategories_one_default_category_option_combo() {
String uid = CodeGenerator.generateUid();
assertEquals(uid, updateDefaultCategoryOptionComboToUid(uid));
postSummary("categories_one_default_category_option_combo");
JsonDataIntegritySummary summary = getSummary("categories_one_default_category_option_combo");
assertEquals(1, summary.getCount());
assertNull(summary.getPercentage());
}
use of org.hisp.dhis.webapi.json.domain.JsonDataIntegritySummary in project dhis2-core by dhis2.
the class DataIntegrityCategoriesControllerTest method testSummaryCategories_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 testSummaryCategories_one_default_category_option() {
String uid = CodeGenerator.generateUid();
assertEquals(uid, updateDefaultCategoryOptionToUid(uid));
postSummary("categories_one_default_category_option");
JsonDataIntegritySummary summary = getSummary("categories_one_default_category_option");
assertEquals(1, summary.getCount());
assertNull(summary.getPercentage());
}
use of org.hisp.dhis.webapi.json.domain.JsonDataIntegritySummary in project dhis2-core by dhis2.
the class DataIntegritySummaryControllerTest method testLegacyChecksHaveSummary.
@Test
void testLegacyChecksHaveSummary() {
for (DataIntegrityCheckType type : DataIntegrityCheckType.values()) {
String check = type.getName();
postSummary(check);
JsonDataIntegritySummary summary = getSummary(check);
assertTrue(summary.getCount() >= 0, "summary threw an exception");
}
}
use of org.hisp.dhis.webapi.json.domain.JsonDataIntegritySummary in project dhis2-core by dhis2.
the class DataIntegritySummaryControllerTest method testSingleCheckByPath.
@Test
void testSingleCheckByPath() {
assertStatus(HttpStatus.CREATED, POST("/categories", "{'name': 'CatDog', 'shortName': 'CD', 'dataDimensionType': 'ATTRIBUTE'}"));
postSummary("categories-no-options");
JsonDataIntegritySummary summary = GET("/dataIntegrity/categories-no-options/summary").content().as(JsonDataIntegritySummary.class);
assertTrue(summary.exists());
assertTrue(summary.isObject());
assertEquals(1, summary.getCount());
assertEquals(50, summary.getPercentage().intValue());
}
Aggregations