Skip to content

Commit

Permalink
Merge pull request #725 from catenax-ng/feature/412-tracex-adapt-regi…
Browse files Browse the repository at this point in the history
…stry-lookup

feat(decentral-client-library):412-tracex changed lookupGlobalAssetId request
  • Loading branch information
ds-jhartmann authored Jan 23, 2024
2 parents 016b65a + 34e2713 commit e7b757a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed

- Updated license header to "Copyright (c) 2021,2024 Contributors to the Eclipse Foundation"
- Changed lookupGlobalAssetIds to lookupShellsByBPN, which provides full object.

## [4.4.0] - 2024-01-15
### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,13 @@
public interface DigitalTwinRegistryService {

/**
* Retrieves the global asset IDs of all asset administration shells for a given BPN.
* Retrieves the shell details of all asset administration shells for a given BPN.
*
* @param bpn the BPN to retrieve the shells for
* @return the collection of global asset IDs
* @return the collection of asset administration shells
*/
default Collection<String> lookupGlobalAssetIds(final String bpn) throws RegistryServiceException {
return fetchShells(lookupShellIdentifiers(bpn)).stream()
.map(AssetAdministrationShellDescriptor::getGlobalAssetId)
.toList();
default Collection<AssetAdministrationShellDescriptor> lookupShellsByBPN(final String bpn) throws RegistryServiceException {
return fetchShells(lookupShellIdentifiers(bpn)).stream().toList();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,11 +203,12 @@ void shouldReturnExpectedGlobalAssetId() throws RegistryServiceException {
expectedShell);

// when
final Collection<String> globalAssetIds = decentralDigitalTwinRegistryService.lookupGlobalAssetIds(
final Collection<AssetAdministrationShellDescriptor> assetAdministrationShellDescriptors = decentralDigitalTwinRegistryService.lookupShellsByBPN(
digitalTwinRegistryKey.bpn());

String actualGlobalAssetId = assetAdministrationShellDescriptors.stream().findFirst().map(AssetAdministrationShellDescriptor::getGlobalAssetId).get();
// then
Assertions.assertThat(globalAssetIds).containsExactly(expectedGlobalAssetId);
Assertions.assertThat(actualGlobalAssetId).isEqualTo(expectedGlobalAssetId);
}

}

0 comments on commit e7b757a

Please sign in to comment.