use of org.hisp.dhis.period.QuarterlyPeriodType in project dhis2-core by dhis2.
the class DataSetApprovalFrequencyComparatorTest method testB.
@Test
void testB() {
DataSet dsA = new DataSet("EA: Expenditures Site Level", new QuarterlyPeriodType());
DataSet dsB = new DataSet("MER Results: Facility Based", new QuarterlyPeriodType());
DataSet dsC = new DataSet("MER Results: Facility Based - DoD ONLY", new QuarterlyPeriodType());
DataApprovalWorkflow workflow = new DataApprovalWorkflow("Workflow A", new QuarterlyPeriodType(), null);
dsB.assignWorkflow(workflow);
List<DataSet> list = Lists.newArrayList(dsB, dsC, dsA);
Collections.sort(list, DataSetApprovalFrequencyComparator.INSTANCE);
assertEquals(dsB, list.get(0));
assertEquals(dsA, list.get(1));
assertEquals(dsC, list.get(2));
}
use of org.hisp.dhis.period.QuarterlyPeriodType in project dhis2-core by dhis2.
the class DataSetApprovalFrequencyComparatorTest method testC.
@Test
void testC() {
DataSet dsA = new DataSet("DataSetA", new YearlyPeriodType());
DataSet dsB = new DataSet("DataSetB", new YearlyPeriodType());
DataSet dsC = new DataSet("DataSetC", new MonthlyPeriodType());
DataSet dsD = new DataSet("DataSetD", new QuarterlyPeriodType());
DataApprovalWorkflow workflow = new DataApprovalWorkflow("Workflow A", new QuarterlyPeriodType(), null);
dsA.assignWorkflow(workflow);
dsD.assignWorkflow(workflow);
DataElement deA = new DataElement();
dsA.addDataSetElement(deA);
dsB.addDataSetElement(deA);
dsC.addDataSetElement(deA);
dsD.addDataSetElement(deA);
assertEquals(dsD, deA.getApprovalDataSet());
}
use of org.hisp.dhis.period.QuarterlyPeriodType in project dhis2-core by dhis2.
the class QueryPlannerUtilsTest method testGetAggregationType.
@Test
void testGetAggregationType() {
AnalyticsAggregationType typeA = new AnalyticsAggregationType(AggregationType.SUM, AggregationType.AVERAGE, DataType.NUMERIC, true);
AnalyticsAggregationType typeB = new AnalyticsAggregationType(AggregationType.AVERAGE, AggregationType.AVERAGE, DataType.NUMERIC, true);
assertEquals(typeA, QueryPlannerUtils.getAggregationType(new AnalyticsAggregationType(AggregationType.SUM, AggregationType.AVERAGE), ValueType.INTEGER, new QuarterlyPeriodType(), new YearlyPeriodType()));
assertEquals(typeB, QueryPlannerUtils.getAggregationType(new AnalyticsAggregationType(AggregationType.AVERAGE, AggregationType.AVERAGE), ValueType.INTEGER, new QuarterlyPeriodType(), new YearlyPeriodType()));
}
use of org.hisp.dhis.period.QuarterlyPeriodType in project dhis2-core by dhis2.
the class DataSetCompletenessServiceExportTest method setUpTest.
@Override
public void setUpTest() {
dataSets = new ArrayList<>();
periods = new ArrayList<>();
units = new ArrayList<>();
monthly = new MonthlyPeriodType();
quarterly = new QuarterlyPeriodType();
periodA = createPeriod(monthly, getDate(2000, 1, 1), getDate(2000, 1, 31));
periodB = createPeriod(monthly, getDate(2000, 2, 1), getDate(2000, 2, 28));
periodC = createPeriod(monthly, getDate(2000, 3, 1), getDate(2000, 3, 31));
periodD = createPeriod(quarterly, getDate(2000, 1, 1), getDate(2000, 3, 31));
periodService.addPeriod(periodA);
periodService.addPeriod(periodB);
periodService.addPeriod(periodC);
periodService.addPeriod(periodD);
periods.add(periodA);
periods.add(periodB);
periods.add(periodC);
periods.add(periodD);
unitA = createOrganisationUnit('A');
unitB = createOrganisationUnit('B');
unitC = createOrganisationUnit('C');
unitB.setParent(unitA);
unitC.setParent(unitA);
unitA.getChildren().add(unitB);
unitA.getChildren().add(unitC);
organisationUnitService.addOrganisationUnit(unitA);
organisationUnitService.addOrganisationUnit(unitB);
organisationUnitService.addOrganisationUnit(unitC);
units.add(unitA);
units.add(unitB);
units.add(unitC);
dataSetA = createDataSet('A', monthly);
dataSetA.getSources().add(unitA);
dataSetA.getSources().add(unitB);
dataSetA.getSources().add(unitC);
dataSetService.addDataSet(dataSetA);
dataSets.add(dataSetA);
}
use of org.hisp.dhis.period.QuarterlyPeriodType in project dhis2-core by dhis2.
the class DataSetCompletenessServiceTest method setUpTest.
// -------------------------------------------------------------------------
// Fixture
// -------------------------------------------------------------------------
@Override
public void setUpTest() {
setExternalTestDir(locationManager);
categoryOptionCombo = categoryService.getDefaultDataElementCategoryOptionCombo();
periodType = new MonthlyPeriodType();
periodA = createPeriod(periodType, getDate(2000, 1, 1), getDate(2000, 1, 31));
periodB = createPeriod(periodType, getDate(2000, 2, 1), getDate(2000, 2, 28));
periodC = createPeriod(new QuarterlyPeriodType(), getDate(2000, 1, 1), getDate(2000, 3, 31));
periodIdA = periodService.addPeriod(periodA);
periodService.addPeriod(periodB);
periodIdC = periodService.addPeriod(periodC);
unitA = createOrganisationUnit('A');
unitB = createOrganisationUnit('B');
unitC = createOrganisationUnit('C');
unitD = createOrganisationUnit('D');
unitE = createOrganisationUnit('E');
unitF = createOrganisationUnit('F');
unitG = createOrganisationUnit('G');
unitH = createOrganisationUnit('H');
unitB.setParent(unitA);
unitC.setParent(unitA);
unitE.setParent(unitB);
unitF.setParent(unitB);
unitG.setParent(unitC);
unitH.setParent(unitC);
unitA.getChildren().add(unitB);
unitA.getChildren().add(unitC);
unitB.getChildren().add(unitE);
unitB.getChildren().add(unitF);
unitC.getChildren().add(unitG);
unitC.getChildren().add(unitH);
unitIdA = organisationUnitService.addOrganisationUnit(unitA);
unitIdB = organisationUnitService.addOrganisationUnit(unitB);
unitIdC = organisationUnitService.addOrganisationUnit(unitC);
organisationUnitService.addOrganisationUnit(unitD);
organisationUnitService.addOrganisationUnit(unitE);
organisationUnitService.addOrganisationUnit(unitF);
organisationUnitService.addOrganisationUnit(unitG);
organisationUnitService.addOrganisationUnit(unitH);
unitIdsA = new HashSet<>();
unitIdsA.add(unitIdA);
unitIdsA.add(unitIdB);
unitIdsA.add(unitIdC);
groupA = createOrganisationUnitGroup('A');
groupB = createOrganisationUnitGroup('B');
groupC = createOrganisationUnitGroup('C');
groupA.addOrganisationUnit(unitA);
groupB.addOrganisationUnit(unitA);
groupB.addOrganisationUnit(unitB);
groupC.addOrganisationUnit(unitE);
groupC.addOrganisationUnit(unitF);
organisationUnitGroupService.addOrganisationUnitGroup(groupA);
organisationUnitGroupService.addOrganisationUnitGroup(groupB);
organisationUnitGroupService.addOrganisationUnitGroup(groupC);
dataSetA = createDataSet('A', periodType);
dataSetB = createDataSet('B', periodType);
dataSetC = createDataSet('C', periodType);
dataElementA = createDataElement('A');
dataElementB = createDataElement('B');
dataElementService.addDataElement(dataElementA);
dataElementService.addDataElement(dataElementB);
dataSetA.getCompulsoryDataElementOperands().add(new DataElementOperand(dataElementA, categoryOptionCombo));
dataSetA.getCompulsoryDataElementOperands().add(new DataElementOperand(dataElementB, categoryOptionCombo));
dataSetB.getCompulsoryDataElementOperands().add(new DataElementOperand(dataElementA, categoryOptionCombo));
onTimeA = getDate(2000, 2, 10);
tooLateA = getDate(2000, 2, 25);
onTimeB = getDate(2000, 3, 10);
tooLateB = getDate(2000, 3, 25);
}
Aggregations