Search in sources :

Example 16 with QuarterlyPeriodType

use of org.hisp.dhis.period.QuarterlyPeriodType in project dhis2-core by dhis2.

the class DataSetFrequencyComparatorTest 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());
    List<DataSet> list = Lists.newArrayList(dsB, dsC, dsA);
    Collections.sort(list, DataSetFrequencyComparator.INSTANCE);
    assertEquals(dsA, list.get(0));
    assertEquals(dsB, list.get(1));
    assertEquals(dsC, list.get(2));
}
Also used : DataSet(org.hisp.dhis.dataset.DataSet) QuarterlyPeriodType(org.hisp.dhis.period.QuarterlyPeriodType) Test(org.junit.jupiter.api.Test)

Example 17 with QuarterlyPeriodType

use of org.hisp.dhis.period.QuarterlyPeriodType in project dhis2-core by dhis2.

the class DataSetApprovalFrequencyComparatorTest method testD.

@Test
void testD() {
    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);
    DataElement deA = new DataElement();
    dsA.addDataSetElement(deA);
    dsB.addDataSetElement(deA);
    dsC.addDataSetElement(deA);
    assertEquals(dsB, deA.getApprovalDataSet());
}
Also used : DataElement(org.hisp.dhis.dataelement.DataElement) DataSet(org.hisp.dhis.dataset.DataSet) QuarterlyPeriodType(org.hisp.dhis.period.QuarterlyPeriodType) DataApprovalWorkflow(org.hisp.dhis.dataapproval.DataApprovalWorkflow) Test(org.junit.jupiter.api.Test)

Example 18 with QuarterlyPeriodType

use of org.hisp.dhis.period.QuarterlyPeriodType in project dhis2-core by dhis2.

the class DataSetApprovalFrequencyComparatorTest method testA.

@Test
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.assignWorkflow(workflow);
    dsD.assignWorkflow(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));
}
Also used : DataSet(org.hisp.dhis.dataset.DataSet) MonthlyPeriodType(org.hisp.dhis.period.MonthlyPeriodType) QuarterlyPeriodType(org.hisp.dhis.period.QuarterlyPeriodType) DataApprovalWorkflow(org.hisp.dhis.dataapproval.DataApprovalWorkflow) YearlyPeriodType(org.hisp.dhis.period.YearlyPeriodType) Test(org.junit.jupiter.api.Test)

Aggregations

QuarterlyPeriodType (org.hisp.dhis.period.QuarterlyPeriodType)18 MonthlyPeriodType (org.hisp.dhis.period.MonthlyPeriodType)12 Test (org.junit.jupiter.api.Test)12 YearlyPeriodType (org.hisp.dhis.period.YearlyPeriodType)10 DataSet (org.hisp.dhis.dataset.DataSet)8 WeeklyPeriodType (org.hisp.dhis.period.WeeklyPeriodType)6 DataApprovalWorkflow (org.hisp.dhis.dataapproval.DataApprovalWorkflow)5 DailyPeriodType (org.hisp.dhis.period.DailyPeriodType)5 Calendar (java.util.Calendar)3 Date (java.util.Date)3 Period (org.hisp.dhis.period.Period)3 DataElement (org.hisp.dhis.dataelement.DataElement)2 BiMonthlyPeriodType (org.hisp.dhis.period.BiMonthlyPeriodType)2 BiWeeklyPeriodType (org.hisp.dhis.period.BiWeeklyPeriodType)2 Cal (org.hisp.dhis.period.Cal)2 FinancialAprilPeriodType (org.hisp.dhis.period.FinancialAprilPeriodType)2 FinancialJulyPeriodType (org.hisp.dhis.period.FinancialJulyPeriodType)2 FinancialNovemberPeriodType (org.hisp.dhis.period.FinancialNovemberPeriodType)2 FinancialOctoberPeriodType (org.hisp.dhis.period.FinancialOctoberPeriodType)2 PeriodType (org.hisp.dhis.period.PeriodType)2