Search in sources :

Example 1 with DateUtilCalendarImpl

use of org.activityinfo.server.util.date.DateUtilCalendarImpl in project activityinfo by bedatadriven.

the class ReportGeneratorTest method testFileName.

@Test
public void testFileName() {
    // Input user
    User user = new User();
    user.setLocale("en");
    // Input test data: report model + parameter
    Report report = new Report();
    report.setFileName("Report ${DATE_RANGE} of Activities");
    // Input test data: parameter values
    DateUtil dateUtil = new DateUtilCalendarImpl();
    DateRange dateRange = dateUtil.monthRange(2009, 1);
    // class under test
    ReportGenerator generator = new ReportGenerator(null, null, null, null, null);
    generator.generate(user, report, null, dateRange);
    // VERIFY correct file name
    Assert.assertEquals("Report Jan 2009 of Activities", report.getContent().getFileName());
}
Also used : DateRange(org.activityinfo.shared.report.model.DateRange) User(org.activityinfo.server.database.hibernate.entity.User) Report(org.activityinfo.shared.report.model.Report) DateUtil(org.activityinfo.shared.util.date.DateUtil) DateUtilCalendarImpl(org.activityinfo.server.util.date.DateUtilCalendarImpl) Test(org.junit.Test)

Example 2 with DateUtilCalendarImpl

use of org.activityinfo.server.util.date.DateUtilCalendarImpl 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 3 with DateUtilCalendarImpl

use of org.activityinfo.server.util.date.DateUtilCalendarImpl 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)

Aggregations

DateUtilCalendarImpl (org.activityinfo.server.util.date.DateUtilCalendarImpl)3 Test (org.junit.Test)3 DateDimension (org.activityinfo.shared.report.model.DateDimension)2 User (org.activityinfo.server.database.hibernate.entity.User)1 DateRange (org.activityinfo.shared.report.model.DateRange)1 Report (org.activityinfo.shared.report.model.Report)1 DateUtil (org.activityinfo.shared.util.date.DateUtil)1