Class AbstractSurefireReport

  • All Implemented Interfaces:
    org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo, org.apache.maven.reporting.MavenMultiPageReport, org.apache.maven.reporting.MavenReport
    Direct Known Subclasses:
    FailsafeOnlyReport, SurefireReport

    public abstract class AbstractSurefireReport
    extends org.apache.maven.reporting.AbstractMavenReport
    Abstract base class for reporting test results using Surefire.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private boolean aggregate
      Whether to build an aggregated report at the root, or build individual reports.
      private java.lang.String customBundle
      Path for a custom bundle instead of using the default one.
      private org.codehaus.plexus.i18n.I18N i18n
      Internationalization component
      private boolean linkXRef
      Link the violation line numbers to the (Test) Source XRef.
      private java.io.File[] reportsDirectories
      Directories containing the XML Report files that will be parsed and rendered to HTML format.
      private java.io.File reportsDirectory
      Deprecated.
      private java.util.List<java.io.File> resolvedReportsDirectories  
      private org.apache.maven.settings.Settings settings
      The current user system settings for use in Maven.
      private boolean showSuccess
      If set to false, only failures are shown.
      private java.io.File xrefTestLocation
      Location where Test Source XRef is generated for this project.
      • Fields inherited from class org.apache.maven.reporting.AbstractMavenReport

        locale, mojoExecution, outputDirectory, outputFormat, outputTimestamp, project, reactorProjects, remoteProjectRepositories, repoSession, siteDirectory, siteRenderer, siteTool
      • Fields inherited from interface org.apache.maven.reporting.MavenReport

        CATEGORY_PROJECT_INFORMATION, CATEGORY_PROJECT_REPORTS, ROLE
      • Fields inherited from interface org.apache.maven.plugin.Mojo

        ROLE
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      boolean canGenerateReport()  
      void executeReport​(java.util.Locale locale)
      protected org.apache.maven.plugin.surefire.log.api.ConsoleLogger getConsoleLogger()  
      java.lang.String getDescription​(java.util.Locale locale)
      protected org.codehaus.plexus.i18n.I18N getI18N​(java.util.Locale locale)  
      protected abstract java.lang.String getI18Nsection()  
      protected java.lang.String getI18nString​(java.util.Locale locale, java.lang.String key)  
      java.lang.String getName​(java.util.Locale locale)
      abstract java.lang.String getOutputName()
      protected org.apache.maven.project.MavenProject getProject()  
      private java.util.List<org.apache.maven.project.MavenProject> getProjectsWithoutRoot()  
      protected java.util.List<org.apache.maven.project.MavenProject> getReactorProjects()  
      private java.util.List<java.io.File> getReportsDirectories()  
      protected abstract java.io.File getSurefireReportsDirectory​(org.apache.maven.project.MavenProject subProject)
      Gets the default surefire reports directory for the specified project.
      protected boolean isGeneratedWhenNoResults()
      Whether the report should be generated when there are no test results.
      protected boolean isSkipped()
      Whether the report should be generated or not.
      • Methods inherited from class org.apache.maven.reporting.AbstractMavenReport

        closeReport, constructXrefLocation, execute, generate, generate, getCategoryName, getInputEncoding, getLocale, getOutputDirectory, getOutputEncoding, getReportOutputDirectory, getSink, getSinkFactory, getSiteRenderer, getXrefLocation, isExternalReport, setReportOutputDirectory
      • Methods inherited from class org.apache.maven.plugin.AbstractMojo

        getLog, getPluginContext, setLog, setPluginContext
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface org.apache.maven.reporting.MavenReport

        getOutputPath
    • Field Detail

      • showSuccess

        @Parameter(defaultValue="true",
                   required=true,
                   property="showSuccess")
        private boolean showSuccess
        If set to false, only failures are shown.
      • reportsDirectories

        @Parameter
        private java.io.File[] reportsDirectories
        Directories containing the XML Report files that will be parsed and rendered to HTML format.
      • reportsDirectory

        @Deprecated
        @Parameter
        private java.io.File reportsDirectory
        Deprecated.
        (Deprecated, use reportsDirectories) This directory contains the XML Report files that will be parsed and rendered to HTML format.
      • linkXRef

        @Parameter(property="linkXRef",
                   defaultValue="true")
        private boolean linkXRef
        Link the violation line numbers to the (Test) Source XRef. Links will be created automatically if the JXR plugin is being used.
      • xrefTestLocation

        @Parameter
        private java.io.File xrefTestLocation
        Location where Test Source XRef is generated for this project.
        Default: AbstractMavenReport.getReportOutputDirectory() + /xref-test
      • aggregate

        @Parameter(defaultValue="false",
                   property="aggregate")
        private boolean aggregate
        Whether to build an aggregated report at the root, or build individual reports.
      • settings

        @Parameter(defaultValue="${settings}",
                   readonly=true,
                   required=true)
        private org.apache.maven.settings.Settings settings
        The current user system settings for use in Maven.
      • customBundle

        @Parameter(defaultValue="${basedir}/src/site/custom/surefire-report.properties")
        private java.lang.String customBundle
        Path for a custom bundle instead of using the default one.
        Using this field, you could change the texts in the generated reports.
        Since:
        3.1.0
      • i18n

        @Component
        private org.codehaus.plexus.i18n.I18N i18n
        Internationalization component
      • resolvedReportsDirectories

        private java.util.List<java.io.File> resolvedReportsDirectories
    • Constructor Detail

      • AbstractSurefireReport

        public AbstractSurefireReport()
    • Method Detail

      • isSkipped

        protected boolean isSkipped()
        Whether the report should be generated or not.
        Returns:
        true if and only if the report should be generated.
        Since:
        2.11
      • isGeneratedWhenNoResults

        protected boolean isGeneratedWhenNoResults()
        Whether the report should be generated when there are no test results.
        Returns:
        true if and only if the report should be generated when there are no result files at all.
        Since:
        2.11
      • executeReport

        public void executeReport​(java.util.Locale locale)
        Specified by:
        executeReport in class org.apache.maven.reporting.AbstractMavenReport
      • canGenerateReport

        public boolean canGenerateReport()
        Specified by:
        canGenerateReport in interface org.apache.maven.reporting.MavenReport
        Overrides:
        canGenerateReport in class org.apache.maven.reporting.AbstractMavenReport
      • getReportsDirectories

        private java.util.List<java.io.File> getReportsDirectories()
      • getSurefireReportsDirectory

        protected abstract java.io.File getSurefireReportsDirectory​(org.apache.maven.project.MavenProject subProject)
        Gets the default surefire reports directory for the specified project.
        Parameters:
        subProject - the project to query.
        Returns:
        the default surefire reports directory for the specified project.
      • getProjectsWithoutRoot

        private java.util.List<org.apache.maven.project.MavenProject> getProjectsWithoutRoot()
      • getI18nString

        protected java.lang.String getI18nString​(java.util.Locale locale,
                                                 java.lang.String key)
        Parameters:
        locale - The locale
        key - The key to search for
        Returns:
        The text appropriate for the locale.
      • getI18N

        protected org.codehaus.plexus.i18n.I18N getI18N​(java.util.Locale locale)
        Parameters:
        locale - The local.
        Returns:
        I18N for the locale
      • getI18Nsection

        protected abstract java.lang.String getI18Nsection()
        Returns:
        The according string for the section.
      • getName

        public java.lang.String getName​(java.util.Locale locale)
      • getDescription

        public java.lang.String getDescription​(java.util.Locale locale)
      • getOutputName

        public abstract java.lang.String getOutputName()
      • getConsoleLogger

        protected final org.apache.maven.plugin.surefire.log.api.ConsoleLogger getConsoleLogger()
      • getProject

        protected org.apache.maven.project.MavenProject getProject()
        Overrides:
        getProject in class org.apache.maven.reporting.AbstractMavenReport
      • getReactorProjects

        protected java.util.List<org.apache.maven.project.MavenProject> getReactorProjects()