Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

[SELC-4383] Feat: Added dependency and configuration of product libs #462

Closed
wants to merge 29 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
0417e91
[SELC-4383] Added dependency and configuration of product libs
flaminiaScarciofolo Mar 1, 2024
2c3900c
Merge branch 'release-dev' into feature/SELC-4383
flaminiaScarciofolo Mar 4, 2024
67558f5
Merge branch 'release-dev' into feature/SELC-4383
empassaro Mar 5, 2024
69fd9f9
[SELC-4383] Refactor methods using the ms-product to use methods expo…
flaminiaScarciofolo Mar 5, 2024
51c0b2d
Merge remote-tracking branch 'origin/feature/SELC-4383' into feature/…
flaminiaScarciofolo Mar 5, 2024
c537c91
Merge branch 'release-dev' into feature/SELC-4383
flaminiaScarciofolo Mar 5, 2024
59f36ad
[SELC-4383] Merge release-dev
flaminiaScarciofolo Mar 5, 2024
1818d4f
Merge branch 'main' into feature/SELC-4383
manuraf Mar 12, 2024
302bf2a
settings to dockefile
manuraf Mar 12, 2024
27ce472
test pipeline
manuraf Mar 12, 2024
0d22004
fix DrepositoryOnboarding
manuraf Mar 12, 2024
25513d9
rename repository selfcare onboarding
manuraf Mar 13, 2024
46df501
reference to main
manuraf Mar 13, 2024
ef6d47c
Merge branch 'main' into feature/SELC-4383
manuraf Mar 13, 2024
a776375
Merge branch 'release-dev' into feature/SELC-4383
manuraf Mar 13, 2024
0bc16fb
add PRODUCT_STORAGE_CONTAINER to container apps
manuraf Mar 13, 2024
80872ad
rename selfcare-onboarding github reference
manuraf Mar 13, 2024
9aadddc
Merge branch 'feature/SELC-4383' of https://github.com/pagopa/selfcar…
manuraf Mar 13, 2024
a2ede88
fix unit test
manuraf Mar 13, 2024
455b25b
upgrade onboarding-sdk
manuraf Mar 13, 2024
1f9fa5e
specific consume json on controller
manuraf Mar 13, 2024
40e6cf2
Merge branch 'main' into feature/SELC-4383
manuraf Apr 8, 2024
d4c7ecd
some fix
manuraf Apr 8, 2024
a47da17
secrets inherit
manuraf Apr 8, 2024
e84c7f4
Merge branch 'main' into feature/SELC-4383
manuraf Apr 23, 2024
ed70748
PRODUCT_STORAGE_CONTAINER
manuraf Apr 23, 2024
c361de8
fix unit test
manuraf Apr 23, 2024
2709973
remove MS_PRODUCT_URL
manuraf Apr 23, 2024
5191bf9
Merge branch 'main' into feature/SELC-4383
manuraf Apr 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/release_open_api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ jobs:
swagger_conflict_update:
runs-on: ubuntu-20.04
permissions: write-all
secrets: inherit
name: Swagger Detect Conflict and Update
steps:
- id: swagger-conflict-update
Expand Down
16 changes: 15 additions & 1 deletion Dockerfile.new
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,21 @@ FROM maven:3-eclipse-temurin-17@sha256:0d328fa6843bb26b60cf44d69833f241ffe96218f

COPY . .

RUN mvn clean package -DskipTests=true
RUN echo "<settings>\n" \
"<servers>\n" \
"<server>\n" \
"<id>\${repositoryOnboarding}</id>\n" \
"<username>\${repoLogin}</username>\n" \
"<password>\${repoPwd}</password>\n" \
"</server>\n" \
"</servers>\n" \
"</settings>\n" > settings.xml

ARG REPO_ONBOARDING
ARG REPO_USERNAME
ARG REPO_PASSWORD

RUN mvn --global-settings settings.xml -DrepositoryOnboarding=${REPO_ONBOARDING} -DrepoLogin=${REPO_USERNAME} -DrepoPwd=${REPO_PASSWORD} clean package -DskipTests=true

FROM openjdk:17-jdk@sha256:528707081fdb9562eb819128a9f85ae7fe000e2fbaeaf9f87662e7b3f38cb7d8 AS runtime

Expand Down
4 changes: 4 additions & 0 deletions app/src/main/resources/config/core-config.properties
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,7 @@ scheduler.threads.max-number=${THREADS_SCHEDULE_MAX_NUMBER:1}
scheduler.fixed-delay.delay=${SCHEDULER_FIXED_DELAY:20000}
scheduler.regenerate-kafka-queue-config.name=${SCHEDULER_REGENERATE_KAFKA_QUEUE_CONFIG_NAME:KafkaScheduler}
scheduler.regenerate-kafka-queue.enabled=${SCHEDULER_REGENERATE_KAFKA_QUEUE_ENABLED:false}

mscore.blob-storage.container-product=${PRODUCT_STORAGE_CONTAINER:selc-d-product}
mscore.blob-storage.filepath-product = products.json
mscore.blob-storage.connection-string-product = ${BLOB_STORAGE_CONN_STRING:UseDevelopmentStorage=true;}
32 changes: 16 additions & 16 deletions app/src/main/resources/swagger/api-docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -2367,7 +2367,7 @@
"200" : {
"description" : "OK",
"content" : {
"*/*" : {
"application/json" : {
"schema" : {
"$ref" : "#/components/schemas/BulkInstitutions"
}
Expand Down Expand Up @@ -2481,7 +2481,7 @@
"204" : {
"description" : "No Content",
"content" : {
"*/*" : {
"application/json" : {
"schema" : {
"$ref" : "#/components/schemas/RelationshipsManagement"
}
Expand Down Expand Up @@ -2618,7 +2618,7 @@
"200" : {
"description" : "OK",
"content" : {
"*/*" : {
"application/json" : {
"schema" : {
"$ref" : "#/components/schemas/OnboardingInfoResponse"
}
Expand Down Expand Up @@ -2725,7 +2725,7 @@
"200" : {
"description" : "OK",
"content" : {
"*/*" : {
"application/json" : {
"schema" : {
"type" : "array",
"items" : {
Expand Down Expand Up @@ -2791,7 +2791,7 @@
"200" : {
"description" : "OK",
"content" : {
"*/*" : {
"application/json" : {
"schema" : {
"type" : "string",
"format" : "byte"
Expand Down Expand Up @@ -2844,7 +2844,7 @@
"200" : {
"description" : "OK",
"content" : {
"*/*" : {
"application/json" : {
"schema" : {
"type" : "array",
"items" : {
Expand Down Expand Up @@ -2909,7 +2909,7 @@
"200" : {
"description" : "OK",
"content" : {
"*/*" : {
"application/json" : {
"schema" : {
"type" : "array",
"items" : {
Expand Down Expand Up @@ -3356,7 +3356,7 @@
"200" : {
"description" : "OK",
"content" : {
"*/*" : {
"application/json" : {
"schema" : {
"$ref" : "#/components/schemas/PaginatedTokenResponse"
}
Expand Down Expand Up @@ -3429,7 +3429,7 @@
"200" : {
"description" : "OK",
"content" : {
"*/*" : {
"application/json" : {
"schema" : {
"$ref" : "#/components/schemas/TokenListResponse"
}
Expand Down Expand Up @@ -3490,7 +3490,7 @@
"200" : {
"description" : "OK",
"content" : {
"*/*" : {
"application/json" : {
"schema" : {
"$ref" : "#/components/schemas/TokenResource"
}
Expand Down Expand Up @@ -3544,7 +3544,7 @@
"204" : {
"description" : "No Content",
"content" : {
"*/*" : {
"application/json" : {
"schema" : {
"$ref" : "#/components/schemas/OnboardedUsersResponse"
}
Expand Down Expand Up @@ -3597,7 +3597,7 @@
"200" : {
"description" : "OK",
"content" : {
"*/*" : {
"application/json" : {
"schema" : {
"$ref" : "#/components/schemas/RelationshipResult"
}
Expand Down Expand Up @@ -3836,7 +3836,7 @@
"200" : {
"description" : "OK",
"content" : {
"*/*" : {
"application/json" : {
"schema" : {
"$ref" : "#/components/schemas/UsersNotificationResponse"
}
Expand Down Expand Up @@ -3907,7 +3907,7 @@
"200" : {
"description" : "OK",
"content" : {
"*/*" : {
"application/json" : {
"schema" : {
"$ref" : "#/components/schemas/UserResponse"
}
Expand Down Expand Up @@ -4147,7 +4147,7 @@
"200" : {
"description" : "OK",
"content" : {
"*/*" : {
"application/json" : {
"schema" : {
"$ref" : "#/components/schemas/OnboardingInfoResponse"
}
Expand Down Expand Up @@ -4293,7 +4293,7 @@
"200" : {
"description" : "OK",
"content" : {
"*/*" : {
"application/json" : {
"schema" : {
"$ref" : "#/components/schemas/UserProductsResponse"
}
Expand Down
13 changes: 13 additions & 0 deletions connector-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,19 @@
<groupId>it.pagopa.selfcare</groupId>
<artifactId>selc-commons-base</artifactId>
</dependency>
<dependency>
<groupId>it.pagopa.selfcare</groupId>
<artifactId>onboarding-sdk-product</artifactId>
<version>0.1.9</version>
</dependency>
</dependencies>

<repositories>
<repository>
<id>selfcare-onboarding</id>
<name>Selfcare Onboarding SDK</name>
<url>https://maven.pkg.github.com/pagopa/selfcare-onboarding</url>
</repository>
</repositories>

</project>

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,12 @@ public class CoreConfig {
private Integer onboardingExpiringDate;
private boolean infoCamereEnable;
private boolean enableSendDelegationMail;
private BlobStorage blobStorage;

@Data
public static class BlobStorage {
private String containerProduct;
private String filepathProduct;
private String connectionStringProduct;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import it.pagopa.selfcare.mscore.connector.dao.model.inner.UserBindingEntity;
import it.pagopa.selfcare.mscore.connector.dao.model.mapper.UserEntityMapper;
import it.pagopa.selfcare.mscore.connector.dao.model.mapper.UserInstitutionAggregationMapper;
import it.pagopa.selfcare.mscore.connector.rest.client.ProductsRestClient;
import it.pagopa.selfcare.mscore.constant.Env;
import it.pagopa.selfcare.mscore.constant.RelationshipState;
import it.pagopa.selfcare.mscore.exception.InvalidRequestException;
Expand All @@ -19,10 +18,11 @@
import it.pagopa.selfcare.mscore.model.onboarding.OnboardedProduct;
import it.pagopa.selfcare.mscore.model.onboarding.OnboardedUser;
import it.pagopa.selfcare.mscore.model.onboarding.Token;
import it.pagopa.selfcare.mscore.model.product.Product;
import it.pagopa.selfcare.mscore.model.product.ProductRoleInfo;
import it.pagopa.selfcare.mscore.model.user.UserBinding;
import it.pagopa.selfcare.mscore.model.user.UserInfo;
import it.pagopa.selfcare.product.entity.Product;
import it.pagopa.selfcare.product.entity.ProductRoleInfo;
import it.pagopa.selfcare.product.service.ProductService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.domain.PageRequest;
Expand Down Expand Up @@ -65,7 +65,7 @@ public class UserConnectorImpl implements UserConnector {

private final MongoOperations mongoOperations;

private final ProductsRestClient productRestClient;
private final ProductService productService;


/**
Expand Down Expand Up @@ -370,8 +370,8 @@ public List<UserInstitutionAggregation> getUserInfo(String userId, String instit
private void checkRoles(String productId, PartyRole role, String productRole) {
if (StringUtils.hasText(productRole)) {
Assert.notNull(role, ROLE_IS_NULL.getMessage());
Product product = productRestClient.getProductById(productId, null);
ProductRoleInfo productRoleInfo = product.getRoleMappings().get(role);
Product product = productService.getProduct(productId);
ProductRoleInfo productRoleInfo = product.getRoleMappings().get(it.pagopa.selfcare.onboarding.common.PartyRole.valueOf(role.name()));
if (productRoleInfo == null) {
throw new InvalidRequestException(ROLE_NOT_FOUND.getMessage(), ROLE_NOT_FOUND.getCode());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import it.pagopa.selfcare.mscore.connector.dao.model.inner.OnboardingEntity;
import it.pagopa.selfcare.mscore.connector.dao.model.inner.UserBindingEntity;
import it.pagopa.selfcare.mscore.connector.dao.model.mapper.*;
import it.pagopa.selfcare.mscore.connector.rest.client.ProductsRestClient;
import it.pagopa.selfcare.mscore.constant.Env;
import it.pagopa.selfcare.mscore.constant.RelationshipState;
import it.pagopa.selfcare.mscore.exception.ResourceNotFoundException;
Expand All @@ -22,9 +21,11 @@
import it.pagopa.selfcare.mscore.model.onboarding.OnboardedProduct;
import it.pagopa.selfcare.mscore.model.onboarding.OnboardedUser;
import it.pagopa.selfcare.mscore.model.onboarding.Token;
import it.pagopa.selfcare.mscore.model.product.Product;
import it.pagopa.selfcare.mscore.model.product.ProductRoleInfo;
import it.pagopa.selfcare.mscore.model.user.UserBinding;
import it.pagopa.selfcare.product.entity.Product;
import it.pagopa.selfcare.product.entity.ProductRole;
import it.pagopa.selfcare.product.entity.ProductRoleInfo;
import it.pagopa.selfcare.product.service.ProductService;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
Expand Down Expand Up @@ -62,7 +63,7 @@ class UserConnectorImplTest {
private UserEntityMapper userMapper = new UserEntityMapperImpl();

@Mock
private ProductsRestClient productsRestClient;
private ProductService productService;

@Spy
private OnboardedProductMapper productMapper = new OnboardedProductMapperImpl();
Expand Down Expand Up @@ -220,15 +221,15 @@ void findAndUpdateStateByInstitutionAndProduct() {
when(userRepository.findAndModify(any(), any(), any(), any()))
.thenReturn(new UserEntity());
Product product = mock(Product.class);
EnumMap<PartyRole, ProductRoleInfo> map = mock(EnumMap.class);
EnumMap<it.pagopa.selfcare.onboarding.common.PartyRole, ProductRoleInfo> map = mock(EnumMap.class);
ProductRoleInfo productRoleInfo = mock(ProductRoleInfo.class);
ProductRoleInfo.ProductRole productRole = mock(ProductRoleInfo.ProductRole.class);
ProductRole productRole = mock(ProductRole.class);
when(productRole.getCode()).thenReturn("productRole");
when(productRoleInfo.getRoles()).thenReturn(List.of(productRole));
when(map.get(PartyRole.DELEGATE)).thenReturn(productRoleInfo);
when(map.get(it.pagopa.selfcare.onboarding.common.PartyRole.DELEGATE)).thenReturn(productRoleInfo);
when(product.getRoleMappings()).thenReturn(map);

when(productsRestClient.getProductById(anyString(), any())).thenReturn(product);
when(productService.getProduct(anyString())).thenReturn(product);
Assertions.assertDoesNotThrow(() -> userConnectorImpl.findAndUpdateStateWithOptionalFilter("42", "42", "productId", PartyRole.DELEGATE, "productRole", RelationshipState.PENDING));
}

Expand All @@ -253,7 +254,7 @@ void findAndUpdateStateWithoutFilter() {
Product product = mock(Product.class);
EnumMap<PartyRole, ProductRoleInfo> map = mock(EnumMap.class);
ProductRoleInfo productRoleInfo = mock(ProductRoleInfo.class);
ProductRoleInfo.ProductRole productRole = mock(ProductRoleInfo.ProductRole.class);
ProductRole productRole = mock(ProductRole.class);
Assertions.assertDoesNotThrow(() -> userConnectorImpl.findAndUpdateStateWithOptionalFilter("42", null, null, null, null, RelationshipState.PENDING));
}

Expand Down

This file was deleted.

This file was deleted.

Loading
Loading