use of org.activityinfo.shared.report.model.Report in project activityinfo by bedatadriven.
the class JaxbParseTest method parseXml.
public Report parseXml(String filename) throws JAXBException {
JAXBContext jc = JAXBContext.newInstance(Report.class.getPackage().getName());
Unmarshaller um = jc.createUnmarshaller();
um.setEventHandler(new javax.xml.bind.helpers.DefaultValidationEventHandler());
return (Report) um.unmarshal(new InputStreamReader(getClass().getResourceAsStream("/report-def/parse-test/" + filename)));
}
use of org.activityinfo.shared.report.model.Report in project activityinfo by bedatadriven.
the class ReadWriteReportTest method readWriteReportTest.
@Test
public void readWriteReportTest() throws Throwable {
Report report = new Report();
MapReportElement map = new MapReportElement();
map.getLayers().add(new BubbleMapLayer());
PiechartMapLayer pielayer = new PiechartMapLayer();
Slice slice1 = new Slice();
slice1.setColor("FF00AA");
slice1.setIndicatorId(1);
Slice slice2 = new Slice();
slice2.setColor("00FFAA");
slice2.setIndicatorId(2);
pielayer.getSlices().add(slice1);
pielayer.getSlices().add(slice2);
map.getLayers().add(pielayer);
report.getElements().add(map);
Report.class.getPackage();
JAXBContext jc = JAXBContext.newInstance(Report.class.getPackage().getName());
Marshaller marshaller = jc.createMarshaller();
marshaller.setEventHandler(new javax.xml.bind.helpers.DefaultValidationEventHandler());
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
FileOutputStream fo = new FileOutputStream("SomeXmlTest.xml");
marshaller.marshal(report, fo);
}
use of org.activityinfo.shared.report.model.Report in project activityinfo by bedatadriven.
the class ReportsTest method testConsolideDesActivitesReport.
@Test
public void testConsolideDesActivitesReport() throws Throwable {
// Setup test
Report report = getReport("realworld/ConsolideDesActivites.xml");
reportGenerator.generate(user, report, null, null);
TableElement pivotTable = (TableElement) report.getElements().get(2);
MapReportElement map1 = pivotTable.getMap();
BubbleMapLayer bubbleMap = (BubbleMapLayer) map1.getLayers().get(0);
assertTrue("Arabic numbering expected", bubbleMap.getLabelSequence() instanceof ArabicNumberSequence);
assertEquals("MinRadius of 8 expected", bubbleMap.getMinRadius(), 8);
assertEquals("MaxRadius of 14 expected", bubbleMap.getMaxRadius(), 14);
assertEquals("Graduated scaling expected", bubbleMap.getScaling(), ScalingType.Graduated);
}
use of org.activityinfo.shared.report.model.Report in project activityinfo by bedatadriven.
the class ReportsTest method testFullReport.
@Test
@Ignore("need dbunit xml with matching data")
public void testFullReport() throws Throwable {
Report report = getReport("full-test.xml");
reportGenerator.generate(user, report, null, null);
for (RenderElement.Format format : RenderElement.Format.values()) {
if (format != RenderElement.Format.Excel && format != RenderElement.Format.Excel_Data) {
Renderer renderer = factory.get(format);
FileOutputStream fos = new FileOutputStream("target/report-tests/full-test" + renderer.getFileSuffix());
renderer.render(report, fos);
fos.close();
}
}
}
use of org.activityinfo.shared.report.model.Report in project activityinfo by bedatadriven.
the class ReportsTest method testApplesReport.
@Test
public void testApplesReport() throws Throwable {
Report report = getReport("realworld/ApplesReport.xml");
reportGenerator.generate(user, report, null, null);
ReportElement element = report.getElements().get(0);
element.getContent();
assertEquals("Expected different report title", report.getTitle(), "Phase one apple report");
assertEquals("Expected different report description", report.getDescription(), "Apples come in different shapes, colors and taste");
assertEquals("Expected only one filter", report.getFilter().getRestrictedDimensions().size(), 1);
assertEquals("Expected one element", report.getElements().size(), 1);
assertTrue("Expected pivottable element", element.getContent() instanceof PivotContent);
assertEquals("Expected title: 'Apples, bananas and oranges'", element.getTitle(), "Apples, bananas and oranges");
}
Aggregations