diff --git a/CHANGELOG.md b/CHANGELOG.md index 7162b38fd0..e7bc735b46 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 @@ -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 @@ -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 diff --git a/irs-api/src/main/java/org/eclipse/tractusx/irs/aaswrapper/job/delegate/DigitalTwinDelegate.java b/irs-api/src/main/java/org/eclipse/tractusx/irs/aaswrapper/job/delegate/DigitalTwinDelegate.java index 5601a2f3ad..dbec718442 100644 --- a/irs-api/src/main/java/org/eclipse/tractusx/irs/aaswrapper/job/delegate/DigitalTwinDelegate.java +++ b/irs-api/src/main/java/org/eclipse/tractusx/irs/aaswrapper/job/delegate/DigitalTwinDelegate.java @@ -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) { diff --git a/irs-api/src/main/java/org/eclipse/tractusx/irs/aaswrapper/job/delegate/SubmodelDelegate.java b/irs-api/src/main/java/org/eclipse/tractusx/irs/aaswrapper/job/delegate/SubmodelDelegate.java index c273f003c1..c7315cd7f1 100644 --- a/irs-api/src/main/java/org/eclipse/tractusx/irs/aaswrapper/job/delegate/SubmodelDelegate.java +++ b/irs-api/src/main/java/org/eclipse/tractusx/irs/aaswrapper/job/delegate/SubmodelDelegate.java @@ -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 { @@ -86,21 +85,19 @@ public ItemContainer process(final ItemContainer.ItemContainerBuilder itemContai final List aasSubmodelDescriptors = shell.payload().getSubmodelDescriptors(); log.info("Retrieved {} SubmodelDescriptor for itemId {}", aasSubmodelDescriptors.size(), itemId); - final List filteredSubmodelDescriptorsByAspectType = shell.payload() - .filterDescriptorsByAspectTypes( - jobData.getAspects()); - if (jobData.isCollectAspects()) { log.info("Collecting Submodels."); + final List 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); diff --git a/irs-api/src/test/java/org/eclipse/tractusx/irs/aaswrapper/job/delegate/DigitalTwinDelegateTest.java b/irs-api/src/test/java/org/eclipse/tractusx/irs/aaswrapper/job/delegate/DigitalTwinDelegateTest.java index 7a33d5c224..25b9a78cc9 100644 --- a/irs-api/src/test/java/org/eclipse/tractusx/irs/aaswrapper/job/delegate/DigitalTwinDelegateTest.java +++ b/irs-api/src/test/java/org/eclipse/tractusx/irs/aaswrapper/job/delegate/DigitalTwinDelegateTest.java @@ -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")))))); @@ -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 diff --git a/irs-api/src/test/java/org/eclipse/tractusx/irs/aaswrapper/job/delegate/SubmodelDelegateTest.java b/irs-api/src/test/java/org/eclipse/tractusx/irs/aaswrapper/job/delegate/SubmodelDelegateTest.java index f96b066866..b54b746d96 100644 --- a/irs-api/src/test/java/org/eclipse/tractusx/irs/aaswrapper/job/delegate/SubmodelDelegateTest.java +++ b/irs-api/src/test/java/org/eclipse/tractusx/irs/aaswrapper/job/delegate/SubmodelDelegateTest.java @@ -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( @@ -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 diff --git a/irs-models/src/main/java/org/eclipse/tractusx/irs/component/assetadministrationshell/AssetAdministrationShellDescriptor.java b/irs-models/src/main/java/org/eclipse/tractusx/irs/component/assetadministrationshell/AssetAdministrationShellDescriptor.java index f9c29d5329..2c8d28110d 100644 --- a/irs-models/src/main/java/org/eclipse/tractusx/irs/component/assetadministrationshell/AssetAdministrationShellDescriptor.java +++ b/irs-models/src/main/java/org/eclipse/tractusx/irs/component/assetadministrationshell/AssetAdministrationShellDescriptor.java @@ -96,15 +96,6 @@ public Optional findManufacturerId() { .findFirst(); } - /** - * @param aspectTypes the aspect types which should be filtered by - * @return AssetAdministrationShellDescriptor with filtered submodel descriptors - */ - public AssetAdministrationShellDescriptor withFilteredSubmodelDescriptors(final List aspectTypes) { - setSubmodelDescriptors(filterDescriptorsByAspectTypes(aspectTypes)); - return this; - } - /** * @param relationshipAspect filter for aspect type * @return The filtered list of submodel addresses