コード例 #1
0
  @Test
  public void testXlsFastListener() throws Exception {
    URL url = getClass().getResource("BACKLOG-7181.prpt");
    MasterReport report =
        (MasterReport) new ResourceManager().createDirectly(url, MasterReport.class).getResource();
    org.pentaho.reporting.engine.classic.core.testsupport.DebugReportRunner.createTestOutputFile();
    final ReportProgressListener mock = mock(ReportProgressListener.class);
    try (ByteArrayOutputStream stream = new ByteArrayOutputStream()) {
      FastExcelReportUtil.processXls(report, stream, mock);
      final byte[] bytes = stream.toByteArray();
      Assert.assertNotNull(bytes);
      Assert.assertTrue(bytes.length > 0);
    }

    verify(mock, times(1)).reportProcessingStarted(any(ReportProgressEvent.class));
    verify(mock, times(1)).reportProcessingFinished(any(ReportProgressEvent.class));
    verify(mock, atLeastOnce()).reportProcessingUpdate(any(ReportProgressEvent.class));

    try (ByteArrayOutputStream stream = new ByteArrayOutputStream()) {
      FastExcelReportUtil.processXls(new MasterReport(), stream, mock);
    }

    verify(mock, times(2)).reportProcessingStarted(any(ReportProgressEvent.class));
    verify(mock, times(2)).reportProcessingFinished(any(ReportProgressEvent.class));
  }
コード例 #2
0
 @Test
 public void testIndention() throws ResourceException, IOException, ReportProcessingException {
   URL url = getClass().getResource("Prd-5522.prpt");
   MasterReport report =
       (MasterReport) new ResourceManager().createDirectly(url, MasterReport.class).getResource();
   org.pentaho.reporting.engine.classic.core.testsupport.DebugReportRunner.createTestOutputFile();
   ExcelReportUtil.createXLSX(report, "test-output/Prd-5522.xlsx");
   ;
 }
コード例 #3
0
 @Test
 public void testXlsxFast() throws Exception {
   org.pentaho.reporting.engine.classic.core.testsupport.DebugReportRunner.createTestOutputFile();
   try (ByteArrayOutputStream stream = new ByteArrayOutputStream()) {
     FastExcelReportUtil.processXlsx(new MasterReport(), stream);
     final byte[] bytes = stream.toByteArray();
     Assert.assertNotNull(bytes);
     Assert.assertTrue(bytes.length > 0);
   }
 }
コード例 #4
0
  @Test
  public void testCsv() throws Exception {
    URL url = getClass().getResource("BACKLOG-7181.prpt");
    MasterReport report =
        (MasterReport) new ResourceManager().createDirectly(url, MasterReport.class).getResource();
    org.pentaho.reporting.engine.classic.core.testsupport.DebugReportRunner.createTestOutputFile();

    try (ByteArrayOutputStream stream = new ByteArrayOutputStream()) {
      CSVReportUtil.createCSV(report, stream, null);
      final byte[] bytes = stream.toByteArray();
      Assert.assertNotNull(bytes);
      Assert.assertTrue(bytes.length > 0);
    }
  }