diff --git a/apps/onboarding-ms/src/main/java/it/pagopa/selfcare/onboarding/controller/OnboardingController.java b/apps/onboarding-ms/src/main/java/it/pagopa/selfcare/onboarding/controller/OnboardingController.java index b8055f54..227eb793 100644 --- a/apps/onboarding-ms/src/main/java/it/pagopa/selfcare/onboarding/controller/OnboardingController.java +++ b/apps/onboarding-ms/src/main/java/it/pagopa/selfcare/onboarding/controller/OnboardingController.java @@ -224,7 +224,7 @@ public Uni onboardingPaCompletion(@Valid OnboardingPaRequest public Uni onboardingPaImport(@Valid OnboardingImportRequest onboardingRequest, @Context SecurityContext ctx) { return readUserIdFromToken(ctx) .onItem().transformToUni(userId -> onboardingService - .onboardingImport(fillUserId(onboardingMapper.toEntity(onboardingRequest), userId), onboardingRequest.getUsers(), onboardingRequest.getContractImported(), onboardingRequest.isForceImport())); + .onboardingImport(fillUserId(onboardingMapper.toEntity(onboardingRequest), userId), onboardingRequest.getUsers(), onboardingRequest.getContractImported())); } @Operation( @@ -238,7 +238,7 @@ public Uni onboardingPaImport(@Valid OnboardingImportRequest public Uni onboardingPspImport(@Valid OnboardingImportPspRequest onboardingRequest, @Context SecurityContext ctx) { return readUserIdFromToken(ctx) .onItem().transformToUni(userId -> onboardingService - .onboardingImport(fillUserId(onboardingMapper.toEntity(onboardingRequest), userId), List.of(), onboardingRequest.getContractImported(), false)); + .onboardingImport(fillUserId(onboardingMapper.toEntity(onboardingRequest), userId), List.of(), onboardingRequest.getContractImported())); } @Operation( diff --git a/apps/onboarding-ms/src/main/java/it/pagopa/selfcare/onboarding/service/OnboardingService.java b/apps/onboarding-ms/src/main/java/it/pagopa/selfcare/onboarding/service/OnboardingService.java index 0b41dcca..8cf42459 100644 --- a/apps/onboarding-ms/src/main/java/it/pagopa/selfcare/onboarding/service/OnboardingService.java +++ b/apps/onboarding-ms/src/main/java/it/pagopa/selfcare/onboarding/service/OnboardingService.java @@ -30,8 +30,7 @@ Uni onboardingUsers( Uni onboardingImport( Onboarding onboarding, List userRequests, - OnboardingImportContract contractImported, - boolean forceImport); + OnboardingImportContract contractImported); Uni onboardingCompletion( Onboarding onboarding, List userRequests); diff --git a/apps/onboarding-ms/src/main/java/it/pagopa/selfcare/onboarding/service/OnboardingServiceDefault.java b/apps/onboarding-ms/src/main/java/it/pagopa/selfcare/onboarding/service/OnboardingServiceDefault.java index 1e3e28e3..967658e4 100644 --- a/apps/onboarding-ms/src/main/java/it/pagopa/selfcare/onboarding/service/OnboardingServiceDefault.java +++ b/apps/onboarding-ms/src/main/java/it/pagopa/selfcare/onboarding/service/OnboardingServiceDefault.java @@ -300,7 +300,7 @@ public Uni onboardingAggregationImport( onboarding.setStatus(OnboardingStatus.PENDING); return fillUsersAndOnboardingForImport( - onboarding, userRequests, aggregates, contractImported, TIMEOUT_ORCHESTRATION_RESPONSE, false); + onboarding, userRequests, aggregates, contractImported); } @@ -311,11 +311,11 @@ public Uni onboardingAggregationImport( public Uni onboardingImport( Onboarding onboarding, List userRequests, - OnboardingImportContract contractImported, boolean forceImport) { + OnboardingImportContract contractImported) { onboarding.setWorkflowType(WorkflowType.IMPORT); onboarding.setStatus(OnboardingStatus.PENDING); return fillUsersAndOnboardingForImport( - onboarding, userRequests, null, contractImported, TIMEOUT_ORCHESTRATION_RESPONSE, forceImport); + onboarding, userRequests, null, contractImported); } /** @@ -452,15 +452,18 @@ private Uni verifyExistingOnboarding( } /** - * @param timeout The orchestration instances will try complete within the defined timeout and the response is delivered synchronously. If is null - * the timeout is default 1 sec and the response is delivered asynchronously + * + * @param onboarding + * @param userRequests + * @param aggregateRequests + * @param contractImported + * @return OnboardingResponse */ private Uni fillUsersAndOnboardingForImport( Onboarding onboarding, List userRequests, List aggregateRequests, - OnboardingImportContract contractImported, - String timeout, boolean forceImport) { + OnboardingImportContract contractImported) { onboarding.setCreatedAt(LocalDateTime.now()); @@ -509,7 +512,7 @@ private Uni fillUsersAndOnboardingForImport( persistAndStartOrchestrationOnboarding( currentOnboarding, orchestrationApi.apiStartOnboardingOrchestrationGet( - currentOnboarding.getId(), timeout))) + currentOnboarding.getId(), TIMEOUT_ORCHESTRATION_RESPONSE))) .onItem() .transform(onboardingMapper::toResponse)); } diff --git a/apps/onboarding-ms/src/test/java/it/pagopa/selfcare/onboarding/controller/OnboardingControllerTest.java b/apps/onboarding-ms/src/test/java/it/pagopa/selfcare/onboarding/controller/OnboardingControllerTest.java index 0b06b764..1a8d5d77 100644 --- a/apps/onboarding-ms/src/test/java/it/pagopa/selfcare/onboarding/controller/OnboardingControllerTest.java +++ b/apps/onboarding-ms/src/test/java/it/pagopa/selfcare/onboarding/controller/OnboardingControllerTest.java @@ -8,7 +8,6 @@ import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.anyBoolean; import static org.mockito.Mockito.anyString; import static org.mockito.Mockito.eq; import static org.mockito.Mockito.times; @@ -763,7 +762,7 @@ void onboardingImport() { OnboardingImportRequest onboardingImportRequest = dummyOnboardingImport(); - Mockito.when(onboardingService.onboardingImport(any(), any(), any(), anyBoolean())) + Mockito.when(onboardingService.onboardingImport(any(), any(), any())) .thenReturn(Uni.createFrom().item(new OnboardingResponse())); given() @@ -775,7 +774,7 @@ void onboardingImport() { .statusCode(200); Mockito.verify(onboardingService, times(1)) - .onboardingImport(any(), any(), any(), anyBoolean()); + .onboardingImport(any(), any(), any()); } @Test @@ -797,7 +796,7 @@ void onboardingImportPSP() { OnboardingImportPspRequest onboardingImportRequest = dummyOnboardingPspRequest(); - Mockito.when(onboardingService.onboardingImport(any(), any(), any(), anyBoolean())) + Mockito.when(onboardingService.onboardingImport(any(), any(), any())) .thenReturn(Uni.createFrom().item(new OnboardingResponse())); given() @@ -809,7 +808,7 @@ void onboardingImportPSP() { .statusCode(200); Mockito.verify(onboardingService, times(1)) - .onboardingImport(any(), any(), any(), anyBoolean()); + .onboardingImport(any(), any(), any()); } @Test @@ -819,7 +818,7 @@ void onboardingImportPSP_with_activatedAt() { OnboardingImportPspRequest onboardingImportRequest = dummyOnboardingPspRequest(); onboardingImportRequest.getContractImported().setActivatedAt(LocalDateTime.now()); - Mockito.when(onboardingService.onboardingImport(any(), any(), any(), anyBoolean())) + Mockito.when(onboardingService.onboardingImport(any(), any(), any())) .thenReturn(Uni.createFrom().item(new OnboardingResponse())); given() @@ -831,7 +830,7 @@ void onboardingImportPSP_with_activatedAt() { .statusCode(200); Mockito.verify(onboardingService, times(1)) - .onboardingImport(any(), any(), any(), anyBoolean()); + .onboardingImport(any(), any(), any()); } @Test diff --git a/apps/onboarding-ms/src/test/java/it/pagopa/selfcare/onboarding/service/OnboardingServiceDefaultTest.java b/apps/onboarding-ms/src/test/java/it/pagopa/selfcare/onboarding/service/OnboardingServiceDefaultTest.java index 3ee7545f..ff5b7b4f 100644 --- a/apps/onboarding-ms/src/test/java/it/pagopa/selfcare/onboarding/service/OnboardingServiceDefaultTest.java +++ b/apps/onboarding-ms/src/test/java/it/pagopa/selfcare/onboarding/service/OnboardingServiceDefaultTest.java @@ -2091,7 +2091,7 @@ void onboarding_Onboarding_importPA(UniAsserter asserter) { asserter.execute(() -> when(geographicTaxonomiesApi.retrieveGeoTaxonomiesByCodeUsingGET(any())) .thenReturn(Uni.createFrom().item(geographicTaxonomyResource))); - asserter.assertThat(() -> onboardingService.onboardingImport(request, users, contractImported, false), Assertions::assertNotNull); + asserter.assertThat(() -> onboardingService.onboardingImport(request, users, contractImported), Assertions::assertNotNull); asserter.execute(() -> { PanacheMock.verify(Onboarding.class).persist(any(Onboarding.class), any()); @@ -2128,7 +2128,7 @@ void onboarding_Onboarding_importPSP(UniAsserter asserter) { mockVerifyOnboardingNotFound(); mockVerifyAllowedMap(request.getInstitution().getTaxCode(), request.getProductId(), asserter); - asserter.assertThat(() -> onboardingService.onboardingImport(request, List.of(), contractImported, false), Assertions::assertNotNull); + asserter.assertThat(() -> onboardingService.onboardingImport(request, List.of(), contractImported), Assertions::assertNotNull); asserter.execute(() -> { PanacheMock.verify(Onboarding.class).persist(any(Onboarding.class), any());