Search in sources :

Example 6 with DateDimension

use of org.activityinfo.shared.report.model.DateDimension in project activityinfo by bedatadriven.

the class PivotSitesHandlerTest method targetFilter.

@Test
public void targetFilter() {
    // Pivoting: PivotSites [dimensions=[Date, Partner, Date, Target,
    // Activity, Indicator],
    // filter=AdminLevel={ 141801 }, Partner={ 130 },
    // Indicator={ 747 746 745 744 749 748 739 738 743 740 119 118 3661 125
    // 124 123 122 121 }, valueType=INDICATOR]
    withPartnerAsDimension();
    dimensions.add(new DateDimension(DateUnit.YEAR));
    dimensions.add(new Dimension(DimensionType.Target));
    dimensions.add(new Dimension(DimensionType.Activity));
    dimensions.add(new Dimension(DimensionType.Indicator));
    filter.addRestriction(DimensionType.AdminLevel, 141801);
    filter.addRestriction(DimensionType.Partner, 130);
    filter.addRestriction(DimensionType.Indicator, 1);
    execute();
}
Also used : Dimension(org.activityinfo.shared.report.model.Dimension) AttributeGroupDimension(org.activityinfo.shared.report.model.AttributeGroupDimension) AdminDimension(org.activityinfo.shared.report.model.AdminDimension) DateDimension(org.activityinfo.shared.report.model.DateDimension) DateDimension(org.activityinfo.shared.report.model.DateDimension) Test(org.junit.Test)

Example 7 with DateDimension

use of org.activityinfo.shared.report.model.DateDimension in project activityinfo by bedatadriven.

the class PivotSitesHandlerTest method testSiteCountOnQuarters.

@Test
public void testSiteCountOnQuarters() {
    forTotalSiteCounts();
    dimensions.add(new DateDimension(DateUnit.QUARTER));
    execute();
    assertThat().forQuarter(2008, 4).thereIsOneBucketWithValue(1);
    assertThat().forQuarter(2009, 1).thereIsOneBucketWithValue(4);
}
Also used : DateDimension(org.activityinfo.shared.report.model.DateDimension) Test(org.junit.Test)

Example 8 with DateDimension

use of org.activityinfo.shared.report.model.DateDimension in project activityinfo by bedatadriven.

the class PivotSitesHandlerTest method testYears.

@Test
public void testYears() {
    forTotalSiteCounts();
    dimensions.add(new DateDimension(DateUnit.YEAR));
    execute();
    assertThat().forYear(2008).thereIsOneBucketWithValue(1);
    assertThat().forYear(2009).thereIsOneBucketWithValue(4);
}
Also used : DateDimension(org.activityinfo.shared.report.model.DateDimension) Test(org.junit.Test)

Example 9 with DateDimension

use of org.activityinfo.shared.report.model.DateDimension in project activityinfo by bedatadriven.

the class PivotSitesHandlerTest method testWeeks.

@Test
@OnDataSet("/dbunit/sites-weeks.db.xml")
public void testWeeks() {
    final Dimension weekDim = new DateDimension(DateUnit.WEEK_MON);
    dimensions.add(weekDim);
    filter.addRestriction(DimensionType.Indicator, 1);
    execute();
    assertEquals(3, buckets.size());
    assertEquals(3600, (int) findBucketByWeek(buckets, 2011, 52).doubleValue());
    assertEquals(1500, (int) findBucketByWeek(buckets, 2012, 1).doubleValue());
    assertEquals(4142, (int) findBucketByWeek(buckets, 2012, 13).doubleValue());
}
Also used : Dimension(org.activityinfo.shared.report.model.Dimension) AttributeGroupDimension(org.activityinfo.shared.report.model.AttributeGroupDimension) AdminDimension(org.activityinfo.shared.report.model.AdminDimension) DateDimension(org.activityinfo.shared.report.model.DateDimension) DateDimension(org.activityinfo.shared.report.model.DateDimension) OnDataSet(org.activityinfo.server.database.OnDataSet) Test(org.junit.Test)

Example 10 with DateDimension

use of org.activityinfo.shared.report.model.DateDimension in project activityinfo by bedatadriven.

the class PivotSitesHandlerTest method testQuarters.

@Test
@OnDataSet("/dbunit/sites-quarters.db.xml")
public void testQuarters() {
    final Dimension quarterDim = new DateDimension(DateUnit.QUARTER);
    dimensions.add(quarterDim);
    filter.addRestriction(DimensionType.Indicator, 1);
    execute();
    assertEquals(3, buckets.size());
    assertEquals(1500, (int) findBucketByQuarter(buckets, 2009, 1).doubleValue());
    assertEquals(3600, (int) findBucketByQuarter(buckets, 2009, 2).doubleValue());
    assertEquals(10000, (int) findBucketByQuarter(buckets, 2008, 4).doubleValue());
}
Also used : Dimension(org.activityinfo.shared.report.model.Dimension) AttributeGroupDimension(org.activityinfo.shared.report.model.AttributeGroupDimension) AdminDimension(org.activityinfo.shared.report.model.AdminDimension) DateDimension(org.activityinfo.shared.report.model.DateDimension) DateDimension(org.activityinfo.shared.report.model.DateDimension) OnDataSet(org.activityinfo.server.database.OnDataSet) Test(org.junit.Test)

Aggregations

DateDimension (org.activityinfo.shared.report.model.DateDimension)20 Test (org.junit.Test)15 Dimension (org.activityinfo.shared.report.model.Dimension)13 AdminDimension (org.activityinfo.shared.report.model.AdminDimension)12 AttributeGroupDimension (org.activityinfo.shared.report.model.AttributeGroupDimension)8 OnDataSet (org.activityinfo.server.database.OnDataSet)5 PivotTableReportElement (org.activityinfo.shared.report.model.PivotTableReportElement)3 LocalDate (com.bedatadriven.rebar.time.calendar.LocalDate)2 JsonObject (com.google.gson.JsonObject)2 DummyPivotTableData (org.activityinfo.server.report.DummyPivotTableData)2 DateUtilCalendarImpl (org.activityinfo.server.util.date.DateUtilCalendarImpl)2 EntityCategory (org.activityinfo.shared.report.content.EntityCategory)2 PivotContent (org.activityinfo.shared.report.content.PivotContent)2 PivotTableData (org.activityinfo.shared.report.content.PivotTableData)2 Axis (org.activityinfo.shared.report.content.PivotTableData.Axis)2 ReportContent (org.activityinfo.shared.report.content.ReportContent)2 SimpleCategory (org.activityinfo.shared.report.content.SimpleCategory)2 DateRange (org.activityinfo.shared.report.model.DateRange)2 Report (org.activityinfo.shared.report.model.Report)2 JsonArray (com.google.gson.JsonArray)1