Search in sources :

Example 1 with TestProvisionedDataDestinationResource

use of org.eclipse.dataspaceconnector.transfer.core.TestProvisionedDataDestinationResource in project DataSpaceConnector by eclipse-dataspaceconnector.

the class ProvisionManagerImplTest method deprovision_should_deprovision_all_the_transfer_process_provisioned_resources.

@Test
void deprovision_should_deprovision_all_the_transfer_process_provisioned_resources() {
    var deprovisionResponse = DeprovisionResponse.Builder.newInstance().resource(new TestProvisionedDataDestinationResource("test-resource")).build();
    when(provisioner.canDeprovision(isA(ProvisionedResource.class))).thenReturn(true);
    when(provisioner.deprovision(isA(TestProvisionedResource.class))).thenReturn(completedFuture(deprovisionResponse));
    TransferProcess transferProcess = TransferProcess.Builder.newInstance().id("id").state(TransferProcessStates.REQUESTED.code()).provisionedResourceSet(ProvisionedResourceSet.Builder.newInstance().resources(List.of(new TestProvisionedResource())).build()).build();
    var result = provisionManager.deprovision(transferProcess);
    assertThat(result).succeedsWithin(1, SECONDS).extracting(responses -> responses.get(0)).extracting(DeprovisionResponse::getResource).extracting(ProvisionedDataDestinationResource.class::cast).extracting(ProvisionedDataDestinationResource::getResourceName).isEqualTo("test-resource");
}
Also used : TestProvisionedDataDestinationResource(org.eclipse.dataspaceconnector.transfer.core.TestProvisionedDataDestinationResource) ProvisionedDataDestinationResource(org.eclipse.dataspaceconnector.spi.types.domain.transfer.ProvisionedDataDestinationResource) TransferProcess(org.eclipse.dataspaceconnector.spi.types.domain.transfer.TransferProcess) TestProvisionedDataDestinationResource(org.eclipse.dataspaceconnector.transfer.core.TestProvisionedDataDestinationResource) ProvisionedResource(org.eclipse.dataspaceconnector.spi.types.domain.transfer.ProvisionedResource) Test(org.junit.jupiter.api.Test)

Example 2 with TestProvisionedDataDestinationResource

use of org.eclipse.dataspaceconnector.transfer.core.TestProvisionedDataDestinationResource in project DataSpaceConnector by eclipse-dataspaceconnector.

the class ProvisionManagerImplTest method provision_should_provision_all_the_transfer_process_definitions.

@Test
void provision_should_provision_all_the_transfer_process_definitions() {
    when(provisioner.canProvision(isA(TestResourceDefinition.class))).thenReturn(true);
    var provisionResult = StatusResult.success(ProvisionResponse.Builder.newInstance().resource(new TestProvisionedDataDestinationResource("test-resource", "1")).build());
    when(provisioner.provision(isA(TestResourceDefinition.class), isA(Policy.class))).thenReturn(completedFuture(provisionResult));
    var result = provisionManager.provision(List.of(new TestResourceDefinition()), policy);
    assertThat(result).succeedsWithin(1, SECONDS).extracting(responses -> responses.get(0)).extracting(StatusResult::getContent).extracting(ProvisionResponse::getResource).extracting(ProvisionedDataDestinationResource.class::cast).extracting(ProvisionedDataDestinationResource::getResourceName).isEqualTo("test-resource");
}
Also used : Policy(org.eclipse.dataspaceconnector.policy.model.Policy) TestResourceDefinition(org.eclipse.dataspaceconnector.transfer.core.TestResourceDefinition) BeforeEach(org.junit.jupiter.api.BeforeEach) Policy(org.eclipse.dataspaceconnector.policy.model.Policy) TestProvisionedDataDestinationResource(org.eclipse.dataspaceconnector.transfer.core.TestProvisionedDataDestinationResource) ProvisionedResource(org.eclipse.dataspaceconnector.spi.types.domain.transfer.ProvisionedResource) CompletableFuture.completedFuture(java.util.concurrent.CompletableFuture.completedFuture) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) EdcException(org.eclipse.dataspaceconnector.spi.EdcException) Mockito.when(org.mockito.Mockito.when) StatusResult(org.eclipse.dataspaceconnector.spi.response.StatusResult) Test(org.junit.jupiter.api.Test) ExecutionException(java.util.concurrent.ExecutionException) DeprovisionedResource(org.eclipse.dataspaceconnector.spi.types.domain.transfer.DeprovisionedResource) CompletableFuture.failedFuture(java.util.concurrent.CompletableFuture.failedFuture) Provisioner(org.eclipse.dataspaceconnector.spi.transfer.provision.Provisioner) List(java.util.List) ProvisionResponse(org.eclipse.dataspaceconnector.spi.types.domain.transfer.ProvisionResponse) ProvisionedDataDestinationResource(org.eclipse.dataspaceconnector.spi.types.domain.transfer.ProvisionedDataDestinationResource) Monitor(org.eclipse.dataspaceconnector.spi.monitor.Monitor) SECONDS(java.util.concurrent.TimeUnit.SECONDS) ArgumentMatchers.isA(org.mockito.ArgumentMatchers.isA) Mockito.mock(org.mockito.Mockito.mock) TestProvisionedDataDestinationResource(org.eclipse.dataspaceconnector.transfer.core.TestProvisionedDataDestinationResource) ProvisionedDataDestinationResource(org.eclipse.dataspaceconnector.spi.types.domain.transfer.ProvisionedDataDestinationResource) StatusResult(org.eclipse.dataspaceconnector.spi.response.StatusResult) TestResourceDefinition(org.eclipse.dataspaceconnector.transfer.core.TestResourceDefinition) TestProvisionedDataDestinationResource(org.eclipse.dataspaceconnector.transfer.core.TestProvisionedDataDestinationResource) Test(org.junit.jupiter.api.Test)

Example 3 with TestProvisionedDataDestinationResource

use of org.eclipse.dataspaceconnector.transfer.core.TestProvisionedDataDestinationResource in project DataSpaceConnector by eclipse-dataspaceconnector.

the class TransferProcessManagerImplIntegrationTest method verifyProvision_shouldNotStarve.

@Test
@DisplayName("Verify that no process 'starves' during two consecutive runs, when the batch size > number of processes")
void verifyProvision_shouldNotStarve() throws InterruptedException {
    var numProcesses = TRANSFER_MANAGER_BATCHSIZE * 2;
    var processesToProvision = new CountDownLatch(numProcesses);
    when(provisionManager.provision(any(), any(Policy.class))).thenAnswer(i -> {
        processesToProvision.countDown();
        return completedFuture(List.of(ProvisionResponse.Builder.newInstance().resource(new TestProvisionedDataDestinationResource("any", "1")).build()));
    });
    var manifest = ResourceManifest.Builder.newInstance().definitions(List.of(new TestResourceDefinition())).build();
    var processes = IntStream.range(0, numProcesses).mapToObj(i -> provisionedResourceSet()).map(resourceSet -> createUnsavedTransferProcess().resourceManifest(manifest).provisionedResourceSet(resourceSet).build()).peek(TransferProcess::transitionInitial).peek(store::create).collect(Collectors.toList());
    transferProcessManager.start();
    assertThat(processesToProvision.await(10, SECONDS)).isTrue();
    assertThat(processes).describedAs("All transfer processes state should be greater than INITIAL").allSatisfy(process -> {
        var id = process.getId();
        var storedProcess = store.find(id);
        assertThat(storedProcess).describedAs("Should exist in the TransferProcessStore").isNotNull();
        assertThat(storedProcess.getState()).isGreaterThan(INITIAL.code());
    });
    verify(provisionManager, times(numProcesses)).provision(any(), any());
}
Also used : Policy(org.eclipse.dataspaceconnector.policy.model.Policy) IntStream(java.util.stream.IntStream) UNSAVED(org.eclipse.dataspaceconnector.spi.types.domain.transfer.TransferProcessStates.UNSAVED) ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) BeforeEach(org.junit.jupiter.api.BeforeEach) TestProvisionedDataDestinationResource(org.eclipse.dataspaceconnector.transfer.core.TestProvisionedDataDestinationResource) TypeManager(org.eclipse.dataspaceconnector.spi.types.TypeManager) DataAddressResolver(org.eclipse.dataspaceconnector.spi.asset.DataAddressResolver) CompletableFuture.completedFuture(java.util.concurrent.CompletableFuture.completedFuture) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) ComponentTest(org.eclipse.dataspaceconnector.common.annotations.ComponentTest) ExponentialWaitStrategy(org.eclipse.dataspaceconnector.spi.retry.ExponentialWaitStrategy) CommandRunner(org.eclipse.dataspaceconnector.spi.command.CommandRunner) TransferProcess(org.eclipse.dataspaceconnector.spi.types.domain.transfer.TransferProcess) ProvisionManager(org.eclipse.dataspaceconnector.spi.transfer.provision.ProvisionManager) InMemoryTransferProcessStore(org.eclipse.dataspaceconnector.core.defaults.transferprocessstore.InMemoryTransferProcessStore) DataFlowManager(org.eclipse.dataspaceconnector.spi.transfer.flow.DataFlowManager) TransferProcessObservable(org.eclipse.dataspaceconnector.spi.transfer.observe.TransferProcessObservable) StatusCheckerRegistry(org.eclipse.dataspaceconnector.spi.types.domain.transfer.StatusCheckerRegistry) PolicyArchive(org.eclipse.dataspaceconnector.spi.policy.store.PolicyArchive) TestResourceDefinition(org.eclipse.dataspaceconnector.transfer.core.TestResourceDefinition) ResourceManifest(org.eclipse.dataspaceconnector.spi.types.domain.transfer.ResourceManifest) Policy(org.eclipse.dataspaceconnector.policy.model.Policy) ResourceManifestGenerator(org.eclipse.dataspaceconnector.spi.transfer.provision.ResourceManifestGenerator) ProvisionedResourceSet(org.eclipse.dataspaceconnector.spi.types.domain.transfer.ProvisionedResourceSet) DataRequest(org.eclipse.dataspaceconnector.spi.types.domain.transfer.DataRequest) Mockito.times(org.mockito.Mockito.times) UUID(java.util.UUID) Mockito.when(org.mockito.Mockito.when) Collectors(java.util.stream.Collectors) TransferProcessStore(org.eclipse.dataspaceconnector.spi.transfer.store.TransferProcessStore) DisplayName(org.junit.jupiter.api.DisplayName) Mockito.verify(org.mockito.Mockito.verify) Test(org.junit.jupiter.api.Test) CountDownLatch(java.util.concurrent.CountDownLatch) List(java.util.List) TransferType(org.eclipse.dataspaceconnector.spi.types.domain.transfer.TransferType) ProvisionResponse(org.eclipse.dataspaceconnector.spi.types.domain.transfer.ProvisionResponse) RemoteMessageDispatcherRegistry(org.eclipse.dataspaceconnector.spi.message.RemoteMessageDispatcherRegistry) CommandQueue(org.eclipse.dataspaceconnector.spi.command.CommandQueue) INITIAL(org.eclipse.dataspaceconnector.spi.types.domain.transfer.TransferProcessStates.INITIAL) Monitor(org.eclipse.dataspaceconnector.spi.monitor.Monitor) SECONDS(java.util.concurrent.TimeUnit.SECONDS) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) Mockito.mock(org.mockito.Mockito.mock) TestResourceDefinition(org.eclipse.dataspaceconnector.transfer.core.TestResourceDefinition) CountDownLatch(java.util.concurrent.CountDownLatch) TransferProcess(org.eclipse.dataspaceconnector.spi.types.domain.transfer.TransferProcess) TestProvisionedDataDestinationResource(org.eclipse.dataspaceconnector.transfer.core.TestProvisionedDataDestinationResource) ComponentTest(org.eclipse.dataspaceconnector.common.annotations.ComponentTest) Test(org.junit.jupiter.api.Test) DisplayName(org.junit.jupiter.api.DisplayName)

Example 4 with TestProvisionedDataDestinationResource

use of org.eclipse.dataspaceconnector.transfer.core.TestProvisionedDataDestinationResource in project DataSpaceConnector by eclipse-dataspaceconnector.

the class TransferProcessManagerImplTest method deprovisioning_shouldTransitionToErrorOnFatalDeprovisionError.

@Test
void deprovisioning_shouldTransitionToErrorOnFatalDeprovisionError() throws InterruptedException {
    var manifest = ResourceManifest.Builder.newInstance().definitions(List.of(new TestResourceDefinition())).build();
    var resourceSet = ProvisionedResourceSet.Builder.newInstance().resources(List.of(new TestProvisionedDataDestinationResource("test", PROVISIONED_RESOURCE_ID))).build();
    var process = createTransferProcess(DEPROVISIONING).toBuilder().resourceManifest(manifest).provisionedResourceSet(resourceSet).build();
    var deprovisionResult = StatusResult.<DeprovisionedResource>failure(ResponseStatus.FATAL_ERROR, "test error");
    when(policyArchive.findPolicyForContract(anyString())).thenReturn(Policy.Builder.newInstance().build());
    when(provisionManager.deprovision(any(), isA(Policy.class))).thenReturn(completedFuture(List.of(deprovisionResult)));
    when(transferProcessStore.nextForState(eq(DEPROVISIONING.code()), anyInt())).thenReturn(List.of(process)).thenReturn(emptyList());
    when(transferProcessStore.find(process.getId())).thenReturn(process);
    var latch = countDownOnUpdateLatch();
    manager.start();
    assertThat(latch.await(TIMEOUT, TimeUnit.SECONDS)).isTrue();
    verify(policyArchive, atLeastOnce()).findPolicyForContract(anyString());
    verify(transferProcessStore).update(argThat(p -> p.getState() == ERROR.code()));
}
Also used : Policy(org.eclipse.dataspaceconnector.policy.model.Policy) BeforeEach(org.junit.jupiter.api.BeforeEach) PROVISIONING(org.eclipse.dataspaceconnector.spi.types.domain.transfer.TransferProcessStates.PROVISIONING) TestProvisionedDataDestinationResource(org.eclipse.dataspaceconnector.transfer.core.TestProvisionedDataDestinationResource) ArgumentMatchers.argThat(org.mockito.ArgumentMatchers.argThat) TypeManager(org.eclipse.dataspaceconnector.spi.types.TypeManager) ArgumentMatchers.eq(org.mockito.ArgumentMatchers.eq) DataAddressResolver(org.eclipse.dataspaceconnector.spi.asset.DataAddressResolver) CompletableFuture.completedFuture(java.util.concurrent.CompletableFuture.completedFuture) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) ExponentialWaitStrategy(org.eclipse.dataspaceconnector.spi.retry.ExponentialWaitStrategy) TransferProcess(org.eclipse.dataspaceconnector.spi.types.domain.transfer.TransferProcess) PROVISIONED(org.eclipse.dataspaceconnector.spi.types.domain.transfer.TransferProcessStates.PROVISIONED) Mockito.verifyNoInteractions(org.mockito.Mockito.verifyNoInteractions) ProvisionManager(org.eclipse.dataspaceconnector.spi.transfer.provision.ProvisionManager) Mockito.doThrow(org.mockito.Mockito.doThrow) DataFlowManager(org.eclipse.dataspaceconnector.spi.transfer.flow.DataFlowManager) Map(java.util.Map) Mockito.doAnswer(org.mockito.Mockito.doAnswer) SecretToken(org.eclipse.dataspaceconnector.spi.types.domain.transfer.SecretToken) StatusCheckerRegistry(org.eclipse.dataspaceconnector.spi.types.domain.transfer.StatusCheckerRegistry) PolicyArchive(org.eclipse.dataspaceconnector.spi.policy.store.PolicyArchive) TestResourceDefinition(org.eclipse.dataspaceconnector.transfer.core.TestResourceDefinition) ERROR(org.eclipse.dataspaceconnector.spi.types.domain.transfer.TransferProcessStates.ERROR) Collections.emptyList(java.util.Collections.emptyList) ENDED(org.eclipse.dataspaceconnector.spi.types.domain.transfer.TransferProcessStates.ENDED) Mockito.atLeastOnce(org.mockito.Mockito.atLeastOnce) EdcException(org.eclipse.dataspaceconnector.spi.EdcException) PROVIDER(org.eclipse.dataspaceconnector.spi.types.domain.transfer.TransferProcess.Type.PROVIDER) DEPROVISIONED(org.eclipse.dataspaceconnector.spi.types.domain.transfer.TransferProcessStates.DEPROVISIONED) UUID(java.util.UUID) JsonPOJOBuilder(com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder) StatusResult(org.eclipse.dataspaceconnector.spi.response.StatusResult) Instant(java.time.Instant) TransferProcessStore(org.eclipse.dataspaceconnector.spi.transfer.store.TransferProcessStore) DataAddress(org.eclipse.dataspaceconnector.spi.types.domain.DataAddress) Test(org.junit.jupiter.api.Test) DeprovisionedResource(org.eclipse.dataspaceconnector.spi.types.domain.transfer.DeprovisionedResource) CountDownLatch(java.util.concurrent.CountDownLatch) CompletableFuture.failedFuture(java.util.concurrent.CompletableFuture.failedFuture) List(java.util.List) TransferType(org.eclipse.dataspaceconnector.spi.types.domain.transfer.TransferType) ProvisionResponse(org.eclipse.dataspaceconnector.spi.types.domain.transfer.ProvisionResponse) UTC(java.time.ZoneOffset.UTC) CommandQueue(org.eclipse.dataspaceconnector.spi.command.CommandQueue) ProvisionedDataDestinationResource(org.eclipse.dataspaceconnector.spi.types.domain.transfer.ProvisionedDataDestinationResource) JsonDeserialize(com.fasterxml.jackson.databind.annotation.JsonDeserialize) REQUESTING(org.eclipse.dataspaceconnector.spi.types.domain.transfer.TransferProcessStates.REQUESTING) ProvisionedContentResource(org.eclipse.dataspaceconnector.spi.types.domain.transfer.ProvisionedContentResource) Mockito.mock(org.mockito.Mockito.mock) ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) Result(org.eclipse.dataspaceconnector.spi.result.Result) CommandRunner(org.eclipse.dataspaceconnector.spi.command.CommandRunner) JsonTypeName(com.fasterxml.jackson.annotation.JsonTypeName) DEPROVISIONING(org.eclipse.dataspaceconnector.spi.types.domain.transfer.TransferProcessStates.DEPROVISIONING) TransferProcessObservable(org.eclipse.dataspaceconnector.spi.transfer.observe.TransferProcessObservable) REQUESTED(org.eclipse.dataspaceconnector.spi.types.domain.transfer.TransferProcessStates.REQUESTED) STREAMING(org.eclipse.dataspaceconnector.spi.types.domain.transfer.TransferProcessStates.STREAMING) IN_PROGRESS(org.eclipse.dataspaceconnector.spi.types.domain.transfer.TransferProcessStates.IN_PROGRESS) ArgumentMatchers.anyInt(org.mockito.ArgumentMatchers.anyInt) CONSUMER(org.eclipse.dataspaceconnector.spi.types.domain.transfer.TransferProcess.Type.CONSUMER) ArgumentMatchers.isA(org.mockito.ArgumentMatchers.isA) ResponseStatus(org.eclipse.dataspaceconnector.spi.response.ResponseStatus) ResourceManifest(org.eclipse.dataspaceconnector.spi.types.domain.transfer.ResourceManifest) Policy(org.eclipse.dataspaceconnector.policy.model.Policy) ResourceManifestGenerator(org.eclipse.dataspaceconnector.spi.transfer.provision.ResourceManifestGenerator) ProvisionedResourceSet(org.eclipse.dataspaceconnector.spi.types.domain.transfer.ProvisionedResourceSet) DataRequest(org.eclipse.dataspaceconnector.spi.types.domain.transfer.DataRequest) Mockito.times(org.mockito.Mockito.times) Vault(org.eclipse.dataspaceconnector.spi.security.Vault) Mockito.when(org.mockito.Mockito.when) DisplayName(org.junit.jupiter.api.DisplayName) Mockito.verify(org.mockito.Mockito.verify) TimeUnit(java.util.concurrent.TimeUnit) COMPLETED(org.eclipse.dataspaceconnector.spi.types.domain.transfer.TransferProcessStates.COMPLETED) Mockito.never(org.mockito.Mockito.never) JsonCreator(com.fasterxml.jackson.annotation.JsonCreator) RemoteMessageDispatcherRegistry(org.eclipse.dataspaceconnector.spi.message.RemoteMessageDispatcherRegistry) Clock(java.time.Clock) INITIAL(org.eclipse.dataspaceconnector.spi.types.domain.transfer.TransferProcessStates.INITIAL) TransferProcessStates(org.eclipse.dataspaceconnector.spi.types.domain.transfer.TransferProcessStates) Monitor(org.eclipse.dataspaceconnector.spi.monitor.Monitor) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) DeprovisionedResource(org.eclipse.dataspaceconnector.spi.types.domain.transfer.DeprovisionedResource) TestResourceDefinition(org.eclipse.dataspaceconnector.transfer.core.TestResourceDefinition) TestProvisionedDataDestinationResource(org.eclipse.dataspaceconnector.transfer.core.TestProvisionedDataDestinationResource) Test(org.junit.jupiter.api.Test)

Example 5 with TestProvisionedDataDestinationResource

use of org.eclipse.dataspaceconnector.transfer.core.TestProvisionedDataDestinationResource in project DataSpaceConnector by eclipse-dataspaceconnector.

the class TransferProcessManagerImplTest method deprovisioning_shouldNotTransitionOnRetriableDeprovisionError.

@Test
void deprovisioning_shouldNotTransitionOnRetriableDeprovisionError() throws InterruptedException {
    var manifest = ResourceManifest.Builder.newInstance().definitions(List.of(new TestResourceDefinition())).build();
    var resourceSet = ProvisionedResourceSet.Builder.newInstance().resources(List.of(new TestProvisionedDataDestinationResource("test", PROVISIONED_RESOURCE_ID))).build();
    var process = createTransferProcess(DEPROVISIONING).toBuilder().resourceManifest(manifest).provisionedResourceSet(resourceSet).build();
    var deprovisionResult = StatusResult.<DeprovisionedResource>failure(ResponseStatus.ERROR_RETRY, "test error");
    when(policyArchive.findPolicyForContract(anyString())).thenReturn(Policy.Builder.newInstance().build());
    when(provisionManager.deprovision(any(), isA(Policy.class))).thenReturn(completedFuture(List.of(deprovisionResult)));
    when(transferProcessStore.nextForState(eq(DEPROVISIONING.code()), anyInt())).thenReturn(List.of(process)).thenReturn(emptyList());
    when(transferProcessStore.find(process.getId())).thenReturn(process);
    var latch = countDownOnUpdateLatch();
    manager.start();
    assertThat(latch.await(TIMEOUT, TimeUnit.SECONDS)).isTrue();
    verify(transferProcessStore).update(argThat(p -> p.getState() == DEPROVISIONING.code()));
    verify(policyArchive, atLeastOnce()).findPolicyForContract(anyString());
}
Also used : Policy(org.eclipse.dataspaceconnector.policy.model.Policy) BeforeEach(org.junit.jupiter.api.BeforeEach) PROVISIONING(org.eclipse.dataspaceconnector.spi.types.domain.transfer.TransferProcessStates.PROVISIONING) TestProvisionedDataDestinationResource(org.eclipse.dataspaceconnector.transfer.core.TestProvisionedDataDestinationResource) ArgumentMatchers.argThat(org.mockito.ArgumentMatchers.argThat) TypeManager(org.eclipse.dataspaceconnector.spi.types.TypeManager) ArgumentMatchers.eq(org.mockito.ArgumentMatchers.eq) DataAddressResolver(org.eclipse.dataspaceconnector.spi.asset.DataAddressResolver) CompletableFuture.completedFuture(java.util.concurrent.CompletableFuture.completedFuture) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) ExponentialWaitStrategy(org.eclipse.dataspaceconnector.spi.retry.ExponentialWaitStrategy) TransferProcess(org.eclipse.dataspaceconnector.spi.types.domain.transfer.TransferProcess) PROVISIONED(org.eclipse.dataspaceconnector.spi.types.domain.transfer.TransferProcessStates.PROVISIONED) Mockito.verifyNoInteractions(org.mockito.Mockito.verifyNoInteractions) ProvisionManager(org.eclipse.dataspaceconnector.spi.transfer.provision.ProvisionManager) Mockito.doThrow(org.mockito.Mockito.doThrow) DataFlowManager(org.eclipse.dataspaceconnector.spi.transfer.flow.DataFlowManager) Map(java.util.Map) Mockito.doAnswer(org.mockito.Mockito.doAnswer) SecretToken(org.eclipse.dataspaceconnector.spi.types.domain.transfer.SecretToken) StatusCheckerRegistry(org.eclipse.dataspaceconnector.spi.types.domain.transfer.StatusCheckerRegistry) PolicyArchive(org.eclipse.dataspaceconnector.spi.policy.store.PolicyArchive) TestResourceDefinition(org.eclipse.dataspaceconnector.transfer.core.TestResourceDefinition) ERROR(org.eclipse.dataspaceconnector.spi.types.domain.transfer.TransferProcessStates.ERROR) Collections.emptyList(java.util.Collections.emptyList) ENDED(org.eclipse.dataspaceconnector.spi.types.domain.transfer.TransferProcessStates.ENDED) Mockito.atLeastOnce(org.mockito.Mockito.atLeastOnce) EdcException(org.eclipse.dataspaceconnector.spi.EdcException) PROVIDER(org.eclipse.dataspaceconnector.spi.types.domain.transfer.TransferProcess.Type.PROVIDER) DEPROVISIONED(org.eclipse.dataspaceconnector.spi.types.domain.transfer.TransferProcessStates.DEPROVISIONED) UUID(java.util.UUID) JsonPOJOBuilder(com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder) StatusResult(org.eclipse.dataspaceconnector.spi.response.StatusResult) Instant(java.time.Instant) TransferProcessStore(org.eclipse.dataspaceconnector.spi.transfer.store.TransferProcessStore) DataAddress(org.eclipse.dataspaceconnector.spi.types.domain.DataAddress) Test(org.junit.jupiter.api.Test) DeprovisionedResource(org.eclipse.dataspaceconnector.spi.types.domain.transfer.DeprovisionedResource) CountDownLatch(java.util.concurrent.CountDownLatch) CompletableFuture.failedFuture(java.util.concurrent.CompletableFuture.failedFuture) List(java.util.List) TransferType(org.eclipse.dataspaceconnector.spi.types.domain.transfer.TransferType) ProvisionResponse(org.eclipse.dataspaceconnector.spi.types.domain.transfer.ProvisionResponse) UTC(java.time.ZoneOffset.UTC) CommandQueue(org.eclipse.dataspaceconnector.spi.command.CommandQueue) ProvisionedDataDestinationResource(org.eclipse.dataspaceconnector.spi.types.domain.transfer.ProvisionedDataDestinationResource) JsonDeserialize(com.fasterxml.jackson.databind.annotation.JsonDeserialize) REQUESTING(org.eclipse.dataspaceconnector.spi.types.domain.transfer.TransferProcessStates.REQUESTING) ProvisionedContentResource(org.eclipse.dataspaceconnector.spi.types.domain.transfer.ProvisionedContentResource) Mockito.mock(org.mockito.Mockito.mock) ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) Result(org.eclipse.dataspaceconnector.spi.result.Result) CommandRunner(org.eclipse.dataspaceconnector.spi.command.CommandRunner) JsonTypeName(com.fasterxml.jackson.annotation.JsonTypeName) DEPROVISIONING(org.eclipse.dataspaceconnector.spi.types.domain.transfer.TransferProcessStates.DEPROVISIONING) TransferProcessObservable(org.eclipse.dataspaceconnector.spi.transfer.observe.TransferProcessObservable) REQUESTED(org.eclipse.dataspaceconnector.spi.types.domain.transfer.TransferProcessStates.REQUESTED) STREAMING(org.eclipse.dataspaceconnector.spi.types.domain.transfer.TransferProcessStates.STREAMING) IN_PROGRESS(org.eclipse.dataspaceconnector.spi.types.domain.transfer.TransferProcessStates.IN_PROGRESS) ArgumentMatchers.anyInt(org.mockito.ArgumentMatchers.anyInt) CONSUMER(org.eclipse.dataspaceconnector.spi.types.domain.transfer.TransferProcess.Type.CONSUMER) ArgumentMatchers.isA(org.mockito.ArgumentMatchers.isA) ResponseStatus(org.eclipse.dataspaceconnector.spi.response.ResponseStatus) ResourceManifest(org.eclipse.dataspaceconnector.spi.types.domain.transfer.ResourceManifest) Policy(org.eclipse.dataspaceconnector.policy.model.Policy) ResourceManifestGenerator(org.eclipse.dataspaceconnector.spi.transfer.provision.ResourceManifestGenerator) ProvisionedResourceSet(org.eclipse.dataspaceconnector.spi.types.domain.transfer.ProvisionedResourceSet) DataRequest(org.eclipse.dataspaceconnector.spi.types.domain.transfer.DataRequest) Mockito.times(org.mockito.Mockito.times) Vault(org.eclipse.dataspaceconnector.spi.security.Vault) Mockito.when(org.mockito.Mockito.when) DisplayName(org.junit.jupiter.api.DisplayName) Mockito.verify(org.mockito.Mockito.verify) TimeUnit(java.util.concurrent.TimeUnit) COMPLETED(org.eclipse.dataspaceconnector.spi.types.domain.transfer.TransferProcessStates.COMPLETED) Mockito.never(org.mockito.Mockito.never) JsonCreator(com.fasterxml.jackson.annotation.JsonCreator) RemoteMessageDispatcherRegistry(org.eclipse.dataspaceconnector.spi.message.RemoteMessageDispatcherRegistry) Clock(java.time.Clock) INITIAL(org.eclipse.dataspaceconnector.spi.types.domain.transfer.TransferProcessStates.INITIAL) TransferProcessStates(org.eclipse.dataspaceconnector.spi.types.domain.transfer.TransferProcessStates) Monitor(org.eclipse.dataspaceconnector.spi.monitor.Monitor) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) DeprovisionedResource(org.eclipse.dataspaceconnector.spi.types.domain.transfer.DeprovisionedResource) TestResourceDefinition(org.eclipse.dataspaceconnector.transfer.core.TestResourceDefinition) TestProvisionedDataDestinationResource(org.eclipse.dataspaceconnector.transfer.core.TestProvisionedDataDestinationResource) Test(org.junit.jupiter.api.Test)

Aggregations

List (java.util.List)4 CompletableFuture.completedFuture (java.util.concurrent.CompletableFuture.completedFuture)4 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)4 Policy (org.eclipse.dataspaceconnector.policy.model.Policy)4 Monitor (org.eclipse.dataspaceconnector.spi.monitor.Monitor)4 ProvisionResponse (org.eclipse.dataspaceconnector.spi.types.domain.transfer.ProvisionResponse)4 UUID (java.util.UUID)3 CompletableFuture.failedFuture (java.util.concurrent.CompletableFuture.failedFuture)3 CountDownLatch (java.util.concurrent.CountDownLatch)3 EdcException (org.eclipse.dataspaceconnector.spi.EdcException)3 DataAddressResolver (org.eclipse.dataspaceconnector.spi.asset.DataAddressResolver)3 CommandQueue (org.eclipse.dataspaceconnector.spi.command.CommandQueue)3 CommandRunner (org.eclipse.dataspaceconnector.spi.command.CommandRunner)3 RemoteMessageDispatcherRegistry (org.eclipse.dataspaceconnector.spi.message.RemoteMessageDispatcherRegistry)3 PolicyArchive (org.eclipse.dataspaceconnector.spi.policy.store.PolicyArchive)3 StatusResult (org.eclipse.dataspaceconnector.spi.response.StatusResult)3 ExponentialWaitStrategy (org.eclipse.dataspaceconnector.spi.retry.ExponentialWaitStrategy)3 DataFlowManager (org.eclipse.dataspaceconnector.spi.transfer.flow.DataFlowManager)3 TransferProcessObservable (org.eclipse.dataspaceconnector.spi.transfer.observe.TransferProcessObservable)3 ProvisionManager (org.eclipse.dataspaceconnector.spi.transfer.provision.ProvisionManager)3