SimpleReportingAction implements IStreamProcessingAction, IStreamingAction, IVarArgsAction { public String getMimeType( String ignored ) { return getMimeType(); } SimpleReportingAction(); String getDefaultOutputTarget(); void setDefaultOutputTarget( final String defaultOutputTarget ); String getOutputTarget(); void setOutputTarget( final String outputTarget ); void setOutputType( final String outputType ); String getOutputType(); IActionSequenceResource getReportDefinition(); void setReportDefinition( final IActionSequenceResource reportDefinition ); void setInputStream( InputStream reportDefinitionInputStream ); String getReportDefinitionPath(); void setReportDefinitionPath( String reportDefinitionPath ); boolean isPaginateOutput(); void setPaginateOutput( final boolean paginateOutput ); int getAcceptedPage(); void setAcceptedPage( final int acceptedPage ); boolean isDashboardMode(); void setDashboardMode( final boolean dashboardMode ); boolean getUseJCR(); void setUseJcr( final Boolean useJcr ); String getJcrOutputPath(); void setJcrOutputPath( String jcrOutputPath ); String getMimeType( String ignored ); String getMimeType(); void setOutputStream( final OutputStream outputStream ); boolean isPrint(); void setPrint( final boolean print ); String getPrinter(); void setPrinter( final String printer ); Map<String, Object> getInputs(); void setVarArgs( Map<String, Object> inputs ); void setReport( MasterReport report ); MasterReport getReport(); String getComputedOutputTarget(); void applyInputsToReportParameters( final MasterReport report, final ParameterContext context ); ValidationResult applyInputsToReportParameters( final ParameterContext context,
                                                         ValidationResult validationResult ); int getPageCount(); boolean validate(); void execute(); boolean _execute(); int paginate(); static final String OUTPUT_TARGET; static final String OUTPUT_TYPE; static final String MIME_TYPE_HTML; static final String MIME_TYPE_EMAIL; static final String MIME_TYPE_PDF; static final String MIME_TYPE_XLS; static final String MIME_TYPE_XLSX; static final String MIME_TYPE_RTF; static final String MIME_TYPE_CSV; static final String MIME_TYPE_TXT; static final String MIME_TYPE_XML; static final String MIME_TYPE_PNG; static final String XLS_WORKBOOK_PARAM; static final String REPORTLOAD_RESURL; static final String REPORT_DEFINITION_INPUT; static final String USE_JCR; static final String REPORTHTML_CONTENTHANDLER_PATTERN; static final String REPORTGENERATE_YIELDRATE; static final String ACCEPTED_PAGE; static final String PAGINATE_OUTPUT; static final String PRINT; static final String PRINTER_NAME; static final String DASHBOARD_MODE; static final String MIME_GENERIC_FALLBACK; static final String PNG_EXPORT_TYPE; static final String RESERVEDMAPKEY_LINEAGE_ID; }
@Test public void testGetMimeType() throws Exception { String mimeType; mimeType = sra.getMimeType( "" ); assertEquals( mimeType, sra.MIME_GENERIC_FALLBACK ); MasterReport report = mock( MasterReport.class ); Configuration config = mock( Configuration.class ); doReturn( config ).when( report ).getConfiguration(); doNothing().when( report ).setReportEnvironment( any( ReportEnvironment.class ) ); sra.setReport( report ); mimeType = sra.getMimeType(); assertEquals( "text/html", mimeType ); doReturn( true ).when( report ).getAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.LOCK_PREFERRED_OUTPUT_TYPE ); doReturn( "pageable/X-AWT-Graphics;image-type=png" ).when( report ) .getAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.PREFERRED_OUTPUT_TYPE ); sra.setReport( report ); mimeType = sra.getMimeType(); assertEquals( "image/png", mimeType ); Map<String, String> map = new HashMap<String, String>() { { put( "text/csv", "text/csv" ); put( "text/html", "text/html" ); put( "application/xml", "application/xml" ); put( "application/pdf", "application/pdf" ); put( "application/rtf", "application/rtf" ); put( "application/vnd.ms-excel", "application/vnd.ms-excel" ); put( "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" ); put( "mime-message/text/html", "mime-message/text/html" ); put( "text/plain", "text/plain" ); put( "pdf", "application/pdf" ); put( "html", "text/html" ); put( "csv", "text/csv" ); put( "rtf", "application/rtf" ); put( "xls", "application/vnd.ms-excel" ); put( "txt", "text/plain" ); } }; for ( int i = 0; i < map.size(); i++ ) { String key = map.keySet().toArray()[ i ].toString(); doReturn( key ).when( report ) .getAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.PREFERRED_OUTPUT_TYPE ); mimeType = sra.getMimeType(); assertEquals( map.get( key ), mimeType ); sra.setPaginateOutput( true ); mimeType = sra.getMimeType(); assertEquals( map.get( key ), mimeType ); sra.setPaginateOutput( false ); } }