Skip to content

Commit

Permalink
Merge pull request #611 from catenax-ng/feat/510-dont-filter-submodel…
Browse files Browse the repository at this point in the history
…-descriptors-from-shell

Feat/510 dont filter submodel descriptors from shell
  • Loading branch information
ds-jhartmann authored May 13, 2024
2 parents 31ed8b8 + a6e6a76 commit d33f669
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 31 deletions.
7 changes: 4 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ _**For better traceability add the corresponding GitHub issue number in each cha

## [Unreleased]

### Changed

- Shells in Job response will contain all submodel descriptors returned by provider, instead filtered by aspect-type parameter. #510

## [5.1.1] - 2024-05-08

### Fixed
Expand All @@ -17,7 +21,6 @@ _**For better traceability add the corresponding GitHub issue number in each cha
### Added

- Cucumber test step definitions for Policy Store API (Happy Path) including some test helper utilities. #518


## [5.1.0] - 2024-05-06

Expand All @@ -34,8 +37,6 @@ _**For better traceability add the corresponding GitHub issue number in each cha
- Update bouncycastle to 1.78 to fix CVE's.
- Fixed validation of json-schemas - IRS is creating tombstone instead collecting Submodel payload, when it not passes validation of schema #522



## [5.0.0] - 2024-04-16

### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,6 @@ public ItemContainer process(final ItemContainer.ItemContainerBuilder itemContai
// DigitalTwinRegistryKey here
.findFirst().orElseThrow();

if (!expectedDepthOfTreeIsNotReached(jobData.getDepth(), aasTransferProcess.getDepth())) {
// filter submodel descriptors if next delegate will not be executed
shell.payload().withFilteredSubmodelDescriptors(jobData.getAspects());
}

itemContainerBuilder.shell(
jobData.isAuditContractNegotiation() ? shell : shell.withoutContractAgreementId());
} catch (final RegistryServiceException | RuntimeException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
/**
* Builds submodels array for AAShell from previous steps.
* All submodels are being retrieved from EDC's components.
* Additionally submodel descriptors from shell are being filtered to requested aspect types.
*/
@Slf4j
public class SubmodelDelegate extends AbstractDelegate {
Expand Down Expand Up @@ -86,21 +85,19 @@ public ItemContainer process(final ItemContainer.ItemContainerBuilder itemContai
final List<SubmodelDescriptor> aasSubmodelDescriptors = shell.payload().getSubmodelDescriptors();
log.info("Retrieved {} SubmodelDescriptor for itemId {}", aasSubmodelDescriptors.size(), itemId);

final List<SubmodelDescriptor> filteredSubmodelDescriptorsByAspectType = shell.payload()
.filterDescriptorsByAspectTypes(
jobData.getAspects());

if (jobData.isCollectAspects()) {
log.info("Collecting Submodels.");
final List<SubmodelDescriptor> filteredSubmodelDescriptorsByAspectType = shell.payload()
.filterDescriptorsByAspectTypes(
jobData.getAspects());

filteredSubmodelDescriptorsByAspectType.forEach(submodelDescriptor -> itemContainerBuilder.submodels(
getSubmodels(submodelDescriptor, itemContainerBuilder, itemId.getGlobalAssetId(),
itemId.getBpn(), jobData.isAuditContractNegotiation())));
}
log.trace("Unfiltered SubmodelDescriptor: {}", aasSubmodelDescriptors);
log.trace("Filtered SubmodelDescriptor: {}", filteredSubmodelDescriptorsByAspectType);

shell.payload().setSubmodelDescriptors(filteredSubmodelDescriptorsByAspectType);

log.trace("Unfiltered SubmodelDescriptor: {}", aasSubmodelDescriptors);
log.trace("Filtered SubmodelDescriptor: {}", filteredSubmodelDescriptorsByAspectType);
}
});

return next(itemContainerBuilder, jobData, aasTransferProcess, itemId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ void shouldFillItemContainerWithShellAndContractAgreementIdWhenAuditFlag() throw
}

@Test
void shouldFillItemContainerWithShellAndFilteredSubmodelDescriptorsWhenDepthReached() throws RegistryServiceException {
void shouldFillItemContainerWithShellAndSubmodelDescriptorsWhenDepthReached() throws RegistryServiceException {
// given
when(digitalTwinRegistryService.fetchShells(any())).thenReturn(
List.of(shell("", shellDescriptor(List.of(submodelDescriptorWithoutHref("any"))))));
Expand All @@ -99,7 +99,7 @@ void shouldFillItemContainerWithShellAndFilteredSubmodelDescriptorsWhenDepthReac
// then
assertThat(result).isNotNull();
assertThat(result.getShells()).isNotEmpty();
assertThat(result.getShells().get(0).payload().getSubmodelDescriptors()).isEmpty();
assertThat(result.getShells().get(0).payload().getSubmodelDescriptors()).isNotEmpty();
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class SubmodelDelegateTest {
jsonValidatorService, new JsonUtil(), connectorEndpointsService);

@Test
void shouldFilterSubmodelDescriptorsByAspectTypeFilter() {
void shouldNotFilterSubmodelDescriptorsByAspectTypeFilter() {
// given
final ItemContainer.ItemContainerBuilder itemContainerShellWithTwoSubmodels = ItemContainer.builder()
.shell(shell("", shellDescriptor(
Expand All @@ -85,7 +85,7 @@ void shouldFilterSubmodelDescriptorsByAspectTypeFilter() {

// then
assertThat(result).isNotNull();
assertThat(result.getShells().get(0).payload().getSubmodelDescriptors()).isEmpty();
assertThat(result.getShells().get(0).payload().getSubmodelDescriptors()).isNotEmpty();
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,6 @@ public Optional<String> findManufacturerId() {
.findFirst();
}

/**
* @param aspectTypes the aspect types which should be filtered by
* @return AssetAdministrationShellDescriptor with filtered submodel descriptors
*/
public AssetAdministrationShellDescriptor withFilteredSubmodelDescriptors(final List<String> aspectTypes) {
setSubmodelDescriptors(filterDescriptorsByAspectTypes(aspectTypes));
return this;
}

/**
* @param relationshipAspect filter for aspect type
* @return The filtered list of submodel addresses
Expand Down

0 comments on commit d33f669

Please sign in to comment.