FastXLSXOutput extends XLSXOutput { public int generate( final MasterReport report, final int acceptedPage, final OutputStream outputStream, final int yieldRate ) throws ReportProcessingException, IOException { proxyOutputStream.setParent( outputStream ); final IAsyncReportListener listener = ReportListenerThreadHolder.getListener(); ReportStructureValidator validator = new ReportStructureValidator(); if ( validator.isValidForFastProcessing( report ) == false ) { return super.generate( report, acceptedPage, outputStream, yieldRate ); } final FastExcelExportProcessor reportProcessor = new FastExcelExportProcessor( report, outputStream, true ); doProcess( listener, reportProcessor ); outputStream.flush(); return 0; } FastXLSXOutput(); int generate( final MasterReport report,
                       final int acceptedPage,
                       final OutputStream outputStream,
                       final int yieldRate ); int paginate( final MasterReport report,
                       final int yieldRate ); void close(); boolean supportsPagination(); Object getReportLock();  }
@Test public void testGenerateListener() throws Exception { ClassicEngineBoot.getInstance().start(); fastXLSXOutput.generate( new MasterReport(), 1, new ByteArrayOutputStream(), 1 ); verify( listener, times( 1 ) ).reportProcessingStarted( any( ReportProgressEvent.class ) ); verify( listener, times( 1 ) ).reportProcessingFinished( any( ReportProgressEvent.class ) ); verify( listener, atLeastOnce() ).reportProcessingUpdate( any( ReportProgressEvent.class ) ); }
@Test public void testGenerate() throws Exception { ClassicEngineBoot.getInstance().start(); ReportListenerThreadHolder.clear(); fastXLSXOutput.generate( new MasterReport(), 1, new ByteArrayOutputStream(), 1 ); verify( listener, times( 0 ) ).reportProcessingStarted( any( ReportProgressEvent.class ) ); verify( listener, times( 0 ) ).reportProcessingFinished( any( ReportProgressEvent.class ) ); verify( listener, times( 0 ) ).reportProcessingUpdate( any( ReportProgressEvent.class ) ); }
@Test public void testGenerateNotFast() throws Exception { try { ClassicEngineBoot.getInstance().start(); ReportListenerThreadHolder.clear(); PentahoSessionHolder.setSession( new StandaloneSession() ); final File file = new File( "target/test/resource/solution/test/reporting/report.prpt" ); final MasterReport report = (MasterReport) new ResourceManager().createDirectly( file.getPath(), MasterReport.class ).getResource(); fastXLSXOutput.generate( report, 1, new ByteArrayOutputStream(), 1 ); verify( listener, times( 0 ) ).reportProcessingStarted( any( ReportProgressEvent.class ) ); verify( listener, times( 0 ) ).reportProcessingFinished( any( ReportProgressEvent.class ) ); verify( listener, times( 0 ) ).reportProcessingUpdate( any( ReportProgressEvent.class ) ); } finally { PentahoSessionHolder.removeSession(); } }