Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotfix/5.1.2 #628

Closed
wants to merge 7 commits into from
Closed
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
9 changes: 7 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ _**For better traceability add the corresponding GitHub issue number in each cha

## [Unreleased]

## [5.1.2] - 2024-05-13

### Fixed

- Cleaning up BPNLs without policies. #533
Expand All @@ -16,7 +18,6 @@ _**For better traceability add the corresponding GitHub issue number in each cha

- Updated default accepted policy to latest traceability framework agreement #596
- BPN summary was removed from Job response #568
- 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
Expand All @@ -28,6 +29,7 @@ _**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 @@ -44,6 +46,7 @@ _**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 Expand Up @@ -652,7 +655,9 @@ _**For better traceability add the corresponding GitHub issue number in each cha
### Unresolved
- **Select Aspects you need** You are able to select the needed aspects for which you want to collect the correct endpoint information.

[Unreleased]: https://github.com/eclipse-tractusx/item-relationship-service/compare/5.1.1...HEAD

[Unreleased]: https://github.com/eclipse-tractusx/item-relationship-service/compare/5.1.2...HEAD
[5.1.2]: https://github.com/eclipse-tractusx/item-relationship-service/compare/5.1.1...5.1.2
[5.1.1]: https://github.com/eclipse-tractusx/item-relationship-service/compare/5.1.0...5.1.1
[5.1.0]: https://github.com/eclipse-tractusx/item-relationship-service/compare/5.0.0...5.1.0
[5.0.0]: https://github.com/eclipse-tractusx/item-relationship-service/compare/4.9.0...5.0.0
Expand Down
10 changes: 5 additions & 5 deletions DEPENDENCIES
Original file line number Diff line number Diff line change
Expand Up @@ -303,12 +303,12 @@ maven/mavencentral/org.eclipse.tractusx.edc/core-spi/0.6.0, Apache-2.0, approved
maven/mavencentral/org.eclipse.tractusx.edc/edr-api/0.6.0, Apache-2.0, approved, automotive.tractusx
maven/mavencentral/org.eclipse.tractusx.edc/edr-spi/0.6.0, Apache-2.0, approved, automotive.tractusx
maven/mavencentral/org.eclipse.tractusx.irs/irs-api/0.0.2-SNAPSHOT, Apache-2.0, approved, automotive.tractusx
maven/mavencentral/org.eclipse.tractusx.irs/irs-common/2.0.2-SNAPSHOT, Apache-2.0, approved, automotive.tractusx
maven/mavencentral/org.eclipse.tractusx.irs/irs-edc-client/2.0.2-SNAPSHOT, Apache-2.0, approved, automotive.tractusx
maven/mavencentral/org.eclipse.tractusx.irs/irs-models/2.0.2-SNAPSHOT, Apache-2.0, approved, automotive.tractusx
maven/mavencentral/org.eclipse.tractusx.irs/irs-common/2.0.2, Apache-2.0, approved, automotive.tractusx
maven/mavencentral/org.eclipse.tractusx.irs/irs-edc-client/2.0.2, Apache-2.0, approved, automotive.tractusx
maven/mavencentral/org.eclipse.tractusx.irs/irs-models/2.0.2, Apache-2.0, approved, automotive.tractusx
maven/mavencentral/org.eclipse.tractusx.irs/irs-policy-store/0.0.2-SNAPSHOT, Apache-2.0, approved, automotive.tractusx
maven/mavencentral/org.eclipse.tractusx.irs/irs-registry-client/2.0.2-SNAPSHOT, Apache-2.0, approved, automotive.tractusx
maven/mavencentral/org.eclipse.tractusx.irs/irs-testing/2.0.2-SNAPSHOT, Apache-2.0, approved, automotive.tractusx
maven/mavencentral/org.eclipse.tractusx.irs/irs-registry-client/2.0.2, Apache-2.0, approved, automotive.tractusx
maven/mavencentral/org.eclipse.tractusx.irs/irs-testing/2.0.2, Apache-2.0, approved, automotive.tractusx
maven/mavencentral/org.glassfish/jakarta.json/2.0.1, EPL-2.0 OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.jsonp
maven/mavencentral/org.hamcrest/hamcrest-core/2.2, BSD-3-Clause, approved, clearlydefined
maven/mavencentral/org.hamcrest/hamcrest/2.2, BSD-3-Clause, approved, clearlydefined
Expand Down
3 changes: 3 additions & 0 deletions charts/item-relationship-service/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [7.1.2] - 2024-05-13

### Changed

- Update IRS version to 5.1.2
- Updated default accepted policy to latest traceability framework agreement #596

## [7.1.1] - 2024-05-08
Expand Down
4 changes: 2 additions & 2 deletions charts/item-relationship-service/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 7.1.1
version: 7.1.2
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "5.1.1"
appVersion: "5.1.2"
dependencies:
- name: common
repository: https://charts.bitnami.com/bitnami
Expand Down
2 changes: 1 addition & 1 deletion docs/src/api/irs-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ info:
description: The API of the Item Relationship Service (IRS) for retrieving item
graphs along the value chain of CATENA-X partners.
title: IRS API
version: 5.1.1
version: 5.1.2
servers:
- url: http://localhost:8080
security:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public class IrsApplication {
/**
* The IRS API version.
*/
public static final String API_VERSION = "5.1.1";
public static final String API_VERSION = "5.1.2";

/**
* The URL prefix for IRS API URLs.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ 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,6 +55,7 @@
/**
* 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 @@ -85,19 +86,21 @@ 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);
}
log.trace("Unfiltered SubmodelDescriptor: {}", aasSubmodelDescriptors);
log.trace("Filtered SubmodelDescriptor: {}", filteredSubmodelDescriptorsByAspectType);

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

@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 shouldNotFilterSubmodelDescriptorsByAspectTypeFilter() {
void shouldFilterSubmodelDescriptorsByAspectTypeFilter() {
// given
final ItemContainer.ItemContainerBuilder itemContainerShellWithTwoSubmodels = ItemContainer.builder()
.shell(shell("", shellDescriptor(
Expand All @@ -85,7 +85,7 @@ void shouldNotFilterSubmodelDescriptorsByAspectTypeFilter() {

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

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,11 @@ public static HashMap<String, HashSet<String>> getExpectedBpnToPolicyIdsMapping(

public static Stream<String> extractPolicyIdsForBpn(
final Map<String, ArrayList<LinkedHashMap<String, ?>>> bpnToPoliciesMap, final String bpn) {
return extractPolicyIds(bpnToPoliciesMap.get(bpn).stream());
List<LinkedHashMap<String, ?>> policyIds = bpnToPoliciesMap.get(bpn);
if (policyIds == null) {
policyIds = new ArrayList<>();
}
return extractPolicyIds(policyIds.stream());
}

@SuppressWarnings("rawtypes")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,15 @@ 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
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
</sonar.coverage.jacoco.xmlReportPaths>

<!-- IRS Registry Client Library -->
<irs-registry-client.version>2.0.2-SNAPSHOT</irs-registry-client.version>
<irs-registry-client.version>2.0.2</irs-registry-client.version>

<!-- Dependencies -->
<springboot.version>3.1.11</springboot.version>
Expand Down
Loading