Skip to content

Commit

Permalink
Merge branch 'master' into hotfix/add-local-profile-legal-entity-task
Browse files Browse the repository at this point in the history
  • Loading branch information
eltntawy authored Apr 24, 2024
2 parents 6e5f016 + 87e498e commit 2a598b3
Show file tree
Hide file tree
Showing 128 changed files with 502 additions and 264 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ jobs:
if: "!contains(github.event.head_commit.message, '[skip bump]') && !contains(github.event.head_commit.message, 'nobump/')"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token.
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of sonar analysis

- name: Set up JDK 17
uses: actions/setup-java@v3
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: 17
distribution: adopt
java-version: 21
distribution: temurin
cache: maven

- name: Cache SonarCloud packages
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# Changelog
All notable changes to this project will be documented in this file.

## [5.0.1](https://github.com/Backbase/stream-services/compare/5.0.0...5.0.1)
### Changed
- Use pagination to query Payment Orders

## [5.0.0](https://github.com/Backbase/stream-services/compare/5.0.0...4.0.0)
### Changed
- Bumping Service SDK to **17.0.0**
## [4.1.0](https://github.com/Backbase/stream-services/compare/4.1.0...4.0.0)
### Changed
- Bumping Service SDK to **16.1.5**
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ You can find listed here the API specification containing the opinionated model

| Stream [version](https://github.com/Backbase/stream-services/releases) | Banking Services | Java | Spring Boot |
|------------------------------------------------------------------------|--------------------|------|-------------|
| 4.0.0 to latest | 2023.12 | 17 | 3.1 |
| 5.0.0 to latest | 2024.04 | 21 | 3.2 |
| 4.0.0 to 4.x.x | 2023.12 | 17 | 3.1 |
| 3.70.0 to 3.x.x | 2023.09-LTS | 17 | 2.7 |
| 3.50.0 to 3.69.0 | 2023.06 | 17 | 2.7 |
| 3.34.0 to 3.49.0 | 2023.02-LTS | 17 | 2.7 |
Expand Down
4 changes: 3 additions & 1 deletion api/stream-legal-entity/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ openapi: 3.0.1
info:
title: Ingest Legal Entity API
description: Ingestion Saga for Legal Entities and their products
version: 2.4.0
version: 2.5.0
x-logo:
url: "http://www.backbase.com/wp-content/uploads/2017/04/backbase-logo-png.png"
backgroundColor: "#FFFFFF"
Expand Down Expand Up @@ -1721,6 +1721,8 @@ components:
description: End time of the service agreement.
status:
$ref: '#/components/schemas/LegalEntityStatus'
customerCategory:
$ref: '#/components/schemas/CustomerCategory'
isMaster:
type: boolean
description: Master flag
Expand Down
4 changes: 2 additions & 2 deletions e2e-tests/.env
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
BB_VERSION=2024.03.3-LTS
STREAM_VERSION=4.0.0
BB_VERSION=2024.04
STREAM_VERSION=5.0.0
STREAM_REGISTRY=harbor.backbase.eu/development
10 changes: 5 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
<parent>
<groupId>com.backbase.buildingblocks</groupId>
<artifactId>backbase-parent</artifactId>
<version>16.1.5</version>
<version>17.0.0</version>
<relativePath/>
</parent>

<groupId>com.backbase.stream</groupId>
<artifactId>stream-services</artifactId>
<version>4.1.0</version>
<version>5.0.1</version>

<packaging>pom</packaging>
<name>Stream :: Services</name>
Expand All @@ -37,9 +37,9 @@
</modules>

<properties>
<java.version>17</java.version>
<ssdk.version>16.1.5</ssdk.version>
<backbase-bom.version>2023.12</backbase-bom.version>
<java.version>21</java.version>
<ssdk.version>17.0.0</ssdk.version>
<backbase-bom.version>2024.04</backbase-bom.version>
<boat-maven-plugin.version>0.17.26</boat-maven-plugin.version>
<spring-boot.repackage.skip>true</spring-boot.repackage.skip>
<openapi-generator-maven-plugin.language>spring</openapi-generator-maven-plugin.language>
Expand Down
2 changes: 1 addition & 1 deletion stream-access-control/access-control-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.backbase.stream</groupId>
<artifactId>stream-access-control</artifactId>
<version>4.1.0</version>
<version>5.0.1</version>
</parent>

<artifactId>access-control-core</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ public Mono<Map<LegalEntityParticipant.ActionEnum, Mono<ServiceAgreement>>> upda

public Flux<ServiceAgreementParticipantsGetResponseBody> getServiceAgreementParticipants(
StreamTask streamTask, ServiceAgreement serviceAgreement) {
return serviceAgreementsApi.getServiceAgreementParticipants(serviceAgreement.getInternalId())
return serviceAgreementsApi.getServiceAgreementParticipants(serviceAgreement.getInternalId(), false)
.onErrorResume(WebClientResponseException.NotFound.class, e -> Flux.empty())
.onErrorResume(WebClientResponseException.class, e -> {
streamTask.error("participant", "update-participant", "failed",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ void updateServiceAgreement() {
.collect(Collectors.toList()));
when(serviceAgreementsApi.putPresentationServiceAgreementUsersBatchUpdate(any())).thenReturn(usersResponse);

when(serviceAgreementsApi.getServiceAgreementParticipants(eq(saInternalId)))
when(serviceAgreementsApi.getServiceAgreementParticipants(eq(saInternalId), eq(false)))
.thenReturn(Flux.fromIterable(Collections.emptyList()));

Mono<ServiceAgreementUsersQuery> emptyExistingUsersList = Mono.just(new ServiceAgreementUsersQuery());
Expand Down Expand Up @@ -245,7 +245,7 @@ void updateServiceAgreementWithExistingParticipants() {
new ServiceAgreementParticipantsGetResponseBody().externalId("p1");
ServiceAgreementParticipantsGetResponseBody existingPar2 =
new ServiceAgreementParticipantsGetResponseBody().externalId("p2");
when(serviceAgreementsApi.getServiceAgreementParticipants(eq(saInternalId)))
when(serviceAgreementsApi.getServiceAgreementParticipants(eq(saInternalId), eq(false)))
.thenReturn(Flux.fromIterable(asList(existingPar1, existingPar2)));

// users
Expand Down Expand Up @@ -306,7 +306,7 @@ void updateParticipantsLogsAllErrors() {
.status(HTTP_STATUS_OK))
));

when(serviceAgreementsApi.getServiceAgreementParticipants(eq(saInternalId)))
when(serviceAgreementsApi.getServiceAgreementParticipants(eq(saInternalId), eq(false)))
.thenReturn(Flux.fromIterable(Collections.emptyList()));


Expand Down
2 changes: 1 addition & 1 deletion stream-access-control/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.backbase.stream</groupId>
<artifactId>stream-services</artifactId>
<version>4.1.0</version>
<version>5.0.1</version>
</parent>

<artifactId>stream-access-control</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion stream-approvals/approvals-bootstrap-task/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.backbase.stream</groupId>
<artifactId>stream-task-starter-parent</artifactId>
<version>4.1.0</version>
<version>5.0.1</version>
<relativePath>../../stream-sdk/stream-starter-parents/stream-task-starter-parent</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion stream-approvals/approvals-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.backbase.stream</groupId>
<artifactId>stream-approvals</artifactId>
<version>4.1.0</version>
<version>5.0.1</version>
</parent>

<artifactId>approvals-core</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,9 @@
import com.backbase.stream.approval.model.Policy;
import com.backbase.stream.approval.model.PolicyAssignmentItem;
import com.backbase.stream.approval.model.PolicyItem;
import com.backbase.stream.exceptions.ApprovalTypeException;
import com.backbase.stream.exceptions.PolicyAssignmentException;
import com.backbase.stream.exceptions.PolicyException;
import com.backbase.stream.service.AccessGroupService;
import com.backbase.stream.service.ApprovalsIntegrationService;
import com.backbase.stream.worker.StreamTaskExecutor;
import com.backbase.stream.worker.exception.StreamTaskException;
import io.micrometer.tracing.annotation.ContinueSpan;
import io.micrometer.tracing.annotation.SpanTag;
import java.util.Collection;
Expand Down Expand Up @@ -75,12 +71,10 @@ private Mono<ApprovalTask> upsertApprovalTypes(@SpanTag(value = "streamTask") Ap
task.info(APPROVAL_TYPE_ENTITY, UPSERT, null, null, null, "Upsert Approval Types");
return Flux.fromStream(nullableCollectionToStream(task.getData().getApprovalTypes()))
.flatMap(approvalsIntegrationService::createApprovalType)
.onErrorResume(ApprovalTypeException.class, approvalTypeException -> {
.onErrorContinue((throwable, o) ->
task.error(APPROVAL_TYPE_ENTITY, UPSERT_APPROVAL_TYPE, FAILED, null, null,
approvalTypeException, approvalTypeException.getHttpResponse(),
approvalTypeException.getMessage());
return Mono.error(new StreamTaskException(task, approvalTypeException));
})
throwable, throwable.getMessage(),
throwable.getMessage()))
.collectList()
.map(approvals -> {
Map<String, String> approvalTypeIdByName =
Expand All @@ -105,12 +99,10 @@ private Mono<ApprovalTask> upsertPolicy(@SpanTag(value = "streamTask") ApprovalT
return p;
})
.flatMap(approvalsIntegrationService::createPolicy)
.onErrorResume(PolicyException.class, policyException -> {
.onErrorContinue((throwable, o) ->
task.error(POLICY_ENTITY, UPSERT_POLICY, FAILED, null, null,
policyException, policyException.getHttpResponse(),
policyException.getMessage());
return Mono.error(new StreamTaskException(task, policyException));
})
throwable, throwable.getMessage(),
throwable.getMessage()))
.collectList()
.map(policies -> {
Map<String, String> policyIdByName =
Expand Down Expand Up @@ -143,11 +135,9 @@ private Mono<ApprovalTask> setupPolicyAssignment(@SpanTag(value = "streamTask")
return pa;
})
.flatMap(approvalsIntegrationService::assignPolicies)
.onErrorResume(PolicyAssignmentException.class, e -> {
task.error(ASSIGN_POLICY, UPSERT_POLICY_ASSIGNMENT, FAILED, null, null, e,
e.getHttpResponse(), e.getMessage());
return Mono.error(new StreamTaskException(task, e));
})
.onErrorContinue((throwable, o) ->
task.error(ASSIGN_POLICY, UPSERT_POLICY_ASSIGNMENT, FAILED, null, null, throwable,
throwable.getMessage(), throwable.getMessage()))
.collectList()
.map(v -> task);
}
Expand Down Expand Up @@ -189,11 +179,7 @@ private Mono<ApprovalTask> assignmentApprovalTypeLevels(@SpanTag(value = "stream
});
})
.flatMap(approvalsIntegrationService::assignApprovalTypeLevels)
.onErrorResume(PolicyAssignmentException.class, e -> {
task.error(ASSIGN_POLICY, UPSERT_POLICY_ASSIGNMENT, FAILED, null, null,
e, e.getHttpResponse(), e.getMessage());
return Mono.error(new StreamTaskException(task, e));
})
.onErrorContinue((throwable, o) -> Mono.just(task))
.collectList()
.map(v -> task);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
package com.backbase.stream;


import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.when;

import com.backbase.dbs.accesscontrol.api.service.v3.model.FunctionGroupItem;
import com.backbase.stream.approval.model.Approval;
import com.backbase.stream.approval.model.ApprovalType;
import com.backbase.stream.approval.model.ApprovalTypeAssignmentItem;
import com.backbase.stream.approval.model.IntegrationPolicyAssignmentRequestBounds;
import com.backbase.stream.approval.model.Policy;
import com.backbase.stream.approval.model.PolicyAssignment;
import com.backbase.stream.approval.model.PolicyAssignmentItem;
import com.backbase.stream.approval.model.PolicyItem;
import com.backbase.stream.approval.model.PolicyLogicalItem;
import com.backbase.stream.legalentity.model.ServiceAgreement;
import com.backbase.stream.service.AccessGroupService;
import com.backbase.stream.service.ApprovalsIntegrationService;
import java.math.BigDecimal;
import java.util.List;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.junit.jupiter.MockitoExtension;
import reactor.core.publisher.Mono;

@ExtendWith(MockitoExtension.class)
class ApprovalSagaTest {

@Mock
private AccessGroupService accessGroupService;

@Mock
private ApprovalsIntegrationService approvalsIntegrationService;

@InjectMocks
ApprovalSaga approvalSaga;

@Test
void executeTask() {
String approvalName = "high level approvals";
Approval approval = new Approval()
.name(approvalName)
.addPoliciesItem(new Policy(List.of(new PolicyLogicalItem().rank(BigDecimal.ONE)
.addItemsItem(new PolicyItem().approvalTypeName("Level A").numberOfApprovals(BigDecimal.ONE))),
List.of()))
.addApprovalTypesItem(
new ApprovalType().rank(BigDecimal.ONE).name("Level A").description("Level A Approvals"))
.addPolicyAssignmentsItem(new PolicyAssignment().externalServiceAgreementId("externalId")
.addApprovalTypeAssignmentsItem(
new ApprovalTypeAssignmentItem().approvalTypeName("Level A").jobProfileName("All"))
.addPolicyAssignmentItemsItem(new PolicyAssignmentItem().externalServiceAgreementId("externalId")
.addFunctionsItem("Assign Users")
.addBoundsItem(new IntegrationPolicyAssignmentRequestBounds("id").policyName("Dual Control"))
.addBoundsItem(new IntegrationPolicyAssignmentRequestBounds(null).policyName("Control"))));
ApprovalTask approvalTask = new ApprovalTask(approval);

when(accessGroupService.getFunctionGroupsForServiceAgreement(any())).thenReturn(
Mono.just(List.of(new FunctionGroupItem().name("name").id("id"))));
when(accessGroupService.getServiceAgreementByExternalId(any())).thenReturn(
Mono.just(new ServiceAgreement().internalId("id")));
var value = approvalSaga.executeTask(approvalTask).block();
assertEquals(approvalName, value.getApproval().getName());
}

@Test
void rollBack() {
ApprovalTask streamTask = Mockito.spy(new ApprovalTask());
Mono<ApprovalTask> approvalTaskMono = approvalSaga.rollBack(streamTask);

assertNotNull(approvalTaskMono);

approvalTaskMono.block();

Mockito.verify(streamTask, Mockito.never()).getData();
}

}
2 changes: 1 addition & 1 deletion stream-approvals/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.backbase.stream</groupId>
<artifactId>stream-services</artifactId>
<version>4.1.0</version>
<version>5.0.1</version>
</parent>

<artifactId>stream-approvals</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion stream-audiences/audiences-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.backbase.stream</groupId>
<artifactId>stream-audiences</artifactId>
<version>4.1.0</version>
<version>5.0.1</version>
</parent>

<artifactId>audiences-core</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion stream-audiences/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.backbase.stream</groupId>
<artifactId>stream-services</artifactId>
<version>4.1.0</version>
<version>5.0.1</version>
</parent>

<artifactId>stream-audiences</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion stream-compositions/api/cursors-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>api</artifactId>
<groupId>com.backbase.stream.compositions</groupId>
<version>4.1.0</version>
<version>5.0.1</version>
</parent>

<artifactId>cursors-api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>cursors-api</artifactId>
<groupId>com.backbase.stream.compositions</groupId>
<version>4.1.0</version>
<version>5.0.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>integrations-api</artifactId>
<groupId>com.backbase.stream.compositions</groupId>
<version>4.1.0</version>
<version>5.0.1</version>
</parent>

<groupId>com.backbase.stream.compositions.api</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>integrations-api</artifactId>
<groupId>com.backbase.stream.compositions</groupId>
<version>4.1.0</version>
<version>5.0.1</version>
</parent>

<groupId>com.backbase.stream.compositions.api</groupId>
Expand Down
Loading

0 comments on commit 2a598b3

Please sign in to comment.