From cf37be6ec8c538080bf748b20b0385469d064d59 Mon Sep 17 00:00:00 2001 From: Antonio Perez Dieppa Date: Tue, 16 Jun 2026 10:42:58 +0100 Subject: [PATCH] refactor: cloud executionid --- .../api/response/ExecutionDetailResponse.java | 8 ++--- .../api/response/ExecutionPlanResponse.java | 14 ++++---- .../response/ExecutionSummaryResponse.java | 8 ++--- .../cloud/planner/CloudExecutionPlanner.java | 4 ++- .../planner/CloudExecutionPlanMapperTest.java | 4 +-- .../planner/CloudExecutionPlannerTest.java | 16 ++++----- .../core/cloud/CloudAuditPersistenceTest.java | 10 +++--- .../core/cloud/CloudTransactionTest.java | 2 +- .../couchbase/CouchbaseTargetSystemTest.java | 6 ++-- .../DynamoDBCloudTargetSystemTest.java | 6 ++-- .../MongoDBSpringDataTargetSystemTest.java | 6 ++-- .../sync/MongoDBSyncTargetSystemTest.java | 6 ++-- .../targetsystem/sql/SqlTargetSystemTest.java | 6 ++-- .../test/cloud/AuditRequestExpectation.java | 6 ++-- .../common/test/cloud/MockRunnerServer.java | 2 +- .../cloud/deprecated/MockRunnerServerOld.java | 36 +++++++++---------- .../ExecutionAwaitRequestResponseMock.java | 4 +-- .../ExecutionBaseRequestResponseMock.java | 6 ++-- .../ExecutionPlanRequestResponseMock.java | 4 +-- .../cloud/mock/MockExecutionPlanBuilder.java | 2 +- 20 files changed, 79 insertions(+), 77 deletions(-) diff --git a/cloud/flamingock-cloud-api/src/main/java/io/flamingock/cloud/api/response/ExecutionDetailResponse.java b/cloud/flamingock-cloud-api/src/main/java/io/flamingock/cloud/api/response/ExecutionDetailResponse.java index 0f4e3a7cf..45ed05ff7 100644 --- a/cloud/flamingock-cloud-api/src/main/java/io/flamingock/cloud/api/response/ExecutionDetailResponse.java +++ b/cloud/flamingock-cloud-api/src/main/java/io/flamingock/cloud/api/response/ExecutionDetailResponse.java @@ -21,7 +21,7 @@ public class ExecutionDetailResponse { - private String executionId; + private Long executionId; private long environmentId; private long serviceId; private String runnerId; @@ -32,7 +32,7 @@ public class ExecutionDetailResponse { public ExecutionDetailResponse() { } - public ExecutionDetailResponse(String executionId, long environmentId, long serviceId, String runnerId, + public ExecutionDetailResponse(Long executionId, long environmentId, long serviceId, String runnerId, Instant startedAt, ClientSubmissionRequest clientSubmission, PipelineResponse pipeline) { this.executionId = executionId; this.environmentId = environmentId; @@ -43,8 +43,8 @@ public ExecutionDetailResponse(String executionId, long environmentId, long serv this.pipeline = pipeline; } - public String getExecutionId() { return executionId; } - public void setExecutionId(String executionId) { this.executionId = executionId; } + public Long getExecutionId() { return executionId; } + public void setExecutionId(Long executionId) { this.executionId = executionId; } public long getEnvironmentId() { return environmentId; } public void setEnvironmentId(long environmentId) { this.environmentId = environmentId; } diff --git a/cloud/flamingock-cloud-api/src/main/java/io/flamingock/cloud/api/response/ExecutionPlanResponse.java b/cloud/flamingock-cloud-api/src/main/java/io/flamingock/cloud/api/response/ExecutionPlanResponse.java index 08bc28730..28a394d7f 100644 --- a/cloud/flamingock-cloud-api/src/main/java/io/flamingock/cloud/api/response/ExecutionPlanResponse.java +++ b/cloud/flamingock-cloud-api/src/main/java/io/flamingock/cloud/api/response/ExecutionPlanResponse.java @@ -22,7 +22,7 @@ public class ExecutionPlanResponse { - private String executionId; + private Long executionId; private CloudExecutionAction action; @@ -50,20 +50,20 @@ public ExecutionPlanResponse() { } public ExecutionPlanResponse(CloudExecutionAction action, - String executionId, + Long executionId, LockInfoResponse lock) { this(action, executionId, lock, Collections.emptyList()); } public ExecutionPlanResponse(CloudExecutionAction action, - String executionId, + Long executionId, LockInfoResponse lock, List stages) { this(action, executionId, lock, stages, false); } public ExecutionPlanResponse(CloudExecutionAction action, - String executionId, + Long executionId, LockInfoResponse lock, List stages, boolean synchronizedMarks) { @@ -71,7 +71,7 @@ public ExecutionPlanResponse(CloudExecutionAction action, } public ExecutionPlanResponse(CloudExecutionAction action, - String executionId, + Long executionId, LockInfoResponse lock, List stages, PipelineResultResponse pipelineResult, @@ -88,11 +88,11 @@ public void setAction(CloudExecutionAction action) { this.action = action; } - public String getExecutionId() { + public Long getExecutionId() { return executionId; } - public void setExecutionId(String executionId) { + public void setExecutionId(Long executionId) { this.executionId = executionId; } diff --git a/cloud/flamingock-cloud-api/src/main/java/io/flamingock/cloud/api/response/ExecutionSummaryResponse.java b/cloud/flamingock-cloud-api/src/main/java/io/flamingock/cloud/api/response/ExecutionSummaryResponse.java index 3cb4bf016..fb2ea8ed4 100644 --- a/cloud/flamingock-cloud-api/src/main/java/io/flamingock/cloud/api/response/ExecutionSummaryResponse.java +++ b/cloud/flamingock-cloud-api/src/main/java/io/flamingock/cloud/api/response/ExecutionSummaryResponse.java @@ -19,7 +19,7 @@ public class ExecutionSummaryResponse { - private String executionId; + private Long executionId; private long environmentId; private long serviceId; private String runnerId; @@ -28,7 +28,7 @@ public class ExecutionSummaryResponse { public ExecutionSummaryResponse() { } - public ExecutionSummaryResponse(String executionId, long environmentId, long serviceId, String runnerId, Instant startedAt) { + public ExecutionSummaryResponse(Long executionId, long environmentId, long serviceId, String runnerId, Instant startedAt) { this.executionId = executionId; this.environmentId = environmentId; this.serviceId = serviceId; @@ -36,8 +36,8 @@ public ExecutionSummaryResponse(String executionId, long environmentId, long ser this.startedAt = startedAt; } - public String getExecutionId() { return executionId; } - public void setExecutionId(String executionId) { this.executionId = executionId; } + public Long getExecutionId() { return executionId; } + public void setExecutionId(Long executionId) { this.executionId = executionId; } public long getEnvironmentId() { return environmentId; } public void setEnvironmentId(long environmentId) { this.environmentId = environmentId; } diff --git a/cloud/flamingock-cloud/src/main/java/io/flamingock/cloud/planner/CloudExecutionPlanner.java b/cloud/flamingock-cloud/src/main/java/io/flamingock/cloud/planner/CloudExecutionPlanner.java index 478c16cd8..952e4f7bb 100644 --- a/cloud/flamingock-cloud/src/main/java/io/flamingock/cloud/planner/CloudExecutionPlanner.java +++ b/cloud/flamingock-cloud/src/main/java/io/flamingock/cloud/planner/CloudExecutionPlanner.java @@ -203,7 +203,9 @@ private ExecutionPlan buildNextExecutionPlan(List loadedSta ExecutionPlanResponse response, Lock lock) { return ExecutionPlan.newExecution( - response.getExecutionId(), + // The server identity is a Long (the executions PK). The shared core ExecutionPlan/AuditEntry keep a + // String executionId (used by Community local audit stores too), so convert at the cloud boundary. + String.valueOf(response.getExecutionId()), lock, CloudExecutionPlanMapper.getExecutableStages(response, loadedStages) ); diff --git a/cloud/flamingock-cloud/src/test/java/io/flamingock/cloud/planner/CloudExecutionPlanMapperTest.java b/cloud/flamingock-cloud/src/test/java/io/flamingock/cloud/planner/CloudExecutionPlanMapperTest.java index caec7ea74..1e3363a86 100644 --- a/cloud/flamingock-cloud/src/test/java/io/flamingock/cloud/planner/CloudExecutionPlanMapperTest.java +++ b/cloud/flamingock-cloud/src/test/java/io/flamingock/cloud/planner/CloudExecutionPlanMapperTest.java @@ -185,7 +185,7 @@ void shouldThrowManualInterventionOnStageValidate() { void shouldBuildAbortPlanFromAbortResponse() { List loadedStages = Arrays.asList(buildStage("stage-1", change1, change2)); ExecutionPlanResponse response = new ExecutionPlanResponse( - CloudExecutionAction.ABORT, "exec-1", null, + CloudExecutionAction.ABORT, 1L, null, Arrays.asList(buildStageResponse("stage-1", 0, changeResponse(change1.getId(), CloudChangeAction.MANUAL_INTERVENTION), changeResponse(change2.getId(), CloudChangeAction.APPLY))) @@ -372,7 +372,7 @@ private static DefaultLoadedStage buildStage(String name, AbstractLoadedChange.. } private static ExecutionPlanResponse buildResponse(StageResponse... stages) { - return new ExecutionPlanResponse(CloudExecutionAction.EXECUTE, "exec-1", null, Arrays.asList(stages)); + return new ExecutionPlanResponse(CloudExecutionAction.EXECUTE, 1L, null, Arrays.asList(stages)); } private static StageResponse buildStageResponse(String name, int order, ChangeResponse... changes) { diff --git a/cloud/flamingock-cloud/src/test/java/io/flamingock/cloud/planner/CloudExecutionPlannerTest.java b/cloud/flamingock-cloud/src/test/java/io/flamingock/cloud/planner/CloudExecutionPlannerTest.java index 47756eac6..853c9d829 100644 --- a/cloud/flamingock-cloud/src/test/java/io/flamingock/cloud/planner/CloudExecutionPlannerTest.java +++ b/cloud/flamingock-cloud/src/test/java/io/flamingock/cloud/planner/CloudExecutionPlannerTest.java @@ -155,7 +155,7 @@ void shouldReturnAbortPlanWhenServerReturnsAbort() { CloudExecutionPlanner planner = buildPlanner(Collections.emptyList()); ExecutionPlanResponse response = new ExecutionPlanResponse( - CloudExecutionAction.ABORT, "exec-1", null, + CloudExecutionAction.ABORT, 1L, null, Collections.singletonList(new StageResponse("stage-1", 0, Collections.singletonList(new ChangeResponse(change1.getId(), CloudChangeAction.MANUAL_INTERVENTION)))) ); @@ -178,7 +178,7 @@ void shouldReturnAbortPlanWhenServerReturnsAbortWithNoMIChanges() { CloudExecutionPlanner planner = buildPlanner(Collections.emptyList()); ExecutionPlanResponse response = new ExecutionPlanResponse( - CloudExecutionAction.ABORT, "exec-1", null, + CloudExecutionAction.ABORT, 1L, null, Collections.singletonList(new StageResponse("stage-1", 0, Collections.singletonList(new ChangeResponse(change1.getId(), CloudChangeAction.APPLY)))) ); @@ -208,7 +208,7 @@ void shouldIncludeAuditMarksInExecutionRequest() { CloudExecutionPlanner planner = buildPlanner(Arrays.asList(marker1, marker2)); ExecutionPlanResponse response = new ExecutionPlanResponse( - CloudExecutionAction.CONTINUE, "exec-1", null, + CloudExecutionAction.CONTINUE, 1L, null, Collections.singletonList(new StageResponse("stage-1", 0, Arrays.asList( new ChangeResponse(change1.getId(), CloudChangeAction.SKIP), new ChangeResponse(change2.getId(), CloudChangeAction.APPLY)))) @@ -238,7 +238,7 @@ void shouldSendNoneStatusWhenNoMarks() { CloudExecutionPlanner planner = buildPlanner(Collections.emptyList()); ExecutionPlanResponse response = new ExecutionPlanResponse( - CloudExecutionAction.CONTINUE, "exec-1", null, + CloudExecutionAction.CONTINUE, 1L, null, Collections.singletonList(new StageResponse("stage-1", 0, Collections.singletonList(new ChangeResponse(change1.getId(), CloudChangeAction.SKIP)))) ); @@ -352,7 +352,7 @@ void shouldNotClearNewMarksWrittenAfterRequest() { private ExecutionPlanResponse buildSyncResponse(CloudExecutionAction action, boolean synchronizedMarks) { ExecutionPlanResponse response = new ExecutionPlanResponse( - action, "exec-1", null, + action, 1L, null, Collections.singletonList(new StageResponse("stage-1", 0, Arrays.asList( new ChangeResponse(change1.getId(), CloudChangeAction.SKIP), @@ -396,7 +396,7 @@ void continueWithPipelineResultWritesVerdict() { Collections.emptyList()) )); ExecutionPlanResponse response = new ExecutionPlanResponse( - CloudExecutionAction.CONTINUE, "exec-1", null, Collections.emptyList(), + CloudExecutionAction.CONTINUE, 1L, null, Collections.emptyList(), pipelineResult, false); when(client.createExecution(any(), any(), anyLong())).thenReturn(response); @@ -440,7 +440,7 @@ void executeWithPipelineResultUpgradesAlreadyAppliedRecords() { lockInfo.setAcquisitionId("acq-1"); lockInfo.setAcquiredForMillis(60000L); ExecutionPlanResponse response = new ExecutionPlanResponse( - CloudExecutionAction.EXECUTE, "exec-1", lockInfo, + CloudExecutionAction.EXECUTE, 1L, lockInfo, Collections.singletonList(new StageResponse("stage-1", 0, Collections.singletonList( new ChangeResponse(change2.getId(), CloudChangeAction.APPLY)))), @@ -477,7 +477,7 @@ void abortLeavesPipelineRunUntouched() { // ABORT carries no pipelineResult — validate() doesn't require it, and the planner // must not attempt to apply one (NPE-guard). ExecutionPlanResponse response = new ExecutionPlanResponse( - CloudExecutionAction.ABORT, "exec-1", null, + CloudExecutionAction.ABORT, 1L, null, Collections.singletonList(new StageResponse("stage-1", 0, Collections.singletonList( new ChangeResponse(change1.getId(), CloudChangeAction.APPLY)))) diff --git a/cloud/flamingock-cloud/src/test/java/io/flamingock/core/cloud/CloudAuditPersistenceTest.java b/cloud/flamingock-cloud/src/test/java/io/flamingock/core/cloud/CloudAuditPersistenceTest.java index f7bbfd939..8a893317f 100644 --- a/cloud/flamingock-cloud/src/test/java/io/flamingock/core/cloud/CloudAuditPersistenceTest.java +++ b/cloud/flamingock-cloud/src/test/java/io/flamingock/core/cloud/CloudAuditPersistenceTest.java @@ -134,7 +134,7 @@ void afterEach() { @DisplayName("Should run successfully happy path") void happyPath() { //GIVEN - String executionId = "execution-1"; + long executionId = 1L; mockRunnerServer .addSimpleStageExecutionPlan(executionId, "changes", auditEntryExpectations) .addExecutionWithAllChangesRequestResponse(executionId) @@ -157,7 +157,7 @@ void shouldPerformRightCallsWhenAwaitExecuteContinue() { try (MockedConstruction lockThreadSleeperConstructors = Mockito.mockConstruction(ThreadSleeper.class)) { - String executionId = "execution-1"; + long executionId = 1L; mockRunnerServer .addSimpleStageExecutionPlan(executionId, "changes", auditEntryExpectations) .addExecutionAwaitRequestResponse(executionId) @@ -185,7 +185,7 @@ void shouldPerformRightCallsWhenAwaitExecuteContinue() { void shouldWaitAndEventuallyAbort() { ///GIVEN String acquisitionId = UUID.randomUUID().toString(); - String executionId = "execution-1"; + long executionId = 1L; mockRunnerServer .addSimpleStageExecutionPlan(executionId, "changes", auditEntryExpectations) .addExecutionAwaitRequestResponse(executionId, 5000L, acquisitionId) @@ -218,7 +218,7 @@ void shouldWaitAndEventuallyAbort() { @DisplayName("Should wait and retry when lock is initially blocked eventually released") void shouldWaitAndRetry() { //GIVEN - String executionId = "execution-1"; + long executionId = 1L; String acquisitionId = UUID.randomUUID().toString(); mockRunnerServer .addSimpleStageExecutionPlan(executionId, "changes", auditEntryExpectations) @@ -243,7 +243,7 @@ void shouldWaitAndRetry() { @DisplayName("Should continue and not run anything if server returns CONTINUE at first") void shouldContinue() { mockRunnerServer - .addSimpleStageExecutionPlan("execution-1", "changes", auditEntryExpectations) + .addSimpleStageExecutionPlan(1L, "changes", auditEntryExpectations) .addExecutionContinueRequestResponse() .start(); diff --git a/cloud/flamingock-cloud/src/test/java/io/flamingock/core/cloud/CloudTransactionTest.java b/cloud/flamingock-cloud/src/test/java/io/flamingock/core/cloud/CloudTransactionTest.java index a66e0acd7..c1a5a0e87 100644 --- a/cloud/flamingock-cloud/src/test/java/io/flamingock/core/cloud/CloudTransactionTest.java +++ b/cloud/flamingock-cloud/src/test/java/io/flamingock/core/cloud/CloudTransactionTest.java @@ -124,7 +124,7 @@ void afterEach() { @DisplayName("Should run successfully happy path") void happyPath() { //GIVEN - String executionId = "execution-1"; + long executionId = 1L; mockRunnerServer .addSimpleStageExecutionPlan(executionId, "changes", auditEntries) .addExecutionWithAllChangesRequestResponse(executionId) diff --git a/core/target-systems/flamingock-couchbase-targetsystem/src/test/java/io/flamingock/targetsystem/couchbase/CouchbaseTargetSystemTest.java b/core/target-systems/flamingock-couchbase-targetsystem/src/test/java/io/flamingock/targetsystem/couchbase/CouchbaseTargetSystemTest.java index a8588258f..4a94ad0d6 100644 --- a/core/target-systems/flamingock-couchbase-targetsystem/src/test/java/io/flamingock/targetsystem/couchbase/CouchbaseTargetSystemTest.java +++ b/core/target-systems/flamingock-couchbase-targetsystem/src/test/java/io/flamingock/targetsystem/couchbase/CouchbaseTargetSystemTest.java @@ -142,7 +142,7 @@ void afterEach() throws Exception { @Test @DisplayName("Should follow the targetSystem lifecycle") void happyPath() { - String executionId = "execution-1"; + long executionId = 1L; String stageName = "stage-1"; PrototypeClientSubmission prototypeClientSubmission = new PrototypeClientSubmission( @@ -191,7 +191,7 @@ void happyPath() { @Test @DisplayName("Should rollback the ongoing deletion when a change fails") void failedChanges() { - String executionId = "execution-1"; + long executionId = 1L; String stageName = "stage-1"; PrototypeClientSubmission prototypeClientSubmission = new PrototypeClientSubmission( @@ -246,7 +246,7 @@ void failedChanges() { @Disabled("adapt when adding cloud support") @DisplayName("Should send ongoing change in execution when is present in local database") void shouldSendOngoingChangeInExecutionPlan() { - String executionId = "execution-1"; + long executionId = 1L; String stageName = "stage-1"; PrototypeClientSubmission prototypeClientSubmission = new PrototypeClientSubmission( diff --git a/core/target-systems/flamingock-dynamodb-targetsystem/src/test/java/io/flamingock/targetsystem/dynamodb/DynamoDBCloudTargetSystemTest.java b/core/target-systems/flamingock-dynamodb-targetsystem/src/test/java/io/flamingock/targetsystem/dynamodb/DynamoDBCloudTargetSystemTest.java index ced435292..09a2a6fff 100644 --- a/core/target-systems/flamingock-dynamodb-targetsystem/src/test/java/io/flamingock/targetsystem/dynamodb/DynamoDBCloudTargetSystemTest.java +++ b/core/target-systems/flamingock-dynamodb-targetsystem/src/test/java/io/flamingock/targetsystem/dynamodb/DynamoDBCloudTargetSystemTest.java @@ -122,7 +122,7 @@ void afterEach() throws Exception { @Test @DisplayName("Should follow the transactioner lifecycle") void happyPath() { - String executionId = "execution-1"; + long executionId = 1L; String stageName = "stage-1"; PrototypeClientSubmission prototypeClientSubmission = new PrototypeClientSubmission( @@ -178,7 +178,7 @@ void happyPath() { @Test @DisplayName("Should rollback the ongoing deletion when a change fails") void failedChanges() { - String executionId = "execution-1"; + long executionId = 1L; String stageName = "stage-1"; PrototypeClientSubmission prototypeClientSubmission = new PrototypeClientSubmission( @@ -238,7 +238,7 @@ void failedChanges() { @Disabled("adapt when adding cloud support") @DisplayName("Should send ongoing change in execution when is present in local database") void shouldSendOngoingChangeInExecutionPlan() { - String executionId = "execution-1"; + long executionId = 1L; String stageName = "stage-1"; PrototypeClientSubmission prototypeClientSubmission = new PrototypeClientSubmission( diff --git a/core/target-systems/flamingock-mongodb-springdata-targetsystem/src/test/java/io/flamingock/targetsystem/mongodb/springdata/MongoDBSpringDataTargetSystemTest.java b/core/target-systems/flamingock-mongodb-springdata-targetsystem/src/test/java/io/flamingock/targetsystem/mongodb/springdata/MongoDBSpringDataTargetSystemTest.java index 432016e4a..ee5760e13 100644 --- a/core/target-systems/flamingock-mongodb-springdata-targetsystem/src/test/java/io/flamingock/targetsystem/mongodb/springdata/MongoDBSpringDataTargetSystemTest.java +++ b/core/target-systems/flamingock-mongodb-springdata-targetsystem/src/test/java/io/flamingock/targetsystem/mongodb/springdata/MongoDBSpringDataTargetSystemTest.java @@ -134,7 +134,7 @@ void afterEach() throws Exception { @Test @DisplayName("Should follow the targetSystem lifecycle") void happyPath() { - String executionId = "execution-1"; + long executionId = 1L; String stageName = "stage-1"; PrototypeClientSubmission prototypeClientSubmission = new PrototypeClientSubmission( @@ -184,7 +184,7 @@ void happyPath() { @Test @DisplayName("Should rollback the ongoing deletion when a change fails") void failedChanges() { - String executionId = "execution-1"; + long executionId = 1L; String stageName = "stage-1"; PrototypeClientSubmission prototypeClientSubmission = new PrototypeClientSubmission( @@ -240,7 +240,7 @@ void failedChanges() { @Disabled("adapt when adding cloud support") @DisplayName("Should send ongoing change in execution when is present in local database") void shouldSendOngoingChangeInExecutionPlan() { - String executionId = "execution-1"; + long executionId = 1L; String stageName = "stage-1"; PrototypeClientSubmission prototypeClientSubmission = new PrototypeClientSubmission( diff --git a/core/target-systems/flamingock-mongodb-sync-targetsystem/src/test/java/io/flamingock/targetsystem/mongodb/sync/MongoDBSyncTargetSystemTest.java b/core/target-systems/flamingock-mongodb-sync-targetsystem/src/test/java/io/flamingock/targetsystem/mongodb/sync/MongoDBSyncTargetSystemTest.java index 55e37144e..af04808a3 100644 --- a/core/target-systems/flamingock-mongodb-sync-targetsystem/src/test/java/io/flamingock/targetsystem/mongodb/sync/MongoDBSyncTargetSystemTest.java +++ b/core/target-systems/flamingock-mongodb-sync-targetsystem/src/test/java/io/flamingock/targetsystem/mongodb/sync/MongoDBSyncTargetSystemTest.java @@ -132,7 +132,7 @@ void afterEach() throws Exception { @Test @DisplayName("Should follow the targetSystem lifecycle") void happyPath() { - String executionId = "execution-1"; + long executionId = 1L; String stageName = "stage-1"; PrototypeClientSubmission prototypeClientSubmission = new PrototypeClientSubmission( @@ -182,7 +182,7 @@ void happyPath() { @Test @DisplayName("Should rollback the ongoing deletion when a change fails") void failedChanges() { - String executionId = "execution-1"; + long executionId = 1L; String stageName = "stage-1"; PrototypeClientSubmission prototypeClientSubmission = new PrototypeClientSubmission( @@ -242,7 +242,7 @@ void failedChanges() { @Disabled("adapt when adding cloud support") @DisplayName("Should send ongoing change in execution when is present in local database") void shouldSendOngoingChangeInExecutionPlan() { - String executionId = "execution-1"; + long executionId = 1L; String stageName = "stage-1"; PrototypeClientSubmission prototypeClientSubmission = new PrototypeClientSubmission( diff --git a/core/target-systems/flamingock-sql-targetsystem/src/test/java/io/flamingock/targetsystem/sql/SqlTargetSystemTest.java b/core/target-systems/flamingock-sql-targetsystem/src/test/java/io/flamingock/targetsystem/sql/SqlTargetSystemTest.java index f59d15f9a..ad6133de8 100644 --- a/core/target-systems/flamingock-sql-targetsystem/src/test/java/io/flamingock/targetsystem/sql/SqlTargetSystemTest.java +++ b/core/target-systems/flamingock-sql-targetsystem/src/test/java/io/flamingock/targetsystem/sql/SqlTargetSystemTest.java @@ -128,7 +128,7 @@ void afterEach() throws Exception { @Test @DisplayName("Should follow the transactioner lifecycle") void happyPath() { - String executionId = "execution-1"; + long executionId = 1L; String stageName = "stage-1"; PrototypeClientSubmission prototypeClientSubmission = new PrototypeClientSubmission( @@ -175,7 +175,7 @@ void happyPath() { @Test @DisplayName("Should keep the ongoing change when change fails") void failedChanges() { - String executionId = "execution-1"; + long executionId = 1L; String stageName = "stage-1"; PrototypeClientSubmission prototypeClientSubmission = new PrototypeClientSubmission( @@ -224,7 +224,7 @@ void failedChanges() { @Disabled("adapt when adding cloud support") @DisplayName("Should send ongoing change in execution when is present in local database") void shouldSendOngoingChangeInExecutionPlan() { - String executionId = "execution-1"; + long executionId = 1L; String stageName = "stage-1"; PrototypeClientSubmission prototypeClientSubmission = new PrototypeClientSubmission( diff --git a/utils/test-util/src/main/java/io/flamingock/common/test/cloud/AuditRequestExpectation.java b/utils/test-util/src/main/java/io/flamingock/common/test/cloud/AuditRequestExpectation.java index 2db90e370..c0856b283 100644 --- a/utils/test-util/src/main/java/io/flamingock/common/test/cloud/AuditRequestExpectation.java +++ b/utils/test-util/src/main/java/io/flamingock/common/test/cloud/AuditRequestExpectation.java @@ -20,9 +20,9 @@ public class AuditRequestExpectation { private final String changeId; private final CloudAuditStatus state; - private final String executionId; + private final Long executionId; - public AuditRequestExpectation(String executionId, String changeId, CloudAuditStatus state) { + public AuditRequestExpectation(Long executionId, String changeId, CloudAuditStatus state) { this.executionId = executionId; this.changeId = changeId; this.state = state; @@ -36,7 +36,7 @@ public CloudAuditStatus getState() { return state; } - public String getExecutionId() { + public Long getExecutionId() { return executionId; } } diff --git a/utils/test-util/src/main/java/io/flamingock/common/test/cloud/MockRunnerServer.java b/utils/test-util/src/main/java/io/flamingock/common/test/cloud/MockRunnerServer.java index 098352cd1..4d8e536ba 100644 --- a/utils/test-util/src/main/java/io/flamingock/common/test/cloud/MockRunnerServer.java +++ b/utils/test-util/src/main/java/io/flamingock/common/test/cloud/MockRunnerServer.java @@ -284,7 +284,7 @@ private void mockAuditWriteEndpoint() { String auditUrlTemplate = "/api/v1/environment/{environmentId}/service/{serviceId}/execution/{executionId}/change/{changeId}/audit"///{auditId}" .replace("{environmentId}", String.valueOf(environmentId)) .replace("{serviceId}", String.valueOf(serviceId)) - .replace("{executionId}", auditWrite.getExecutionId()); + .replace("{executionId}", String.valueOf(auditWrite.getExecutionId())); PrototypeChange changePrototype = getChangePrototype(auditWrite.getChangeId()); String auditUrl = auditUrlTemplate.replace("{auditId}", changePrototype.getChangeId()); diff --git a/utils/test-util/src/main/java/io/flamingock/common/test/cloud/deprecated/MockRunnerServerOld.java b/utils/test-util/src/main/java/io/flamingock/common/test/cloud/deprecated/MockRunnerServerOld.java index 44ec19997..3a0754a96 100644 --- a/utils/test-util/src/main/java/io/flamingock/common/test/cloud/deprecated/MockRunnerServerOld.java +++ b/utils/test-util/src/main/java/io/flamingock/common/test/cloud/deprecated/MockRunnerServerOld.java @@ -151,32 +151,32 @@ public MockRunnerServerOld addExecutionContinueRequestResponse(long acquiredForM } - public MockRunnerServerOld addExecutionAwaitRequestResponse(String executionId) { + public MockRunnerServerOld addExecutionAwaitRequestResponse(Long executionId) { return addExecutionAwaitRequestResponse(executionId, DEFAULT_ACQUIRED_FOR_MILLIS, DEFAULT_LOCK_ACQUISITION_ID); } - public MockRunnerServerOld addExecutionAwaitRequestResponse(String executionId, long acquiredForMillis, String acquisitionId) { + public MockRunnerServerOld addExecutionAwaitRequestResponse(Long executionId, long acquiredForMillis, String acquisitionId) { executionRequestResponses.add(new AwaitPlanRequestResponse(executionId, acquiredForMillis, acquisitionId)); return this; } - public MockRunnerServerOld addExecutionWithAllChangesRequestResponse(String executionId) { + public MockRunnerServerOld addExecutionWithAllChangesRequestResponse(Long executionId) { executionRequestResponses.add(new ExecutePlanRequestResponse(executionId, DEFAULT_ACQUIRED_FOR_MILLIS, DEFAULT_LOCK_ACQUISITION_ID)); return this; } - public MockRunnerServerOld addExecutionWithAllChangesRequestResponse(String executionId, long acquiredForMillis, String acquisitionId) { + public MockRunnerServerOld addExecutionWithAllChangesRequestResponse(Long executionId, long acquiredForMillis, String acquisitionId) { executionRequestResponses.add(new ExecutePlanRequestResponse(executionId, acquiredForMillis, acquisitionId)); return this; } - public MockRunnerServerOld addSimpleStageExecutionPlan(String executionId, String stageName, List auditEntries) { + public MockRunnerServerOld addSimpleStageExecutionPlan(Long executionId, String stageName, List auditEntries) { return addSimpleStageExecutionPlan(executionId, stageName, auditEntries, Collections.emptyList()); } - public MockRunnerServerOld addSimpleStageExecutionPlan(String executionId, String stageName, List auditEntries, List ongoingStatuses) { + public MockRunnerServerOld addSimpleStageExecutionPlan(Long executionId, String stageName, List auditEntries, List ongoingStatuses) { Map ongoingOperationByChange = ongoingStatuses.stream() .collect(Collectors.toMap(TargetSystemAuditMark::getChangeId, TargetSystemAuditMark::getOperation)); @@ -200,11 +200,11 @@ public MockRunnerServerOld addSimpleStageExecutionPlan(String executionId, Strin return this; } - public MockRunnerServerOld addMultipleStageExecutionPlan(String executionId, List stageNames, List auditEntries) { + public MockRunnerServerOld addMultipleStageExecutionPlan(Long executionId, List stageNames, List auditEntries) { return addMultipleStageExecutionPlan(executionId, stageNames, auditEntries, Collections.emptyList()); } - public MockRunnerServerOld addMultipleStageExecutionPlan(String executionId, List stageNames, List auditEntries, List ongoingStatuses) { + public MockRunnerServerOld addMultipleStageExecutionPlan(Long executionId, List stageNames, List auditEntries, List ongoingStatuses) { Map ongoingOperationByChange = ongoingStatuses.stream() .collect(Collectors.toMap(TargetSystemAuditMark::getChangeId, TargetSystemAuditMark::getOperation)); @@ -349,7 +349,7 @@ private void mockAuditWriteEndpoint() { String executionUrl = "/api/v1/environment/{environmentId}/service/{serviceId}/execution/{executionId}/change/{changeId}/audit" .replace("{environmentId}", String.valueOf(environmentId)) .replace("{serviceId}", String.valueOf(serviceId)) - .replace("{executionId}", executionExpectation.getExecutionId()); + .replace("{executionId}", String.valueOf(executionExpectation.getExecutionId())); List auditEntryExpectations = executionExpectation.getAuditEntryExpectations(); @@ -498,10 +498,10 @@ long getAcquiredForMillis() { private static class AwaitPlanRequestResponse extends ExecutionPlanRequestResponse { - private final String executionId; + private final Long executionId; private final String acquisitionId; - AwaitPlanRequestResponse(String executionId, long acquiredForMillis, String acquisitionId) { + AwaitPlanRequestResponse(Long executionId, long acquiredForMillis, String acquisitionId) { super(acquiredForMillis); this.acquisitionId = acquisitionId; this.executionId = executionId; @@ -511,7 +511,7 @@ public String getAcquisitionId() { return acquisitionId; } - public String getExecutionId() { + public Long getExecutionId() { return executionId; } } @@ -519,10 +519,10 @@ public String getExecutionId() { private static class ExecutePlanRequestResponse extends ExecutionPlanRequestResponse { - private final String executionId; + private final Long executionId; private final String acquisitionId; - ExecutePlanRequestResponse(String executionId, long acquiredForMillis, String acquisitionId) { + ExecutePlanRequestResponse(Long executionId, long acquiredForMillis, String acquisitionId) { super(acquiredForMillis); this.acquisitionId = acquisitionId; this.executionId = executionId; @@ -532,7 +532,7 @@ public String getAcquisitionId() { return acquisitionId; } - public String getExecutionId() { + public Long getExecutionId() { return executionId; } } @@ -545,13 +545,13 @@ private static class ContinuePlanRequestResponse extends ExecutionPlanRequestRes } private static class ExecutionExpectation { - private final String executionId; + private final Long executionId; private final List stageRequest; private final List auditEntryExpectations; private final long elapsedMillis; private final long acquiredForMillis; - public ExecutionExpectation(String executionId, List stageRequest, List auditEntryExpectations, long acquiredForMillis, long elapsedMillis) { + public ExecutionExpectation(Long executionId, List stageRequest, List auditEntryExpectations, long acquiredForMillis, long elapsedMillis) { this.executionId = executionId; this.stageRequest = stageRequest; this.auditEntryExpectations = auditEntryExpectations; @@ -559,7 +559,7 @@ public ExecutionExpectation(String executionId, List stageRequest, this.elapsedMillis = elapsedMillis; } - public String getExecutionId() { + public Long getExecutionId() { return executionId; } diff --git a/utils/test-util/src/main/java/io/flamingock/common/test/cloud/execution/ExecutionAwaitRequestResponseMock.java b/utils/test-util/src/main/java/io/flamingock/common/test/cloud/execution/ExecutionAwaitRequestResponseMock.java index 5e9af7d77..d82fae0af 100644 --- a/utils/test-util/src/main/java/io/flamingock/common/test/cloud/execution/ExecutionAwaitRequestResponseMock.java +++ b/utils/test-util/src/main/java/io/flamingock/common/test/cloud/execution/ExecutionAwaitRequestResponseMock.java @@ -21,11 +21,11 @@ public class ExecutionAwaitRequestResponseMock extends ExecutionBaseRequestResponseMock { - public ExecutionAwaitRequestResponseMock(String executionId, MockRequestResponseChange... stages) { + public ExecutionAwaitRequestResponseMock(Long executionId, MockRequestResponseChange... stages) { this(executionId, MockRunnerServer.DEFAULT_ACQUIRED_FOR_MILLIS, MockRunnerServer.DEFAULT_LOCK_ACQUISITION_ID, stages); } - public ExecutionAwaitRequestResponseMock(String executionId, long acquiredForMillis, String acquisitionId, MockRequestResponseChange... stages) { + public ExecutionAwaitRequestResponseMock(Long executionId, long acquiredForMillis, String acquisitionId, MockRequestResponseChange... stages) { super(executionId, acquiredForMillis, acquisitionId, stages); } } diff --git a/utils/test-util/src/main/java/io/flamingock/common/test/cloud/execution/ExecutionBaseRequestResponseMock.java b/utils/test-util/src/main/java/io/flamingock/common/test/cloud/execution/ExecutionBaseRequestResponseMock.java index d7db17825..67c3b4660 100644 --- a/utils/test-util/src/main/java/io/flamingock/common/test/cloud/execution/ExecutionBaseRequestResponseMock.java +++ b/utils/test-util/src/main/java/io/flamingock/common/test/cloud/execution/ExecutionBaseRequestResponseMock.java @@ -24,12 +24,12 @@ public class ExecutionBaseRequestResponseMock { - private final String executionId; + private final Long executionId; private final long acquiredForMillis; private final String acquisitionId; private final List changes; - public ExecutionBaseRequestResponseMock(String executionId, + public ExecutionBaseRequestResponseMock(Long executionId, long acquiredForMillis, String acquisitionId, MockRequestResponseChange...changes) { @@ -39,7 +39,7 @@ public ExecutionBaseRequestResponseMock(String executionId, this.changes = Arrays.asList(changes); } - public String getExecutionId() { + public Long getExecutionId() { return executionId; } diff --git a/utils/test-util/src/main/java/io/flamingock/common/test/cloud/execution/ExecutionPlanRequestResponseMock.java b/utils/test-util/src/main/java/io/flamingock/common/test/cloud/execution/ExecutionPlanRequestResponseMock.java index d88807fd0..ff95c956e 100644 --- a/utils/test-util/src/main/java/io/flamingock/common/test/cloud/execution/ExecutionPlanRequestResponseMock.java +++ b/utils/test-util/src/main/java/io/flamingock/common/test/cloud/execution/ExecutionPlanRequestResponseMock.java @@ -21,12 +21,12 @@ public class ExecutionPlanRequestResponseMock extends ExecutionBaseRequestResponseMock { - public ExecutionPlanRequestResponseMock(String executionId, MockRequestResponseChange... stages) { + public ExecutionPlanRequestResponseMock(Long executionId, MockRequestResponseChange... stages) { this(executionId, MockRunnerServer.DEFAULT_ACQUIRED_FOR_MILLIS, MockRunnerServer.DEFAULT_LOCK_ACQUISITION_ID, stages); } - public ExecutionPlanRequestResponseMock(String executionId, + public ExecutionPlanRequestResponseMock(Long executionId, long acquiredForMillis, String acquisitionId, MockRequestResponseChange... stages) { diff --git a/utils/test-util/src/main/java/io/flamingock/common/test/cloud/mock/MockExecutionPlanBuilder.java b/utils/test-util/src/main/java/io/flamingock/common/test/cloud/mock/MockExecutionPlanBuilder.java index 91389ae88..2763444c5 100644 --- a/utils/test-util/src/main/java/io/flamingock/common/test/cloud/mock/MockExecutionPlanBuilder.java +++ b/utils/test-util/src/main/java/io/flamingock/common/test/cloud/mock/MockExecutionPlanBuilder.java @@ -77,7 +77,7 @@ public ExecutionPlanRequest getRequest(ExecutionBaseRequestResponseMock requestR } public ExecutionPlanResponse getResponse(ExecutionBaseRequestResponseMock mockRequestResponse) { - String executionId = mockRequestResponse.getExecutionId(); + Long executionId = mockRequestResponse.getExecutionId(); if (mockRequestResponse instanceof ExecutionPlanRequestResponseMock) { List stages = clientSubmission .getStages()