From 038ce88a4d7a69db4b73946f79f5708755bb5928 Mon Sep 17 00:00:00 2001 From: serdimic Date: Fri, 20 Dec 2024 11:53:35 +0100 Subject: [PATCH] P4ADEV-1781 minor fixes --- .../pagopa/pu/organization/controller/BrokerController.java | 2 +- .../service/{ => broker}/BrokerEncryptionService.java | 5 ++--- .../pu/organization/service/{ => broker}/BrokerService.java | 2 +- .../service/{ => broker}/BrokerEncryptionServiceTest.java | 2 +- .../organization/service/{ => broker}/BrokerServiceTest.java | 2 +- 5 files changed, 6 insertions(+), 7 deletions(-) rename src/main/java/it/gov/pagopa/pu/organization/service/{ => broker}/BrokerEncryptionService.java (91%) rename src/main/java/it/gov/pagopa/pu/organization/service/{ => broker}/BrokerService.java (94%) rename src/test/java/it/gov/pagopa/pu/organization/service/{ => broker}/BrokerEncryptionServiceTest.java (98%) rename src/test/java/it/gov/pagopa/pu/organization/service/{ => broker}/BrokerServiceTest.java (98%) diff --git a/src/main/java/it/gov/pagopa/pu/organization/controller/BrokerController.java b/src/main/java/it/gov/pagopa/pu/organization/controller/BrokerController.java index d683fa1..4d9edee 100644 --- a/src/main/java/it/gov/pagopa/pu/organization/controller/BrokerController.java +++ b/src/main/java/it/gov/pagopa/pu/organization/controller/BrokerController.java @@ -2,7 +2,7 @@ import it.gov.pagopa.pu.organization.controller.generated.BrokerApi; import it.gov.pagopa.pu.organization.dto.generated.BrokerApiKeys; -import it.gov.pagopa.pu.organization.service.BrokerService; +import it.gov.pagopa.pu.organization.service.broker.BrokerService; import lombok.extern.slf4j.Slf4j; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.RestController; diff --git a/src/main/java/it/gov/pagopa/pu/organization/service/BrokerEncryptionService.java b/src/main/java/it/gov/pagopa/pu/organization/service/broker/BrokerEncryptionService.java similarity index 91% rename from src/main/java/it/gov/pagopa/pu/organization/service/BrokerEncryptionService.java rename to src/main/java/it/gov/pagopa/pu/organization/service/broker/BrokerEncryptionService.java index 7f5d325..5488eff 100644 --- a/src/main/java/it/gov/pagopa/pu/organization/service/BrokerEncryptionService.java +++ b/src/main/java/it/gov/pagopa/pu/organization/service/broker/BrokerEncryptionService.java @@ -8,9 +8,8 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; -import java.util.Collections; -import java.util.HashMap; import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; @Service @Slf4j @@ -23,7 +22,7 @@ public BrokerEncryptionService( this.brokerEncryptPassword = brokerEncryptPassword; } - private final Map apiKeyDecryptMap = Collections.synchronizedMap(new HashMap<>()); + private final Map apiKeyDecryptMap = new ConcurrentHashMap<>(); public BrokerApiKeys getBrokerDecryptedApiKeys(Broker broker){ return BrokerApiKeys.builder() diff --git a/src/main/java/it/gov/pagopa/pu/organization/service/BrokerService.java b/src/main/java/it/gov/pagopa/pu/organization/service/broker/BrokerService.java similarity index 94% rename from src/main/java/it/gov/pagopa/pu/organization/service/BrokerService.java rename to src/main/java/it/gov/pagopa/pu/organization/service/broker/BrokerService.java index dbc4b98..d112d6f 100644 --- a/src/main/java/it/gov/pagopa/pu/organization/service/BrokerService.java +++ b/src/main/java/it/gov/pagopa/pu/organization/service/broker/BrokerService.java @@ -1,4 +1,4 @@ -package it.gov.pagopa.pu.organization.service; +package it.gov.pagopa.pu.organization.service.broker; import it.gov.pagopa.pu.organization.dto.generated.BrokerApiKeys; import it.gov.pagopa.pu.organization.model.Broker; diff --git a/src/test/java/it/gov/pagopa/pu/organization/service/BrokerEncryptionServiceTest.java b/src/test/java/it/gov/pagopa/pu/organization/service/broker/BrokerEncryptionServiceTest.java similarity index 98% rename from src/test/java/it/gov/pagopa/pu/organization/service/BrokerEncryptionServiceTest.java rename to src/test/java/it/gov/pagopa/pu/organization/service/broker/BrokerEncryptionServiceTest.java index 5123ce9..92a60cc 100644 --- a/src/test/java/it/gov/pagopa/pu/organization/service/BrokerEncryptionServiceTest.java +++ b/src/test/java/it/gov/pagopa/pu/organization/service/broker/BrokerEncryptionServiceTest.java @@ -1,4 +1,4 @@ -package it.gov.pagopa.pu.organization.service; +package it.gov.pagopa.pu.organization.service.broker; import it.gov.pagopa.pu.organization.dto.generated.BrokerApiKeys; import it.gov.pagopa.pu.organization.model.Broker; diff --git a/src/test/java/it/gov/pagopa/pu/organization/service/BrokerServiceTest.java b/src/test/java/it/gov/pagopa/pu/organization/service/broker/BrokerServiceTest.java similarity index 98% rename from src/test/java/it/gov/pagopa/pu/organization/service/BrokerServiceTest.java rename to src/test/java/it/gov/pagopa/pu/organization/service/broker/BrokerServiceTest.java index e14408e..11ffe55 100644 --- a/src/test/java/it/gov/pagopa/pu/organization/service/BrokerServiceTest.java +++ b/src/test/java/it/gov/pagopa/pu/organization/service/broker/BrokerServiceTest.java @@ -1,4 +1,4 @@ -package it.gov.pagopa.pu.organization.service; +package it.gov.pagopa.pu.organization.service.broker; import it.gov.pagopa.pu.organization.dto.generated.BrokerApiKeys; import it.gov.pagopa.pu.organization.model.Broker;