From 2f3994f7f95918ddb4ed7cbbb39d3f716022a6eb Mon Sep 17 00:00:00 2001 From: Pawel Sosnowski Date: Fri, 8 Dec 2023 10:50:14 +0100 Subject: [PATCH] feat(irs-registry-client):[#256] added cache for send notification --- .../client/ContractNegotiationService.java | 17 ++-- .../irs/edc/client/EdcSubmodelClient.java | 94 +++++++++++-------- .../client/EndpointDataReferenceStorage.java | 7 +- .../EndpointDataReferenceCacheService.java | 4 +- .../EndpointDataReferenceStatus.java | 2 +- .../ContractNegotiationServiceTest.java | 2 +- .../edc/client/EdcCallbackControllerTest.java | 4 +- .../irs/edc/client/EdcSubmodelClientTest.java | 9 +- .../client/SubmodelFacadeWiremockTest.java | 2 +- .../irs/edc/client/SubmodelRetryerTest.java | 4 +- ...EndpointDataReferenceCacheServiceTest.java | 32 ++++--- 11 files changed, 98 insertions(+), 79 deletions(-) rename irs-edc-client/src/main/java/org/eclipse/tractusx/irs/edc/client/{util => cache/endpointdatareference}/EndpointDataReferenceCacheService.java (96%) rename irs-edc-client/src/main/java/org/eclipse/tractusx/irs/edc/client/{util => cache/endpointdatareference}/EndpointDataReferenceStatus.java (95%) diff --git a/irs-edc-client/src/main/java/org/eclipse/tractusx/irs/edc/client/ContractNegotiationService.java b/irs-edc-client/src/main/java/org/eclipse/tractusx/irs/edc/client/ContractNegotiationService.java index b4665d6676..344cd039a8 100644 --- a/irs-edc-client/src/main/java/org/eclipse/tractusx/irs/edc/client/ContractNegotiationService.java +++ b/irs-edc-client/src/main/java/org/eclipse/tractusx/irs/edc/client/ContractNegotiationService.java @@ -45,7 +45,7 @@ import org.eclipse.tractusx.irs.edc.client.model.TransferProcessRequest; import org.eclipse.tractusx.irs.edc.client.model.TransferProcessResponse; import org.eclipse.tractusx.irs.edc.client.policy.PolicyCheckerService; -import org.eclipse.tractusx.irs.edc.client.util.EndpointDataReferenceStatus; +import org.eclipse.tractusx.irs.edc.client.cache.endpointdatareference.EndpointDataReferenceStatus; import org.eclipse.tractusx.irs.edc.client.util.Masker; import org.springframework.stereotype.Service; @@ -68,22 +68,25 @@ public NegotiationResponse negotiate(final String providerConnectorUrl, final Ca new EndpointDataReferenceStatus(null, EndpointDataReferenceStatus.TokenStatus.REQUIRED_NEW)); } - @SuppressWarnings("PMD.AvoidReassigningParameters") public NegotiationResponse negotiate(final String providerConnectorUrl, final CatalogItem catalogItem, - EndpointDataReferenceStatus endpointDataReferenceStatus) + final EndpointDataReferenceStatus endpointDataReferenceStatus) throws ContractNegotiationException, UsagePolicyException, TransferProcessException { + EndpointDataReferenceStatus resultEndpointDataReferenceStatus; + if (endpointDataReferenceStatus == null) { log.info( "Missing information about endpoint data reference from storage, setting token status to REQUIRED_NEW."); - endpointDataReferenceStatus = new EndpointDataReferenceStatus(null, + resultEndpointDataReferenceStatus = new EndpointDataReferenceStatus(null, EndpointDataReferenceStatus.TokenStatus.REQUIRED_NEW); + } else { + resultEndpointDataReferenceStatus = endpointDataReferenceStatus; } NegotiationResponse negotiationResponse = null; - String contractAgreementId = null; + String contractAgreementId; - switch (endpointDataReferenceStatus.tokenStatus()) { + switch (resultEndpointDataReferenceStatus.tokenStatus()) { case REQUIRED_NEW -> { final CompletableFuture responseFuture = startNewNegotiation(providerConnectorUrl, catalogItem); @@ -91,7 +94,7 @@ public NegotiationResponse negotiate(final String providerConnectorUrl, final Ca contractAgreementId = negotiationResponse.getContractAgreementId(); } case EXPIRED -> { - final String authKey = endpointDataReferenceStatus.endpointDataReference().getAuthKey(); + final String authKey = resultEndpointDataReferenceStatus.endpointDataReference().getAuthKey(); if (authKey == null) { throw new IllegalStateException("Missing information about AuthKey."); } diff --git a/irs-edc-client/src/main/java/org/eclipse/tractusx/irs/edc/client/EdcSubmodelClient.java b/irs-edc-client/src/main/java/org/eclipse/tractusx/irs/edc/client/EdcSubmodelClient.java index e27b90e39c..3024f80792 100644 --- a/irs-edc-client/src/main/java/org/eclipse/tractusx/irs/edc/client/EdcSubmodelClient.java +++ b/irs-edc-client/src/main/java/org/eclipse/tractusx/irs/edc/client/EdcSubmodelClient.java @@ -24,7 +24,7 @@ package org.eclipse.tractusx.irs.edc.client; import static org.eclipse.tractusx.irs.edc.client.configuration.JsonLdConfiguration.NAMESPACE_EDC_ID; -import static org.eclipse.tractusx.irs.edc.client.util.EndpointDataReferenceStatus.TokenStatus; +import static org.eclipse.tractusx.irs.edc.client.cache.endpointdatareference.EndpointDataReferenceStatus.TokenStatus; import java.net.URI; import java.util.List; @@ -43,12 +43,13 @@ import org.eclipse.tractusx.irs.data.StringMapper; import org.eclipse.tractusx.irs.edc.client.exceptions.EdcClientException; import org.eclipse.tractusx.irs.edc.client.model.CatalogItem; +import org.eclipse.tractusx.irs.edc.client.model.EDRAuthCode; import org.eclipse.tractusx.irs.edc.client.model.NegotiationResponse; import org.eclipse.tractusx.irs.edc.client.model.notification.EdcNotification; import org.eclipse.tractusx.irs.edc.client.model.notification.EdcNotificationResponse; import org.eclipse.tractusx.irs.edc.client.model.notification.NotificationContent; -import org.eclipse.tractusx.irs.edc.client.util.EndpointDataReferenceCacheService; -import org.eclipse.tractusx.irs.edc.client.util.EndpointDataReferenceStatus; +import org.eclipse.tractusx.irs.edc.client.cache.endpointdatareference.EndpointDataReferenceCacheService; +import org.eclipse.tractusx.irs.edc.client.cache.endpointdatareference.EndpointDataReferenceStatus; import org.eclipse.tractusx.irs.edc.client.util.Masker; import org.springframework.context.annotation.Profile; import org.springframework.stereotype.Service; @@ -70,8 +71,7 @@ CompletableFuture getEndpointReferenceForAsset(String end String filterValue) throws EdcClientException; CompletableFuture getEndpointReferenceForAsset(String endpointAddress, String filterKey, - String filterValue, EndpointDataReferenceStatus cachedEndpointDataReference) - throws EdcClientException; + String filterValue, EndpointDataReferenceStatus cachedEndpointDataReference) throws EdcClientException; } /** @@ -162,31 +162,36 @@ private NegotiationResponse fetchNegotiationResponseWithFilter(final String conn return contractNegotiationService.negotiate(connectorEndpoint, catalogItem); } - private CompletableFuture sendNotificationAsync(final String contractAgreementId, - final EdcNotification notification, final StopWatch stopWatch) { + private CompletableFuture sendNotificationAsync(final String assetId, + final EdcNotification notification, final StopWatch stopWatch, + final EndpointDataReference endpointDataReference) { return pollingService.createJob() - .action(() -> sendSubmodelNotification(contractAgreementId, notification, stopWatch)) + .action(() -> sendSubmodelNotification(assetId, notification, stopWatch, + endpointDataReference)) .timeToLive(config.getSubmodel().getRequestTtl()) .description("waiting for submodel notification to be sent") .build() .schedule(); - } private Optional retrieveSubmodelData(final String submodelDataplaneUrl, final StopWatch stopWatch, final EndpointDataReference endpointDataReference) { - log.info("Retrieving data from EDC data plane for dataReference with id {}", endpointDataReference.getId()); - final String data = edcDataPlaneClient.getData(endpointDataReference, submodelDataplaneUrl); - stopWatchOnEdcTask(stopWatch); + if (endpointDataReference != null) { + log.info("Retrieving data from EDC data plane for dataReference with id {}", endpointDataReference.getId()); + final String data = edcDataPlaneClient.getData(endpointDataReference, submodelDataplaneUrl); + stopWatchOnEdcTask(stopWatch); - return Optional.of(data); + return Optional.of(data); + } + + return Optional.empty(); } - private Optional retrieveEndpointReference(final String contractAgreementId, + private Optional retrieveEndpointReference(final String storageId, final StopWatch stopWatch) { final Optional dataReference = retrieveEndpointDataReferenceByContractAgreementId( - contractAgreementId); + storageId); if (dataReference.isPresent()) { final EndpointDataReference ref = dataReference.get(); @@ -198,19 +203,17 @@ private Optional retrieveEndpointReference(final String c return Optional.empty(); } - private Optional sendSubmodelNotification(final String contractAgreementId, - final EdcNotification notification, final StopWatch stopWatch) { - final Optional dataReference = retrieveEndpointDataReferenceByContractAgreementId( - contractAgreementId); + private Optional sendSubmodelNotification(final String assetId, + final EdcNotification notification, final StopWatch stopWatch, + final EndpointDataReference endpointDataReference) { - if (dataReference.isPresent()) { - final EndpointDataReference ref = dataReference.get(); - log.info("Sending dataReference to EDC data plane for contractAgreementId '{}'", - Masker.mask(contractAgreementId)); - final EdcNotificationResponse response = edcDataPlaneClient.sendData(ref, notification); + if (endpointDataReference != null) { + log.info("Sending dataReference to EDC data plane for assetId '{}'", assetId); + final EdcNotificationResponse response = edcDataPlaneClient.sendData(endpointDataReference, notification); stopWatchOnEdcTask(stopWatch); return Optional.of(response); } + return Optional.empty(); } @@ -234,18 +237,19 @@ public CompletableFuture getSubmodelRawPayload(final String connectorEnd }); } - @SuppressWarnings("PMD.ConfusingTernary") private EndpointDataReference getEndpointDataReference(final String connectorEndpoint, final String assetId) throws EdcClientException { + log.info("Retrieving endpoint data reference from cache for assed id: {}", assetId); final EndpointDataReferenceStatus cachedEndpointDataReference = endpointDataReferenceCacheService.getEndpointDataReference( assetId); EndpointDataReference endpointDataReference; - if (cachedEndpointDataReference.tokenStatus() != TokenStatus.VALID) { + if (cachedEndpointDataReference.tokenStatus() == TokenStatus.VALID) { + log.info("Endpoint data reference found in cache with token status valid, reusing cache record."); + endpointDataReference = cachedEndpointDataReference.endpointDataReference(); + } else { endpointDataReference = getEndpointDataReferenceAndAddToStorage(connectorEndpoint, assetId, cachedEndpointDataReference); - } else { - endpointDataReference = cachedEndpointDataReference.endpointDataReference(); } return endpointDataReference; @@ -274,12 +278,9 @@ public CompletableFuture sendNotification(final String return execute(connectorEndpoint, () -> { final StopWatch stopWatch = new StopWatch(); stopWatch.start("Send EDC notification task, endpoint " + connectorEndpoint); - final var negotiationEndpoint = appendSuffix(connectorEndpoint, - config.getControlplane().getProviderSuffix()); - final NegotiationResponse negotiationResponse = fetchNegotiationResponseWithFilter(negotiationEndpoint, - assetId); + final EndpointDataReference endpointDataReference = getEndpointDataReference(connectorEndpoint, assetId); - return sendNotificationAsync(negotiationResponse.getContractAgreementId(), notification, stopWatch); + return sendNotificationAsync(assetId, notification, stopWatch, endpointDataReference); }); } @@ -307,8 +308,10 @@ public CompletableFuture getEndpointReferenceForAsset(fin final NegotiationResponse response = contractNegotiationService.negotiate(providerWithSuffix, items.stream().findFirst().orElseThrow(), endpointDataReferenceStatus); + final String storageId = getStorageId(endpointDataReferenceStatus, response); + return pollingService.createJob() - .action(() -> retrieveEndpointReference(response.getContractAgreementId(), stopWatch)) + .action(() -> retrieveEndpointReference(storageId, stopWatch)) .timeToLive(config.getSubmodel().getRequestTtl()) .description("waiting for Endpoint Reference retrieval") .build() @@ -317,6 +320,21 @@ public CompletableFuture getEndpointReferenceForAsset(fin }); } + private static String getStorageId(final EndpointDataReferenceStatus endpointDataReferenceStatus, + final NegotiationResponse response) { + final String storageId; + if (response != null) { + storageId = response.getContractAgreementId(); + } else { + final String authKey = endpointDataReferenceStatus.endpointDataReference().getAuthKey(); + if (authKey == null) { + throw new IllegalStateException("Missing information about AuthKey."); + } + storageId = EDRAuthCode.fromAuthCodeToken(authKey).getCid(); + } + return storageId; + } + private String appendSuffix(final String endpointAddress, final String providerSuffix) { String addressWithSuffix; if (endpointAddress.endsWith(providerSuffix)) { @@ -329,10 +347,10 @@ private String appendSuffix(final String endpointAddress, final String providerS return addressWithSuffix; } - private Optional retrieveEndpointDataReferenceByContractAgreementId( - final String contractAgreementId) { - log.info("Retrieving dataReference from storage for contractAgreementId {}", Masker.mask(contractAgreementId)); - return endpointDataReferenceStorage.remove(contractAgreementId); + private Optional retrieveEndpointDataReferenceByContractAgreementId(final String storageId) { + log.info("Retrieving dataReference from storage for storageId (assetId or contractAgreementId): {}", + Masker.mask(storageId)); + return endpointDataReferenceStorage.get(storageId); } @SuppressWarnings({ "PMD.AvoidRethrowingException", diff --git a/irs-edc-client/src/main/java/org/eclipse/tractusx/irs/edc/client/EndpointDataReferenceStorage.java b/irs-edc-client/src/main/java/org/eclipse/tractusx/irs/edc/client/EndpointDataReferenceStorage.java index 2110f52961..80bd53c4d3 100644 --- a/irs-edc-client/src/main/java/org/eclipse/tractusx/irs/edc/client/EndpointDataReferenceStorage.java +++ b/irs-edc-client/src/main/java/org/eclipse/tractusx/irs/edc/client/EndpointDataReferenceStorage.java @@ -69,13 +69,8 @@ private void cleanup() { }); } - public Optional remove(final String storageId) { - return Optional.ofNullable(storageMap.remove(storageId)).map(ExpiringContainer::getDataReference); - } - public Optional get(final String storageId) { - return Optional.ofNullable( - storageMap.get(storageId) != null ? storageMap.get(storageId).getDataReference() : null); + return Optional.ofNullable(storageMap.get(storageId)).map(ExpiringContainer::getDataReference); } /** diff --git a/irs-edc-client/src/main/java/org/eclipse/tractusx/irs/edc/client/util/EndpointDataReferenceCacheService.java b/irs-edc-client/src/main/java/org/eclipse/tractusx/irs/edc/client/cache/endpointdatareference/EndpointDataReferenceCacheService.java similarity index 96% rename from irs-edc-client/src/main/java/org/eclipse/tractusx/irs/edc/client/util/EndpointDataReferenceCacheService.java rename to irs-edc-client/src/main/java/org/eclipse/tractusx/irs/edc/client/cache/endpointdatareference/EndpointDataReferenceCacheService.java index 604e422bd5..2b044a0b39 100644 --- a/irs-edc-client/src/main/java/org/eclipse/tractusx/irs/edc/client/util/EndpointDataReferenceCacheService.java +++ b/irs-edc-client/src/main/java/org/eclipse/tractusx/irs/edc/client/cache/endpointdatareference/EndpointDataReferenceCacheService.java @@ -21,7 +21,7 @@ * * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -package org.eclipse.tractusx.irs.edc.client.util; +package org.eclipse.tractusx.irs.edc.client.cache.endpointdatareference; import java.time.Instant; import java.util.Optional; @@ -52,7 +52,7 @@ public class EndpointDataReferenceCacheService { * @param assetId key for * {@link org.eclipse.tractusx.irs.edc.client.EndpointDataReferenceStorage} * @return {@link org.eclipse.edc.spi.types.domain.edr.EndpointDataReference} - * and {@link org.eclipse.tractusx.irs.edc.client.util.EndpointDataReferenceStatus.TokenStatus} + * and {@link EndpointDataReferenceStatus.TokenStatus} * describing token status */ public EndpointDataReferenceStatus getEndpointDataReference(final String assetId) { diff --git a/irs-edc-client/src/main/java/org/eclipse/tractusx/irs/edc/client/util/EndpointDataReferenceStatus.java b/irs-edc-client/src/main/java/org/eclipse/tractusx/irs/edc/client/cache/endpointdatareference/EndpointDataReferenceStatus.java similarity index 95% rename from irs-edc-client/src/main/java/org/eclipse/tractusx/irs/edc/client/util/EndpointDataReferenceStatus.java rename to irs-edc-client/src/main/java/org/eclipse/tractusx/irs/edc/client/cache/endpointdatareference/EndpointDataReferenceStatus.java index 6687aad5fb..f14745a5b5 100644 --- a/irs-edc-client/src/main/java/org/eclipse/tractusx/irs/edc/client/util/EndpointDataReferenceStatus.java +++ b/irs-edc-client/src/main/java/org/eclipse/tractusx/irs/edc/client/cache/endpointdatareference/EndpointDataReferenceStatus.java @@ -21,7 +21,7 @@ * * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -package org.eclipse.tractusx.irs.edc.client.util; +package org.eclipse.tractusx.irs.edc.client.cache.endpointdatareference; import org.eclipse.edc.spi.types.domain.edr.EndpointDataReference; diff --git a/irs-edc-client/src/test/java/org/eclipse/tractusx/irs/edc/client/ContractNegotiationServiceTest.java b/irs-edc-client/src/test/java/org/eclipse/tractusx/irs/edc/client/ContractNegotiationServiceTest.java index da0787bacb..2748e84e0c 100644 --- a/irs-edc-client/src/test/java/org/eclipse/tractusx/irs/edc/client/ContractNegotiationServiceTest.java +++ b/irs-edc-client/src/test/java/org/eclipse/tractusx/irs/edc/client/ContractNegotiationServiceTest.java @@ -44,7 +44,7 @@ import org.eclipse.tractusx.irs.edc.client.model.Response; import org.eclipse.tractusx.irs.edc.client.model.TransferProcessResponse; import org.eclipse.tractusx.irs.edc.client.policy.PolicyCheckerService; -import org.eclipse.tractusx.irs.edc.client.util.EndpointDataReferenceStatus; +import org.eclipse.tractusx.irs.edc.client.cache.endpointdatareference.EndpointDataReferenceStatus; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.InjectMocks; diff --git a/irs-edc-client/src/test/java/org/eclipse/tractusx/irs/edc/client/EdcCallbackControllerTest.java b/irs-edc-client/src/test/java/org/eclipse/tractusx/irs/edc/client/EdcCallbackControllerTest.java index 9297a473df..f43d2aa7ad 100644 --- a/irs-edc-client/src/test/java/org/eclipse/tractusx/irs/edc/client/EdcCallbackControllerTest.java +++ b/irs-edc-client/src/test/java/org/eclipse/tractusx/irs/edc/client/EdcCallbackControllerTest.java @@ -49,7 +49,7 @@ void shouldStoreAgreementId() { testee.receiveEdcCallback(ref); // assert - final var result = storage.remove("testId"); + final var result = storage.get("testId"); assertThat(result).isNotNull().contains(ref); } @@ -62,7 +62,7 @@ void shouldDoNothingWhenEDRTokenIsInvalid() { testee.receiveEdcCallback(ref); // assert - final var result = storage.remove("testId"); + final var result = storage.get("testId"); assertThat(result).isNotNull().isEmpty(); } } \ No newline at end of file diff --git a/irs-edc-client/src/test/java/org/eclipse/tractusx/irs/edc/client/EdcSubmodelClientTest.java b/irs-edc-client/src/test/java/org/eclipse/tractusx/irs/edc/client/EdcSubmodelClientTest.java index 3a694937c6..730469b02f 100644 --- a/irs-edc-client/src/test/java/org/eclipse/tractusx/irs/edc/client/EdcSubmodelClientTest.java +++ b/irs-edc-client/src/test/java/org/eclipse/tractusx/irs/edc/client/EdcSubmodelClientTest.java @@ -24,7 +24,7 @@ package org.eclipse.tractusx.irs.edc.client; import static org.assertj.core.api.Assertions.assertThat; -import static org.eclipse.tractusx.irs.edc.client.util.EndpointDataReferenceStatus.TokenStatus; +import static org.eclipse.tractusx.irs.edc.client.cache.endpointdatareference.EndpointDataReferenceStatus.TokenStatus; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.mock; @@ -70,8 +70,8 @@ import org.eclipse.tractusx.irs.edc.client.model.notification.EdcNotification; import org.eclipse.tractusx.irs.edc.client.model.notification.EdcNotificationResponse; import org.eclipse.tractusx.irs.edc.client.model.notification.NotificationContent; -import org.eclipse.tractusx.irs.edc.client.util.EndpointDataReferenceCacheService; -import org.eclipse.tractusx.irs.edc.client.util.EndpointDataReferenceStatus; +import org.eclipse.tractusx.irs.edc.client.cache.endpointdatareference.EndpointDataReferenceCacheService; +import org.eclipse.tractusx.irs.edc.client.cache.endpointdatareference.EndpointDataReferenceStatus; import org.eclipse.tractusx.irs.testing.containers.LocalTestDataConfigurationAware; import org.jetbrains.annotations.NotNull; import org.junit.jupiter.api.BeforeEach; @@ -155,11 +155,12 @@ void shouldSendNotificationSuccessfully() throws Exception { final EdcNotification notification = EdcNotification.builder().build(); when(catalogFacade.fetchCatalogByFilter(any(), any(), any())).thenReturn( List.of(CatalogItem.builder().itemId("itemId").build())); - when(contractNegotiationService.negotiate(any(), any())).thenReturn( + when(contractNegotiationService.negotiate(any(), any(), any())).thenReturn( NegotiationResponse.builder().contractAgreementId("agreementId").build()); final EndpointDataReference ref = mock(EndpointDataReference.class); endpointDataReferenceStorage.put("agreementId", ref); when(edcDataPlaneClient.sendData(ref, notification)).thenReturn(() -> true); + when(endpointDataReferenceCacheService.getEndpointDataReference(any())).thenReturn(new EndpointDataReferenceStatus(null, TokenStatus.REQUIRED_NEW)); // act final var result = testee.sendNotification(CONNECTOR_ENDPOINT, "notify-request-asset", notification); diff --git a/irs-edc-client/src/test/java/org/eclipse/tractusx/irs/edc/client/SubmodelFacadeWiremockTest.java b/irs-edc-client/src/test/java/org/eclipse/tractusx/irs/edc/client/SubmodelFacadeWiremockTest.java index 0a7210fcf4..a6fdc2217e 100644 --- a/irs-edc-client/src/test/java/org/eclipse/tractusx/irs/edc/client/SubmodelFacadeWiremockTest.java +++ b/irs-edc-client/src/test/java/org/eclipse/tractusx/irs/edc/client/SubmodelFacadeWiremockTest.java @@ -64,7 +64,7 @@ import org.eclipse.tractusx.irs.edc.client.policy.Permission; import org.eclipse.tractusx.irs.edc.client.policy.PolicyCheckerService; import org.eclipse.tractusx.irs.edc.client.policy.PolicyType; -import org.eclipse.tractusx.irs.edc.client.util.EndpointDataReferenceCacheService; +import org.eclipse.tractusx.irs.edc.client.cache.endpointdatareference.EndpointDataReferenceCacheService; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; diff --git a/irs-edc-client/src/test/java/org/eclipse/tractusx/irs/edc/client/SubmodelRetryerTest.java b/irs-edc-client/src/test/java/org/eclipse/tractusx/irs/edc/client/SubmodelRetryerTest.java index e0c228f4bb..2ed23c9674 100644 --- a/irs-edc-client/src/test/java/org/eclipse/tractusx/irs/edc/client/SubmodelRetryerTest.java +++ b/irs-edc-client/src/test/java/org/eclipse/tractusx/irs/edc/client/SubmodelRetryerTest.java @@ -37,8 +37,8 @@ import io.github.resilience4j.retry.RetryRegistry; import io.github.resilience4j.retry.internal.InMemoryRetryRegistry; import org.eclipse.tractusx.irs.edc.client.policy.PolicyCheckerService; -import org.eclipse.tractusx.irs.edc.client.util.EndpointDataReferenceCacheService; -import org.eclipse.tractusx.irs.edc.client.util.EndpointDataReferenceStatus; +import org.eclipse.tractusx.irs.edc.client.cache.endpointdatareference.EndpointDataReferenceCacheService; +import org.eclipse.tractusx.irs.edc.client.cache.endpointdatareference.EndpointDataReferenceStatus; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; diff --git a/irs-edc-client/src/test/java/org/eclipse/tractusx/irs/edc/client/util/EndpointDataReferenceCacheServiceTest.java b/irs-edc-client/src/test/java/org/eclipse/tractusx/irs/edc/client/util/EndpointDataReferenceCacheServiceTest.java index b84e338b78..96dd69b0a1 100644 --- a/irs-edc-client/src/test/java/org/eclipse/tractusx/irs/edc/client/util/EndpointDataReferenceCacheServiceTest.java +++ b/irs-edc-client/src/test/java/org/eclipse/tractusx/irs/edc/client/util/EndpointDataReferenceCacheServiceTest.java @@ -1,18 +1,3 @@ -package org.eclipse.tractusx.irs.edc.client.util; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.when; - -import java.util.Optional; - -import org.eclipse.edc.spi.types.domain.edr.EndpointDataReference; -import org.eclipse.tractusx.irs.edc.client.EndpointDataReferenceStorage; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.junit.jupiter.MockitoExtension; - /******************************************************************************** * Copyright (c) 2021,2022,2023 * 2022: ZF Friedrichshafen AG @@ -36,6 +21,23 @@ * * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ +package org.eclipse.tractusx.irs.edc.client.util; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Mockito.when; + +import java.util.Optional; + +import org.eclipse.edc.spi.types.domain.edr.EndpointDataReference; +import org.eclipse.tractusx.irs.edc.client.EndpointDataReferenceStorage; +import org.eclipse.tractusx.irs.edc.client.cache.endpointdatareference.EndpointDataReferenceCacheService; +import org.eclipse.tractusx.irs.edc.client.cache.endpointdatareference.EndpointDataReferenceStatus; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; + @ExtendWith(MockitoExtension.class) class EndpointDataReferenceCacheServiceTest {