From df2988f3290387523b16072862512150faee7cfc Mon Sep 17 00:00:00 2001 From: marcingajek-zf Date: Wed, 11 Jan 2023 14:30:04 +0100 Subject: [PATCH] cp-adapter : code review, rollbacke name change --- .../tractusx/edc/cp/adapter/ApiAdapterConfig.java | 6 +++--- .../tractusx/edc/cp/adapter/HttpController.java | 12 ++++++------ .../tractusx/edc/cp/adapter/dto/ProcessData.java | 2 +- .../ContractNegotiationHandlerTest.java | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/edc-extensions/control-plane-adapter/src/main/java/org/eclipse/tractusx/edc/cp/adapter/ApiAdapterConfig.java b/edc-extensions/control-plane-adapter/src/main/java/org/eclipse/tractusx/edc/cp/adapter/ApiAdapterConfig.java index 59b96f178..124addea6 100644 --- a/edc-extensions/control-plane-adapter/src/main/java/org/eclipse/tractusx/edc/cp/adapter/ApiAdapterConfig.java +++ b/edc-extensions/control-plane-adapter/src/main/java/org/eclipse/tractusx/edc/cp/adapter/ApiAdapterConfig.java @@ -26,7 +26,7 @@ public class ApiAdapterConfig { private static final String CATALOG_EXPIRE_AFTER_TIME = "edc.cp.adapter.cache.catalog.expire.after"; private static final String CATALOG_REQUEST_LIMIT = "edc.cp.adapter.catalog.request.limit"; - private static final String CACHE_CONTRACT_AGREEMENT = "edc.cp.adapter.cache.contract.agreement"; + private static final String REUSE_CONTRACT_AGREEMENT = "edc.cp.adapter.reuse.contract.agreement"; private final ServiceExtensionContext context; @@ -46,8 +46,8 @@ public int getInMemoryMessageBusThreadNumber() { return context.getSetting(IN_MEMORY_MESSAGE_BUS_THREAD_NUMBER, 10); } - public boolean isContractAgreementCacheOn() { - return context.getSetting(CACHE_CONTRACT_AGREEMENT, 1) != 0; + public boolean isContractAgreementReuseOn() { + return context.getSetting(REUSE_CONTRACT_AGREEMENT, 1) != 0; } public int getCatalogExpireAfterTime() { diff --git a/edc-extensions/control-plane-adapter/src/main/java/org/eclipse/tractusx/edc/cp/adapter/HttpController.java b/edc-extensions/control-plane-adapter/src/main/java/org/eclipse/tractusx/edc/cp/adapter/HttpController.java index 94833897d..5db422535 100644 --- a/edc-extensions/control-plane-adapter/src/main/java/org/eclipse/tractusx/edc/cp/adapter/HttpController.java +++ b/edc-extensions/control-plane-adapter/src/main/java/org/eclipse/tractusx/edc/cp/adapter/HttpController.java @@ -45,14 +45,14 @@ public Response getAssetSynchronous( @PathParam("assetId") String assetId, @QueryParam("providerUrl") String providerUrl, @QueryParam("contractAgreementId") String contractAgreementId, - @QueryParam("contractAgreementCache") String contractAgreementCache) { + @QueryParam("contractAgreementReuse") String contractAgreementReuse) { if (invalidParams(assetId, providerUrl)) { return badRequestResponse(); } String traceId = - initiateProcess(assetId, providerUrl, contractAgreementId, contractAgreementCache); + initiateProcess(assetId, providerUrl, contractAgreementId, contractAgreementReuse); try { ProcessData processData = resultService.pull(traceId); @@ -87,13 +87,13 @@ private String initiateProcess( String assetId, String providerUrl, String contractAgreementId, - String contractAgreementCache) { + String contractAgreementReuse) { ProcessData processData = ProcessData.builder() .assetId(assetId) .provider(providerUrl) .contractAgreementId(contractAgreementId) - .contractAgreementCacheOn(isContractAgreementCacheOn(contractAgreementCache)) + .contractAgreementReuseOn(isContractAgreementReuseOn(contractAgreementReuse)) .catalogExpiryTime(config.getCatalogExpireAfterTime()) .build(); @@ -103,8 +103,8 @@ private String initiateProcess( return message.getTraceId(); } - private boolean isContractAgreementCacheOn(String contractAgreementCache) { - return !"0".equals(contractAgreementCache) && config.isContractAgreementCacheOn(); + private boolean isContractAgreementReuseOn(String contractAgreementReuse) { + return !"0".equals(contractAgreementReuse) && config.isContractAgreementReuseOn(); } private Response notFoundResponse() { diff --git a/edc-extensions/control-plane-adapter/src/main/java/org/eclipse/tractusx/edc/cp/adapter/dto/ProcessData.java b/edc-extensions/control-plane-adapter/src/main/java/org/eclipse/tractusx/edc/cp/adapter/dto/ProcessData.java index 3df6c40b6..4555db9df 100644 --- a/edc-extensions/control-plane-adapter/src/main/java/org/eclipse/tractusx/edc/cp/adapter/dto/ProcessData.java +++ b/edc-extensions/control-plane-adapter/src/main/java/org/eclipse/tractusx/edc/cp/adapter/dto/ProcessData.java @@ -34,7 +34,7 @@ public class ProcessData { private final String provider; private String contractOfferId; private int catalogExpiryTime; - private boolean contractAgreementCacheOn; + private boolean contractAgreementReuseOn; // contract data @Setter private String contractNegotiationId; diff --git a/edc-extensions/control-plane-adapter/src/test/java/org/eclipse/tractusx/edc/cp/adapter/process/contractnegotiation/ContractNegotiationHandlerTest.java b/edc-extensions/control-plane-adapter/src/test/java/org/eclipse/tractusx/edc/cp/adapter/process/contractnegotiation/ContractNegotiationHandlerTest.java index 0855154c1..7d82766a9 100644 --- a/edc-extensions/control-plane-adapter/src/test/java/org/eclipse/tractusx/edc/cp/adapter/process/contractnegotiation/ContractNegotiationHandlerTest.java +++ b/edc-extensions/control-plane-adapter/src/test/java/org/eclipse/tractusx/edc/cp/adapter/process/contractnegotiation/ContractNegotiationHandlerTest.java @@ -116,7 +116,7 @@ private ProcessData getProcessData() { .assetId("assetId") .provider("provider") .catalogExpiryTime(30) - .contractAgreementCacheOn(true) + .contractAgreementReuseOn(true) .build(); }