java.lang.Object
io.jenkins.plugins.util.BuildAction<Node>
com.parasoft.findings.jenkins.coverage.api.metrics.steps.CoverageBuildAction
All Implemented Interfaces:
Action, ModelObject, Serializable, RunAction2, SimpleBuildStep.LastBuildAction, org.kohsuke.stapler.StaplerProxy

public final class CoverageBuildAction extends io.jenkins.plugins.util.BuildAction<Node> implements org.kohsuke.stapler.StaplerProxy
Controls the life cycle of the coverage results in a job. This action persists the results of a build and displays a summary on the build page. The actual visualization of the results is defined in the matching summary.jelly file. This action also provides access to the coverage details: these are rendered using a new view instance.
See Also:
  • Constructor Details

    • CoverageBuildAction

      public CoverageBuildAction(Run<?,?> owner, String id, String icon, Node result, io.jenkins.plugins.util.QualityGateResult qualityGateResult, edu.hm.hafner.util.FilteredLog log, ReferenceResult referenceResult)
      Creates a new instance of CoverageBuildAction.
      Parameters:
      owner - the associated build that created the statistics
      id - ID (URL) of the results
      icon - name of the icon that should be used in actions and views
      result - the coverage tree as a result to persist with this action
      qualityGateResult - status of the quality gates
      log - the logging statements of the recording step
    • CoverageBuildAction

      public CoverageBuildAction(Run<?,?> owner, String id, String icon, Node result, io.jenkins.plugins.util.QualityGateResult qualityGateResult, edu.hm.hafner.util.FilteredLog log, String referenceBuildId, List<? extends Value> modifiedLinesCoverage, ReferenceResult referenceResult)
      Creates a new instance of CoverageBuildAction.
      Parameters:
      owner - the associated build that created the statistics
      id - ID (URL) of the results
      icon - name of the icon that should be used in actions and views
      result - the coverage tree as a result to persist with this action
      qualityGateResult - status of the quality gates
      log - the logging statements of the recording step
      referenceBuildId - the ID of the reference build
      modifiedLinesCoverage - the coverages filtered by modified lines of the associated change request
  • Method Details

    • getLog

      public edu.hm.hafner.util.FilteredLog getLog()
    • getQualityGateResult

      public io.jenkins.plugins.util.QualityGateResult getQualityGateResult()
    • getFormatter

      public ElementFormatter getFormatter()
    • getStatistics

      public CoverageStatistics getStatistics()
    • getProjectBaseline

      public Baseline getProjectBaseline()
      Returns the supported baselines.
      Returns:
      all supported baselines
    • hasBaselineResult

      public boolean hasBaselineResult(Baseline baseline)
      Returns whether a delta metric for the specified metric exists.
      Parameters:
      baseline - the baseline to use
      Returns:
      true if a delta is available for the specified metric, false otherwise
    • getTitle

      public String getTitle(Baseline baseline)
      Returns the title text for the specified baseline.
      Parameters:
      baseline - the baseline to get the title for
      Returns:
      the title
    • getAllValues

      public List<Value> getAllValues(Baseline baseline)
      Returns all available values for the specified baseline.
      Parameters:
      baseline - the baseline to get the values for
      Returns:
      the available values
      Throws:
      NoSuchElementException - if this baseline does not provide values
    • getValues

      public List<Value> getValues(Baseline baseline)
      Returns all important values for the specified baseline.
      Parameters:
      baseline - the baseline to get the values for
      Returns:
      the available values
      Throws:
      NoSuchElementException - if this baseline does not provide values
    • getValueForMetric

      public Optional<Value> getValueForMetric(Baseline baseline, Metric metric)
      Returns the value for the specified metric, if available.
      Parameters:
      baseline - the baseline to get the value for
      metric - the metric to get the value for
      Returns:
      the optional value
    • formatValue

      public String formatValue(Baseline baseline, Metric metric)
      Returns a formatted and localized String representation of the value for the specified metric (with respect to the given baseline).
      Parameters:
      baseline - the baseline to use
      metric - the metric to get the delta for
      Returns:
      the formatted value
    • getReferenceBuildLink

      public String getReferenceBuildLink()
      Renders the reference build as HTML-link.
      Returns:
      the reference build
    • getReferenceBuildWarningMessage

      public String getReferenceBuildWarningMessage()
    • createXmlStream

      protected io.jenkins.plugins.util.AbstractXmlStream<Node> createXmlStream()
      Specified by:
      createXmlStream in class io.jenkins.plugins.util.BuildAction<Node>
    • createProjectAction

      protected CoverageJobAction createProjectAction()
      Specified by:
      createProjectAction in class io.jenkins.plugins.util.BuildAction<Node>
    • getBuildResultBaseName

      protected String getBuildResultBaseName()
      Specified by:
      getBuildResultBaseName in class io.jenkins.plugins.util.BuildAction<Node>
    • getTarget

      public CoverageViewModel getTarget()
      Specified by:
      getTarget in interface org.kohsuke.stapler.StaplerProxy
    • getIconFileName

      @NonNull public String getIconFileName()
      Specified by:
      getIconFileName in interface Action
    • getDisplayName

      @NonNull public String getDisplayName()
      Specified by:
      getDisplayName in interface Action
      Specified by:
      getDisplayName in interface ModelObject
    • getUrlName

      @NonNull public String getUrlName()
      Specified by:
      getUrlName in interface Action
    • toString

      public String toString()
      Overrides:
      toString in class Object