use of org.hisp.dhis.common.BaseDimensionalObject 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.common.BaseDimensionalObject in project dhis2-core by dhis2.
the class QueryPlannerTest method validateFailureReportingRatesAndDataElementGroupSetAsDimensions.
@Test(expected = IllegalQueryException.class)
public void validateFailureReportingRatesAndDataElementGroupSetAsDimensions() {
DataQueryParams params = DataQueryParams.newBuilder().addDimension(new BaseDimensionalObject(ORGUNIT_DIM_ID, DimensionType.ORGANISATION_UNIT, getList(ouA, ouB))).addDimension(new BaseDimensionalObject(DATA_X_DIM_ID, DimensionType.DATA_X, getList(rrA, inA))).addDimension(new BaseDimensionalObject(dgsA.getDimension(), DimensionType.DATA_ELEMENT_GROUP_SET, getList(deA))).build();
queryPlanner.validate(params);
}
use of org.hisp.dhis.common.BaseDimensionalObject in project dhis2-core by dhis2.
the class QueryPlannerTest method validateFailureAggregationType.
@Test(expected = IllegalQueryException.class)
public void validateFailureAggregationType() {
deB.setAggregationType(AggregationType.CUSTOM);
DataQueryParams params = DataQueryParams.newBuilder().addDimension(new BaseDimensionalObject(DATA_X_DIM_ID, DimensionType.DATA_X, getList(deA, deB))).addDimension(new BaseDimensionalObject(ORGUNIT_DIM_ID, DimensionType.ORGANISATION_UNIT, getList(ouA, ouB))).addDimension(new BaseDimensionalObject(PERIOD_DIM_ID, DimensionType.PERIOD, getList(peA, peB))).build();
queryPlanner.validate(params);
}
use of org.hisp.dhis.common.BaseDimensionalObject in project dhis2-core by dhis2.
the class DimensionServiceTest method testMergeAnalyticalEventObjectA.
@Test
void testMergeAnalyticalEventObjectA() {
// Given
EventVisualization eventVisualization = new EventVisualization("any");
eventVisualization.getColumns().add(new BaseDimensionalObject(DimensionalObject.DATA_X_DIM_ID, DimensionType.DATA_X, Lists.newArrayList(deA, deB)));
eventVisualization.getRows().add(new BaseDimensionalObject(DimensionalObject.ORGUNIT_DIM_ID, DimensionType.ORGANISATION_UNIT, Lists.newArrayList(ouA, ouB, ouC, ouD, ouE)));
eventVisualization.getFilters().add(new BaseDimensionalObject(DimensionalObject.PERIOD_DIM_ID, DimensionType.PERIOD, Lists.newArrayList(peA, peB)));
// When
dimensionService.mergeAnalyticalObject(eventVisualization);
// Then
assertEquals(2, eventVisualization.getDataDimensionItems().size());
assertEquals(2, eventVisualization.getPeriods().size());
assertEquals(5, eventVisualization.getOrganisationUnits().size());
}
use of org.hisp.dhis.common.BaseDimensionalObject in project dhis2-core by dhis2.
the class DimensionServiceTest method testMergeAnalyticalObjectDataElementGroupSet.
@Test
void testMergeAnalyticalObjectDataElementGroupSet() {
Visualization visualization = new Visualization();
visualization.getColumns().add(new BaseDimensionalObject(DimensionalObject.DATA_X_DIM_ID, DimensionType.DATA_X, Lists.newArrayList(deA, deB)));
visualization.getRows().add(deGroupSetA);
visualization.getFilters().add(new BaseDimensionalObject(DimensionalObject.PERIOD_DIM_ID, DimensionType.PERIOD, Lists.newArrayList(peA, peB)));
dimensionService.mergeAnalyticalObject(visualization);
assertEquals(2, visualization.getDataDimensionItems().size());
assertEquals(2, visualization.getPeriods().size());
assertEquals(1, visualization.getDataElementGroupSetDimensions().size());
assertEquals(3, visualization.getDataElementGroupSetDimensions().get(0).getItems().size());
}
Aggregations