use of org.hisp.dhis.period.MonthlyPeriodType in project dhis2-core by dhis2.
the class DataElementTest method testGetLatestOpenFuturePeriod.
@Test
public void testGetLatestOpenFuturePeriod() {
DataElement deA = new DataElement("A");
assertEquals(0, deA.getOpenFuturePeriods());
DataSet dsA = new DataSet("A", periodType);
DataSet dsB = new DataSet("B", periodType);
dsA.setOpenFuturePeriods(3);
dsB.setOpenFuturePeriods(3);
dsA.addDataSetElement(deA);
dsB.addDataSetElement(deA);
Period lastOpen = deA.getLatestOpenFuturePeriod();
assertTrue(lastOpen.isAfter(new MonthlyPeriodType().createPeriod()));
}
use of org.hisp.dhis.period.MonthlyPeriodType in project dhis2-core by dhis2.
the class DataSetApprovalFrequencyComparatorTest method testA.
@Test
public void testA() {
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.setWorkflow(workflow);
dsD.setWorkflow(workflow);
List<DataSet> list = Lists.newArrayList(dsA, dsC, dsB, dsD);
Collections.sort(list, DataSetApprovalFrequencyComparator.INSTANCE);
assertEquals(dsD, list.get(0));
assertEquals(dsA, list.get(1));
assertEquals(dsC, list.get(2));
assertEquals(dsB, list.get(3));
}
use of org.hisp.dhis.period.MonthlyPeriodType in project dhis2-core by dhis2.
the class DataSetFrequencyComparatorTest method testA.
@Test
public void testA() {
DataSet dsA = new DataSet("DataSetA", new QuarterlyPeriodType());
DataSet dsB = new DataSet("DataSetB", new YearlyPeriodType());
DataSet dsC = new DataSet("DataSetC", new MonthlyPeriodType());
DataSet dsD = new DataSet("DataSetD", new QuarterlyPeriodType());
List<DataSet> list = Lists.newArrayList(dsA, dsC, dsB, dsD);
Collections.sort(list, DataSetFrequencyComparator.INSTANCE);
assertEquals(dsC, list.get(0));
assertEquals(dsA, list.get(1));
assertEquals(dsD, list.get(2));
assertEquals(dsB, list.get(3));
}
Aggregations