Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class ExecuteResponseData {
private int failedStages;
private int totalChanges;
private int appliedChanges;
private int skippedChanges;
private int alreadyAppliedChanges;
private int failedChanges;
private int notReachedChanges;

Expand All @@ -63,7 +63,7 @@ private ExecuteResponseData(Builder builder) {
this.failedStages = builder.failedStages;
this.totalChanges = builder.totalChanges;
this.appliedChanges = builder.appliedChanges;
this.skippedChanges = builder.skippedChanges;
this.alreadyAppliedChanges = builder.alreadyAppliedChanges;
this.failedChanges = builder.failedChanges;
this.notReachedChanges = builder.notReachedChanges;
this.stages = builder.stages != null ? builder.stages : new ArrayList<>();
Expand Down Expand Up @@ -157,12 +157,12 @@ public void setAppliedChanges(int appliedChanges) {
this.appliedChanges = appliedChanges;
}

public int getSkippedChanges() {
return skippedChanges;
public int getAlreadyAppliedChanges() {
return alreadyAppliedChanges;
}

public void setSkippedChanges(int skippedChanges) {
this.skippedChanges = skippedChanges;
public void setAlreadyAppliedChanges(int alreadyAppliedChanges) {
this.alreadyAppliedChanges = alreadyAppliedChanges;
}

public int getFailedChanges() {
Expand Down Expand Up @@ -213,7 +213,7 @@ public static class Builder {
private int failedStages;
private int totalChanges;
private int appliedChanges;
private int skippedChanges;
private int alreadyAppliedChanges;
private int failedChanges;
private int notReachedChanges;
private List<StageResult> stages = new ArrayList<>();
Expand Down Expand Up @@ -273,8 +273,8 @@ public Builder appliedChanges(int appliedChanges) {
return this;
}

public Builder skippedChanges(int skippedChanges) {
this.skippedChanges = skippedChanges;
public Builder alreadyAppliedChanges(int alreadyAppliedChanges) {
this.alreadyAppliedChanges = alreadyAppliedChanges;
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public static String summary(ExecuteResponseData result) {
String counts = String.format(
"; changes newly_applied=%d, already_applied=%d, failed=%d, not_reached=%d; duration=%dms",
result.getAppliedChanges(),
result.getSkippedChanges(),
result.getAlreadyAppliedChanges(),
result.getFailedChanges(),
result.getNotReachedChanges(),
result.getTotalDurationMs());
Expand Down Expand Up @@ -112,7 +112,7 @@ public static String report(ExecuteResponseData result) {
sb.append(" Changes: ")
.append(result.getTotalChanges()).append(" total — ")
.append(result.getAppliedChanges()).append(" newly applied, ")
.append(result.getSkippedChanges()).append(" already applied, ")
.append(result.getAlreadyAppliedChanges()).append(" already applied, ")
.append(result.getFailedChanges()).append(" failed, ")
.append(result.getNotReachedChanges()).append(" not reached")
.append(NEWLINE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public int getAppliedCount() {
.count();
}

public int getSkippedCount() {
public int getAlreadyAppliedCount() {
return (int) changes.stream()
.filter(ChangeResult::isAlreadyApplied)
.count();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ void shouldWriteValidJsonToFile() throws Exception {
.completedStages(1)
.totalChanges(3)
.appliedChanges(2)
.skippedChanges(1)
.alreadyAppliedChanges(1)
.failedChanges(0)
.totalDurationMs(500)
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ void shouldSerializeAndDeserializeExecuteResponseData() throws Exception {
.failedStages(0)
.totalChanges(5)
.appliedChanges(3)
.skippedChanges(2)
.alreadyAppliedChanges(2)
.failedChanges(0)
.addStage(StageResult.builder()
.stageId("stage-1")
Expand All @@ -93,7 +93,7 @@ void shouldSerializeAndDeserializeExecuteResponseData() throws Exception {
assertEquals(2, deserialized.getCompletedStages());
assertEquals(5, deserialized.getTotalChanges());
assertEquals(3, deserialized.getAppliedChanges());
assertEquals(2, deserialized.getSkippedChanges());
assertEquals(2, deserialized.getAlreadyAppliedChanges());
assertEquals(0, deserialized.getFailedChanges());
assertEquals(1, deserialized.getStages().size());
assertEquals("stage-1", deserialized.getStages().get(0).getStageId());
Expand Down Expand Up @@ -156,7 +156,7 @@ void shouldSerializeResponseEnvelopeWithPolymorphicData() throws Exception {
.completedStages(1)
.totalChanges(2)
.appliedChanges(2)
.skippedChanges(0)
.alreadyAppliedChanges(0)
.failedChanges(0)
.totalDurationMs(500)
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ void summaryOnSuccess() {
.failedStages(0)
.totalChanges(3)
.appliedChanges(3)
.skippedChanges(0)
.alreadyAppliedChanges(0)
.failedChanges(0)
.totalDurationMs(120)
.build();
Expand Down Expand Up @@ -237,7 +237,7 @@ void reportCountsRolledBackChangeAsFailedAndListsItsId() {
ExecuteResponseData result = ExecuteResponseData.builder()
.status(ExecutionStatus.FAILED)
.totalStages(1).failedStages(1)
.totalChanges(6).appliedChanges(0).skippedChanges(5).failedChanges(1)
.totalChanges(6).appliedChanges(0).alreadyAppliedChanges(5).failedChanges(1)
.totalDurationMs(221)
.stages(Collections.singletonList(stage))
.build();
Expand Down Expand Up @@ -284,7 +284,7 @@ void reportAllUpToDateShowsNoChangesHeadlineAndUpToDateRowsInBreakdown() {
ExecuteResponseData result = ExecuteResponseData.builder()
.status(ExecutionStatus.NO_CHANGES)
.totalStages(1).upToDateStages(1).notReachedStages(0).failedStages(0)
.totalChanges(6).appliedChanges(0).skippedChanges(6).failedChanges(0)
.totalChanges(6).appliedChanges(0).alreadyAppliedChanges(6).failedChanges(0)
.stages(Collections.singletonList(upToDate))
.build();

Expand Down Expand Up @@ -359,7 +359,7 @@ void reportPartialCoverageMixesReachedUpToDateAndNotReached() {
ExecuteResponseData result = ExecuteResponseData.builder()
.status(ExecutionStatus.FAILED)
.totalStages(4).completedStages(1).upToDateStages(1).notReachedStages(1).failedStages(1)
.totalChanges(10).appliedChanges(3).skippedChanges(3).failedChanges(1).notReachedChanges(3)
.totalChanges(10).appliedChanges(3).alreadyAppliedChanges(3).failedChanges(1).notReachedChanges(3)
.totalDurationMs(170)
.stages(Arrays.asList(block1, block2, block3, block4))
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ public Output executeStage(ExecutableStage executableStage,
resultBuilder.stopTimer().completed();
Duration stageDuration = Duration.between(stageStart, LocalDateTime.now());
StageResult stageResult = resultBuilder.build();
logger.info("Stage completed [stage={} duration={} applied={} skipped={}]",
stageName, formatDuration(stageDuration), stageResult.getAppliedCount(), stageResult.getSkippedCount());
logger.info("Stage completed [stage={} duration={} applied={} alreadyApplied={}]",
stageName, formatDuration(stageDuration), stageResult.getAppliedCount(), stageResult.getAlreadyAppliedCount());
return new Output(stageResult);

} catch (StageExecutionException stageExecutionException) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ public ExecuteResponseData toResponse() {
int failedStages = 0;
int totalChanges = 0;
int appliedChanges = 0;
int skippedChanges = 0;
int alreadyAppliedChanges = 0;
int failedChanges = 0;
int notReachedChanges = 0;
boolean anyFailed = false;
Expand Down Expand Up @@ -415,7 +415,7 @@ public ExecuteResponseData toResponse() {
if (change.getStatus() == ChangeStatus.APPLIED) {
appliedChanges++;
} else if (change.getStatus() == ChangeStatus.ALREADY_APPLIED) {
skippedChanges++;
alreadyAppliedChanges++;
} else if (change.getStatus() == ChangeStatus.FAILED
|| change.getStatus() == ChangeStatus.ROLLED_BACK) {
// ROLLED_BACK counts as a failed attempt for the user-facing aggregate.
Expand Down Expand Up @@ -455,7 +455,7 @@ public ExecuteResponseData toResponse() {
.failedStages(failedStages)
.totalChanges(totalChanges)
.appliedChanges(appliedChanges)
.skippedChanges(skippedChanges)
.alreadyAppliedChanges(alreadyAppliedChanges)
.failedChanges(failedChanges)
.notReachedChanges(notReachedChanges)
.stages(stages)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ void twoCompletedStagesYieldsSuccessAndCountersRollUp() {
assertEquals(0, response.getFailedStages());
assertEquals(4, response.getTotalChanges()); // 3 (loaded alpha) + 1 (loaded beta)
assertEquals(3, response.getAppliedChanges()); // 2 + 1
assertEquals(1, response.getSkippedChanges()); // 1 + 0
assertEquals(1, response.getAlreadyAppliedChanges()); // 1 + 0
assertEquals(0, response.getFailedChanges());
}

Expand Down Expand Up @@ -187,7 +187,7 @@ void rolledBackChangeIsCountedAsFailedInAggregate() {
ExecuteResponseData response = pipelineRun.toResponse();
assertEquals(3, response.getTotalChanges());
assertEquals(0, response.getAppliedChanges());
assertEquals(2, response.getSkippedChanges());
assertEquals(2, response.getAlreadyAppliedChanges());
assertEquals(1, response.getFailedChanges(),
"ROLLED_BACK must be counted as failed in the user-facing aggregate");
}
Expand Down Expand Up @@ -235,8 +235,8 @@ void upToDateVerdictWithAuditPopulatedChangesAggregatesAsExpected() {
assertEquals(ExecutionStatus.NO_CHANGES, response.getStatus());
assertEquals(1, response.getUpToDateStages());
assertEquals(0, response.getNotReachedStages());
assertEquals(6, response.getSkippedChanges(),
"ALREADY_APPLIED records added by the planner must roll up into skippedChanges");
assertEquals(6, response.getAlreadyAppliedChanges(),
"ALREADY_APPLIED records added by the planner must roll up into alreadyAppliedChanges");
assertEquals(0, response.getAppliedChanges());
assertEquals(0, response.getFailedChanges());
assertEquals(PlannerVerdict.UP_TO_DATE, response.getStages().get(0).getPlannerVerdict());
Expand Down Expand Up @@ -267,7 +267,7 @@ void markStageAlreadyAppliedFromAuditDefensiveMergeRespectsOperationWrites() {

ExecuteResponseData response = pipelineRun.toResponse();
assertEquals(1, response.getAppliedChanges(), "alpha-c0 stays APPLIED");
assertEquals(1, response.getSkippedChanges(), "alpha-c1 becomes ALREADY_APPLIED");
assertEquals(1, response.getAlreadyAppliedChanges(), "alpha-c1 becomes ALREADY_APPLIED");
assertEquals(0, response.getNotReachedChanges(), "no NOT_REACHED records left");
assertEquals(2, response.getStages().get(0).getChanges().size());
}
Expand Down Expand Up @@ -298,7 +298,7 @@ void midStageFailurePreservesNotReachedForUnprocessedChanges() {
ExecuteResponseData response = pipelineRun.toResponse();
assertEquals(5, response.getTotalChanges());
assertEquals(2, response.getAppliedChanges());
assertEquals(0, response.getSkippedChanges());
assertEquals(0, response.getAlreadyAppliedChanges());
assertEquals(1, response.getFailedChanges());
assertEquals(2, response.getNotReachedChanges(),
"trailing unprocessed changes must remain NOT_REACHED after merge");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ void shouldEnrichOperationTouchedStageWithAuditOnlyChanges() {
// Aggregate reporting reflects the enriched view: 1 applied this run, 1 already at target.
io.flamingock.internal.common.core.response.data.ExecuteResponseData response = pipelineRun.toResponse();
assertEquals(1, response.getAppliedChanges());
assertEquals(1, response.getSkippedChanges());
assertEquals(1, response.getAlreadyAppliedChanges());
assertEquals(0, response.getFailedChanges());
}

Expand Down
Loading