@Test public void testGetChildren() { BandData root = createData(); BandData band1 = root.getChildByName("Band1"); BandData band2 = root.getChildByName("Band2"); BandData band3 = root.getChildByName("Band3"); assertNotNull(band1); assertNotNull(band2); assertNotNull(band3); BandData band11 = band1.getChildByName("Band11"); BandData band12 = band1.getChildByName("Band12"); BandData band13 = band1.getChildByName("Band13"); BandData band14 = band1.getChildByName("Band14"); assertNotNull(band11); assertNotNull(band12); assertNotNull(band13); assertNotNull(band14); BandData alsoBand1 = root.getChildrenByName("Band1").get(0); BandData alsoBand14 = alsoBand1.getChildrenByName("Band14").get(0); assertSame(alsoBand1, band1); assertSame(alsoBand14, band14); }
@Override public void run() { try { BandData root = createRootBand(); root.addReportFieldFormats(Arrays.asList(new ReportFieldFormatImpl("Band1.col2", "${html}"))); BandData footer = root.getChildByName("Footer"); BandData footerChild = new BandData("FooterChild", footer); footerChild.addData("nestedData", "NESTED_DATA"); footer.addChild(footerChild); FileOutputStream outputStream = new FileOutputStream("./result/smoke/result_parallel3.doc"); ReportFormatter formatter = defaultFormatterFactory.createFormatter(new FormatterFactoryInput("doc", root, new ReportTemplateImpl("", "./modules/core/test/smoketest/test.doc", "./modules/core/test/smoketest/test.doc", ReportOutputType.doc), outputStream)); formatter.renderDocument(); IOUtils.closeQuietly(outputStream); } catch (IOException e) { Assert.fail(); } finally { countDownLatch.countDown(); } } }.start();
@Override public void run() { try { BandData root = createRootBand(); root.addReportFieldFormats(Arrays.asList(new ReportFieldFormatImpl("Band1.col2", "${html}"))); BandData footer = root.getChildByName("Footer"); BandData footerChild = new BandData("FooterChild", footer); footerChild.addData("nestedData", "NESTED_DATA"); footer.addChild(footerChild); FileOutputStream outputStream = new FileOutputStream("./result/smoke/result_parallel1.doc"); ReportFormatter formatter = defaultFormatterFactory.createFormatter(new FormatterFactoryInput("doc", root, new ReportTemplateImpl("", "./modules/core/test/smoketest/test.doc", "./modules/core/test/smoketest/test.doc", ReportOutputType.doc), outputStream)); formatter.renderDocument(); IOUtils.closeQuietly(outputStream); } catch (IOException e) { Assert.fail(); } finally { countDownLatch.countDown(); } } }.start();
@Override public void run() { try { BandData root = createRootBand(); root.addReportFieldFormats(Arrays.asList(new ReportFieldFormatImpl("Band1.col2", "${html}"))); BandData footer = root.getChildByName("Footer"); BandData footerChild = new BandData("FooterChild", footer); footerChild.addData("nestedData", "NESTED_DATA"); footer.addChild(footerChild); FileOutputStream outputStream = new FileOutputStream("./result/smoke/result_parallel2.doc"); ReportFormatter formatter = defaultFormatterFactory.createFormatter(new FormatterFactoryInput("doc", root, new ReportTemplateImpl("", "./modules/core/test/smoketest/test.doc", "./modules/core/test/smoketest/test.doc", ReportOutputType.doc), outputStream)); formatter.renderDocument(); IOUtils.closeQuietly(outputStream); } catch (IOException e) { Assert.fail(); } finally { countDownLatch.countDown(); } } }.start();
@Test public void testDocxToHtml() throws Exception { BandData root = createRootBand(); root.addReportFieldFormats(Collections.singletonList(new ReportFieldFormatImpl("Band1.col2", "${html}"))); BandData footer = root.getChildByName("Footer"); BandData footerChild = new BandData("FooterChild", footer); footerChild.addData("nestedData", "NESTED_DATA"); footer.addChild(footerChild); FileOutputStream outputStream = new FileOutputStream("./result/smoke/result_docx.html"); ReportFormatter formatter = new DefaultFormatterFactory().createFormatter(new FormatterFactoryInput("docx", root, new ReportTemplateImpl("", "./modules/core/test/smoketest/test.docx", "./modules/core/test/smoketest/test.docx", ReportOutputType.html), outputStream)); formatter.renderDocument(); IOUtils.closeQuietly(outputStream); }
@Test public void testDocx() throws Exception { BandData root = createRootBand(); root.addReportFieldFormats(Collections.singletonList(new ReportFieldFormatImpl("Band1.col2", "${html}"))); BandData footer = root.getChildByName("Footer"); BandData footerChild = new BandData("FooterChild", footer); footerChild.addData("nestedData", "NESTED_DATA"); footerChild.addData("nestedData.withPoint", "NESTED_DATA_WITH_POINT"); footer.addChild(footerChild); FileOutputStream outputStream = new FileOutputStream("./result/smoke/result.docx"); ReportFormatter formatter = new DefaultFormatterFactory().createFormatter(new FormatterFactoryInput("docx", root, new ReportTemplateImpl("", "./modules/core/test/smoketest/test.docx", "./modules/core/test/smoketest/test.docx", ReportOutputType.docx), outputStream)); formatter.renderDocument(); IOUtils.closeQuietly(outputStream); }
@Test public void testDocxToHtml_OfficeIntegration() throws Exception { BandData root = createRootBand(); root.addReportFieldFormats(Collections.singletonList(new ReportFieldFormatImpl("Band1.col2", "${html}"))); BandData footer = root.getChildByName("Footer"); BandData footerChild = new BandData("FooterChild", footer); footerChild.addData("nestedData", "NESTED_DATA"); footer.addChild(footerChild); FileOutputStream outputStream = new FileOutputStream("./result/smoke/result_docx_office.html"); DefaultFormatterFactory defaultFormatterFactory = new DefaultFormatterFactory(); defaultFormatterFactory.setOfficeIntegration(new OfficeIntegration(openOfficePath, 8100)); ReportFormatter formatter = defaultFormatterFactory.createFormatter(new FormatterFactoryInput("docx", root, new ReportTemplateImpl("", "./modules/core/test/smoketest/test.docx", "./modules/core/test/smoketest/test.docx", ReportOutputType.html), outputStream)); formatter.renderDocument(); IOUtils.closeQuietly(outputStream); }
@Test public void testOdt() throws Exception { BandData root = createRootBand(); root.addReportFieldFormats(Collections.singletonList(new ReportFieldFormatImpl("Band1.col2", "${html}"))); BandData footer = root.getChildByName("Footer"); BandData footerChild = new BandData("FooterChild", footer); footerChild.addData("nestedData", "NESTED_DATA"); footer.addChild(footerChild); FileOutputStream outputStream = new FileOutputStream("./result/smoke/result.doc"); DefaultFormatterFactory defaultFormatterFactory = new DefaultFormatterFactory(); defaultFormatterFactory.setOfficeIntegration(new OfficeIntegration(openOfficePath, 8100)); ReportFormatter formatter = defaultFormatterFactory.createFormatter(new FormatterFactoryInput("odt", root, new ReportTemplateImpl("", "./modules/core/test/smoketest/test.odt", "./modules/core/test/smoketest/test.odt", ReportOutputType.doc), outputStream)); formatter.renderDocument(); IOUtils.closeQuietly(outputStream); }
@Test public void testDocxToPdf() throws Exception { BandData root = createRootBand(); BandData footer = root.getChildByName("Footer"); BandData footerChild = new BandData("FooterChild", footer); footerChild.addData("nestedData", "NESTED_DATA"); footer.addChild(footerChild); FileOutputStream outputStream = new FileOutputStream("./result/smoke/result_docx.pdf"); DefaultFormatterFactory defaultFormatterFactory = new DefaultFormatterFactory(); defaultFormatterFactory.setOfficeIntegration(new OfficeIntegration(openOfficePath, 8100)); ReportFormatter formatter = defaultFormatterFactory.createFormatter(new FormatterFactoryInput("docx", root, new ReportTemplateImpl("", "./modules/core/test/smoketest/test.docx", "./modules/core/test/smoketest/test.docx", ReportOutputType.pdf), outputStream)); formatter.renderDocument(); IOUtils.closeQuietly(outputStream); }
@Test public void testDoc() throws Exception { BandData root = createRootBand(); root.addReportFieldFormats(Collections.singletonList(new ReportFieldFormatImpl("Band1.col2", "${html}"))); BandData footer = root.getChildByName("Footer"); BandData footerChild = new BandData("FooterChild", footer); footerChild.addData("nestedData", "NESTED_DATA"); footer.addChild(footerChild); FileOutputStream outputStream = new FileOutputStream("./result/smoke/result2.doc"); DefaultFormatterFactory defaultFormatterFactory = new DefaultFormatterFactory(); defaultFormatterFactory.setOfficeIntegration(new OfficeIntegration(openOfficePath, 8100)); ReportFormatter formatter = defaultFormatterFactory.createFormatter(new FormatterFactoryInput("doc", root, new ReportTemplateImpl("", "./modules/core/test/smoketest/test.doc", "./modules/core/test/smoketest/test.doc", ReportOutputType.doc), outputStream)); formatter.renderDocument(); IOUtils.closeQuietly(outputStream); }