Search in sources :

Example 21 with Dimension

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());
}
Also used : 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) DateDimension(org.activityinfo.shared.report.model.DateDimension) OnDataSet(org.activityinfo.server.database.OnDataSet) Test(org.junit.Test)

Example 22 with Dimension

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);
}
Also used : 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)

Example 23 with Dimension

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());
}
Also used : Dimension(org.activityinfo.shared.report.model.Dimension) AttributeGroupDimension(org.activityinfo.shared.report.model.AttributeGroupDimension) PivotTableReportElement(org.activityinfo.shared.report.model.PivotTableReportElement) Test(org.junit.Test)

Example 24 with Dimension

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();
}
Also used : 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) AdminDimension(org.activityinfo.shared.report.model.AdminDimension) Before(org.junit.Before)

Example 25 with Dimension

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());
}
Also used : 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) DateDimension(org.activityinfo.shared.report.model.DateDimension) OnDataSet(org.activityinfo.server.database.OnDataSet) Test(org.junit.Test)

Aggregations

Dimension (org.activityinfo.shared.report.model.Dimension)46 AdminDimension (org.activityinfo.shared.report.model.AdminDimension)31 AttributeGroupDimension (org.activityinfo.shared.report.model.AttributeGroupDimension)29 DateDimension (org.activityinfo.shared.report.model.DateDimension)28 Test (org.junit.Test)23 Bucket (org.activityinfo.shared.command.result.Bucket)11 OnDataSet (org.activityinfo.server.database.OnDataSet)10 PivotTableReportElement (org.activityinfo.shared.report.model.PivotTableReportElement)10 EntityCategory (org.activityinfo.shared.report.content.EntityCategory)9 ArrayList (java.util.ArrayList)6 PivotSites (org.activityinfo.shared.command.PivotSites)6 PivotTableData (org.activityinfo.shared.report.content.PivotTableData)4 Comparator (java.util.Comparator)3 DispatcherSync (org.activityinfo.server.command.DispatcherSync)3 User (org.activityinfo.server.database.hibernate.entity.User)3 DimensionCategory (org.activityinfo.shared.report.content.DimensionCategory)3 LocalDate (com.bedatadriven.rebar.time.calendar.LocalDate)2 JsonObject (com.google.gson.JsonObject)2 List (java.util.List)2 ReportChangeEvent (org.activityinfo.client.page.report.ReportChangeEvent)2