Search in sources :

Example 6 with ValidationResultQuery

use of org.hisp.dhis.validation.comparator.ValidationResultQuery in project dhis2-core by dhis2.

the class ValidationResultStoreHqlTest method queryWithUserWithCategoryOptionGroupSet.

@Test
void queryWithUserWithCategoryOptionGroupSet() {
    CategoryOptionGroupSet groupSet = new CategoryOptionGroupSet();
    groupSet.setId(42L);
    setUpUser("orgUid", null, groupSet);
    store.query(new ValidationResultQuery());
    assertHQLMatches("from ValidationResult vr where (locate('orgUid',vr.organisationUnit.path) <> 0) and 1 = ...", 544);
}
Also used : ValidationResultQuery(org.hisp.dhis.validation.comparator.ValidationResultQuery) CategoryOptionGroupSet(org.hisp.dhis.category.CategoryOptionGroupSet) Test(org.junit.jupiter.api.Test)

Example 7 with ValidationResultQuery

use of org.hisp.dhis.validation.comparator.ValidationResultQuery in project dhis2-core by dhis2.

the class ValidationResultStoreHqlTest method queryWithOrgUnitFilter.

@Test
void queryWithOrgUnitFilter() {
    ValidationResultQuery query = new ValidationResultQuery();
    query.setOu(asList("uid1", "uid2"));
    store.query(query);
    assertHQLMatches("from ValidationResult vr where vr.organisationUnit.uid in :orgUnitsUids ");
    assertHQLParameter("orgUnitsUids", asList("uid1", "uid2"));
    assertHQLParameterCount(1);
}
Also used : ValidationResultQuery(org.hisp.dhis.validation.comparator.ValidationResultQuery) Test(org.junit.jupiter.api.Test)

Example 8 with ValidationResultQuery

use of org.hisp.dhis.validation.comparator.ValidationResultQuery in project dhis2-core by dhis2.

the class ValidationResultStoreHqlTest method queryWithValidationRuleFilter.

@Test
void queryWithValidationRuleFilter() {
    ValidationResultQuery query = new ValidationResultQuery();
    query.setVr(asList("uid1", "uid2"));
    store.query(query);
    assertHQLMatches("from ValidationResult vr where vr.validationRule.uid in :validationRulesUids ");
    assertHQLParameter("validationRulesUids", asList("uid1", "uid2"));
    assertHQLParameterCount(1);
}
Also used : ValidationResultQuery(org.hisp.dhis.validation.comparator.ValidationResultQuery) Test(org.junit.jupiter.api.Test)

Example 9 with ValidationResultQuery

use of org.hisp.dhis.validation.comparator.ValidationResultQuery in project dhis2-core by dhis2.

the class ValidationResultStoreHqlTest method queryWithIsoPeriodFilter.

@Test
void queryWithIsoPeriodFilter() {
    ValidationResultQuery query = new ValidationResultQuery();
    query.setPe(singletonList("2017Q1"));
    store.query(query);
    assertHQLMatches("from ValidationResult vr where( ((vr.period.startDate <= :periodId1End ) and (vr.period.endDate >= :periodId1Start )))");
    PeriodType quarterly = PeriodType.getByNameIgnoreCase(DateUnitType.QUARTERLY.getName());
    Period q1_2017 = quarterly.createPeriod("2017Q1");
    assertNotNull(q1_2017);
    assertHQLParameter("periodId1Start", q1_2017.getStartDate());
    assertHQLParameter("periodId1End", q1_2017.getEndDate());
    assertHQLParameterCount(2);
}
Also used : PeriodType(org.hisp.dhis.period.PeriodType) ValidationResultQuery(org.hisp.dhis.validation.comparator.ValidationResultQuery) Period(org.hisp.dhis.period.Period) Test(org.junit.jupiter.api.Test)

Example 10 with ValidationResultQuery

use of org.hisp.dhis.validation.comparator.ValidationResultQuery in project dhis2-core by dhis2.

the class ValidationResultStoreHqlTest method queryWithUserWithCategory.

@Test
void queryWithUserWithCategory() {
    Category category = new Category();
    category.setId(42L);
    setUpUser("orgUid", category, null);
    store.query(new ValidationResultQuery());
    assertHQLMatches("from ValidationResult vr where (locate('orgUid',vr.organisationUnit.path) <> 0) and 1 = ...", 523);
}
Also used : Category(org.hisp.dhis.category.Category) ValidationResultQuery(org.hisp.dhis.validation.comparator.ValidationResultQuery) Test(org.junit.jupiter.api.Test)

Aggregations

ValidationResultQuery (org.hisp.dhis.validation.comparator.ValidationResultQuery)19 Test (org.junit.jupiter.api.Test)17 TransactionalIntegrationTest (org.hisp.dhis.TransactionalIntegrationTest)8 Category (org.hisp.dhis.category.Category)2 CategoryOptionGroupSet (org.hisp.dhis.category.CategoryOptionGroupSet)2 LocalDate (java.time.LocalDate)1 Date (java.util.Date)1 IllegalQueryException (org.hisp.dhis.common.IllegalQueryException)1 Period (org.hisp.dhis.period.Period)1 PeriodType (org.hisp.dhis.period.PeriodType)1