From b1c7419703bcdfab0f7b8cfa4288eef3efac9cab Mon Sep 17 00:00:00 2001 From: "pierpaolo.didato@emeal.nttdata.com" Date: Fri, 20 Dec 2024 07:42:44 +0100 Subject: [PATCH] Fix get contract --- .../selfcare/onboarding/service/ContractServiceDefault.java | 3 +-- .../selfcare/onboarding/service/TokenServiceDefault.java | 3 +-- .../selfcare/onboarding/service/TokenServiceDefaultTest.java | 5 ++--- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/apps/onboarding-functions/src/main/java/it/pagopa/selfcare/onboarding/service/ContractServiceDefault.java b/apps/onboarding-functions/src/main/java/it/pagopa/selfcare/onboarding/service/ContractServiceDefault.java index 2a6719be..8043fe75 100644 --- a/apps/onboarding-functions/src/main/java/it/pagopa/selfcare/onboarding/service/ContractServiceDefault.java +++ b/apps/onboarding-functions/src/main/java/it/pagopa/selfcare/onboarding/service/ContractServiceDefault.java @@ -51,7 +51,6 @@ import java.util.Arrays; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Optional; import java.util.UUID; import java.util.function.Function; @@ -423,7 +422,7 @@ public File retrieveAttachment(OnboardingAttachment onboardingAttachment, String @Override public Optional getLogoFile() { - if (Objects.nonNull(isLogoEnable) && isLogoEnable) { + if (Boolean.TRUE.equals(isLogoEnable)) { StringBuilder stringBuilder = new StringBuilder( diff --git a/apps/onboarding-ms/src/main/java/it/pagopa/selfcare/onboarding/service/TokenServiceDefault.java b/apps/onboarding-ms/src/main/java/it/pagopa/selfcare/onboarding/service/TokenServiceDefault.java index d474f8bf..f117c261 100644 --- a/apps/onboarding-ms/src/main/java/it/pagopa/selfcare/onboarding/service/TokenServiceDefault.java +++ b/apps/onboarding-ms/src/main/java/it/pagopa/selfcare/onboarding/service/TokenServiceDefault.java @@ -39,8 +39,7 @@ public Uni> getToken(String onboardingId) { } @Override public Uni> retrieveContractNotSigned(String onboardingId) { - return Token.find("onboardingId = ?1 and type = ?2", onboardingId, INSTITUTION.name()) - .firstResult() + return Token.findById(onboardingId) .map(Token.class::cast) .onItem().transformToUni(token -> Uni.createFrom().item(() -> azureBlobClient.getFileAsPdf(String.format("%s%s/%s", onboardingMsConfig.getContractPath(), onboardingId, token.getContractFilename()))) diff --git a/apps/onboarding-ms/src/test/java/it/pagopa/selfcare/onboarding/service/TokenServiceDefaultTest.java b/apps/onboarding-ms/src/test/java/it/pagopa/selfcare/onboarding/service/TokenServiceDefaultTest.java index 25f2f1a2..d08c6040 100644 --- a/apps/onboarding-ms/src/test/java/it/pagopa/selfcare/onboarding/service/TokenServiceDefaultTest.java +++ b/apps/onboarding-ms/src/test/java/it/pagopa/selfcare/onboarding/service/TokenServiceDefaultTest.java @@ -62,11 +62,10 @@ void retrieveContractNotSigned() { token.setContractFilename("fileName"); token.setType(TokenType.INSTITUTION); ReactivePanacheQuery queryPage = mock(ReactivePanacheQuery.class); - when(queryPage.firstResult()).thenReturn(Uni.createFrom().item(token)); PanacheMock.mock(Token.class); - when(Token.find("onboardingId = ?1 and type = ?2", onboardingId, INSTITUTION.name())) - .thenReturn(queryPage); + when(Token.findById(onboardingId)) + .thenReturn(Uni.createFrom().item(token)); when(azureBlobClient.getFileAsPdf(anyString())).thenReturn(new File("fileName"));