use of org.activityinfo.shared.report.model.Dimension 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());
}
use of org.activityinfo.shared.report.model.Dimension in project activityinfo by bedatadriven.
the class PivotSitesHandlerTest method withIndicatorAsDimension.
private void withIndicatorAsDimension() {
indicatorDim = new Dimension(DimensionType.Indicator);
dimensions.add(indicatorDim);
}
use of org.activityinfo.shared.report.model.Dimension in project activityinfo by bedatadriven.
the class GeneratePivotTableHandlerTest method serverSide.
@Test
public void serverSide() throws CommandException {
PivotTableReportElement element = new PivotTableReportElement();
element.setRowDimensions(Arrays.asList(new Dimension(DimensionType.Indicator)));
element.setColumnDimensions(Arrays.asList(new Dimension(DimensionType.Partner)));
Filter filter = new Filter();
filter.addRestriction(DimensionType.Indicator, Arrays.asList(1, 2, 103));
element.setFilter(filter);
execute(new GeneratePivotTable(element));
// TODO real test
// System.out.println(content.getData());
}
use of org.activityinfo.shared.report.model.Dimension in project activityinfo by bedatadriven.
the class PivotSitesHandlerLocalTest method init.
@Before
public void init() throws Exception {
dimensions = new HashSet<Dimension>();
filter = new Filter();
provinceDim = new AdminDimension(OWNER_USER_ID);
territoireDim = new AdminDimension(2);
synchronizeFirstTime();
}
use of org.activityinfo.shared.report.model.Dimension 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());
}
Aggregations