Skip to content

Commit

Permalink
Merge pull request #673 from eclipse-tractusx/fix/submodel-request
Browse files Browse the repository at this point in the history
fix(edc-client): Add property "submodel-postfix" to be prefixed for s…
  • Loading branch information
ds-jhartmann authored May 27, 2024
2 parents 3af6d06 + 392b9fd commit 7eab7f4
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ _**For better traceability add the corresponding GitHub issue number in each cha

## [Unreleased]

### Fixed

- Fixed submodel request path by introducing configuration property `irs-edc-client.submodel.submodel-suffix` which will
be appended to the href URL.

## [5.1.3] - 2024-05-17

### Fixed
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,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added
- Added configuration property `edc.submodel.suffix`.

## [7.1.3] - 2024-05-17

### Changed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ data:
submodel:
request-ttl: {{ tpl .Values.edc.submodel.request.ttl . | default "PT10M" | quote }}
urn-prefix: {{ tpl (.Values.edc.submodel.urnprefix | default "/urn") . | quote }}
submodel-suffix: {{ tpl (.Values.edc.submodel.suffix | default "/$value") . | quote }}
catalog:
acceptedPolicies:
Expand Down
1 change: 1 addition & 0 deletions charts/item-relationship-service/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ edc:
request:
ttl: PT10M # Requests to dataplane will time out after this duration (see https://en.wikipedia.org/wiki/ISO_8601#Durations)
urnprefix: /urn
suffix: /$value
catalog:
# IRS will only negotiate contracts for offers with a policy as defined in the allowedNames list.
# If a requested asset does not provide one of these policies, a tombstone will be created and this node will not be processed.
Expand Down
1 change: 1 addition & 0 deletions irs-api/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ irs-edc-client:
submodel:
request-ttl: ${EDC_SUBMODEL_REQUEST_TTL:PT10M} # How long to wait for an async EDC submodel retrieval to finish, ISO 8601 Duration
urn-prefix: ${EDC_SUBMODEL_URN_PREFIX:/urn} # A prefix used to identify URNs correctly in the submodel endpoint address
submodel-suffix: "/$value"
timeout:
read: PT90S # HTTP read timeout for the submodel client
connect: PT90S # HTTP connect timeout for the submodel client
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@
import org.eclipse.tractusx.irs.testing.wiremock.SubmodelFacadeWiremockSupport;

public class WiremockSupport {

public static final String SUBMODEL_SUFFIX = "/\\$value";

public static EndpointDataReference createEndpointDataReference(final String contractAgreementId) {
final EDRAuthCode edrAuthCode = EDRAuthCode.builder()
.cid(contractAgreementId)
Expand Down Expand Up @@ -126,7 +129,7 @@ static void verifyNegotiationCalls(final int times) {
}

static void successfulDataRequests(final String assetId, final String fileName) {
stubFor(get(urlPathMatching(DtrWiremockSupport.DATAPLANE_PUBLIC_PATH + "/" + assetId)).willReturn(
stubFor(get(urlPathMatching(DtrWiremockSupport.DATAPLANE_PUBLIC_PATH + "/" + assetId+ SUBMODEL_SUFFIX)).willReturn(
responseWithStatus(200).withBodyFile(fileName)));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ public static class SubmodelConfig {
private Duration requestTtl;

private String urnPrefix;
private String submodelSuffix;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ public class EdcSubmodelFacade {
public SubmodelDescriptor getSubmodelPayload(final String connectorEndpoint, final String submodelDataplaneUrl,
final String assetId, final String bpn) throws EdcClientException {
try {
return client.getSubmodelPayload(connectorEndpoint, submodelDataplaneUrl, assetId, bpn)
final String fullSubmodelDataplaneUrl = submodelDataplaneUrl + config.getSubmodel().getSubmodelSuffix();
log.debug("Requesting Submodel for URL: '{}'", fullSubmodelDataplaneUrl);
return client.getSubmodelPayload(connectorEndpoint, fullSubmodelDataplaneUrl, assetId, bpn)
.get(config.getAsyncTimeoutMillis(), TimeUnit.MILLISECONDS);
} catch (InterruptedException e) {
log.debug("InterruptedException occurred.", e);
Expand Down

0 comments on commit 7eab7f4

Please sign in to comment.