From 4eec43fab1e890684bd167dd3e43716149c4b53e Mon Sep 17 00:00:00 2001 From: ds-lcapellino Date: Wed, 28 Feb 2024 10:41:09 +0100 Subject: [PATCH 1/2] feature: 420 add Service annotation to EdcContractAgreementService --- .../client/contract/service/EdcContractAgreementService.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/irs-edc-client/src/main/java/org/eclipse/tractusx/irs/edc/client/contract/service/EdcContractAgreementService.java b/irs-edc-client/src/main/java/org/eclipse/tractusx/irs/edc/client/contract/service/EdcContractAgreementService.java index 3064b5f5f3..9540752572 100644 --- a/irs-edc-client/src/main/java/org/eclipse/tractusx/irs/edc/client/contract/service/EdcContractAgreementService.java +++ b/irs-edc-client/src/main/java/org/eclipse/tractusx/irs/edc/client/contract/service/EdcContractAgreementService.java @@ -32,6 +32,7 @@ import org.eclipse.tractusx.irs.edc.client.contract.model.EdcContractAgreementsResponse; import org.eclipse.tractusx.irs.edc.client.contract.model.exception.ContractAgreementException; import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Service; import org.springframework.web.client.RestTemplate; /** @@ -39,6 +40,7 @@ */ @Slf4j @RequiredArgsConstructor +@Service("irsEdcClientEdcContractAgreementService") public class EdcContractAgreementService { public static final String EDC_REQUEST_SUFFIX = "/request"; From f146aa939566c04abf4a125d0381431897319309 Mon Sep 17 00:00:00 2001 From: ds-lcapellino Date: Wed, 28 Feb 2024 10:43:50 +0100 Subject: [PATCH 2/2] feature: 420 fix RestTemplate bean in EdcContractAgreementService --- .../contract/service/EdcContractAgreementService.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/irs-edc-client/src/main/java/org/eclipse/tractusx/irs/edc/client/contract/service/EdcContractAgreementService.java b/irs-edc-client/src/main/java/org/eclipse/tractusx/irs/edc/client/contract/service/EdcContractAgreementService.java index 9540752572..9190266fb3 100644 --- a/irs-edc-client/src/main/java/org/eclipse/tractusx/irs/edc/client/contract/service/EdcContractAgreementService.java +++ b/irs-edc-client/src/main/java/org/eclipse/tractusx/irs/edc/client/contract/service/EdcContractAgreementService.java @@ -31,6 +31,7 @@ import org.eclipse.tractusx.irs.edc.client.EdcConfiguration; import org.eclipse.tractusx.irs.edc.client.contract.model.EdcContractAgreementsResponse; import org.eclipse.tractusx.irs.edc.client.contract.model.exception.ContractAgreementException; +import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Service; import org.springframework.web.client.RestTemplate; @@ -46,13 +47,13 @@ public class EdcContractAgreementService { public static final String EDC_REQUEST_SUFFIX = "/request"; public static final String EDC_ASSET_ID = "https://w3id.org/edc/v0.0.1/ns/assetId"; private final EdcConfiguration config; - private final RestTemplate restTemplate; + private final @Qualifier("edcClientRestTemplate") RestTemplate edcRestTemplate; public List getContractAgreements(final String... contractAgreementIds) throws ContractAgreementException { final QuerySpec querySpec = buildQuerySpec(contractAgreementIds); - final ResponseEntity edcContractAgreementListResponseEntity = restTemplate.postForEntity( + final ResponseEntity edcContractAgreementListResponseEntity = edcRestTemplate.postForEntity( config.getControlplane().getEndpoint().getContractAgreements() + EDC_REQUEST_SUFFIX, querySpec, EdcContractAgreementsResponse.class); @@ -67,7 +68,7 @@ public List getContractAgreements(final String... contractAgr } public ContractNegotiation getContractAgreementNegotiation(final String contractAgreementId) { - final ResponseEntity contractNegotiationResponseEntity = restTemplate.getForEntity( + final ResponseEntity contractNegotiationResponseEntity = edcRestTemplate.getForEntity( config.getControlplane().getEndpoint().getContractAgreements() + "/" + contractAgreementId + "/negotiation", ContractNegotiation.class); return contractNegotiationResponseEntity.getBody();