use of org.activityinfo.shared.report.model.DateDimension in project activityinfo by bedatadriven.
the class PivotSitesHandlerTest method testMonths.
@Test
public void testMonths() {
forTotalSiteCounts();
dimensions.add(new DateDimension(DateUnit.MONTH));
filter.setDateRange(new DateUtilCalendarImpl().yearRange(2009));
execute();
assertThat().thereAre(3).buckets();
}
use of org.activityinfo.shared.report.model.DateDimension in project activityinfo by bedatadriven.
the class PivotSitesHandlerLocalTest method testSiteCountOnQuarters.
@Test(expected = RuntimeException.class)
public void testSiteCountOnQuarters() {
forTotalSiteCounts();
dimensions.add(new DateDimension(DateUnit.QUARTER));
execute();
assertThat().forQuarter(2008, 4).thereIsOneBucketWithValue(1);
assertThat().forQuarter(2009, 1).thereIsOneBucketWithValue(4);
}
use of org.activityinfo.shared.report.model.DateDimension in project activityinfo by bedatadriven.
the class PivotSitesHandlerLocalTest 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());
}
use of org.activityinfo.shared.report.model.DateDimension in project activityinfo by bedatadriven.
the class PivotSitesHandlerLocalTest method testMonths.
@Test(expected = RuntimeException.class)
public void testMonths() {
forTotalSiteCounts();
dimensions.add(new DateDimension(DateUnit.MONTH));
filter.setDateRange(new DateUtilCalendarImpl().yearRange(2009));
execute();
assertThat().thereAre(3).buckets();
}
use of org.activityinfo.shared.report.model.DateDimension in project activityinfo by bedatadriven.
the class PivotSitesHandlerLocalTest method testTargetPivot.
/**
* year, quarter and month functions in SqliteDialect throw java.lang.UnsupportedOperationException
*/
@Test(expected = RuntimeException.class)
@OnDataSet("/dbunit/sites-simple-target.db.xml")
public void testTargetPivot() {
withIndicatorAsDimension();
dimensions.add(new DateDimension(DateUnit.YEAR));
dimensions.add(new Dimension(DimensionType.Target));
filter.addRestriction(DimensionType.Indicator, 1);
filter.setDateRange(new DateRange(new LocalDate(2008, 1, 1), new LocalDate(2008, 12, 31)));
execute();
assertThat().thereAre(2).buckets();
}
Aggregations