Class CoverageBuildAction
java.lang.Object
io.jenkins.plugins.util.BuildAction<edu.hm.hafner.coverage.Node>
io.jenkins.plugins.coverage.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<edu.hm.hafner.coverage.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.- Author:
- Ullrich Hafner
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCoverageBuildAction(Run<?, ?> owner, String id, String optionalName, String icon, edu.hm.hafner.coverage.Node result, io.jenkins.plugins.util.QualityGateResult qualityGateResult, edu.hm.hafner.util.FilteredLog log) Creates a new instance ofCoverageBuildAction.CoverageBuildAction(Run<?, ?> owner, String id, String optionalName, String icon, edu.hm.hafner.coverage.Node result, io.jenkins.plugins.util.QualityGateResult qualityGateResult, edu.hm.hafner.util.FilteredLog log, String referenceBuildId, List<? extends edu.hm.hafner.coverage.Difference> delta, List<? extends edu.hm.hafner.coverage.Value> modifiedLinesCoverage, List<? extends edu.hm.hafner.coverage.Difference> modifiedLinesCoverageDifference, List<? extends edu.hm.hafner.coverage.Value> modifiedFilesCoverage, List<? extends edu.hm.hafner.coverage.Difference> modifiedFilesCoverageDifference, List<? extends edu.hm.hafner.coverage.Value> indirectCoverageChanges) Creates a new instance ofCoverageBuildAction. -
Method Summary
Modifier and TypeMethodDescriptionprotected io.jenkins.plugins.util.JobAction<? extends io.jenkins.plugins.util.BuildAction<edu.hm.hafner.coverage.Node>> protected io.jenkins.plugins.util.AbstractXmlStream<edu.hm.hafner.coverage.Node> formatDelta(Baseline baseline, edu.hm.hafner.coverage.Metric metric) Returns a formatted and localized String representation of the delta for the specified metric (with respect to the given baseline).formatValue(Baseline baseline, edu.hm.hafner.coverage.Metric metric) Returns a formatted and localized String representation of the value for the specified metric (with respect to the given baseline).List<edu.hm.hafner.coverage.Difference> getAllDeltas(Baseline baseline) Returns all available deltas for the specified baseline.List<edu.hm.hafner.coverage.Value> getAllValues(Baseline baseline) Returns all available values for the specified baseline.Returns the supported baselines.protected StringOptional<edu.hm.hafner.coverage.Value> Returns whether a delta metric for the specified metric exists.getDeltaBaseline(Baseline baseline) Returns the associate delta baseline for the specified baseline.edu.hm.hafner.util.FilteredLoggetLog()io.jenkins.plugins.util.QualityGateResultReturns the possible reference build that has been used to compute the coverage delta.Renders the reference build as an HTML link.Returns the title text for the specified baseline.doubleReturns whether the trend of the values for the specific metric is positive or negative.Optional<edu.hm.hafner.coverage.Value> getValueForMetric(Baseline baseline, edu.hm.hafner.coverage.Metric metric) Returns the value for the specified metric, if available.List<edu.hm.hafner.coverage.Value> Returns all important values for the specified baseline.booleanhasBaselineResult(Baseline baseline) Returns whether a delta metric for the specified metric exists.booleanReturns whether this action represents results with coverage metrics.booleanReturns whether a delta metric for the specified baseline exists.booleanReturns whether a delta metric for the specified metric exists.booleanReturns whether a value for the specified metric exists.protected ObjecttoString()Methods inherited from class io.jenkins.plugins.util.BuildAction
getBuildActionFromHistoryStartingFrom, getOwner, getProjectActions, getResult, onAttached, onLoad
-
Constructor Details
-
CoverageBuildAction
public CoverageBuildAction(Run<?, ?> owner, String id, String optionalName, String icon, edu.hm.hafner.coverage.Node result, io.jenkins.plugins.util.QualityGateResult qualityGateResult, edu.hm.hafner.util.FilteredLog log) Creates a new instance ofCoverageBuildAction.- Parameters:
owner- the associated build that created the statisticsid- ID (URL) of the resultsoptionalName- optional name that overrides the default name 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 optionalName, String icon, edu.hm.hafner.coverage.Node result, io.jenkins.plugins.util.QualityGateResult qualityGateResult, edu.hm.hafner.util.FilteredLog log, String referenceBuildId, List<? extends edu.hm.hafner.coverage.Difference> delta, List<? extends edu.hm.hafner.coverage.Value> modifiedLinesCoverage, List<? extends edu.hm.hafner.coverage.Difference> modifiedLinesCoverageDifference, List<? extends edu.hm.hafner.coverage.Value> modifiedFilesCoverage, List<? extends edu.hm.hafner.coverage.Difference> modifiedFilesCoverageDifference, List<? extends edu.hm.hafner.coverage.Value> indirectCoverageChanges) Creates a new instance ofCoverageBuildAction.- Parameters:
owner- the associated build that created the statisticsid- ID (URL) of the resultsoptionalName- optional name that overrides the default name 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 builddelta- delta of this build's coverages with respect to the reference buildmodifiedLinesCoverage- the coverages filtered by modified lines of the associated change requestmodifiedLinesCoverageDifference- difference between the project coverage and the modified lines coverage of the current buildmodifiedFilesCoverage- the coverages filtered by changed files of the associated change requestmodifiedFilesCoverageDifference- difference between the project coverage and the modified files coverage of the current buildindirectCoverageChanges- the indirect coverage changes of the associated change request with respect to the reference build
-
-
Method Details
-
readResolve
- Overrides:
readResolvein classio.jenkins.plugins.util.BuildAction<edu.hm.hafner.coverage.Node>
-
getLog
public edu.hm.hafner.util.FilteredLog getLog() -
getQualityGateResult
public io.jenkins.plugins.util.QualityGateResult getQualityGateResult() -
getFormatter
-
getStatistics
-
getBaselines
Returns the supported baselines.- Returns:
- all supported baselines
-
hasBaselineResult
Returns whether a delta metric for the specified metric exists.- Parameters:
baseline- the baseline to use- Returns:
trueif a delta is available for the specified metric,falseotherwise
-
getDeltaBaseline
Returns the associate delta baseline for the specified baseline.- Parameters:
baseline- the baseline to get the delta baseline for- Returns:
- the delta baseline
- Throws:
NoSuchElementException- if this baseline does not provide a delta baseline
-
getTitle
Returns the title text for the specified baseline.- Parameters:
baseline- the baseline to get the title for- Returns:
- the title
-
getAllValues
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
-
getAllDeltas
Returns all available deltas for the specified baseline.- Parameters:
baseline- the baseline to get the deltas for- Returns:
- the available values
- Throws:
NoSuchElementException- if this baseline does not provide deltas
-
getValues
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
-
hasCoverage
public boolean hasCoverage()Returns whether this action represents results with coverage metrics. Otherwise, this action represents software metrics.- Returns:
trueif this action represents coverage metrics,falseif this action represents software metrics
-
getValueForMetric
public Optional<edu.hm.hafner.coverage.Value> getValueForMetric(Baseline baseline, edu.hm.hafner.coverage.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
-
hasDelta
Returns whether a delta metric for the specified baseline exists.- Parameters:
baseline- the baseline to use- Returns:
trueif a delta is available for the specified baseline,falseotherwise
-
hasDelta
Returns whether a delta metric for the specified metric exists.- Parameters:
baseline- the baseline to usemetric- the metric to check- Returns:
trueif a delta is available for the specified metric,falseotherwise
-
getDelta
public Optional<edu.hm.hafner.coverage.Value> getDelta(Baseline baseline, edu.hm.hafner.coverage.Metric metric) Returns whether a delta metric for the specified metric exists.- Parameters:
baseline- the baseline to usemetric- the metric to check- Returns:
trueif a delta is available for the specified metric,falseotherwise
-
hasValue
Returns whether a value for the specified metric exists.- Parameters:
baseline- the baseline to usemetric- the metric to check- Returns:
trueif a value is available for the specified metric,falseotherwise
-
formatValue
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
-
formatDelta
Returns a formatted and localized String representation of the delta 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 delta metric
-
getTrend
Returns whether the trend of the values for the specific metric is positive or negative.- Parameters:
baseline- the baseline to usemetric- the metric to check- Returns:
- a positive value if the trend is positive, a negative value if the trend is negative, or
0if there is no significant change in the trend
-
getReferenceBuild
Returns the possible reference build that has been used to compute the coverage delta.- Returns:
- the reference build, if available
-
getReferenceBuildLink
Renders the reference build as an HTML link.- Returns:
- the reference build
- See Also:
-
createXmlStream
protected io.jenkins.plugins.util.AbstractXmlStream<edu.hm.hafner.coverage.Node> createXmlStream()- Specified by:
createXmlStreamin classio.jenkins.plugins.util.BuildAction<edu.hm.hafner.coverage.Node>
-
createProjectAction
protected io.jenkins.plugins.util.JobAction<? extends io.jenkins.plugins.util.BuildAction<edu.hm.hafner.coverage.Node>> createProjectAction()- Specified by:
createProjectActionin classio.jenkins.plugins.util.BuildAction<edu.hm.hafner.coverage.Node>
-
getBuildResultBaseName
- Specified by:
getBuildResultBaseNamein classio.jenkins.plugins.util.BuildAction<edu.hm.hafner.coverage.Node>
-
getTarget
- Specified by:
getTargetin interfaceorg.kohsuke.stapler.StaplerProxy
-
getIconFileName
- Specified by:
getIconFileNamein interfaceAction
-
getDisplayName
- Specified by:
getDisplayNamein interfaceAction- Specified by:
getDisplayNamein interfaceModelObject
-
getUrlName
- Specified by:
getUrlNamein interfaceAction
-
toString
-