Skip to content

Commit

Permalink
Remove SCM parameter, since this value should be stored in factory.
Browse files Browse the repository at this point in the history
  • Loading branch information
uhafner committed Jan 26, 2024
1 parent ccd6ab0 commit 66595dc
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import java.io.Serializable;
import java.util.Optional;

import org.apache.commons.lang3.StringUtils;

import edu.hm.hafner.util.FilteredLog;

import hudson.model.Run;
Expand All @@ -15,6 +17,23 @@
public abstract class DeltaCalculator implements Serializable {
private static final long serialVersionUID = 8641535877389921937L;

/**
* Calculates the {@link Delta} between two passed Jenkins builds.
*
* @param build
* the currently processed build
* @param referenceBuild
* The reference build
* @param logger
* The used log
*
* @return the delta if it could be calculated
*/
public Optional<Delta> calculateDelta(final Run<?, ?> build, final Run<?, ?> referenceBuild,
final FilteredLog logger) {
return calculateDelta(build, referenceBuild, StringUtils.EMPTY, logger);

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation Note

Invoking
DeltaCalculator.calculateDelta
should be avoided because it has been deprecated.
}

/**
* Calculates the {@link Delta} between two passed Jenkins builds.
*
Expand All @@ -28,7 +47,9 @@ public abstract class DeltaCalculator implements Serializable {
* The used log
*
* @return the delta if it could be calculated
* @deprecated use {@link #calculateDelta(Run, Run, FilteredLog)} instead
*/
@Deprecated
public abstract Optional<Delta> calculateDelta(Run<?, ?> build, Run<?, ?> referenceBuild,
String scmKeyFilter, FilteredLog logger);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ void shouldSelectNullDeltaCalculatorIfNoCalculatorIsFound() {
DeltaCalculator nullCalculator = createDeltaCalculator("/", log);

assertThat(nullCalculator).isInstanceOf(NullDeltaCalculator.class);
assertThat(nullCalculator.calculateDelta(mock(Run.class), mock(Run.class), "", log)).isEmpty();
assertThat(nullCalculator.calculateDelta(mock(Run.class), mock(Run.class), log)).isEmpty();
assertThat(log.getInfoMessages()).containsOnly(NO_SUITABLE_DELTA_CALCULATOR_FOUND,
ACTUAL_FACTORY_NULL_DELTA_CALCULATOR, EMPTY_FACTORY_NULL_DELTA_CALCULATOR);
assertThat(log.getErrorMessages()).isEmpty();
Expand Down

0 comments on commit 66595dc

Please sign in to comment.