Search in sources :

Example 11 with EntityCategory

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());
}
Also used : Bucket(org.activityinfo.shared.command.result.Bucket) 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) EntityCategory(org.activityinfo.shared.report.content.EntityCategory) OnDataSet(org.activityinfo.server.database.OnDataSet) Test(org.junit.Test)

Example 12 with EntityCategory

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());
}
Also used : Bucket(org.activityinfo.shared.command.result.Bucket) 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) EntityCategory(org.activityinfo.shared.report.content.EntityCategory) OnDataSet(org.activityinfo.server.database.OnDataSet) Test(org.junit.Test)

Example 13 with EntityCategory

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());
}
Also used : Bucket(org.activityinfo.shared.command.result.Bucket) 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) EntityCategory(org.activityinfo.shared.report.content.EntityCategory) OnDataSet(org.activityinfo.server.database.OnDataSet) Test(org.junit.Test)

Example 14 with EntityCategory

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());
}
Also used : Bucket(org.activityinfo.shared.command.result.Bucket) 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) EntityCategory(org.activityinfo.shared.report.content.EntityCategory) OnDataSet(org.activityinfo.server.database.OnDataSet) Test(org.junit.Test)

Example 15 with EntityCategory

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());
}
Also used : Bucket(org.activityinfo.shared.command.result.Bucket) EntityCategory(org.activityinfo.shared.report.content.EntityCategory) Test(org.junit.Test)

Aggregations

EntityCategory (org.activityinfo.shared.report.content.EntityCategory)15 Bucket (org.activityinfo.shared.command.result.Bucket)9 Dimension (org.activityinfo.shared.report.model.Dimension)9 AdminDimension (org.activityinfo.shared.report.model.AdminDimension)8 Test (org.junit.Test)8 DateDimension (org.activityinfo.shared.report.model.DateDimension)7 AttributeGroupDimension (org.activityinfo.shared.report.model.AttributeGroupDimension)5 OnDataSet (org.activityinfo.server.database.OnDataSet)4 PivotSites (org.activityinfo.shared.command.PivotSites)3 Axis (org.activityinfo.shared.report.content.PivotTableData.Axis)3 ArrayList (java.util.ArrayList)2 Comparator (java.util.Comparator)2 List (java.util.List)2 DummyPivotTableData (org.activityinfo.server.report.DummyPivotTableData)2 PivotContent (org.activityinfo.shared.report.content.PivotContent)2 PivotTableData (org.activityinfo.shared.report.content.PivotTableData)2 ReportContent (org.activityinfo.shared.report.content.ReportContent)2 SimpleCategory (org.activityinfo.shared.report.content.SimpleCategory)2 PivotTableReportElement (org.activityinfo.shared.report.model.PivotTableReportElement)2 Report (org.activityinfo.shared.report.model.Report)2