use of org.activityinfo.shared.report.content.EntityCategory in project activityinfo by bedatadriven.
the class PivotSitesHandlerTest 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());
}
use of org.activityinfo.shared.report.content.EntityCategory 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.content.EntityCategory 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());
}
use of org.activityinfo.shared.report.content.EntityCategory in project activityinfo by bedatadriven.
the class PivotSitesHandlerLocalTest 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.content.EntityCategory in project activityinfo by bedatadriven.
the class PivotSitesHandlerLocalTest method testIndicatorOrder.
@Test
public void testIndicatorOrder() {
withIndicatorAsDimension();
filter.addRestriction(DimensionType.Indicator, 1);
filter.addRestriction(DimensionType.Indicator, 2);
execute();
assertEquals(2, buckets.size());
Bucket indicator1 = findBucketsByCategory(buckets, indicatorDim, new EntityCategory(1)).get(0);
Bucket indicator2 = findBucketsByCategory(buckets, indicatorDim, new EntityCategory(2)).get(0);
EntityCategory cat1 = (EntityCategory) indicator1.getCategory(indicatorDim);
EntityCategory cat2 = (EntityCategory) indicator2.getCategory(indicatorDim);
assertEquals(2, cat1.getSortOrder().intValue());
assertEquals(OWNER_USER_ID, cat2.getSortOrder().intValue());
}
Aggregations