use of org.activityinfo.shared.report.model.Report in project activityinfo by bedatadriven.
the class JaxbParseTest method testFilter.
@Test
public void testFilter() throws Throwable {
Report report = parseXml("filter.xml");
dumpXml(report);
Calendar minDate = Calendar.getInstance();
minDate.setTime(report.getFilter().getDateRange().getMinDate());
Assert.assertEquals(2008, minDate.get(Calendar.YEAR));
Assert.assertEquals(11, minDate.get(Calendar.MONTH));
Assert.assertEquals(1, minDate.get(Calendar.DATE));
Assert.assertTrue(report.getFilter().isRestricted(DimensionType.Indicator));
Assert.assertTrue(report.getFilter().getRestrictions(DimensionType.Indicator).contains(21));
}
use of org.activityinfo.shared.report.model.Report in project activityinfo by bedatadriven.
the class JaxbParseTest method testMarshallElements.
@Test
public void testMarshallElements() throws Throwable {
Report report = new Report();
report.addElement(new PivotChartReportElement());
report.addElement(new PivotTableReportElement());
dumpXml(report);
}
use of org.activityinfo.shared.report.model.Report in project activityinfo by bedatadriven.
the class JaxbParseTest method testDimensions.
@Test
public void testDimensions() throws Throwable {
Report report = parseXml("dimensions.xml");
dumpXml(report);
Assert.assertEquals("element count", 1, report.getElements().size());
Assert.assertTrue("is pivotTable", report.getElements().get(0) instanceof PivotTableReportElement);
PivotTableReportElement table = report.getElement(0);
Assert.assertEquals("dimension count", 2, table.getRowDimensions().size());
Assert.assertEquals("indicator type", DimensionType.Indicator, table.getRowDimensions().get(0).getType());
Assert.assertTrue("admin subclass", table.getRowDimensions().get(1) instanceof AdminDimension);
Assert.assertEquals("level is 91", 91, ((AdminDimension) table.getRowDimensions().get(1)).getLevelId());
}
use of org.activityinfo.shared.report.model.Report 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());
}
use of org.activityinfo.shared.report.model.Report in project activityinfo by bedatadriven.
the class ItextReportRendererTest method iconTest.
@Test
public void iconTest() throws IOException {
IconMapMarker marker1 = new IconMapMarker();
marker1.setIcon(MapIcon.fromEnum(Icon.Default));
marker1.setLat(-2.45);
marker1.setLng(28.8);
marker1.setX(100);
marker1.setY(100);
TileBaseMap baseMap = new TileBaseMap();
baseMap.setTileUrlPattern("//www.activityinfo.org/resources/tile/nordkivu.cd/{z}/{x}/{y}.png");
IconMapLayer layer3 = new IconMapLayer();
layer3.setIcon(MapIcon.Icon.Default.name());
layer3.getIndicatorIds().add(101);
MapContent mapContent = new MapContent();
mapContent.setFilterDescriptions(Collections.EMPTY_LIST);
mapContent.setBaseMap(baseMap);
mapContent.setZoomLevel(8);
mapContent.setCenter(new Extents(-2.2, -2.1, 28.85, 28.9).center());
mapContent.setMarkers(Arrays.asList((MapMarker) marker1));
MapReportElement map = new MapReportElement();
map.setTitle("My Map");
map.setContent(mapContent);
map.addLayer(layer3);
ReportContent content = new ReportContent();
content.setFilterDescriptions(Collections.EMPTY_LIST);
Report report = new Report();
report.setContent(content);
report.addElement(map);
renderToPdf(report, "iconMarker.pdf");
renderToHtml(report, "iconMarker.html");
renderToRtf(report, "iconMarker.rtf");
renderToPpt(map, "iconMarker.ppt");
renderToImage(map, "iconMarker.png");
}
Aggregations