generated from pagopa/pagopa-functions-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor: replace business logic for retrieving product with onboardi…
…ng-sdk-product (#36)
- Loading branch information
Showing
12 changed files
with
261 additions
and
1,757 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,8 @@ jobs: | |
- uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.ref_name }} | ||
sparse-checkout: | | ||
libs/onboarding-sdk | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
|
@@ -21,6 +23,10 @@ jobs: | |
java-version: '17' | ||
cache: maven | ||
|
||
- uses: s4u/[email protected] | ||
with: | ||
servers: '[{"id": "selfcare-github", "username": "${{ github.actor }}", "password": "${{ secrets.GITHUB_TOKEN }}"}]' | ||
|
||
- name: Build with Maven | ||
run: mvn --projects :onboarding-sdk --also-make-dependents clean package -DskipTests | ||
shell: bash | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
apps/onboarding-ms/src/main/java/it/pagopa/selfcare/onboarding/conf/OnboardingMsConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package it.pagopa.selfcare.onboarding.conf; | ||
|
||
import com.fasterxml.jackson.core.JsonProcessingException; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import it.pagopa.selfcare.azurestorage.AzureBlobClient; | ||
import it.pagopa.selfcare.azurestorage.AzureBlobClientDefault; | ||
import it.pagopa.selfcare.product.service.ProductService; | ||
import it.pagopa.selfcare.product.service.ProductServiceDefault; | ||
import jakarta.enterprise.context.ApplicationScoped; | ||
import org.eclipse.microprofile.config.inject.ConfigProperty; | ||
|
||
@ApplicationScoped | ||
public class OnboardingMsConfig { | ||
|
||
@ConfigProperty(name = "onboarding-ms.blob-storage.container-product") | ||
String containerProduct; | ||
|
||
@ConfigProperty(name = "onboarding-ms.blob-storage.filepath-product") | ||
String filepathProduct; | ||
|
||
@ConfigProperty(name = "onboarding-ms.blob-storage.connection-string-product") | ||
String connectionStringProduct; | ||
|
||
@ApplicationScoped | ||
public ProductService productService(ObjectMapper objectMapper){ | ||
AzureBlobClient azureBlobClient = new AzureBlobClientDefault(connectionStringProduct, containerProduct); | ||
String productJsonString = azureBlobClient.getFileAsText(filepathProduct); | ||
try { | ||
return new ProductServiceDefault(productJsonString, objectMapper); | ||
} catch (JsonProcessingException e) { | ||
throw new IllegalArgumentException("Found an issue when trying to serialize product json string!!"); | ||
} | ||
} | ||
} |
Oops, something went wrong.