use of org.hisp.dhis.analytics.DataQueryParams in project dhis2-core by dhis2.
the class DataQueryServiceTest method testGetFromUrlWithCodeA.
@Test
// TODO Not working for composite identifiers with non-UID identifier schemes
@Ignore
public void testGetFromUrlWithCodeA() {
Set<String> dimensionParams = new HashSet<>();
dimensionParams.add("dx:" + deA.getCode() + ";" + deB.getCode() + ";" + patA.getDimensionItem(IdScheme.CODE) + ";" + patB.getDimensionItem(IdScheme.CODE));
Set<String> filterParams = new HashSet<>();
filterParams.add("ou:" + ouA.getCode());
DataQueryParams params = dataQueryService.getFromUrl(dimensionParams, filterParams, null, null, null, null, null, false, false, false, false, false, false, false, false, false, false, null, null, IdScheme.CODE, false, null, null, null, false, null);
assertEquals(2, params.getDataElements().size());
assertEquals(2, params.getProgramAttributes().size());
assertEquals(1, params.getFilterOrganisationUnits().size());
}
use of org.hisp.dhis.analytics.DataQueryParams in project dhis2-core by dhis2.
the class DataQueryServiceTest method testGetFromUrlOrgUnitGroupSetAllItems.
@Test
public void testGetFromUrlOrgUnitGroupSetAllItems() {
Set<String> dimensionParams = new HashSet<>();
dimensionParams.add("dx:" + deA.getDimensionItem() + ";" + deB.getDimensionItem() + ";" + deC.getDimensionItem());
dimensionParams.add("pe:2012;2012S1");
dimensionParams.add(ouGroupSetA.getUid());
Set<String> filterParams = new HashSet<>();
filterParams.add("ou:" + ouA.getDimensionItem() + ";" + ouB.getDimensionItem() + ";" + ouC.getDimensionItem());
DataQueryParams params = dataQueryService.getFromUrl(dimensionParams, filterParams, null, null, null, null, null, false, false, false, false, false, false, false, false, false, false, null, null, null, false, null, null, null, false, null);
assertEquals(3, params.getDataElements().size());
assertEquals(2, params.getPeriods().size());
assertEquals(3, params.getFilterOrganisationUnits().size());
assertEquals(3, params.getDimensionOptions(ouGroupSetA.getUid()).size());
}
use of org.hisp.dhis.analytics.DataQueryParams in project dhis2-core by dhis2.
the class QueryPlannerTest method validateFailureSingleIndicatorAsFilter.
@Test(expected = IllegalQueryException.class)
public void validateFailureSingleIndicatorAsFilter() {
DataQueryParams params = DataQueryParams.newBuilder().addDimension(new BaseDimensionalObject(ORGUNIT_DIM_ID, DimensionType.ORGANISATION_UNIT, getList(ouA, ouB))).addFilter(new BaseDimensionalObject(DATA_X_DIM_ID, DimensionType.DATA_X, getList(deA, inA))).build();
queryPlanner.validate(params);
}
use of org.hisp.dhis.analytics.DataQueryParams in project dhis2-core by dhis2.
the class DataQueryServiceTest method testGetFromUrlOrgUnitGroup.
@Test
public void testGetFromUrlOrgUnitGroup() {
Set<String> dimensionParams = new HashSet<>();
dimensionParams.add("ou:OU_GROUP-" + ouGroupA.getUid());
dimensionParams.add("dx:" + deA.getDimensionItem() + ";" + deB.getDimensionItem());
dimensionParams.add("pe:2011;2012");
DataQueryParams params = dataQueryService.getFromUrl(dimensionParams, null, null, null, null, null, null, false, false, false, false, false, false, false, false, false, false, null, null, null, false, null, null, null, false, null);
assertEquals(3, params.getOrganisationUnits().size());
assertEquals(2, params.getDataElements().size());
assertEquals(2, params.getPeriods().size());
}
use of org.hisp.dhis.analytics.DataQueryParams in project dhis2-core by dhis2.
the class EventQueryPlannerTest method testPlanAggregateDataQueryA.
@Test
public void testPlanAggregateDataQueryA() {
DataQueryParams dataQueryParams = DataQueryParams.newBuilder().withProgramDataElements(getList(pdeA, pdeB, pdeC, pdeD)).withProgramAttributes(getList(patA, patB)).withOrganisationUnits(getList(ouA, ouB, ouC)).withPeriods(getList(createPeriod("200101"), createPeriod("200103"), createPeriod("200105"), createPeriod("200107"))).build();
EventQueryParams params = EventQueryParams.fromDataQueryParams(dataQueryParams);
List<EventQueryParams> queries = queryPlanner.planAggregateQuery(params);
assertEquals(12, queries.size());
for (EventQueryParams query : queries) {
assertTrue(query.hasValueDimension());
}
}
Aggregations