Skip to content

Commit

Permalink
fix depedencies file
Browse files Browse the repository at this point in the history
  • Loading branch information
wolf4ood committed Jul 20, 2023
1 parent 79a582c commit 9da1d48
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 12 deletions.
8 changes: 4 additions & 4 deletions DEPENDENCIES
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ maven/mavencentral/com.azure/azure-core-http-netty/1.13.5, MIT AND Apache-2.0, a
maven/mavencentral/com.azure/azure-core/1.39.0, MIT, approved, clearlydefined
maven/mavencentral/com.azure/azure-core/1.40.0, MIT, approved, clearlydefined
maven/mavencentral/com.azure/azure-core/1.41.0, MIT AND Apache-2.0, approved, #9648
maven/mavencentral/com.azure/azure-identity/1.9.0, MIT, approved, clearlydefined
maven/mavencentral/com.azure/azure-identity/1.9.2, , restricted, clearlydefined
maven/mavencentral/com.azure/azure-identity/1.9.0, MIT AND Apache-2.0, approved, #9686
maven/mavencentral/com.azure/azure-identity/1.9.2, MIT AND Apache-2.0, approved, #9686
maven/mavencentral/com.azure/azure-json/1.0.1, MIT AND Apache-2.0, approved, #7933
maven/mavencentral/com.azure/azure-security-keyvault-secrets/4.6.2, MIT, approved, #7940
maven/mavencentral/com.azure/azure-security-keyvault-secrets/4.6.3, MIT, approved, #7940
Expand Down Expand Up @@ -162,8 +162,8 @@ maven/mavencentral/io.netty/netty-transport/4.1.94.Final, Apache-2.0 AND BSD-3-C
maven/mavencentral/io.opentelemetry.instrumentation/opentelemetry-instrumentation-annotations/1.27.0, Apache-2.0, approved, #9270
maven/mavencentral/io.opentelemetry/opentelemetry-api/1.27.0, Apache-2.0, approved, clearlydefined
maven/mavencentral/io.opentelemetry/opentelemetry-context/1.27.0, Apache-2.0, approved, clearlydefined
maven/mavencentral/io.projectreactor.netty/reactor-netty-core/1.0.28, Apache-2.0, approved, clearlydefined
maven/mavencentral/io.projectreactor.netty/reactor-netty-core/1.0.33, , restricted, clearlydefined
maven/mavencentral/io.projectreactor.netty/reactor-netty-core/1.0.28, Apache-2.0, approved, #9687
maven/mavencentral/io.projectreactor.netty/reactor-netty-core/1.0.33, Apache-2.0, approved, #9687
maven/mavencentral/io.projectreactor.netty/reactor-netty-http/1.0.28, Apache-2.0, approved, clearlydefined
maven/mavencentral/io.projectreactor.netty/reactor-netty-http/1.0.33, Apache-2.0, approved, clearlydefined
maven/mavencentral/io.projectreactor/reactor-core/3.4.27, Apache-2.0, approved, #7517
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,6 @@ protected void transitionToNegotiated(EndpointDataReferenceEntry edrEntry) {
update(edrEntry);
}

protected void transitionToExpired(EndpointDataReferenceEntry edrEntry) {
edrEntry.transitionToExpired();
update(edrEntry);
}

protected void transitionToError(EndpointDataReferenceEntry edrEntry, String message) {
edrEntry.setErrorDetail(message);
edrEntry.transitionError();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.eclipse.edc.service.spi.result.ServiceResult;
import org.eclipse.edc.spi.monitor.Monitor;
import org.eclipse.edc.spi.query.Criterion;
import org.eclipse.edc.spi.query.QuerySpec;
import org.eclipse.edc.spi.result.StoreResult;
import org.eclipse.tractusx.edc.edr.spi.store.EndpointDataReferenceCache;
import org.eclipse.tractusx.edc.edr.spi.types.EndpointDataReferenceEntry;
Expand All @@ -38,16 +39,19 @@
import java.time.ZoneOffset;
import java.util.List;
import java.util.UUID;
import java.util.stream.Stream;

import static java.util.Collections.emptyList;
import static org.assertj.core.api.Assertions.assertThat;
import static org.awaitility.Awaitility.await;
import static org.eclipse.edc.connector.transfer.spi.types.TransferProcess.Type.CONSUMER;
import static org.eclipse.edc.spi.persistence.StateEntityStore.hasState;
import static org.eclipse.tractusx.edc.edr.core.EdrCoreExtension.DEFAULT_BATCH_SIZE;
import static org.eclipse.tractusx.edc.edr.core.EdrCoreExtension.DEFAULT_EXPIRING_DURATION;
import static org.eclipse.tractusx.edc.edr.core.fixtures.TestFunctions.getContractNegotiation;
import static org.eclipse.tractusx.edc.edr.core.fixtures.TestFunctions.getNegotiateEdrRequest;
import static org.eclipse.tractusx.edc.edr.core.manager.EdrManagerImpl.LOCAL_CALLBACK;
import static org.eclipse.tractusx.edc.edr.spi.types.EndpointDataReferenceEntryStates.DELETING;
import static org.eclipse.tractusx.edc.edr.spi.types.EndpointDataReferenceEntryStates.ERROR;
import static org.eclipse.tractusx.edc.edr.spi.types.EndpointDataReferenceEntryStates.EXPIRED;
import static org.eclipse.tractusx.edc.edr.spi.types.EndpointDataReferenceEntryStates.NEGOTIATED;
Expand Down Expand Up @@ -193,16 +197,37 @@ void initial_shouldNotTransitionError_whenInitiatedTransferFailsOnce() {
}

@Test
@DisplayName("Verify that EDR is deleted when the retention period is over")
void initial_shouldDeleteTheEntry_whenTheRetentionPeriodIsOver() {
@DisplayName("Verify that EDR state should transition to deleting when the retention period is over")
void initial_shouldTransitionToDeleting_whenTheRetentionPeriodIsOver() {
var expiration = Instant.now().atOffset(ZoneOffset.UTC).toInstant().minusSeconds(DEFAULT_EXPIRING_DURATION + 10);
var edrEntry = edrEntryBuilder().state(EXPIRED.code()).expirationTimestamp(expiration.toEpochMilli()).build();

when(edrCache.nextNotLeased(anyInt(), stateIs(EXPIRED.code())))
.thenReturn(List.of(edrEntry))
.thenReturn(emptyList());

when(edrCache.deleteByTransferProcessId(edrEntry.getTransferProcessId())).thenReturn(StoreResult.success(edrEntry));
edrManager.start();

await().untilAsserted(() -> verify(edrCache).update(argThat(p -> p.getState() == DELETING.code())));
}

@Test
@DisplayName("Verify that EDR is deleted when state is DELETING")
void initial_shouldDeleteTheEntry_whenTheRetentionPeriodIsOver() {
var expiration = Instant.now().atOffset(ZoneOffset.UTC).toInstant().minusSeconds(DEFAULT_EXPIRING_DURATION + 10);
var edrEntry = edrEntryBuilder().state(DELETING.code()).expirationTimestamp(expiration.toEpochMilli()).build();

var query = QuerySpec.Builder.newInstance()
.filter(hasState(DELETING.code()))
.limit(DEFAULT_BATCH_SIZE)
.build();

when(edrCache.queryForEntries(query))
.thenReturn(Stream.of(edrEntry))
.thenReturn(Stream.empty());


when(edrCache.deleteByTransferProcessId(edrEntry.getTransferProcessId())).thenReturn(StoreResult.success());

edrManager.start();

Expand Down

0 comments on commit 9da1d48

Please sign in to comment.