/** * Registers a report with the given identifier and strategy. * <p> * Note that no report will be registered, if the factory of this instance is * not set. * </p> * * @param reportId the identifier of the report to register. * @param strategy the link constructor strategy to use. * @return <code>true</code> if the report has been created and registered, * <code>false</code> otherwise. */ public boolean registerReport(final ReportId reportId, final LinkConstructorStrategy strategy) { return registerReport(true, reportId, strategy); }
private void addJxrReports() throws MavenReportException { final ReportId jxrReport = provideLinkConstructor(linkXref, MavenExternalReportFactory.MAVEN_JXR_PLUGIN, ReportId.NORMAL_REPORT, xrefLocation, true, "report.link.jxr"); if (jxrReport != null) { reports.addUutReportId(jxrReport); } final ReportId jxrTestReport = provideLinkConstructor(linkXrefTest, MavenExternalReportFactory.MAVEN_JXR_PLUGIN, ReportId.TEST_REPORT, xrefTestLocation, true, "report.link.jxr"); if (jxrTestReport != null) { reports.addTestCaseReportId(jxrTestReport); } }
/** * {@inheritDoc} * * @see de.smartics.testdoc.maven.export.AbstractReportExporter#renderTestDocUutReportLinks(de.smartics.testdoc.report.doc.Type, * de.smartics.testdoc.report.export.doc.ExternalReportReferences) */ @Override protected void renderTestDocUutReportLinks(final Type type, final ExternalReportReferences refs) throws IOException { try { renderReports(type, refs.getUutReports(), null); } catch (final XMLStreamException e) { throw new IOException("Cannot write UUT report links.", e); } }
/** * Returns the ordered list of report IDs to render for the test case. * * @return the ordered list of report IDs to render for the test case. */ public List<ExternalReport> getTestCaseReports() { return getReports(getTestCaseReportIds()); }
/** * Returns the ordered list of report IDs to render for the UUT. * * @return the ordered list of report IDs to render for the UUT. */ public List<ExternalReport> getUutReports() { return getReports(getUutReportIds()); }
/** * {@inheritDoc} * * @see de.smartics.testdoc.maven.export.AbstractReportExporter#renderTestCase(de.smartics.testdoc.report.doc.ScenarioTestDoc) */ @Override protected void renderTestCase(final ScenarioTestDoc scenario) throws IOException { try { final TestMethodDoc testMethodDoc = scenario.getTestMethod(); final Type type = scenario.getTestCaseType(); xmlWriter.writeStartElement(TESTDOC_NS, "test-case"); writeType(type); final ExternalReportReferences refs = testDocHelper.getReports(); renderReports(type, refs.getTestCaseReports(), testMethodDoc); xmlWriter.writeEndElement(); } catch (final XMLStreamException e) { throw new IOException("Cannot write test case.", e); } }
private void addSurefireReport() throws MavenReportException { final ReportId surefireReport = provideLinkConstructor(linkSurefire, MavenExternalReportFactory.MAVEN_SUREFIRE_PLUGIN, ReportId.NORMAL_REPORT, surefireLocation, false, "report.link.surefire"); if (surefireReport != null) { reports.addTestCaseReportId(surefireReport); } }
private void addCoberturaReport() throws MavenReportException { final ReportId coberturaReport = provideLinkConstructor(linkCobertura, MavenExternalReportFactory.MAVEN_COBERTURA_PLUGIN, ReportId.NORMAL_REPORT, coberturaLocation, false, "report.link.cobertura"); if (coberturaReport != null) { reports.addUutReportId(coberturaReport); } }
/** * {@inheritDoc} * <p> * Configures the plugin logger. * </p> * * @see org.apache.maven.reporting.AbstractMavenReport#executeReport(java.util.Locale) */ @Override protected void executeReport(final Locale locale) throws MavenReportException { super.executeReport(locale); final ExternalReportFactory factory = new MavenExternalReportFactory(project, ""); reports = new ExternalReportReferences(factory); addJxrReports(); addJavadocReports(); addSurefireReport(); addCoberturaReport(); if (presentJUnitReport) { junitManager = new DirectoryJUnitTestCaseManager(junitReportLocation); } }
/** * Returns the list of reports with the given IDs. * * @param reportIds the IDs of the requested reports. * @return the list of reports, which may be empty, but is never * <code>null</code>. */ public List<ExternalReport> getReports(final List<ReportId> reportIds) { final List<ExternalReport> reports = new ArrayList<ExternalReport>(reportIds.size()); for (final ReportId reportId : reportIds) { reports.add(get(reportId)); } return reports; }
/** * {@inheritDoc} * * @see de.smartics.testdoc.maven.export.AbstractReportExporter#renderTestCase(de.smartics.testdoc.report.doc.ScenarioTestDoc) */ @Override protected void renderTestCase(final ScenarioTestDoc scenario) throws IOException { try { final TestMethodDoc testMethodDoc = scenario.getTestMethod(); final Type type = scenario.getTestCaseType(); xmlWriter.writeStartElement(TESTDOC_NS, "test-case"); writeType(type); final ExternalReportReferences refs = testDocHelper.getReports(); renderReports(type, refs.getTestCaseReports(), testMethodDoc); xmlWriter.writeEndElement(); } catch (final XMLStreamException e) { throw new IOException("Cannot write test case.", e); } }
private void addSurefireReport() throws MavenReportException { final ReportId surefireReport = provideLinkConstructor(linkSurefire, MavenExternalReportFactory.MAVEN_SUREFIRE_PLUGIN, ReportId.NORMAL_REPORT, surefireLocation, false, "report.link.surefire"); if (surefireReport != null) { reports.addTestCaseReportId(surefireReport); } }
private void addCoberturaReport() throws MavenReportException { final ReportId coberturaReport = provideLinkConstructor(linkCobertura, MavenExternalReportFactory.MAVEN_COBERTURA_PLUGIN, ReportId.NORMAL_REPORT, coberturaLocation, false, "report.link.cobertura"); if (coberturaReport != null) { reports.addUutReportId(coberturaReport); } }
/** * {@inheritDoc} * <p> * Configures the plugin logger. * </p> * * @see org.apache.maven.reporting.AbstractMavenReport#executeReport(java.util.Locale) */ @Override protected void executeReport(final Locale locale) throws MavenReportException { super.executeReport(locale); final ExternalReportFactory factory = new MavenExternalReportFactory(project, ""); reports = new ExternalReportReferences(factory); addJxrReports(); addJavadocReports(); addSurefireReport(); addCoberturaReport(); if (presentJUnitReport) { junitManager = new DirectoryJUnitTestCaseManager(junitReportLocation); } }
private void addJxrReports() throws MavenReportException { final ReportId jxrReport = provideLinkConstructor(linkXref, MavenExternalReportFactory.MAVEN_JXR_PLUGIN, ReportId.NORMAL_REPORT, xrefLocation, true, "report.link.jxr"); if (jxrReport != null) { reports.addUutReportId(jxrReport); } final ReportId jxrTestReport = provideLinkConstructor(linkXrefTest, MavenExternalReportFactory.MAVEN_JXR_PLUGIN, ReportId.TEST_REPORT, xrefTestLocation, true, "report.link.jxr"); if (jxrTestReport != null) { reports.addTestCaseReportId(jxrTestReport); } }
private ReportId provideLinkConstructor( // NOPMD final boolean addReport, final String reportArtifactId, final String reportType, final File location, final boolean linkToMember, final String labelKey) throws MavenReportException { final LinkConstructorStrategy strategy = createStrategy(reportArtifactId, location, linkToMember, labelKey); final ReportId reportId = new ReportId(reportArtifactId, reportType); if (reports.registerReport(addReport, reportId, strategy)) { return reportId; } return null; }
/** * {@inheritDoc} * * @see de.smartics.testdoc.maven.export.AbstractReportExporter#renderTestDocUutReportLinks(de.smartics.testdoc.report.doc.Type, * de.smartics.testdoc.report.export.doc.ExternalReportReferences) */ @Override protected void renderTestDocUutReportLinks(final Type type, final ExternalReportReferences refs) throws IOException { try { renderReports(type, refs.getUutReports(), null); } catch (final XMLStreamException e) { throw new IOException("Cannot write UUT report links.", e); } }
@Override protected void renderTestCase(final ScenarioTestDoc scenario) { if (informationFilter.isShowTestCase()) { sink.tableCell(); final Type testCase = scenario.getTestCaseType(); sink.text(testCase.getTypeName()); final ExternalReportReferences reportRefs = testDocHelper.getReports(); final List<ExternalReport> reports = reportRefs.getTestCaseReports(); if (!reports.isEmpty()) { sink.text(": "); final ScenarioLinkRenderer linkRenderer = new ScenarioLinkRenderer(sink, messages, scenario); for (final ExternalReport report : reports) { linkRenderer.renderTestMethodLink(report); } } sink.tableCell_(); } }
private void addJavadocReports() throws MavenReportException { final ReportId javadocReport = provideLinkConstructor(linkJavadoc, MavenExternalReportFactory.MAVEN_JAVADOC_PLUGIN, ReportId.NORMAL_REPORT, javadocLocation, true, "report.link.javadoc"); if (javadocReport != null) { reports.addUutReportId(javadocReport); } final ReportId javadocTestReport = provideLinkConstructor(linkJavadocTest, MavenExternalReportFactory.MAVEN_JAVADOC_PLUGIN, ReportId.TEST_REPORT, javadocTestLocation, true, "report.link.javadoc"); if (javadocTestReport != null) { reports.addTestCaseReportId(javadocTestReport); } }
private ReportId provideLinkConstructor( // NOPMD final boolean addReport, final String reportArtifactId, final String reportType, final File location, final boolean linkToMember, final String labelKey) throws MavenReportException { final LinkConstructorStrategy strategy = createStrategy(reportArtifactId, location, linkToMember, labelKey); final ReportId reportId = new ReportId(reportArtifactId, reportType); if (reports.registerReport(addReport, reportId, strategy)) { return reportId; } return null; }