diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 5659cd71..4ba4da6f 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -88,7 +88,6 @@ object Dependencies { namespace %% "interop-be-authorization-management-client" % authorizationManagementVersion lazy val commonsUtils = namespace %% "interop-commons-utils" % commonsVersion - lazy val fileManager = namespace %% "interop-commons-file-manager" % commonsVersion lazy val commonsJWT = namespace %% "interop-commons-jwt" % commonsVersion lazy val commonsCqrs = namespace %% "interop-commons-cqrs" % commonsVersion lazy val riskAnalysis = namespace %% "interop-commons-risk-analysis" % commonsVersion @@ -120,7 +119,6 @@ object Dependencies { pagopa.authorizationManagementClient % Compile, pagopa.tenantManagementModels % Compile, pagopa.commonsUtils % Compile, - pagopa.fileManager % Compile, pagopa.commonsJWT % Compile, pagopa.commonsCqrs % Compile, pagopa.riskAnalysis % Compile, diff --git a/src/main/resources/application-standalone.conf b/src/main/resources/application-standalone.conf index a1c52877..b6a501ae 100644 --- a/src/main/resources/application-standalone.conf +++ b/src/main/resources/application-standalone.conf @@ -29,10 +29,6 @@ catalog-process { jwt { audience = ${ACCEPTED_AUDIENCES} } - storage { - kind = "file" - container = "local" - } read-model { db { diff --git a/src/main/resources/application.conf b/src/main/resources/application.conf index bafe8c81..ca8e9feb 100644 --- a/src/main/resources/application.conf +++ b/src/main/resources/application.conf @@ -29,11 +29,7 @@ catalog-process { jwt { audience = ${ACCEPTED_AUDIENCES} } - storage { - kind = "S3" - container = ${STORAGE_CONTAINER} - } - + read-model { db { name = ${READ_MODEL_DB_NAME} diff --git a/src/main/scala/it/pagopa/interop/catalogprocess/api/impl/ProcessApiServiceImpl.scala b/src/main/scala/it/pagopa/interop/catalogprocess/api/impl/ProcessApiServiceImpl.scala index 638c21d0..59498d53 100644 --- a/src/main/scala/it/pagopa/interop/catalogprocess/api/impl/ProcessApiServiceImpl.scala +++ b/src/main/scala/it/pagopa/interop/catalogprocess/api/impl/ProcessApiServiceImpl.scala @@ -27,7 +27,6 @@ import it.pagopa.interop.catalogprocess.errors.CatalogProcessErrors._ import it.pagopa.interop.catalogprocess.model._ import it.pagopa.interop.catalogprocess.service._ import it.pagopa.interop.commons.cqrs.service.ReadModelService -import it.pagopa.interop.commons.files.service.FileManager import it.pagopa.interop.commons.jwt._ import it.pagopa.interop.commons.logging.{CanLogContextFields, ContextFieldsToLog} import it.pagopa.interop.commons.riskanalysis.api.impl.RiskAnalysisValidation @@ -46,8 +45,7 @@ final case class ProcessApiServiceImpl( agreementManagementService: AgreementManagementService, authorizationManagementService: AuthorizationManagementService, attributeRegistryManagementService: AttributeRegistryManagementService, - tenantManagementService: TenantManagementService, - fileManager: FileManager + tenantManagementService: TenantManagementService )(implicit ec: ExecutionContext, readModel: ReadModelService) extends ProcessApiService { diff --git a/src/main/scala/it/pagopa/interop/catalogprocess/common/system/ApplicationConfiguration.scala b/src/main/scala/it/pagopa/interop/catalogprocess/common/system/ApplicationConfiguration.scala index ea6b36cc..f8006509 100644 --- a/src/main/scala/it/pagopa/interop/catalogprocess/common/system/ApplicationConfiguration.scala +++ b/src/main/scala/it/pagopa/interop/catalogprocess/common/system/ApplicationConfiguration.scala @@ -13,10 +13,6 @@ object ApplicationConfiguration { val jwtAudience: Set[String] = config.getString("catalog-process.jwt.audience").split(",").toSet.filter(_.nonEmpty) - val storageKind: String = config.getString("catalog-process.storage.kind") - - val storageContainer: String = config.getString("catalog-process.storage.container") - val readModelConfig: ReadModelConfig = { val connectionString: String = config.getString("catalog-process.read-model.db.connection-string") val dbName: String = config.getString("catalog-process.read-model.db.name") diff --git a/src/main/scala/it/pagopa/interop/catalogprocess/server/impl/Dependencies.scala b/src/main/scala/it/pagopa/interop/catalogprocess/server/impl/Dependencies.scala index 539c8606..89c58306 100644 --- a/src/main/scala/it/pagopa/interop/catalogprocess/server/impl/Dependencies.scala +++ b/src/main/scala/it/pagopa/interop/catalogprocess/server/impl/Dependencies.scala @@ -22,7 +22,6 @@ import it.pagopa.interop.catalogprocess.api.impl.ResponseHandlers.serviceCode import it.pagopa.interop.catalogprocess.service._ import it.pagopa.interop.catalogprocess.service.impl._ import it.pagopa.interop.commons.cqrs.service.{MongoDbReadModelService, ReadModelService} -import it.pagopa.interop.commons.files.service.FileManager import it.pagopa.interop.commons.jwt.service.JWTReader import it.pagopa.interop.commons.jwt.service.impl.{DefaultJWTReader, getClaimsVerifier} import it.pagopa.interop.commons.jwt.{JWTConfiguration, KID, PublicKeysHolder, SerializedKey} @@ -39,13 +38,6 @@ trait Dependencies { implicit val loggerTI: LoggerTakingImplicit[ContextFieldsToLog] = Logger.takingImplicit[ContextFieldsToLog]("OAuth2JWTValidatorAsContexts") - def getFileManager(blockingEc: ExecutionContextExecutor): FileManager = - FileManager.get(ApplicationConfiguration.storageKind match { - case "S3" => FileManager.S3 - case "file" => FileManager.File - case _ => throw new Exception("Incorrect File Manager") - })(blockingEc) - def getJwtReader(): Future[JWTReader] = JWTConfiguration.jwtReader .loadKeyset() .map(keyset => @@ -61,7 +53,7 @@ trait Dependencies { ApplicationConfiguration.readModelConfig ) - def processApi(jwtReader: JWTReader, fileManager: FileManager, blockingEc: ExecutionContextExecutor)(implicit + def processApi(jwtReader: JWTReader, blockingEc: ExecutionContextExecutor)(implicit ec: ExecutionContext, actorSystem: ActorSystem[_] ): ProcessApi = @@ -71,7 +63,6 @@ trait Dependencies { agreementManagementService = AgreementManagementServiceImpl, authorizationManagementService = authorizationManagementService(blockingEc), attributeRegistryManagementService = AttributeRegistryManagementServiceImpl, - fileManager = fileManager, tenantManagementService = TenantManagementServiceImpl ), ProcessApiMarshallerImpl, diff --git a/src/main/scala/it/pagopa/interop/catalogprocess/server/impl/Main.scala b/src/main/scala/it/pagopa/interop/catalogprocess/server/impl/Main.scala index be00ebdd..3a26bd65 100644 --- a/src/main/scala/it/pagopa/interop/catalogprocess/server/impl/Main.scala +++ b/src/main/scala/it/pagopa/interop/catalogprocess/server/impl/Main.scala @@ -32,12 +32,9 @@ object Main extends App with CORSSupport with Dependencies { val serverBinding: Future[Http.ServerBinding] = for { jwtReader <- getJwtReader() - fileManager = getFileManager(blockingEc) - controller = new Controller( - healthApi, - processApi(jwtReader, fileManager, blockingEc), - validationExceptionToRoute.some - )(actorSystem.classicSystem) + controller = new Controller(healthApi, processApi(jwtReader, blockingEc), validationExceptionToRoute.some)( + actorSystem.classicSystem + ) binding <- Http().newServerAt("0.0.0.0", ApplicationConfiguration.serverPort).bind(corsHandler(controller.routes)) } yield binding diff --git a/src/test/resources/application-test.conf b/src/test/resources/application-test.conf index dd8c9dd3..b739ae18 100644 --- a/src/test/resources/application-test.conf +++ b/src/test/resources/application-test.conf @@ -7,5 +7,4 @@ akka { catalog-process { url = "http://localhost:18088/catalog-process" port = 18088 - storage.kind = "file" } \ No newline at end of file diff --git a/src/test/scala/it/pagopa/interop/catalogprocess/SpecHelper.scala b/src/test/scala/it/pagopa/interop/catalogprocess/SpecHelper.scala index e437da67..a757b41a 100644 --- a/src/test/scala/it/pagopa/interop/catalogprocess/SpecHelper.scala +++ b/src/test/scala/it/pagopa/interop/catalogprocess/SpecHelper.scala @@ -7,7 +7,6 @@ import org.scalamock.scalatest.MockFactory import com.typesafe.config.{Config, ConfigFactory} import it.pagopa.interop.commons.cqrs.service.ReadModelService -import it.pagopa.interop.commons.files.service.FileManager import it.pagopa.interop.catalogprocess.service._ import it.pagopa.interop.catalogprocess.model._ import it.pagopa.interop.catalogprocess.api.ProcessApiService @@ -24,7 +23,6 @@ trait SpecHelper extends SprayJsonSupport with DefaultJsonProtocol with MockFact .resolve() implicit val mockReadModel: ReadModelService = mock[ReadModelService] - val mockfileManager: FileManager = mock[FileManager] val mockAuthorizationManagementService: AuthorizationManagementService = mock[AuthorizationManagementService] val mockCatalogManagementService: CatalogManagementService = mock[CatalogManagementService] val mockAgreementManagementService: AgreementManagementService = mock[AgreementManagementService] @@ -37,8 +35,7 @@ trait SpecHelper extends SprayJsonSupport with DefaultJsonProtocol with MockFact mockAgreementManagementService, mockAuthorizationManagementService, mockAttributeRegistryManagementService, - mockTenantManagementService, - mockfileManager + mockTenantManagementService )(ExecutionContext.global, mockReadModel) implicit def fromResponseUnmarshallerProblem: FromEntityUnmarshaller[Problem] = diff --git a/src/test/scala/it/pagopa/interop/catalogprocess/authz/ProcessApiAuthzSpec.scala b/src/test/scala/it/pagopa/interop/catalogprocess/authz/ProcessApiAuthzSpec.scala index 91c344ca..bab386cb 100644 --- a/src/test/scala/it/pagopa/interop/catalogprocess/authz/ProcessApiAuthzSpec.scala +++ b/src/test/scala/it/pagopa/interop/catalogprocess/authz/ProcessApiAuthzSpec.scala @@ -9,12 +9,12 @@ import it.pagopa.interop.catalogprocess.util.FakeDependencies._ import it.pagopa.interop.catalogprocess.util.{AuthorizedRoutes, AuthzScalatestRouteTest} import it.pagopa.interop.commons.cqrs.service.{ReadModelService, MongoDbReadModelService} import it.pagopa.interop.commons.cqrs.model.ReadModelConfig -import it.pagopa.interop.commons.files.service.FileManager + import org.scalatest.BeforeAndAfterAll import org.scalatest.wordspec.AnyWordSpecLike import java.util.concurrent.{ExecutorService, Executors} -import scala.concurrent.{ExecutionContext, ExecutionContextExecutor} +import scala.concurrent.ExecutionContext import java.util.UUID class ProcessApiAuthzSpec extends AnyWordSpecLike with BeforeAndAfterAll with AuthzScalatestRouteTest { @@ -26,9 +26,7 @@ class ProcessApiAuthzSpec extends AnyWordSpecLike with BeforeAndAfterAll with Au new FakeAttributeRegistryManagementService() val fakeTenantManagementService: TenantManagementService = new FakeTenantManagementService() private val threadPool: ExecutorService = Executors.newSingleThreadExecutor() - private val blockingEc: ExecutionContextExecutor = ExecutionContext.fromExecutorService(threadPool) - val fakeFileManager: FileManager = FileManager.get(FileManager.File)(blockingEc) - implicit val fakeReadModel: ReadModelService = new MongoDbReadModelService( + implicit val fakeReadModel: ReadModelService = new MongoDbReadModelService( ReadModelConfig( "mongodb://localhost/?socketTimeoutMS=1&serverSelectionTimeoutMS=1&connectTimeoutMS=1&&autoReconnect=false&keepAlive=false", "db" @@ -43,8 +41,7 @@ class ProcessApiAuthzSpec extends AnyWordSpecLike with BeforeAndAfterAll with Au fakeAgreementManagementService, fakeAuthorizationManagementService, fakeAttributeRegistryManagementService, - fakeTenantManagementService, - fakeFileManager + fakeTenantManagementService )(ExecutionContext.global, fakeReadModel) "E-Service api operation authorization spec" should {