use of org.activityinfo.shared.report.model.Dimension in project activityinfo by bedatadriven.
the class PivotSitesHandlerTest method setUp.
@Before
public void setUp() throws Exception {
dimensions = new HashSet<Dimension>();
filter = new Filter();
provinceDim = new AdminDimension(OWNER_USER_ID);
territoireDim = new AdminDimension(2);
}
use of org.activityinfo.shared.report.model.Dimension in project activityinfo by bedatadriven.
the class PivotSitesHandlerTest method testTargetPivot.
@Test
@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();
}
use of org.activityinfo.shared.report.model.Dimension in project activityinfo by bedatadriven.
the class PivotSitesHandlerTest method testLinkedAttributegroupFilterDataForIndicator.
@Test
@OnDataSet("/dbunit/sites-linked.db.xml")
public void testLinkedAttributegroupFilterDataForIndicator() {
withAttributeGroupDim();
forFilterData();
Dimension dim = new Dimension(DimensionType.AttributeGroup);
// empty
filter.addRestriction(DimensionType.Indicator, 100);
execute();
assertThat().thereAre(0).buckets();
// cause, contenu du kit
filter = new Filter();
filter.addRestriction(DimensionType.Indicator, 1);
execute();
assertThat().thereAre(2).buckets();
Bucket bucket1 = findBucketsByCategory(buckets, dim, new EntityCategory(1)).get(0);
assertEquals("cause", bucket1.getCategory(dim).getLabel());
assertEquals(0, (int) bucket1.doubleValue());
Bucket bucket2 = findBucketsByCategory(buckets, dim, new EntityCategory(2)).get(0);
assertEquals("contenu du kit", bucket2.getCategory(dim).getLabel());
assertEquals(0, (int) bucket2.doubleValue());
// cause
filter = new Filter();
filter.addRestriction(DimensionType.Indicator, 2);
execute();
assertThat().thereAre(1).buckets();
bucket1 = findBucketsByCategory(buckets, dim, new EntityCategory(1)).get(0);
assertEquals("cause", bucket1.getCategory(dim).getLabel());
assertEquals(0, (int) bucket1.doubleValue());
// cause, contenu du kit
filter = new Filter();
filter.addRestriction(DimensionType.Indicator, Arrays.asList(1, 2, 100));
execute();
assertThat().thereAre(2).buckets();
bucket1 = findBucketsByCategory(buckets, dim, new EntityCategory(1)).get(0);
assertEquals("cause", bucket1.getCategory(dim).getLabel());
assertEquals(0, (int) bucket1.doubleValue());
bucket2 = findBucketsByCategory(buckets, dim, new EntityCategory(2)).get(0);
assertEquals("contenu du kit", bucket2.getCategory(dim).getLabel());
assertEquals(0, (int) bucket2.doubleValue());
}
use of org.activityinfo.shared.report.model.Dimension in project activityinfo by bedatadriven.
the class GeneratePivotTableHandlerTest method withNullAttribute.
@Test
public void withNullAttribute() throws CommandException {
PivotTableReportElement element = new PivotTableReportElement();
element.setRowDimensions(Arrays.asList(new Dimension(DimensionType.Indicator)));
element.setColumnDimensions(Arrays.asList((Dimension) new AttributeGroupDimension(1)));
Filter filter = new Filter();
filter.addRestriction(DimensionType.Indicator, Arrays.asList(1, 2, 103));
element.setFilter(filter);
execute(new GeneratePivotTable(element));
}
use of org.activityinfo.shared.report.model.Dimension in project activityinfo by bedatadriven.
the class PivotSitesHandlerLocalTest method testLinkedAttributegroupFilterData.
@Test
@OnDataSet("/dbunit/sites-linked.db.xml")
public void testLinkedAttributegroupFilterData() {
withAttributeGroupDim();
forFilterData();
execute();
assertThat().thereAre(2).buckets();
Dimension dim = new Dimension(DimensionType.AttributeGroup);
Bucket causeBucket = findBucketsByCategory(buckets, dim, new EntityCategory(1)).get(0);
assertEquals("cause", causeBucket.getCategory(dim).getLabel());
assertEquals(0, (int) causeBucket.doubleValue());
Bucket contenuBucket = findBucketsByCategory(buckets, dim, new EntityCategory(2)).get(0);
assertEquals("contenu du kit", contenuBucket.getCategory(dim).getLabel());
assertEquals(0, (int) contenuBucket.doubleValue());
}
Aggregations