private void initFormatters() { try { formatters.clear(); TestEngineConfiguration config = TestEngineConfiguration.getInstance(); String output = config.getString("reporting.generated_report_path"); // create the directory if not exists File outputDir = new File(output); if (!outputDir.exists()) { outputDir.mkdirs(); } HashMap<String, String> templates = new HashMap<>(); templates.put( "start", StaticConfiguration.CONFIG_DIRECTORY + "/reporting/campaign/campaign_start_template.html"); templates.put( "rowData", StaticConfiguration.CONFIG_DIRECTORY + "/reporting/campaign/campaign_row_data.html"); templates.put( "end", StaticConfiguration.CONFIG_DIRECTORY + "/reporting/campaign/campaign_end_template.html"); formatters.add(new CampaignHTMLFormatter(templates, output)); formatters.add(new CampaignGUIFormatter()); } catch (IOException e) { logger.error("Cannot add HTMLCampaignReport", e); } }
private TestResultsReportManager() { super(); results = new ArrayList<>(); TestEngineConfiguration config = TestEngineConfiguration.getInstance(); String output = config.getString("reporting.generated_report_path"); // create the directory if not exists File outputDir = new File(output); if (!outputDir.exists()) { outputDir.mkdirs(); } }
private void initFormatters(String reportName) { formatters.clear(); TestEngineConfiguration config = TestEngineConfiguration.getInstance(); int reportersCount = config.getMaxIndex("reporting.reporters.format") + 1; for (int reporterIndex = 0; reporterIndex < reportersCount; reporterIndex++) { String reportFormat = config.getString("reporting.reporters.format(" + reporterIndex + ")"); try { Class<?> formatterClass = Class.forName( "com.qspin.qtaste.reporter.testresults." + reportFormat.toLowerCase() + "." + reportFormat.toUpperCase() + "ReportFormatter"); Constructor<?> formatterConstructor = formatterClass.getConstructor(reportName.getClass()); formatters.add((ReportFormatter) formatterConstructor.newInstance(reportName)); } catch (Exception e) { logger.fatal("Exception initializing the report format: " + reportFormat, e); } } }