Search in sources :

Example 11 with DateDimension

use of org.activityinfo.shared.report.model.DateDimension in project activityinfo by bedatadriven.

the class PivotSitesHandlerTest method testMonths.

@Test
public void testMonths() {
    forTotalSiteCounts();
    dimensions.add(new DateDimension(DateUnit.MONTH));
    filter.setDateRange(new DateUtilCalendarImpl().yearRange(2009));
    execute();
    assertThat().thereAre(3).buckets();
}
Also used : DateUtilCalendarImpl(org.activityinfo.server.util.date.DateUtilCalendarImpl) DateDimension(org.activityinfo.shared.report.model.DateDimension) Test(org.junit.Test)

Example 12 with DateDimension

use of org.activityinfo.shared.report.model.DateDimension in project activityinfo by bedatadriven.

the class PivotSitesHandlerLocalTest method testSiteCountOnQuarters.

@Test(expected = RuntimeException.class)
public void testSiteCountOnQuarters() {
    forTotalSiteCounts();
    dimensions.add(new DateDimension(DateUnit.QUARTER));
    execute();
    assertThat().forQuarter(2008, 4).thereIsOneBucketWithValue(1);
    assertThat().forQuarter(2009, 1).thereIsOneBucketWithValue(4);
}
Also used : DateDimension(org.activityinfo.shared.report.model.DateDimension) Test(org.junit.Test)

Example 13 with DateDimension

use of org.activityinfo.shared.report.model.DateDimension 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)

Example 14 with DateDimension

use of org.activityinfo.shared.report.model.DateDimension in project activityinfo by bedatadriven.

the class PivotSitesHandlerLocalTest method testMonths.

@Test(expected = RuntimeException.class)
public void testMonths() {
    forTotalSiteCounts();
    dimensions.add(new DateDimension(DateUnit.MONTH));
    filter.setDateRange(new DateUtilCalendarImpl().yearRange(2009));
    execute();
    assertThat().thereAre(3).buckets();
}
Also used : DateUtilCalendarImpl(org.activityinfo.server.util.date.DateUtilCalendarImpl) DateDimension(org.activityinfo.shared.report.model.DateDimension) Test(org.junit.Test)

Example 15 with DateDimension

use of org.activityinfo.shared.report.model.DateDimension in project activityinfo by bedatadriven.

the class PivotSitesHandlerLocalTest method testTargetPivot.

/**
 * year, quarter and month functions in SqliteDialect throw java.lang.UnsupportedOperationException
 */
@Test(expected = RuntimeException.class)
@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();
}
Also used : DateRange(org.activityinfo.shared.report.model.DateRange) 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) LocalDate(com.bedatadriven.rebar.time.calendar.LocalDate) OnDataSet(org.activityinfo.server.database.OnDataSet) Test(org.junit.Test)

Aggregations

DateDimension (org.activityinfo.shared.report.model.DateDimension)20 Test (org.junit.Test)15 Dimension (org.activityinfo.shared.report.model.Dimension)13 AdminDimension (org.activityinfo.shared.report.model.AdminDimension)12 AttributeGroupDimension (org.activityinfo.shared.report.model.AttributeGroupDimension)8 OnDataSet (org.activityinfo.server.database.OnDataSet)5 PivotTableReportElement (org.activityinfo.shared.report.model.PivotTableReportElement)3 LocalDate (com.bedatadriven.rebar.time.calendar.LocalDate)2 JsonObject (com.google.gson.JsonObject)2 DummyPivotTableData (org.activityinfo.server.report.DummyPivotTableData)2 DateUtilCalendarImpl (org.activityinfo.server.util.date.DateUtilCalendarImpl)2 EntityCategory (org.activityinfo.shared.report.content.EntityCategory)2 PivotContent (org.activityinfo.shared.report.content.PivotContent)2 PivotTableData (org.activityinfo.shared.report.content.PivotTableData)2 Axis (org.activityinfo.shared.report.content.PivotTableData.Axis)2 ReportContent (org.activityinfo.shared.report.content.ReportContent)2 SimpleCategory (org.activityinfo.shared.report.content.SimpleCategory)2 DateRange (org.activityinfo.shared.report.model.DateRange)2 Report (org.activityinfo.shared.report.model.Report)2 JsonArray (com.google.gson.JsonArray)1