Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Changelog
All notable changes to this project will be documented in this file.

## [9.2.0](https://github.com/Backbase/stream-services/compare/9.2.0...9.3.0)
### Changed
- fix for NoSuchElementException (No value present) thrown while update data groups

## [9.1.0](https://github.com/Backbase/stream-services/compare/9.0.0...9.1.0)
### Changed
- added partitioning to a batch permission update request
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1030,7 +1030,7 @@ public Mono<BatchProductGroupTask> updateExistingDataGroupsBatch(BatchProductGro
// it should be external data item ids (both add and remove)
Set<String> arrangementsToAdd = new HashSet<>();
Set<String> arrangementsToRemove = new HashSet<>();
affectedArrangements.forEach((internalId, externalId) -> {
affectedArrangements.forEach((internalId, externalId) -> pg.ifPresent(p -> {
boolean shouldBeInGroup =
StreamUtils.getInternalProductIds(pg.get()).contains(internalId) ||
pg.get().getCustomDataGroupItems().stream()
Expand All @@ -1048,7 +1048,7 @@ public Mono<BatchProductGroupTask> updateExistingDataGroupsBatch(BatchProductGro
internalId, externalId, dbsDataGroup.getName());
arrangementsToRemove.add(externalId);
}
});
}));
if (!CollectionUtils.isEmpty(arrangementsToAdd)) {
batchUpdateRequest.add(new DataItemBatchUpdate()
.dataGroupIdentifier(new DataGroupNameIdentifier()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -849,6 +849,55 @@ void updateExistingDataGroupsBatchWithSameInDbsIngestionModeReplace() {
verify(dataGroupIntegrationApi, times(0)).batchUpdateDataItems(any());
}

@Test
void updateExistingDataGroupsBatchWhenNoMatchingInDbsIngestionModeReplace() {
// Given
BatchProductGroupTask batchProductGroupTask = new BatchProductGroupTask();
batchProductGroupTask.setIngestionMode(BatchProductIngestionMode.REPLACE);
batchProductGroupTask.setBatchProductGroup(new BatchProductGroup().productGroups(
List.of(new BaseProductGroup().name("Test product group"))));

DataGroup unmatchedDataGroup1 = buildDataGroupItem(
"Unmatched Data Group 1",
"Unmatched Data Group 1",
"unmatched-1"
);
DataGroup unmatchedDataGroup2 = buildDataGroupItem(
"Unmatched Data Group 2",
"Unmatched Data Group 2",
"unmatched-2"
);

BaseProductGroup productGroup1 = buildBaseProductGroup(
"Different Product Group 1",
"Different Product Group 1",
BaseProductGroup.ProductGroupTypeEnum.REPOSITORIES,
"different-1"
);
BaseProductGroup productGroup2 = buildBaseProductGroup(
"Different Product Group 2",
"Different Product Group 2",
BaseProductGroup.ProductGroupTypeEnum.REPOSITORIES,
"different-2"
);

when(arrangementsApi.postSearchArrangements(any()))
.thenReturn(Mono.just(new ArrangementSearchesListResponse()
.arrangementElements(List.of(
new ArrangementItem().id("unmatched-1").externalArrangementId("ext-unmatched-1"),
new ArrangementItem().id("unmatched-2").externalArrangementId("ext-unmatched-2")
))));

// When
subject.updateExistingDataGroupsBatch(batchProductGroupTask,
List.of(unmatchedDataGroup1, unmatchedDataGroup2),
List.of(productGroup1, productGroup2))
.block();

// Then
verify(dataGroupIntegrationApi, times(0)).batchUpdateDataItems(any());
}

@Test
void updateExistingDataGroupsBatchWithMissingInDbsIngestionModeReplace() {
// Given
Expand Down
Loading