Class CoverageBuildAction
- 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 matchingsummary.jelly
file. This action also provides access to the coverage details: these are rendered using a new view instance.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description 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 ofCoverageBuildAction
.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 ofCoverageBuildAction
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected CoverageJobAction
createProjectAction()
protected io.jenkins.plugins.util.AbstractXmlStream<Node>
createXmlStream()
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).List<Value>
getAllValues(Baseline baseline)
Returns all available values for the specified baseline.protected String
getBuildResultBaseName()
String
getDisplayName()
ElementFormatter
getFormatter()
String
getIconFileName()
edu.hm.hafner.util.FilteredLog
getLog()
Baseline
getProjectBaseline()
Returns the supported baselines.io.jenkins.plugins.util.QualityGateResult
getQualityGateResult()
String
getReferenceBuildLink()
Renders the reference build as HTML-link.String
getReferenceBuildWarningMessage()
CoverageStatistics
getStatistics()
CoverageViewModel
getTarget()
String
getTitle(Baseline baseline)
Returns the title text for the specified baseline.String
getUrlName()
Optional<Value>
getValueForMetric(Baseline baseline, Metric metric)
Returns the value for the specified metric, if available.List<Value>
getValues(Baseline baseline)
Returns all important values for the specified baseline.boolean
hasBaselineResult(Baseline baseline)
Returns whether a delta metric for the specified metric exists.String
toString()
-
-
-
Constructor Detail
-
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 ofCoverageBuildAction
.- Parameters:
owner
- the associated build that created the statisticsid
- ID (URL) of the resultsicon
- name of the icon that should be used in actions and viewsresult
- the coverage tree as a result to persist with this actionqualityGateResult
- status of the quality gateslog
- 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 ofCoverageBuildAction
.- Parameters:
owner
- the associated build that created the statisticsid
- ID (URL) of the resultsicon
- name of the icon that should be used in actions and viewsresult
- the coverage tree as a result to persist with this actionqualityGateResult
- status of the quality gateslog
- the logging statements of the recording stepreferenceBuildId
- the ID of the reference buildmodifiedLinesCoverage
- the coverages filtered by modified lines of the associated change request
-
-
Method Detail
-
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 formetric
- 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 usemetric
- 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 classio.jenkins.plugins.util.BuildAction<Node>
-
createProjectAction
protected CoverageJobAction createProjectAction()
- Specified by:
createProjectAction
in classio.jenkins.plugins.util.BuildAction<Node>
-
getBuildResultBaseName
protected String getBuildResultBaseName()
- Specified by:
getBuildResultBaseName
in classio.jenkins.plugins.util.BuildAction<Node>
-
getTarget
public CoverageViewModel getTarget()
- Specified by:
getTarget
in interfaceorg.kohsuke.stapler.StaplerProxy
-
getIconFileName
@NonNull public String getIconFileName()
- Specified by:
getIconFileName
in interfaceAction
-
getDisplayName
@NonNull public String getDisplayName()
- Specified by:
getDisplayName
in interfaceAction
- Specified by:
getDisplayName
in interfaceModelObject
-
getUrlName
@NonNull public String getUrlName()
- Specified by:
getUrlName
in interfaceAction
-
-