Skip to content

Commit

Permalink
fix stream compile execution
Browse files Browse the repository at this point in the history
  • Loading branch information
Aboruhen committed Dec 15, 2023
1 parent 486e391 commit 699e16c
Show file tree
Hide file tree
Showing 20 changed files with 131 additions and 85 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ public Mono<ServiceAgreement> updateServiceAgreementItem(StreamTask streamTask,
log.info("Updating Service Agreement with external Id: {}", serviceAgreement.getExternalId());
ServiceAgreementPut serviceAgreementPut = accessGroupMapper.toPresentationPut(serviceAgreement);
return serviceAgreementsApi.putServiceAgreementItem(serviceAgreement.getInternalId(), serviceAgreementPut)
.onErrorResume(HttpClientErrorException.class, throwable -> {
.onErrorResume(WebClientResponseException.class, throwable -> {
log.error(SERVICE_AGREEMENT, "update", "failed", serviceAgreement.getExternalId(),
"", throwable, throwable.getResponseBodyAsString(), "Failed to update Service Agreement");
return Mono.error(new StreamTaskException(streamTask, throwable, "Failed to update Service Agreement"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,31 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.3.1</version>
<executions>
<execution>
<id>copy-realm</id>
<phase>validate</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<resources>
<resource>
<directory>../../../../api/stream-legal-entity</directory>
<includes>
<include>openapi.yaml</include>
</includes>
</resource>
</resources>
<outputDirectory>${project.build.directory}/copy</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.backbase.oss</groupId>
<artifactId>boat-maven-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,23 +55,23 @@ components:
type: object
properties:
legalEntityExternalId:
$ref: '../../../../../../../api/stream-legal-entity/openapi.yaml#/components/schemas/LegalEntity/properties/externalId'
$ref: '../../../target/copy/openapi.yaml#/components/schemas/LegalEntity/properties/externalId'
taxId:
type: string
description: The Tax ID associated with the legal entity
userExternalId:
$ref: '../../../../../../../api/stream-legal-entity/openapi.yaml#/components/schemas/User/properties/externalId'
$ref: '../../../target/copy/openapi.yaml#/components/schemas/User/properties/externalId'
parentLegalEntityExternalId:
$ref: '../../../../../../../api/stream-legal-entity/openapi.yaml#/components/schemas/LegalEntity/properties/parentExternalId'
$ref: '../../../target/copy/openapi.yaml#/components/schemas/LegalEntity/properties/parentExternalId'
realmName:
$ref: '../../../../../../../api/stream-legal-entity/openapi.yaml#/components/schemas/LegalEntity/properties/realmName'
$ref: '../../../target/copy/openapi.yaml#/components/schemas/LegalEntity/properties/realmName'
referenceJobRoleNames:
$ref: '../../../../../../../api/stream-legal-entity/openapi.yaml#/components/schemas/JobProfileUser/properties/referenceJobRoleNames'
$ref: '../../../target/copy/openapi.yaml#/components/schemas/JobProfileUser/properties/referenceJobRoleNames'
isAdmin:
type: boolean
description: Indicates if the user is an administrator on the Legal Entity
identityUserLinkStrategy:
$ref: '../../../../../../../api/stream-legal-entity/openapi.yaml#/components/schemas/IdentityUserLinkStrategy'
$ref: '../../../target/copy/openapi.yaml#/components/schemas/IdentityUserLinkStrategy'
additions:
type: object
additionalProperties:
Expand All @@ -81,7 +81,7 @@ components:
type: object
properties:
legalEntity:
$ref: '../../../../../../../api/stream-legal-entity/openapi.yaml#/components/schemas/LegalEntity'
$ref: '../../../target/copy/openapi.yaml#/components/schemas/LegalEntity'
membershipAccounts:
type: array
items:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,39 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.3.1</version>
<executions>
<execution>
<id>copy-realm</id>
<phase>validate</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<resources>
<resource>
<directory>../../../../api/stream-legal-entity</directory>
<includes>
<include>openapi.yaml</include>
</includes>
</resource>
</resources>
<outputDirectory>${project.build.directory}/copy</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.backbase.oss</groupId>
<artifactId>boat-maven-plugin</artifactId>
<version>${boat-maven-plugin.version}</version>
<executions>
<execution>
<id>boat-validation</id>
<phase>prepare-package</phase>
<phase>generate-sources</phase>
<goals>
<goal>validate</goal>
</goals>
Expand All @@ -59,7 +84,7 @@
<goals>
<goal>bundle</goal>
</goals>
<phase>prepare-package</phase>
<phase>generate-sources</phase>
<configuration>
<input>${project.basedir}/src/main/resources</input>
<output>${project.build.directory}</output>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,23 +88,23 @@ components:
type: object
properties:
legalEntityExternalId:
$ref: '../../../../../../../api/stream-legal-entity/openapi.yaml#/components/schemas/LegalEntity/properties/externalId'
$ref: '../../../target/copy/openapi.yaml#/components/schemas/LegalEntity/properties/externalId'
taxId:
type: string
description: The Tax ID associated with the legal entity
userExternalId:
$ref: '../../../../../../../api/stream-legal-entity/openapi.yaml#/components/schemas/User/properties/externalId'
$ref: '../../../target/copy/openapi.yaml#/components/schemas/User/properties/externalId'
parentLegalEntityExternalId:
$ref: '../../../../../../../api/stream-legal-entity/openapi.yaml#/components/schemas/LegalEntity/properties/parentExternalId'
$ref: '../../../target/copy/openapi.yaml#/components/schemas/LegalEntity/properties/parentExternalId'
realmName:
$ref: '../../../../../../../api/stream-legal-entity/openapi.yaml#/components/schemas/LegalEntity/properties/realmName'
$ref: '../../../target/copy/openapi.yaml#/components/schemas/LegalEntity/properties/realmName'
referenceJobRoleNames:
$ref: '../../../../../../../api/stream-legal-entity/openapi.yaml#/components/schemas/JobProfileUser/properties/referenceJobRoleNames'
$ref: '../../../target/copy/openapi.yaml#/components/schemas/JobProfileUser/properties/referenceJobRoleNames'
isAdmin:
type: boolean
description: Indicates if the user is an administrator on the Legal Entity
identityUserLinkStrategy:
$ref: '../../../../../../../api/stream-legal-entity/openapi.yaml#/components/schemas/IdentityUserLinkStrategy'
$ref: '../../../target/copy/openapi.yaml#/components/schemas/IdentityUserLinkStrategy'
productChainEnabled:
type: boolean
description: Flag to indicate if Product Ingestion should follow Legal Entity Ingestion
Expand All @@ -117,13 +117,13 @@ components:
type: object
properties:
legalEntity:
$ref: '../../../../../../../api/stream-legal-entity/openapi.yaml#/components/schemas/LegalEntity'
$ref: '../../../target/copy/openapi.yaml#/components/schemas/LegalEntity'

LegalEntityIngestionResponse:
type: object
properties:
legalEntity:
$ref: '../../../../../../../api/stream-legal-entity/openapi.yaml#/components/schemas/LegalEntity'
$ref: '../../../target/copy/openapi.yaml#/components/schemas/LegalEntity'
membershipAccounts:
type: array
items:
Expand Down
6 changes: 6 additions & 0 deletions stream-compositions/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@
<ssdk.version>16.0.1</ssdk.version>
<jakarta-validation.version>3.0.2</jakarta-validation.version>
<jib.container.volumes>/tmp</jib.container.volumes>
<archuint.skip>true</archuint.skip>
<archunit.backbase.LoggingRules.skip>true</archunit.backbase.LoggingRules.skip>
<archunit.backbase.ArchitectureRules.skip>true</archunit.backbase.ArchitectureRules.skip>
<archunit.backbase.ConfigurationRules.skip>true</archunit.backbase.ConfigurationRules.skip>
<archunit.backbase.DataMappingRules.skip>true</archunit.backbase.DataMappingRules.skip>
<archunit.backbase.NamingConventionRules.skip>true</archunit.backbase.NamingConventionRules.skip>
</properties>

<dependencyManagement>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,10 @@ void ingestionInPullModeSync_Success(TestInfo testInfo) {
when(config.getChains().getIncludeSubsidiaries()).thenReturn(Boolean.TRUE);
when(productCompositionApi.pullIngestProduct(any()))
.thenReturn(Mono.just(new ProductIngestionResponse()
.withProductGroups(
.productGroups(
Arrays.asList((com.backbase.stream.compositions.product.client.model.ProductGroup)
new com.backbase.stream.compositions.product.client.model.ProductGroup()
.withCurrentAccounts(List.of(new CurrentAccount().withBBAN("test BBAN")))))));
.currentAccounts(List.of(new CurrentAccount().BBAN("test BBAN")))))));

Mono<LegalEntityResponse> legalEntityIngestResponseMono = executeIngestionWithPullMode(
Boolean.valueOf(tags.get(0)), Boolean.TRUE, Boolean.TRUE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ void setUp() {
@Test
void callLE() throws UnsupportedOperationException {
String leName = "Legal Entity 1";
LegalEntity legalEntity1 = new LegalEntity().withName(leName);
LegalEntity legalEntity1 = new LegalEntity().name(leName);
com.backbase.stream.legalentity.model.LegalEntity legalEntity2 =
new com.backbase.stream.legalentity.model.LegalEntity().name(leName);
List<String> membershipAccounts = Collections.singletonList("012");
LegalEntityResponse res1 = new LegalEntityResponse(Boolean.TRUE, legalEntity2,
membershipAccounts, null);
Mono<PullLegalEntityResponse> res = Mono.just(new PullLegalEntityResponse()
.withLegalEntity(legalEntity1).withMembershipAccounts(Collections.singletonList("012")));
.legalEntity(legalEntity1).membershipAccounts(Collections.singletonList("012")));

when(legalEntityIntegrationApi.pullLegalEntity(any())).thenReturn(res);
when(legalEntityMapper.mapResponseIntegrationToStream(any())).thenReturn(res1);
Expand All @@ -74,14 +74,14 @@ void callLE_fail() throws UnsupportedOperationException {

@Test
void callIntegrationService_LegalEntitiesFound() throws UnsupportedOperationException {
LegalEntity legalEntity1 = new LegalEntity().withName("Legal Entity 1");
LegalEntity legalEntity1 = new LegalEntity().name("Legal Entity 1");
com.backbase.stream.legalentity.model.LegalEntity legalEntity2 =
new com.backbase.stream.legalentity.model.LegalEntity().name("Legal Entity 1");
List<String> membershipAccounts = Collections.singletonList("012");
LegalEntityResponse res1 = new LegalEntityResponse(Boolean.TRUE, legalEntity2,
membershipAccounts, Map.of("test", "test"));
PullLegalEntityResponse getLegalEntityListResponse = new PullLegalEntityResponse()
.withLegalEntity(legalEntity1);
.legalEntity(legalEntity1);

when(legalEntityIntegrationApi.pullLegalEntity(any()))
.thenReturn(Mono.just(getLegalEntityListResponse));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ void pullIngestLegalEntity_Success() throws Exception {

URI uri = URI.create("/service-api/v2/ingest/pull");
LegalEntityPullIngestionRequest pullIngestionRequest =
new LegalEntityPullIngestionRequest().withLegalEntityExternalId("externalId");
new LegalEntityPullIngestionRequest().legalEntityExternalId("externalId");

WebTestClient webTestClient = WebTestClient.bindToController(legalEntityController).build();
webTestClient.post().uri(uri)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ void setUp() {
@Test
void testPullIngestion_Success() {
Mono<LegalEntityPullIngestionRequest> requestMono = Mono.just(
new LegalEntityPullIngestionRequest().withLegalEntityExternalId("externalId"));
new LegalEntityPullIngestionRequest().legalEntityExternalId("externalId"));

when(legalEntityIngestionService.ingestPull(any())).thenReturn(
Mono.just(LegalEntityResponse.builder()
Expand All @@ -55,7 +55,7 @@ void testPullIngestion_Success() {
@Test
void testPushIngestion_Success() {
Mono<LegalEntityPushIngestionRequest> requestMono = Mono.just(
new LegalEntityPushIngestionRequest().withLegalEntity(
new LegalEntityPushIngestionRequest().legalEntity(
new com.backbase.stream.compositions.legalentity.api.model.LegalEntity()));

when(legalEntityIngestionService.ingestPush(any())).thenReturn(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import com.backbase.stream.compositions.productcatalog.core.model.ProductCatalogIngestResponse;
import com.backbase.stream.compositions.productcatalog.core.service.ProductCatalogIngestionService;
import com.backbase.stream.compositions.productcatalog.http.ProductCatalogController;
import com.backbase.stream.compositions.productcatalog.mapper.ProductCatalogMapper;
import com.backbase.stream.compositions.productcatalog.model.ProductCatalogIngestionResponse;
import com.backbase.stream.compositions.productcatalog.model.ProductCatalog;
Expand Down Expand Up @@ -59,7 +58,7 @@ void testPullIngestion_Success() {
@Test
void testPushIngestion_Success() {
Mono<ProductCatalogPushIngestionRequest> requestMono = Mono.just(
new ProductCatalogPushIngestionRequest().withProductCatalog(new ProductCatalog()));
new ProductCatalogPushIngestionRequest().productCatalog(new ProductCatalog()));

doAnswer(invocation -> {
Mono mono = invocation.getArgument(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ void mapPushRequest() {

ArrangementPushIngestionRequest request =
new ArrangementPushIngestionRequest()
.withInternalArrangementId(ARRANGEMENT_ID)
.withSource(SOURCE)
.withArrangement(arrangementItemPut)
.withConfig(requestConfig);
.internalArrangementId(ARRANGEMENT_ID)
.source(SOURCE)
.arrangement(arrangementItemPut)
.config(requestConfig);

ArrangementIngestPushRequest mappedRequest = arrangementRestMapper.mapPushRequest(request);
assertEquals(SOURCE, mappedRequest.getSource());
Expand All @@ -66,10 +66,10 @@ void mapPullRequest() {

ArrangementPullIngestionRequest request =
new ArrangementPullIngestionRequest()
.withInternalArrangementId(ARRANGEMENT_ID)
.withExternalArrangementId(EXTERNAL_ARRANGEMENT_ID)
.withSource(SOURCE)
.withConfig(requestConfig);
.internalArrangementId(ARRANGEMENT_ID)
.externalArrangementId(EXTERNAL_ARRANGEMENT_ID)
.source(SOURCE)
.config(requestConfig);

ArrangementIngestPullRequest mappedRequest = arrangementRestMapper.mapPullRequest(request);
assertEquals(SOURCE, mappedRequest.getSource());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ class ConfigMapperTest {
void map() {
ArrangementIngestionConfig config =
new ArrangementIngestionConfig()
.withChains(
.chains(
new ArrangementsChainsConfig()
.withTransactionComposition(
.transactionComposition(
new TransactionCompositionChainConfig()
.withEnabled(true)
.withAsync(true)));
.enabled(true)
.async(true)));

ConfigMapper configMapper = new ConfigMapper();
RequestConfig requestConfig = configMapper.map(config);
Expand All @@ -31,7 +31,7 @@ void map() {
void mapNullTransactionComposition() {
ArrangementIngestionConfig config =
new ArrangementIngestionConfig()
.withChains(
.chains(
new ArrangementsChainsConfig());

ConfigMapper configMapper = new ConfigMapper();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package com.backbase.stream.compositions.product.core.service.impl;

import com.backbase.stream.compositions.integration.product.api.ArrangementIntegrationApi;
import com.backbase.stream.compositions.integration.product.model.AccountArrangementItemPut;
import com.backbase.stream.compositions.integration.product.model.PullArrangementResponse;
import com.backbase.stream.compositions.product.core.mapper.ArrangementMapper;
import com.backbase.stream.compositions.product.core.model.ArrangementIngestPullRequest;
import com.backbase.stream.compositions.product.core.model.ArrangementIngestResponse;
import com.backbase.stream.compositions.product.integration.client.ArrangementIntegrationApi;
import com.backbase.stream.compositions.product.integration.client.model.AccountArrangementItemPut;
import com.backbase.stream.compositions.product.integration.client.model.PullArrangementResponse;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.InjectMocks;
Expand Down
Loading

0 comments on commit 699e16c

Please sign in to comment.