diff --git a/core/common/lib/http-lib/src/main/java/org/eclipse/edc/http/client/EdcHttpClientImpl.java b/core/common/lib/http-lib/src/main/java/org/eclipse/edc/http/client/EdcHttpClientImpl.java index e6ef616ff98..0cdaaadec19 100644 --- a/core/common/lib/http-lib/src/main/java/org/eclipse/edc/http/client/EdcHttpClientImpl.java +++ b/core/common/lib/http-lib/src/main/java/org/eclipse/edc/http/client/EdcHttpClientImpl.java @@ -74,11 +74,6 @@ public Result execute(Request request, List fallbacks, F } } - @Override - public CompletableFuture executeAsync(Request request, Function mappingFunction) { - return executeAsync(request, emptyList(), mappingFunction); - } - @Override public CompletableFuture executeAsync(Request request, List fallbacks) { var call = okHttpClient.newCall(request); @@ -89,16 +84,6 @@ public CompletableFuture executeAsync(Request request, List CompletableFuture executeAsync(Request request, List fallbacks, Function mappingFunction) { - return executeAsync(request, fallbacks) - .thenApply(response -> { - try (response) { - return mappingFunction.apply(response); - } - }); - } - @Override public EdcHttpClient withDns(String dnsServer) { var url = requireNonNull(HttpUrl.get(dnsServer)); diff --git a/core/control-plane/control-plane-aggregate-services/src/main/java/org/eclipse/edc/connector/controlplane/services/contractnegotiation/ContractNegotiationProtocolServiceImpl.java b/core/control-plane/control-plane-aggregate-services/src/main/java/org/eclipse/edc/connector/controlplane/services/contractnegotiation/ContractNegotiationProtocolServiceImpl.java index 05b6d34fc64..4f31adef458 100644 --- a/core/control-plane/control-plane-aggregate-services/src/main/java/org/eclipse/edc/connector/controlplane/services/contractnegotiation/ContractNegotiationProtocolServiceImpl.java +++ b/core/control-plane/control-plane-aggregate-services/src/main/java/org/eclipse/edc/connector/controlplane/services/contractnegotiation/ContractNegotiationProtocolServiceImpl.java @@ -314,8 +314,6 @@ private ServiceResult terminatedAction(ContractNegotiationT private ServiceResult getAndLeaseNegotiation(String negotiationId) { return store.findByIdAndLease(negotiationId) - // recover needed to maintain backward compatibility when there was no distinction between providerPid and consumerPid - .recover(it -> store.findByCorrelationIdAndLease(negotiationId)) .flatMap(ServiceResult::from); } @@ -326,8 +324,6 @@ private ServiceResult verifyRequest(TokenRepresentation tokenR private ServiceResult getNegotiation(String negotiationId) { return Optional.ofNullable(store.findById(negotiationId)) - // recover needed to maintain backward compatibility when there was no distinction between providerPid and consumerPid - .or(() -> Optional.ofNullable(store.findForCorrelationId(negotiationId))) .map(ServiceResult::success) .orElseGet(() -> ServiceResult.notFound("No negotiation with id %s found".formatted(negotiationId))); } diff --git a/core/control-plane/control-plane-aggregate-services/src/main/java/org/eclipse/edc/connector/controlplane/services/transferprocess/TransferProcessProtocolServiceImpl.java b/core/control-plane/control-plane-aggregate-services/src/main/java/org/eclipse/edc/connector/controlplane/services/transferprocess/TransferProcessProtocolServiceImpl.java index df0ffd48593..ee2513d4539 100644 --- a/core/control-plane/control-plane-aggregate-services/src/main/java/org/eclipse/edc/connector/controlplane/services/transferprocess/TransferProcessProtocolServiceImpl.java +++ b/core/control-plane/control-plane-aggregate-services/src/main/java/org/eclipse/edc/connector/controlplane/services/transferprocess/TransferProcessProtocolServiceImpl.java @@ -321,8 +321,6 @@ private ServiceResult validateCounterParty(ParticipantAgent par private ServiceResult findAndLease(TransferRemoteMessage remoteMessage) { return transferProcessStore .findByIdAndLease(remoteMessage.getProcessId()) - // recover needed to maintain backward compatibility when there was no distinction between providerPid and consumerPid - .recover(it -> transferProcessStore.findByCorrelationIdAndLease(remoteMessage.getProcessId())) .flatMap(ServiceResult::from); } diff --git a/core/control-plane/control-plane-aggregate-services/src/test/java/org/eclipse/edc/connector/controlplane/services/contractnegotiation/ContractNegotiationProtocolServiceImplTest.java b/core/control-plane/control-plane-aggregate-services/src/test/java/org/eclipse/edc/connector/controlplane/services/contractnegotiation/ContractNegotiationProtocolServiceImplTest.java index 07099a2bf54..684e1e97252 100644 --- a/core/control-plane/control-plane-aggregate-services/src/test/java/org/eclipse/edc/connector/controlplane/services/contractnegotiation/ContractNegotiationProtocolServiceImplTest.java +++ b/core/control-plane/control-plane-aggregate-services/src/test/java/org/eclipse/edc/connector/controlplane/services/contractnegotiation/ContractNegotiationProtocolServiceImplTest.java @@ -339,7 +339,6 @@ void notify_shouldReturnNotFound_whenNotFound(MethodCa when(protocolTokenValidator.verify(eq(tokenRepresentation), eq(CONTRACT_NEGOTIATION_REQUEST_SCOPE), any(), eq(message))) .thenReturn(ServiceResult.success(participantAgent())); when(store.findByIdAndLease(any())).thenReturn(StoreResult.notFound("not found")); - when(store.findByCorrelationIdAndLease(any())).thenReturn(StoreResult.notFound("not found")); // currently ContractRequestMessage cannot happen on an already existing negotiation if (!(message instanceof ContractRequestMessage)) { @@ -708,7 +707,6 @@ void shouldReturnNotFound_whenOfferNotFound() { when(protocolTokenValidator.verify(eq(tokenRepresentation), eq(CONTRACT_NEGOTIATION_REQUEST_SCOPE), any(), eq(message))) .thenReturn(ServiceResult.success(participantAgent())); when(store.findByIdAndLease(any())).thenReturn(StoreResult.notFound("not found")); - when(store.findByCorrelationIdAndLease(any())).thenReturn(StoreResult.notFound("not found")); var result = service.notifyOffered(message, tokenRepresentation); diff --git a/core/control-plane/control-plane-aggregate-services/src/test/java/org/eclipse/edc/connector/controlplane/services/transferprocess/TransferProcessProtocolServiceImplTest.java b/core/control-plane/control-plane-aggregate-services/src/test/java/org/eclipse/edc/connector/controlplane/services/transferprocess/TransferProcessProtocolServiceImplTest.java index c2dc3cc1683..f90c2351ec3 100644 --- a/core/control-plane/control-plane-aggregate-services/src/test/java/org/eclipse/edc/connector/controlplane/services/transferprocess/TransferProcessProtocolServiceImplTest.java +++ b/core/control-plane/control-plane-aggregate-services/src/test/java/org/eclipse/edc/connector/controlplane/services/transferprocess/TransferProcessProtocolServiceImplTest.java @@ -469,7 +469,6 @@ void notify_shouldFail_whenTransferProcessNotFound(Met when(protocolTokenValidator.verify(eq(tokenRepresentation), eq(TRANSFER_PROCESS_REQUEST_SCOPE), any())).thenReturn(ServiceResult.success(participantAgent)); when(store.findByIdAndLease(any())).thenReturn(StoreResult.notFound("not found")); - when(store.findByCorrelationIdAndLease(any())).thenReturn(StoreResult.notFound("not found")); var result = methodCall.call(service, message, tokenRepresentation); diff --git a/core/control-plane/control-plane-contract/src/test/java/org/eclipse/edc/connector/controlplane/contract/negotiation/ContractNegotiationIntegrationTest.java b/core/control-plane/control-plane-contract/src/test/java/org/eclipse/edc/connector/controlplane/contract/negotiation/ContractNegotiationIntegrationTest.java index 0ed41b28f44..4e811fcca7f 100644 --- a/core/control-plane/control-plane-contract/src/test/java/org/eclipse/edc/connector/controlplane/contract/negotiation/ContractNegotiationIntegrationTest.java +++ b/core/control-plane/control-plane-contract/src/test/java/org/eclipse/edc/connector/controlplane/contract/negotiation/ContractNegotiationIntegrationTest.java @@ -15,7 +15,6 @@ package org.eclipse.edc.connector.controlplane.contract.negotiation; -import org.eclipse.edc.connector.controlplane.contract.observe.ContractNegotiationObservableImpl; import org.eclipse.edc.connector.controlplane.contract.spi.ContractOfferId; import org.eclipse.edc.connector.controlplane.contract.spi.offer.ConsumerOfferResolver; import org.eclipse.edc.connector.controlplane.contract.spi.types.agreement.ContractAgreement; @@ -35,7 +34,6 @@ import org.eclipse.edc.connector.controlplane.contract.spi.validation.ValidatableConsumerOffer; import org.eclipse.edc.connector.controlplane.contract.spi.validation.ValidatedConsumerOffer; import org.eclipse.edc.connector.controlplane.defaults.storage.contractnegotiation.InMemoryContractNegotiationStore; -import org.eclipse.edc.connector.controlplane.policy.spi.store.PolicyDefinitionStore; import org.eclipse.edc.connector.controlplane.services.contractnegotiation.ContractNegotiationProtocolServiceImpl; import org.eclipse.edc.connector.controlplane.services.spi.contractnegotiation.ContractNegotiationProtocolService; import org.eclipse.edc.connector.controlplane.services.spi.protocol.ProtocolTokenValidator; @@ -75,6 +73,7 @@ import java.util.Collections; import java.util.List; import java.util.concurrent.CompletableFuture; +import java.util.concurrent.atomic.AtomicReference; import java.util.stream.Stream; import static java.util.UUID.randomUUID; @@ -122,6 +121,8 @@ class ContractNegotiationIntegrationTest { protected ParticipantAgent participantAgent = new ParticipantAgent(Collections.emptyMap(), Collections.emptyMap()); protected TokenRepresentation tokenRepresentation = TokenRepresentation.Builder.newInstance().build(); private String consumerNegotiationId; + private final AtomicReference providerNegotiationId = new AtomicReference<>(null); + private final NoopTransactionContext transactionContext = new NoopTransactionContext(); private ProviderContractNegotiationManagerImpl providerManager; private ConsumerContractNegotiationManagerImpl consumerManager; @@ -137,9 +138,9 @@ void init() { .dispatcherRegistry(providerDispatcherRegistry) .monitor(monitor) .waitStrategy(() -> 1000) - .observable(new ContractNegotiationObservableImpl()) + .observable(mock()) .store(providerStore) - .policyStore(mock(PolicyDefinitionStore.class)) + .policyStore(mock()) .protocolWebhook(protocolWebhook) .build(); @@ -147,15 +148,15 @@ void init() { .participantId(CONSUMER_ID) .dispatcherRegistry(consumerDispatcherRegistry) .monitor(monitor).waitStrategy(() -> 1000) - .observable(new ContractNegotiationObservableImpl()) + .observable(mock()) .store(consumerStore) - .policyStore(mock(PolicyDefinitionStore.class)) + .policyStore(mock()) .protocolWebhook(protocolWebhook) .build(); when(protocolTokenValidator.verify(eq(tokenRepresentation), any(), any(), any())).thenReturn(ServiceResult.success(participantAgent)); - consumerService = new ContractNegotiationProtocolServiceImpl(consumerStore, new NoopTransactionContext(), validationService, offerResolver, protocolTokenValidator, new ContractNegotiationObservableImpl(), monitor, mock()); - providerService = new ContractNegotiationProtocolServiceImpl(providerStore, new NoopTransactionContext(), validationService, offerResolver, protocolTokenValidator, new ContractNegotiationObservableImpl(), monitor, mock()); + consumerService = new ContractNegotiationProtocolServiceImpl(consumerStore, transactionContext, validationService, offerResolver, protocolTokenValidator, mock(), monitor, mock()); + providerService = new ContractNegotiationProtocolServiceImpl(providerStore, transactionContext, validationService, offerResolver, protocolTokenValidator, mock(), monitor, mock()); } @AfterEach @@ -197,9 +198,10 @@ void testNegotiation_initialOfferAccepted() { await().atMost(DEFAULT_TEST_TIMEOUT).pollInterval(DEFAULT_POLL_INTERVAL).untilAsserted(() -> { assertThat(consumerNegotiationId).isNotNull(); var consumerNegotiation = consumerStore.findById(consumerNegotiationId); - var providerNegotiation = providerStore.findForCorrelationId(consumerNegotiationId); + var maybeProviderNegotiation = providerStore.findAll().filter(it -> it.getCorrelationId().equals(consumerNegotiationId)).findAny(); assertThat(consumerNegotiation).isNotNull(); - assertThat(providerNegotiation).isNotNull(); + assertThat(maybeProviderNegotiation).isPresent(); + var providerNegotiation = maybeProviderNegotiation.get(); // Assert that the consumer has the callbacks assertThat(consumerNegotiation.getCallbackAddresses()).hasSize(1); @@ -279,9 +281,10 @@ void testNegotiation_agreementDeclined() { await().atMost(DEFAULT_TEST_TIMEOUT).pollInterval(DEFAULT_POLL_INTERVAL).untilAsserted(() -> { assertThat(consumerNegotiationId).isNotNull(); var consumerNegotiation = consumerStore.findById(consumerNegotiationId); - var providerNegotiation = providerStore.findForCorrelationId(consumerNegotiationId); + var maybeProviderNegotiation = providerStore.findAll().filter(it -> it.getCorrelationId().equals(consumerNegotiationId)).findAny(); assertThat(consumerNegotiation).isNotNull(); - assertThat(providerNegotiation).isNotNull(); + assertThat(maybeProviderNegotiation).isPresent(); + var providerNegotiation = maybeProviderNegotiation.get(); // Assert that the consumer has the callbacks assertThat(consumerNegotiation.getCallbackAddresses()).hasSize(1); @@ -323,6 +326,7 @@ private Answer onConsumerSentTermination() { private Answer onProviderSentAgreementRequest() { return i -> { ContractAgreementMessage request = i.getArgument(1); + providerNegotiationId.set(request.getProviderPid()); var result = consumerService.notifyAgreed(request, tokenRepresentation); return toFuture(result, "Success!"); }; @@ -341,6 +345,7 @@ private Answer onProviderSentNegotiationEventMessage() { private Answer onConsumerSentAgreementVerification() { return i -> { ContractAgreementVerificationMessage request = i.getArgument(1); + request.setProcessId(providerNegotiationId.get()); var result = providerService.notifyVerified(request, tokenRepresentation); return toFuture(result, "Success!"); }; diff --git a/core/control-plane/control-plane-core/src/main/java/org/eclipse/edc/connector/controlplane/defaults/storage/contractnegotiation/InMemoryContractNegotiationStore.java b/core/control-plane/control-plane-core/src/main/java/org/eclipse/edc/connector/controlplane/defaults/storage/contractnegotiation/InMemoryContractNegotiationStore.java index deca7e3fe0b..318424c13c9 100644 --- a/core/control-plane/control-plane-core/src/main/java/org/eclipse/edc/connector/controlplane/defaults/storage/contractnegotiation/InMemoryContractNegotiationStore.java +++ b/core/control-plane/control-plane-core/src/main/java/org/eclipse/edc/connector/controlplane/defaults/storage/contractnegotiation/InMemoryContractNegotiationStore.java @@ -21,7 +21,6 @@ import org.eclipse.edc.spi.query.CriterionOperatorRegistry; import org.eclipse.edc.spi.query.QueryResolver; import org.eclipse.edc.spi.query.QuerySpec; -import org.eclipse.edc.spi.result.StoreResult; import org.eclipse.edc.store.InMemoryStatefulEntityStore; import org.eclipse.edc.store.ReflectionBasedQueryResolver; import org.jetbrains.annotations.NotNull; @@ -86,16 +85,6 @@ public void delete(String negotiationId) { return agreementQueryResolver.query(getAgreements(), querySpec); } - @Override - public StoreResult findByCorrelationIdAndLease(String correlationId) { - var negotiation = findForCorrelationId(correlationId); - if (negotiation == null) { - return StoreResult.notFound(format("ContractNegotiation with correlationId %s not found", correlationId)); - } - - return findByIdAndLease(negotiation.getId()); - } - @NotNull private Stream getAgreements() { return super.findAll() diff --git a/core/control-plane/control-plane-core/src/main/java/org/eclipse/edc/connector/controlplane/defaults/storage/transferprocess/InMemoryTransferProcessStore.java b/core/control-plane/control-plane-core/src/main/java/org/eclipse/edc/connector/controlplane/defaults/storage/transferprocess/InMemoryTransferProcessStore.java index eaff0142d8b..a318fa289ab 100644 --- a/core/control-plane/control-plane-core/src/main/java/org/eclipse/edc/connector/controlplane/defaults/storage/transferprocess/InMemoryTransferProcessStore.java +++ b/core/control-plane/control-plane-core/src/main/java/org/eclipse/edc/connector/controlplane/defaults/storage/transferprocess/InMemoryTransferProcessStore.java @@ -18,7 +18,6 @@ import org.eclipse.edc.connector.controlplane.transfer.spi.types.TransferProcess; import org.eclipse.edc.spi.query.CriterionOperatorRegistry; import org.eclipse.edc.spi.query.QuerySpec; -import org.eclipse.edc.spi.result.StoreResult; import org.eclipse.edc.store.InMemoryStatefulEntityStore; import org.jetbrains.annotations.Nullable; @@ -26,7 +25,6 @@ import java.util.UUID; import java.util.stream.Stream; -import static java.lang.String.format; import static org.eclipse.edc.spi.query.Criterion.criterion; /** @@ -59,14 +57,4 @@ public Stream findAll(QuerySpec querySpec) { return super.findAll(querySpec); } - @Override - public StoreResult findByCorrelationIdAndLease(String correlationId) { - var transferProcess = findForCorrelationId(correlationId); - if (transferProcess == null) { - return StoreResult.notFound(format("TransferProcess with correlationId %s not found", correlationId)); - } - - return findByIdAndLease(transferProcess.getId()); - } - } diff --git a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractAgreementMessageTransformer.java b/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractAgreementMessageTransformer.java index 4611353912a..40e45742307 100644 --- a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractAgreementMessageTransformer.java +++ b/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractAgreementMessageTransformer.java @@ -35,7 +35,6 @@ import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_PROPERTY_TIMESTAMP; import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROCESS_ID; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID; /** @@ -52,30 +51,21 @@ public JsonObjectToContractAgreementMessageTransformer() { @Override public @Nullable ContractAgreementMessage transform(@NotNull JsonObject object, @NotNull TransformerContext context) { var messageBuilder = ContractAgreementMessage.Builder.newInstance(); - var processId = object.get(DSPACE_PROPERTY_PROCESS_ID); if (!transformMandatoryString(object.get(DSPACE_PROPERTY_CONSUMER_PID), messageBuilder::consumerPid, context)) { - if (processId == null) { - context.problem() - .missingProperty() - .type(DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE) - .property(DSPACE_PROPERTY_CONSUMER_PID) - .report(); - return null; - } else { - messageBuilder.consumerPid(transformString(processId, context)); - } + context.problem() + .missingProperty() + .type(DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE) + .property(DSPACE_PROPERTY_CONSUMER_PID) + .report(); + return null; } if (!transformMandatoryString(object.get(DSPACE_PROPERTY_PROVIDER_PID), messageBuilder::providerPid, context)) { - if (processId == null) { - context.problem() - .missingProperty() - .type(DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE) - .property(DSPACE_PROPERTY_PROVIDER_PID) - .report(); - return null; - } else { - messageBuilder.providerPid(transformString(processId, context)); - } + context.problem() + .missingProperty() + .type(DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE) + .property(DSPACE_PROPERTY_PROVIDER_PID) + .report(); + return null; } var jsonAgreement = returnMandatoryJsonObject(object.get(DSPACE_PROPERTY_AGREEMENT), context, DSPACE_PROPERTY_AGREEMENT); diff --git a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationAckTransformer.java b/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationAckTransformer.java index decc66a9ada..e916f0dd3c7 100644 --- a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationAckTransformer.java +++ b/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationAckTransformer.java @@ -22,7 +22,6 @@ import org.jetbrains.annotations.Nullable; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROCESS_ID; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_STATE; @@ -38,14 +37,9 @@ public JsonObjectToContractNegotiationAckTransformer() { @Override public @Nullable ContractNegotiationAck transform(@NotNull JsonObject jsonObject, @NotNull TransformerContext context) { var builder = ContractNegotiationAck.Builder.newInstance(); - var processId = transformString(jsonObject.get(DSPACE_PROPERTY_PROCESS_ID), context); - if (!transformMandatoryString(jsonObject.get(DSPACE_PROPERTY_CONSUMER_PID), builder::consumerPid, context)) { - builder.consumerPid(processId); - } - - if (!transformMandatoryString(jsonObject.get(DSPACE_PROPERTY_PROVIDER_PID), builder::providerPid, context)) { - builder.providerPid(processId); - } + + transformMandatoryString(jsonObject.get(DSPACE_PROPERTY_CONSUMER_PID), builder::consumerPid, context); + transformMandatoryString(jsonObject.get(DSPACE_PROPERTY_PROVIDER_PID), builder::providerPid, context); return builder .state(transformString(jsonObject.get(DSPACE_PROPERTY_STATE), context)) diff --git a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationEventMessageTransformer.java b/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationEventMessageTransformer.java index e91573ebf0c..c0c5dafba80 100644 --- a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationEventMessageTransformer.java +++ b/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationEventMessageTransformer.java @@ -28,7 +28,6 @@ import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_VALUE_NEGOTIATION_EVENT_TYPE_ACCEPTED; import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_VALUE_NEGOTIATION_EVENT_TYPE_FINALIZED; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROCESS_ID; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID; /** @@ -44,30 +43,21 @@ public JsonObjectToContractNegotiationEventMessageTransformer() { public @Nullable ContractNegotiationEventMessage transform(@NotNull JsonObject object, @NotNull TransformerContext context) { var builder = ContractNegotiationEventMessage.Builder.newInstance(); - var processId = object.get(DSPACE_PROPERTY_PROCESS_ID); if (!transformMandatoryString(object.get(DSPACE_PROPERTY_CONSUMER_PID), builder::consumerPid, context)) { - if (processId == null) { - context.problem() - .missingProperty() - .type(DSPACE_TYPE_CONTRACT_NEGOTIATION_EVENT_MESSAGE) - .property(DSPACE_PROPERTY_CONSUMER_PID) - .report(); - return null; - } else { - builder.consumerPid(transformString(processId, context)); - } + context.problem() + .missingProperty() + .type(DSPACE_TYPE_CONTRACT_NEGOTIATION_EVENT_MESSAGE) + .property(DSPACE_PROPERTY_CONSUMER_PID) + .report(); + return null; } if (!transformMandatoryString(object.get(DSPACE_PROPERTY_PROVIDER_PID), builder::providerPid, context)) { - if (processId == null) { - context.problem() - .missingProperty() - .type(DSPACE_TYPE_CONTRACT_NEGOTIATION_EVENT_MESSAGE) - .property(DSPACE_PROPERTY_PROVIDER_PID) - .report(); - return null; - } else { - builder.providerPid(transformString(processId, context)); - } + context.problem() + .missingProperty() + .type(DSPACE_TYPE_CONTRACT_NEGOTIATION_EVENT_MESSAGE) + .property(DSPACE_PROPERTY_PROVIDER_PID) + .report(); + return null; } var eventType = transformString(object.get(DSPACE_PROPERTY_EVENT_TYPE), context); diff --git a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationTerminationMessageTransformer.java b/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationTerminationMessageTransformer.java index 9cc4834ca76..724ec2f5328 100644 --- a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationTerminationMessageTransformer.java +++ b/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationTerminationMessageTransformer.java @@ -26,7 +26,6 @@ import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_NEGOTIATION_TERMINATION_MESSAGE; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CODE; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROCESS_ID; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_REASON; @@ -43,30 +42,21 @@ public JsonObjectToContractNegotiationTerminationMessageTransformer() { public @Nullable ContractNegotiationTerminationMessage transform(@NotNull JsonObject object, @NotNull TransformerContext context) { var builder = ContractNegotiationTerminationMessage.Builder.newInstance(); - var processId = object.get(DSPACE_PROPERTY_PROCESS_ID); if (!transformMandatoryString(object.get(DSPACE_PROPERTY_CONSUMER_PID), builder::consumerPid, context)) { - if (processId == null) { - context.problem() - .missingProperty() - .type(DSPACE_TYPE_CONTRACT_NEGOTIATION_TERMINATION_MESSAGE) - .property(DSPACE_PROPERTY_CONSUMER_PID) - .report(); - return null; - } else { - builder.consumerPid(transformString(processId, context)); - } + context.problem() + .missingProperty() + .type(DSPACE_TYPE_CONTRACT_NEGOTIATION_TERMINATION_MESSAGE) + .property(DSPACE_PROPERTY_CONSUMER_PID) + .report(); + return null; } if (!transformMandatoryString(object.get(DSPACE_PROPERTY_PROVIDER_PID), builder::providerPid, context)) { - if (processId == null) { - context.problem() - .missingProperty() - .type(DSPACE_TYPE_CONTRACT_NEGOTIATION_TERMINATION_MESSAGE) - .property(DSPACE_PROPERTY_PROVIDER_PID) - .report(); - return null; - } else { - builder.providerPid(transformString(processId, context)); - } + context.problem() + .missingProperty() + .type(DSPACE_TYPE_CONTRACT_NEGOTIATION_TERMINATION_MESSAGE) + .property(DSPACE_PROPERTY_PROVIDER_PID) + .report(); + return null; } var code = object.get(DSPACE_PROPERTY_CODE); diff --git a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractOfferMessageTransformer.java b/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractOfferMessageTransformer.java index ea9ff807e07..ad7494a0b60 100644 --- a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractOfferMessageTransformer.java +++ b/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractOfferMessageTransformer.java @@ -30,7 +30,6 @@ import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_OFFER_MESSAGE; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CALLBACK_ADDRESS; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROCESS_ID; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID; /** @@ -46,14 +45,8 @@ public JsonObjectToContractOfferMessageTransformer() { public @Nullable ContractOfferMessage transform(@NotNull JsonObject jsonObject, @NotNull TransformerContext context) { var builder = ContractOfferMessage.Builder.newInstance(); if (!transformMandatoryString(jsonObject.get(DSPACE_PROPERTY_PROVIDER_PID), builder::providerPid, context)) { - var processId = jsonObject.get(DSPACE_PROPERTY_PROCESS_ID); - if (processId == null) { - reportMissingProperty(DSPACE_TYPE_CONTRACT_OFFER_MESSAGE, DSPACE_PROPERTY_PROVIDER_PID, context); - return null; - } else { - builder.providerPid(transformString(processId, context)); - builder.consumerPid(transformString(processId, context)); - } + reportMissingProperty(DSPACE_TYPE_CONTRACT_OFFER_MESSAGE, DSPACE_PROPERTY_PROVIDER_PID, context); + return null; } var consumerPid = jsonObject.get(DSPACE_PROPERTY_CONSUMER_PID); diff --git a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractRequestMessageTransformer.java b/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractRequestMessageTransformer.java index 8c8712ce382..23711ee5d8a 100644 --- a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractRequestMessageTransformer.java +++ b/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractRequestMessageTransformer.java @@ -28,7 +28,6 @@ import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CALLBACK_ADDRESS; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROCESS_ID; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID; /** @@ -45,17 +44,12 @@ public JsonObjectToContractRequestMessageTransformer() { var builder = ContractRequestMessage.Builder.newInstance(); if (!transformMandatoryString(requestObject.get(DSPACE_PROPERTY_CONSUMER_PID), builder::consumerPid, context)) { - var processId = requestObject.get(DSPACE_PROPERTY_PROCESS_ID); - if (processId == null) { - context.problem() - .missingProperty() - .type(DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE) - .property(DSPACE_PROPERTY_CONSUMER_PID) - .report(); - return null; - } else { - builder.consumerPid(transformString(processId, context)); - } + context.problem() + .missingProperty() + .type(DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE) + .property(DSPACE_PROPERTY_CONSUMER_PID) + .report(); + return null; } var providerPid = requestObject.get(DSPACE_PROPERTY_PROVIDER_PID); diff --git a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractAgreementMessageTransformerTest.java b/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractAgreementMessageTransformerTest.java index d07b5b307c9..1d2de8b7e2a 100644 --- a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractAgreementMessageTransformerTest.java +++ b/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractAgreementMessageTransformerTest.java @@ -114,7 +114,7 @@ void transform() { verify(context, never()).reportProblem(anyString()); } - @Deprecated + @Deprecated(since = "0.5.1") @Test void shouldSetConsumerIdAndProviderIdForBackwardCompatibility() { var message = ContractAgreementMessage.Builder.newInstance() diff --git a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractAgreementMessageTransformerTest.java b/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractAgreementMessageTransformerTest.java index 1a4bc653000..ad3f9dee013 100644 --- a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractAgreementMessageTransformerTest.java +++ b/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractAgreementMessageTransformerTest.java @@ -45,7 +45,6 @@ import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_PROPERTY_TIMESTAMP; import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROCESS_ID; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyString; @@ -154,42 +153,6 @@ void transformFallbackConsumerIdProviderId_whenAssigneeAndAssignerAreMissing() { verify(context, never()).reportProblem(anyString()); } - @Deprecated(since = "0.4.1") - @Test - void transform_processId() { - var message = jsonFactory.createObjectBuilder() - .add(ID, MESSAGE_ID) - .add(TYPE, DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE) - .add(DSPACE_PROPERTY_PROCESS_ID, "processId") - .add(DSPACE_PROPERTY_AGREEMENT, jsonFactory.createObjectBuilder() - .add(ID, AGREEMENT_ID) - .add(TYPE, ODRL_POLICY_TYPE_AGREEMENT) - .add(ODRL_ASSIGNEE_ATTRIBUTE, CONSUMER_ID) - .add(ODRL_ASSIGNER_ATTRIBUTE, PROVIDER_ID) - .add(DSPACE_PROPERTY_TIMESTAMP, TIMESTAMP) - .build()) - .build(); - - when(context.transform(any(JsonObject.class), eq(Policy.class))).thenReturn(policy()); - - var result = transformer.transform(getExpanded(message), context); - - assertThat(result).isNotNull(); - assertThat(result.getClass()).isEqualTo(ContractAgreementMessage.class); - assertThat(result.getProtocol()).isNotEmpty(); - assertThat(result.getConsumerPid()).isEqualTo("processId"); - assertThat(result.getProviderPid()).isEqualTo("processId"); - - var agreement = result.getContractAgreement(); - assertThat(agreement).isNotNull(); - assertThat(agreement.getClass()).isEqualTo(ContractAgreement.class); - assertThat(agreement.getId()).isEqualTo(AGREEMENT_ID); - assertThat(agreement.getAssetId()).isEqualTo(TARGET); - assertThat(agreement.getContractSigningDate()).isEqualTo(Instant.parse(TIMESTAMP).getEpochSecond()); - - verify(context, never()).reportProblem(anyString()); - } - @Test void transform_nullPolicy() { var value = "example"; diff --git a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationAckTransformerTest.java b/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationAckTransformerTest.java index 2ebc4ec4fd1..9c2d4b97dca 100644 --- a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationAckTransformerTest.java +++ b/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationAckTransformerTest.java @@ -26,7 +26,6 @@ import static org.eclipse.edc.protocol.dsp.negotiation.transform.to.TestInput.getExpanded; import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_NEGOTIATION; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROCESS_ID; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_STATE; import static org.mockito.Mockito.mock; @@ -56,21 +55,4 @@ void shouldTransform() { verifyNoInteractions(context); } - @Deprecated(since = "0.5.0") - @Test // this is to support old connectors that did not handle consumerPid and providerPid - void shouldUseProcessIdAsConsumerPidAndProviderPid_whenTheyAreNotPresent() { - var message = jsonFactory.createObjectBuilder() - .add(JsonLdKeywords.TYPE, DSPACE_TYPE_CONTRACT_NEGOTIATION) - .add(DSPACE_PROPERTY_PROCESS_ID, "processId") - .add(DSPACE_PROPERTY_STATE, "STATE") - .build(); - - var result = transformer.transform(getExpanded(message), context); - - assertThat(result).isNotNull(); - assertThat(result.getConsumerPid()).isEqualTo("processId"); - assertThat(result.getProviderPid()).isEqualTo("processId"); - assertThat(result.getState()).isEqualTo("STATE"); - verifyNoInteractions(context); - } } diff --git a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationEventMessageTransformerTest.java b/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationEventMessageTransformerTest.java index af28dbad987..aca4217f20b 100644 --- a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationEventMessageTransformerTest.java +++ b/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationEventMessageTransformerTest.java @@ -31,7 +31,6 @@ import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_NEGOTIATION_EVENT_MESSAGE; import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_VALUE_NEGOTIATION_EVENT_TYPE_ACCEPTED; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROCESS_ID; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.contains; @@ -76,28 +75,6 @@ void transform() { verify(context, never()).reportProblem(anyString()); } - @Deprecated(since = "0.4.1") - @Test - void transform_processId() { - var message = jsonFactory.createObjectBuilder() - .add(JsonLdKeywords.ID, "id1") - .add(JsonLdKeywords.TYPE, DSPACE_TYPE_CONTRACT_NEGOTIATION_EVENT_MESSAGE) - .add(DSPACE_PROPERTY_PROCESS_ID, "processId") - .add(DSPACE_PROPERTY_EVENT_TYPE, DSPACE_VALUE_NEGOTIATION_EVENT_TYPE_ACCEPTED) - .build(); - - var result = transformer.transform(getExpanded(message), context); - - assertThat(result).isNotNull(); - assertThat(result.getClass()).isEqualTo(ContractNegotiationEventMessage.class); - assertThat(result.getProtocol()).isNotEmpty(); - assertThat(result.getProviderPid()).isEqualTo("processId"); - assertThat(result.getConsumerPid()).isEqualTo("processId"); - assertThat(result.getType()).isEqualTo(ContractNegotiationEventMessage.Type.ACCEPTED); - - verify(context, never()).reportProblem(anyString()); - } - @Test void verify_failTransformWhenProcessIdMissing() { var message = jsonFactory.createObjectBuilder() diff --git a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationTerminationMessageTransformerTest.java b/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationTerminationMessageTransformerTest.java index ab1dbe4c8dd..4e635f73ff6 100644 --- a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationTerminationMessageTransformerTest.java +++ b/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationTerminationMessageTransformerTest.java @@ -29,7 +29,6 @@ import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_NEGOTIATION_TERMINATION_MESSAGE; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CODE; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROCESS_ID; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_REASON; import static org.mockito.ArgumentMatchers.anyString; @@ -75,34 +74,6 @@ void transform() { verify(context, never()).reportProblem(anyString()); } - @Test - void transform_processId() { - var reason = Json.createBuilderFactory(Map.of()).createObjectBuilder().add(DSPACE_SCHEMA + "foo", "bar"); - var reasonArray = Json.createBuilderFactory(Map.of()).createArrayBuilder().add(reason).build(); - - var message = jsonFactory.createObjectBuilder() - .add(JsonLdKeywords.ID, "id1") - .add(JsonLdKeywords.TYPE, DSPACE_TYPE_CONTRACT_NEGOTIATION_TERMINATION_MESSAGE) - .add(DSPACE_PROPERTY_PROCESS_ID, "processId") - .add(DSPACE_PROPERTY_CODE, CODE) - .add(DSPACE_PROPERTY_REASON, reasonArray) - .build(); - - var result = transformer.transform(getExpanded(message), context); - - assertThat(result).isNotNull(); - - assertThat(result.getProtocol()).isNotNull(); - assertThat(result.getCounterPartyAddress()).isNull(); - assertThat(result.getConsumerPid()).isEqualTo("processId"); - assertThat(result.getProviderPid()).isEqualTo("processId"); - assertThat(result.getCode()).isEqualTo(CODE); - - assertThat(result.getRejectionReason()).isEqualTo(format("[{\"%sfoo\":[{\"@value\":\"bar\"}]}]", DSPACE_SCHEMA)); - - verify(context, never()).reportProblem(anyString()); - } - @Test void verify_noCodeNodReason() { var message = jsonFactory.createObjectBuilder() diff --git a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractOfferMessageTransformerTest.java b/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractOfferMessageTransformerTest.java index a9ce074b07b..ace7fc5e39d 100644 --- a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractOfferMessageTransformerTest.java +++ b/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractOfferMessageTransformerTest.java @@ -34,7 +34,6 @@ import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_OFFER_MESSAGE; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CALLBACK_ADDRESS; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROCESS_ID; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyString; @@ -96,39 +95,6 @@ void transform_shouldReturnMessage_whenValidJsonObject() { verify(context).setData(Policy.class, TYPE, PolicyType.OFFER); } - @Deprecated(since = "0.4.1") - @Test - void transform_shouldReturnMessage_whenValidJsonObject_processId() { - var message = jsonFactory.createObjectBuilder() - .add(ID, MESSAGE_ID) - .add(JsonLdKeywords.TYPE, DSPACE_TYPE_CONTRACT_OFFER_MESSAGE) - .add(DSPACE_PROPERTY_PROCESS_ID, "processId") - .add(DSPACE_PROPERTY_CALLBACK_ADDRESS, CALLBACK_ADDRESS) - .add(DSPACE_PROPERTY_OFFER, jsonFactory.createObjectBuilder() - .add(ID, CONTRACT_OFFER_ID) - .build()) - .build(); - var policy = policy(); - - when(context.transform(any(JsonObject.class), eq(Policy.class))).thenReturn(policy); - - var result = transformer.transform(message, context); - - assertThat(result).isNotNull(); - assertThat(result.getProtocol()).isNotEmpty(); - assertThat(result.getConsumerPid()).isEqualTo("processId"); - assertThat(result.getProviderPid()).isEqualTo("processId"); - assertThat(result.getCallbackAddress()).isEqualTo(CALLBACK_ADDRESS); - - var contractOffer = result.getContractOffer(); - assertThat(contractOffer).isNotNull(); - assertThat(contractOffer.getId()).isEqualTo(CONTRACT_OFFER_ID); - assertThat(contractOffer.getPolicy()).isEqualTo(policy); - assertThat(contractOffer.getAssetId()).isEqualTo(ASSET_ID); - - verify(context, never()).reportProblem(anyString()); - } - @Test void transform_shouldReportProblem_whenMissingProcessId() { var message = jsonFactory.createObjectBuilder() diff --git a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractRequestMessageTransformerTest.java b/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractRequestMessageTransformerTest.java index 6f2cff22e6c..490c43d170a 100644 --- a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractRequestMessageTransformerTest.java +++ b/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractRequestMessageTransformerTest.java @@ -37,7 +37,6 @@ import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CALLBACK_ADDRESS; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROCESS_ID; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyString; @@ -95,35 +94,6 @@ void verify_usingOffer() { verify(context, never()).reportProblem(anyString()); } - @Deprecated(since = "0.4.1") - @Test - void verify_processId() { - var message = jsonFactory.createObjectBuilder() - .add(JsonLdKeywords.ID, OBJECT_ID) - .add(JsonLdKeywords.TYPE, DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE) - .add(DSPACE_PROPERTY_PROCESS_ID, "processId") - .add(DSPACE_PROPERTY_CALLBACK_ADDRESS, CALLBACK) - .add(DSPACE_PROPERTY_OFFER, contractOffer()) - .build(); - - when(context.transform(any(JsonObject.class), eq(Policy.class))).thenReturn(policy()); - - var result = transformer.transform(getExpanded(message), context); - - assertThat(result).isNotNull(); - assertThat(result.getProtocol()).isNotEmpty(); - assertThat(result.getConsumerPid()).isEqualTo("processId"); - assertThat(result.getCallbackAddress()).isEqualTo(CALLBACK); - - var contractOffer = result.getContractOffer(); - assertThat(contractOffer).isNotNull(); - assertThat(contractOffer.getId()).isNotNull(); - assertThat(contractOffer.getPolicy()).isNotNull(); - assertThat(contractOffer.getAssetId()).isEqualTo("target"); - - verify(context, never()).reportProblem(anyString()); - } - @Test void verify_noCallbackOrDatasetOk() { var message = jsonFactory.createObjectBuilder() diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferCompletionMessageTransformer.java b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferCompletionMessageTransformer.java index b898821ba2d..47e3a9db634 100644 --- a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferCompletionMessageTransformer.java +++ b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferCompletionMessageTransformer.java @@ -22,7 +22,6 @@ import org.jetbrains.annotations.Nullable; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROCESS_ID; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID; import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE; @@ -36,32 +35,22 @@ public JsonObjectToTransferCompletionMessageTransformer() { public @Nullable TransferCompletionMessage transform(@NotNull JsonObject messageObject, @NotNull TransformerContext context) { var builder = TransferCompletionMessage.Builder.newInstance(); - var processId = transformString(messageObject.get(DSPACE_PROPERTY_PROCESS_ID), context); - if (!transformMandatoryString(messageObject.get(DSPACE_PROPERTY_CONSUMER_PID), builder::consumerPid, context)) { - if (processId == null) { - context.problem() - .missingProperty() - .type(DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE) - .property(DSPACE_PROPERTY_CONSUMER_PID) - .report(); - return null; - } else { - builder.consumerPid(processId); - } + context.problem() + .missingProperty() + .type(DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE) + .property(DSPACE_PROPERTY_CONSUMER_PID) + .report(); + return null; } if (!transformMandatoryString(messageObject.get(DSPACE_PROPERTY_PROVIDER_PID), builder::providerPid, context)) { - if (processId == null) { - context.problem() - .missingProperty() - .type(DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE) - .property(DSPACE_PROPERTY_PROVIDER_PID) - .report(); - return null; - } else { - builder.providerPid(processId); - } + context.problem() + .missingProperty() + .type(DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE) + .property(DSPACE_PROPERTY_PROVIDER_PID) + .report(); + return null; } return builder.build(); diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferProcessAckTransformer.java b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferProcessAckTransformer.java index a71e258972f..b6d40a9841a 100644 --- a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferProcessAckTransformer.java +++ b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferProcessAckTransformer.java @@ -22,7 +22,6 @@ import org.jetbrains.annotations.Nullable; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROCESS_ID; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_STATE; @@ -38,14 +37,8 @@ public JsonObjectToTransferProcessAckTransformer() { @Override public @Nullable TransferProcessAck transform(@NotNull JsonObject jsonObject, @NotNull TransformerContext context) { var builder = TransferProcessAck.Builder.newInstance(); - var processId = transformString(jsonObject.get(DSPACE_PROPERTY_PROCESS_ID), context); - if (!transformMandatoryString(jsonObject.get(DSPACE_PROPERTY_CONSUMER_PID), builder::consumerPid, context)) { - builder.consumerPid(processId); - } - - if (!transformMandatoryString(jsonObject.get(DSPACE_PROPERTY_PROVIDER_PID), builder::providerPid, context)) { - builder.providerPid(processId); - } + transformMandatoryString(jsonObject.get(DSPACE_PROPERTY_CONSUMER_PID), builder::consumerPid, context); + transformMandatoryString(jsonObject.get(DSPACE_PROPERTY_PROVIDER_PID), builder::providerPid, context); return builder .state(transformString(jsonObject.get(DSPACE_PROPERTY_STATE), context)) diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferRequestMessageTransformer.java b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferRequestMessageTransformer.java index 69ac8a22418..ff8341b6e3e 100644 --- a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferRequestMessageTransformer.java +++ b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferRequestMessageTransformer.java @@ -26,7 +26,6 @@ import static org.eclipse.edc.jsonld.spi.PropertyAndTypeNames.DEPRECATED_DCT_FORMAT_ATTRIBUTE; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CALLBACK_ADDRESS; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROCESS_ID; import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_PROPERTY_CONTRACT_AGREEMENT_ID; import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_PROPERTY_DATA_ADDRESS; import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE; @@ -42,14 +41,12 @@ public JsonObjectToTransferRequestMessageTransformer() { var builder = TransferRequestMessage.Builder.newInstance(); if (!transformMandatoryString(messageObject.get(DSPACE_PROPERTY_CONSUMER_PID), builder::consumerPid, context)) { - if (!transformMandatoryString(messageObject.get(DSPACE_PROPERTY_PROCESS_ID), builder::consumerPid, context)) { - context.problem() - .missingProperty() - .type(DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE) - .property(DSPACE_PROPERTY_CONSUMER_PID) - .report(); - return null; - } + context.problem() + .missingProperty() + .type(DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE) + .property(DSPACE_PROPERTY_CONSUMER_PID) + .report(); + return null; } visitProperties(messageObject, k -> switch (k) { diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferStartMessageTransformer.java b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferStartMessageTransformer.java index cc0220bff51..9e6309bc6ad 100644 --- a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferStartMessageTransformer.java +++ b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferStartMessageTransformer.java @@ -23,7 +23,6 @@ import org.jetbrains.annotations.Nullable; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROCESS_ID; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID; import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_PROPERTY_DATA_ADDRESS; import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_START_MESSAGE; @@ -38,32 +37,22 @@ public JsonObjectToTransferStartMessageTransformer() { public @Nullable TransferStartMessage transform(@NotNull JsonObject messageObject, @NotNull TransformerContext context) { var builder = TransferStartMessage.Builder.newInstance(); - var processId = transformString(messageObject.get(DSPACE_PROPERTY_PROCESS_ID), context); - if (!transformMandatoryString(messageObject.get(DSPACE_PROPERTY_CONSUMER_PID), builder::consumerPid, context)) { - if (processId == null) { - context.problem() - .missingProperty() - .type(DSPACE_TYPE_TRANSFER_START_MESSAGE) - .property(DSPACE_PROPERTY_CONSUMER_PID) - .report(); - return null; - } else { - builder.consumerPid(processId); - } + context.problem() + .missingProperty() + .type(DSPACE_TYPE_TRANSFER_START_MESSAGE) + .property(DSPACE_PROPERTY_CONSUMER_PID) + .report(); + return null; } if (!transformMandatoryString(messageObject.get(DSPACE_PROPERTY_PROVIDER_PID), builder::providerPid, context)) { - if (processId == null) { - context.problem() - .missingProperty() - .type(DSPACE_TYPE_TRANSFER_START_MESSAGE) - .property(DSPACE_PROPERTY_PROVIDER_PID) - .report(); - return null; - } else { - builder.providerPid(processId); - } + context.problem() + .missingProperty() + .type(DSPACE_TYPE_TRANSFER_START_MESSAGE) + .property(DSPACE_PROPERTY_PROVIDER_PID) + .report(); + return null; } var dataAddressObject = returnJsonObject(messageObject.get(DSPACE_PROPERTY_DATA_ADDRESS), context, DSPACE_PROPERTY_DATA_ADDRESS, false); diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferTerminationMessageTransformer.java b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferTerminationMessageTransformer.java index a548d41a17e..b555f7e8895 100644 --- a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferTerminationMessageTransformer.java +++ b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferTerminationMessageTransformer.java @@ -25,7 +25,6 @@ import static jakarta.json.JsonValue.ValueType.ARRAY; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CODE; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROCESS_ID; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_REASON; import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE; @@ -40,32 +39,22 @@ public JsonObjectToTransferTerminationMessageTransformer() { public @Nullable TransferTerminationMessage transform(@NotNull JsonObject messageObject, @NotNull TransformerContext context) { var builder = TransferTerminationMessage.Builder.newInstance(); - var processId = transformString(messageObject.get(DSPACE_PROPERTY_PROCESS_ID), context); - if (!transformMandatoryString(messageObject.get(DSPACE_PROPERTY_CONSUMER_PID), builder::consumerPid, context)) { - if (processId == null) { - context.problem() - .missingProperty() - .type(DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE) - .property(DSPACE_PROPERTY_CONSUMER_PID) - .report(); - return null; - } else { - builder.consumerPid(processId); - } + context.problem() + .missingProperty() + .type(DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE) + .property(DSPACE_PROPERTY_CONSUMER_PID) + .report(); + return null; } if (!transformMandatoryString(messageObject.get(DSPACE_PROPERTY_PROVIDER_PID), builder::providerPid, context)) { - if (processId == null) { - context.problem() - .missingProperty() - .type(DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE) - .property(DSPACE_PROPERTY_PROVIDER_PID) - .report(); - return null; - } else { - builder.providerPid(processId); - } + context.problem() + .missingProperty() + .type(DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE) + .property(DSPACE_PROPERTY_PROVIDER_PID) + .report(); + return null; } if (messageObject.containsKey(DSPACE_PROPERTY_CODE)) { diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferCompletionMessageTransformerTest.java b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferCompletionMessageTransformerTest.java index 69bed31ef38..3e389675131 100644 --- a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferCompletionMessageTransformerTest.java +++ b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferCompletionMessageTransformerTest.java @@ -23,7 +23,6 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.TYPE; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROCESS_ID; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID; import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE; import static org.eclipse.edc.protocol.dsp.transferprocess.transform.to.TestInput.getExpanded; @@ -71,20 +70,4 @@ void shouldReportError_whenConsumerPidAndProviderPidNotSet() { verify(context).reportProblem(anyString()); } - @Deprecated(since = "0.4.1") - @Test - void shouldSetProcessIdAsConsumerAndProviderPid_whenProcessIdIsSet() { - var json = Json.createObjectBuilder() - .add(TYPE, DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE) - .add(DSPACE_PROPERTY_PROCESS_ID, "TestProcessId") - .build(); - - var result = transformer.transform(getExpanded(json), context); - - assertThat(result).isNotNull(); - assertThat(result.getConsumerPid()).isEqualTo("TestProcessId"); - assertThat(result.getProviderPid()).isEqualTo("TestProcessId"); - - verify(context, never()).reportProblem(anyString()); - } } diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferProcessAckTransformerTest.java b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferProcessAckTransformerTest.java index ebc62f518a7..f2707156ad5 100644 --- a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferProcessAckTransformerTest.java +++ b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferProcessAckTransformerTest.java @@ -25,7 +25,6 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.TYPE; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROCESS_ID; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_STATE; import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_PROCESS; @@ -57,22 +56,4 @@ void shouldTransform() { verifyNoInteractions(context); } - // this is to support old connectors that did not handle consumerPid and providerPid - @Deprecated(since = "0.5.0") - @Test - void shouldUseProcessIdAsConsumerPidAndProviderPid_whenTheyAreNotPresent() { - var message = jsonFactory.createObjectBuilder() - .add(TYPE, DSPACE_TYPE_TRANSFER_PROCESS) - .add(DSPACE_PROPERTY_PROCESS_ID, "processId") - .add(DSPACE_PROPERTY_STATE, "STATE") - .build(); - - var result = transformer.transform(getExpanded(message), context); - - assertThat(result).isNotNull(); - assertThat(result.getConsumerPid()).isEqualTo("processId"); - assertThat(result.getProviderPid()).isEqualTo("processId"); - assertThat(result.getState()).isEqualTo("STATE"); - verifyNoInteractions(context); - } } diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferRequestMessageTransformerTest.java b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferRequestMessageTransformerTest.java index cad77234f28..d622f47feb9 100644 --- a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferRequestMessageTransformerTest.java +++ b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferRequestMessageTransformerTest.java @@ -28,7 +28,6 @@ import static org.eclipse.edc.jsonld.spi.PropertyAndTypeNames.DEPRECATED_DCT_FORMAT_ATTRIBUTE; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CALLBACK_ADDRESS; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROCESS_ID; import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_PROPERTY_CONTRACT_AGREEMENT_ID; import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_PROPERTY_DATA_ADDRESS; import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE; @@ -137,27 +136,6 @@ void shouldReturnNullAndReportError_whenConsumerPidNotSet() { verify(context).reportProblem(anyString()); } - @Deprecated(since = "0.4.1") - @Test - void shouldGetConsumerPidFromProcessId_whenFormerIsNotSet() { - var json = Json.createObjectBuilder() - .add(TYPE, DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE) - .add(DSPACE_PROPERTY_CONTRACT_AGREEMENT_ID, contractId) - .add(DCT_FORMAT_ATTRIBUTE, destinationType) - .add(DSPACE_PROPERTY_CALLBACK_ADDRESS, callbackAddress) - .add(DSPACE_PROPERTY_PROCESS_ID, "processId") - .build(); - - var result = transformer.transform(getExpanded(json), context); - - assertThat(result).isNotNull(); - assertThat(result.getContractId()).isEqualTo(contractId); - assertThat(result.getCallbackAddress()).isEqualTo(callbackAddress); - assertThat(result.getConsumerPid()).isEqualTo("processId"); - - verify(context, never()).reportProblem(anyString()); - } - private JsonObject createDataAddress() { return Json.createObjectBuilder() .add(EDC_NAMESPACE + "accessKeyId", "TESTID") diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferStartMessageTransformerTest.java b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferStartMessageTransformerTest.java index 3ab84ebe01c..f95dd367940 100644 --- a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferStartMessageTransformerTest.java +++ b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferStartMessageTransformerTest.java @@ -25,7 +25,6 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.TYPE; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROCESS_ID; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID; import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_PROPERTY_DATA_ADDRESS; import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_START_MESSAGE; @@ -63,23 +62,6 @@ void jsonObjectToTransferStartMessage() { verify(context, never()).reportProblem(anyString()); } - @Deprecated(since = "0.4.1") - @Test - void transform_processId() { - var json = Json.createObjectBuilder() - .add(TYPE, DSPACE_TYPE_TRANSFER_START_MESSAGE) - .add(DSPACE_PROPERTY_PROCESS_ID, "processPid") - .build(); - - var result = transformer.transform(getExpanded(json), context); - - assertThat(result).isNotNull(); - assertThat(result.getConsumerPid()).isEqualTo("processPid"); - assertThat(result.getProviderPid()).isEqualTo("processPid"); - - verify(context, never()).reportProblem(anyString()); - } - @Test void shouldReturnNullAndReportError_whenConsumerAndProviderPidNotValid() { when(context.problem()).thenReturn(new ProblemBuilder(context)); diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferTerminationMessageTransformerTest.java b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferTerminationMessageTransformerTest.java index 36f092478df..f82cc9acb49 100644 --- a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferTerminationMessageTransformerTest.java +++ b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferTerminationMessageTransformerTest.java @@ -28,7 +28,6 @@ import static org.eclipse.edc.jsonld.spi.Namespaces.DSPACE_SCHEMA; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CODE; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROCESS_ID; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_REASON; import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE; @@ -86,29 +85,4 @@ void shouldReportError_whenMissingPids() { assertThat(result).isNull(); verify(context).reportProblem(anyString()); } - - @Deprecated(since = "0.4.1") - @Test - void shouldTransformProcessId_whenPidsAreMissing() { - var reason = Json.createBuilderFactory(Map.of()).createObjectBuilder().add(DSPACE_SCHEMA + "foo", "bar"); - var reasonArray = Json.createBuilderFactory(Map.of()).createArrayBuilder().add(reason).build(); - - var json = Json.createObjectBuilder() - .add(TYPE, DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE) - .add(DSPACE_PROPERTY_PROCESS_ID, "TestProcessId") - .add(DSPACE_PROPERTY_CODE, "testCode") - .add(DSPACE_PROPERTY_REASON, Json.createBuilderFactory(Map.of()).createArrayBuilder().add(reasonArray).build()) - .build(); - - var result = transformer.transform(TestInput.getExpanded(json), context); - - assertThat(result).isNotNull(); - - assertThat(result.getConsumerPid()).isEqualTo("TestProcessId"); - assertThat(result.getProviderPid()).isEqualTo("TestProcessId"); - assertThat(result.getReason()).isEqualTo(format("[{\"%sfoo\":[{\"@value\":\"bar\"}]}]", DSPACE_SCHEMA)); - assertThat(result.getCode()).isEqualTo("testCode"); - - verify(context, never()).reportProblem(anyString()); - } } diff --git a/extensions/control-plane/store/sql/contract-negotiation-store-sql/src/main/java/org/eclipse/edc/connector/controlplane/store/sql/contractnegotiation/store/SqlContractNegotiationStore.java b/extensions/control-plane/store/sql/contract-negotiation-store-sql/src/main/java/org/eclipse/edc/connector/controlplane/store/sql/contractnegotiation/store/SqlContractNegotiationStore.java index 4baadc82018..2409bccacb2 100644 --- a/extensions/control-plane/store/sql/contract-negotiation-store-sql/src/main/java/org/eclipse/edc/connector/controlplane/store/sql/contractnegotiation/store/SqlContractNegotiationStore.java +++ b/extensions/control-plane/store/sql/contract-negotiation-store-sql/src/main/java/org/eclipse/edc/connector/controlplane/store/sql/contractnegotiation/store/SqlContractNegotiationStore.java @@ -211,29 +211,6 @@ public void delete(String negotiationId) { }); } - @Override - public StoreResult findByCorrelationIdAndLease(String correlationId) { - return transactionContext.execute(() -> { - var querySpec = correlationIdQuerySpec(correlationId); - try ( - var connection = getConnection(); - var stream = queryNegotiations(querySpec, connection); - ) { - var entity = stream.findFirst().orElse(null); - if (entity == null) { - return StoreResult.notFound(format("ContractNegotiation with correlationId %s not found", correlationId)); - } - - leaseContext.withConnection(connection).acquireLease(entity.getId()); - return StoreResult.success(entity); - } catch (IllegalStateException e) { - return StoreResult.alreadyLeased(format("ContractNegotiation with correlationId %s is already leased", correlationId)); - } catch (SQLException e) { - throw new EdcPersistenceException(e); - } - }); - } - private QuerySpec correlationIdQuerySpec(String correlationId) { return QuerySpec.Builder.newInstance().filter(List.of(new Criterion("correlationId", "=", correlationId))).build(); } diff --git a/extensions/control-plane/store/sql/transfer-process-store-sql/src/main/java/org/eclipse/edc/connector/controlplane/store/sql/transferprocess/store/SqlTransferProcessStore.java b/extensions/control-plane/store/sql/transfer-process-store-sql/src/main/java/org/eclipse/edc/connector/controlplane/store/sql/transferprocess/store/SqlTransferProcessStore.java index 118a578ee50..adc6edef3af 100644 --- a/extensions/control-plane/store/sql/transfer-process-store-sql/src/main/java/org/eclipse/edc/connector/controlplane/store/sql/transferprocess/store/SqlTransferProcessStore.java +++ b/extensions/control-plane/store/sql/transfer-process-store-sql/src/main/java/org/eclipse/edc/connector/controlplane/store/sql/transferprocess/store/SqlTransferProcessStore.java @@ -183,30 +183,6 @@ public Stream findAll(QuerySpec querySpec) { }); } - @Override - public StoreResult findByCorrelationIdAndLease(String correlationId) { - return transactionContext.execute(() -> { - var query = correlationIdQuerySpec(correlationId); - - try ( - var connection = getConnection(); - var stream = executeQuery(connection, query) - ) { - var entity = stream.findFirst().orElse(null); - if (entity == null) { - return StoreResult.notFound(format("TransferProcess with correlationId %s not found", correlationId)); - } - - leaseContext.withConnection(connection).acquireLease(entity.getId()); - return StoreResult.success(entity); - } catch (IllegalStateException e) { - return StoreResult.alreadyLeased(format("TransferProcess with correlationId %s is already leased", correlationId)); - } catch (SQLException e) { - throw new EdcPersistenceException(e); - } - }); - } - private QuerySpec correlationIdQuerySpec(String correlationId) { var criterion = criterion("correlationId", "=", correlationId); return QuerySpec.Builder.newInstance().filter(criterion).build(); diff --git a/spi/common/http-spi/src/main/java/org/eclipse/edc/http/spi/EdcHttpClient.java b/spi/common/http-spi/src/main/java/org/eclipse/edc/http/spi/EdcHttpClient.java index 54516042398..6f84e73dd6a 100644 --- a/spi/common/http-spi/src/main/java/org/eclipse/edc/http/spi/EdcHttpClient.java +++ b/spi/common/http-spi/src/main/java/org/eclipse/edc/http/spi/EdcHttpClient.java @@ -68,17 +68,6 @@ public interface EdcHttpClient { */ Result execute(Request request, List fallbacks, Function> mappingFunction); - /** - * Executes the specified request asynchronously, maps the response with the mappingFunction. - * - * @param request the {@link Request}. - * @param mappingFunction the function that will be applied to the {@link Response}. - * @return a {@link CompletableFuture} containing the result value. - * @deprecated please use {{@link #executeAsync(Request, List)}} passing an empty list for fallbacks. - */ - @Deprecated(since = "0.4.1") - CompletableFuture executeAsync(Request request, Function mappingFunction); - /** * Executes the specified request asynchronously and returns the response. * Accepts a list of {@link FallbackFactories} that could apply retry in particular occasions. @@ -89,19 +78,6 @@ public interface EdcHttpClient { */ CompletableFuture executeAsync(Request request, List fallbacks); - /** - * Executes the specified request asynchronously, maps the response with the mappingFunction. - * Accepts a list of {@link FallbackFactories} that could apply retry in particular occasions. - * - * @param request the {@link Request}. - * @param fallbacks a list of fallbacks to be applied. - * @param mappingFunction the function that will be applied to the {@link Response}. - * @return a {@link CompletableFuture} containing the result value. - * @deprecated please use {{@link #executeAsync(Request, List)}}. - */ - @Deprecated(since = "0.4.1") - CompletableFuture executeAsync(Request request, List fallbacks, Function mappingFunction); - /** * Returns a new client instance with a custom dns server set. * diff --git a/spi/control-plane/contract-spi/src/main/java/org/eclipse/edc/connector/controlplane/contract/spi/negotiation/store/ContractNegotiationStore.java b/spi/control-plane/contract-spi/src/main/java/org/eclipse/edc/connector/controlplane/contract/spi/negotiation/store/ContractNegotiationStore.java index 479d5d52314..6ca37b6d8b4 100644 --- a/spi/control-plane/contract-spi/src/main/java/org/eclipse/edc/connector/controlplane/contract/spi/negotiation/store/ContractNegotiationStore.java +++ b/spi/control-plane/contract-spi/src/main/java/org/eclipse/edc/connector/controlplane/contract/spi/negotiation/store/ContractNegotiationStore.java @@ -20,7 +20,6 @@ import org.eclipse.edc.runtime.metamodel.annotation.ExtensionPoint; import org.eclipse.edc.spi.persistence.StateEntityStore; import org.eclipse.edc.spi.query.QuerySpec; -import org.eclipse.edc.spi.result.StoreResult; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -35,7 +34,10 @@ public interface ContractNegotiationStore extends StateEntityStore queryAgreements(QuerySpec querySpec); - /** - * Find the entity by the passed correlation id and lease it. - * If the entity is already leased, will return a failure. - * - * @param correlationId the entity correlation id. - * @return success if the entity is unleased, failure otherwise. - * @deprecated it will be deleted in the future - */ - @Deprecated(since = "0.4.1") - StoreResult findByCorrelationIdAndLease(String correlationId); } diff --git a/spi/control-plane/contract-spi/src/testFixtures/java/org/eclipse/edc/connector/controlplane/contract/spi/testfixtures/negotiation/store/ContractNegotiationStoreTestBase.java b/spi/control-plane/contract-spi/src/testFixtures/java/org/eclipse/edc/connector/controlplane/contract/spi/testfixtures/negotiation/store/ContractNegotiationStoreTestBase.java index cb3291596f5..8331b0bd321 100644 --- a/spi/control-plane/contract-spi/src/testFixtures/java/org/eclipse/edc/connector/controlplane/contract/spi/testfixtures/negotiation/store/ContractNegotiationStoreTestBase.java +++ b/spi/control-plane/contract-spi/src/testFixtures/java/org/eclipse/edc/connector/controlplane/contract/spi/testfixtures/negotiation/store/ContractNegotiationStoreTestBase.java @@ -122,6 +122,7 @@ void findById_notExist() { } } + @Deprecated(since = "0.8.0") @Nested class FindForCorrelationId { @Test @@ -871,39 +872,4 @@ void shouldReturnAlreadyLeased_whenEntityIsAlreadyLeased() { } } - @Deprecated(since = "0.4.1") - @Nested - class FindByCorrelationIdAndLease { - @Test - void shouldReturnTheEntityAndLeaseIt() { - var id = UUID.randomUUID().toString(); - var correlationId = UUID.randomUUID().toString(); - getContractNegotiationStore().save(createNegotiationBuilder(id).correlationId(correlationId).build()); - - var result = getContractNegotiationStore().findByCorrelationIdAndLease(correlationId); - - assertThat(result).isSucceeded(); - assertThat(isLeasedBy(id, CONNECTOR_NAME)).isTrue(); - } - - @Test - void shouldReturnNotFound_whenEntityDoesNotExist() { - var result = getContractNegotiationStore().findByCorrelationIdAndLease("unexistent"); - - assertThat(result).isFailed().extracting(StoreFailure::getReason).isEqualTo(NOT_FOUND); - } - - @Test - void shouldReturnAlreadyLeased_whenEntityIsAlreadyLeased() { - var id = UUID.randomUUID().toString(); - var correlationId = UUID.randomUUID().toString(); - getContractNegotiationStore().save(createNegotiationBuilder(id).correlationId(correlationId).build()); - leaseEntity(id, "other owner"); - - var result = getContractNegotiationStore().findByCorrelationIdAndLease(correlationId); - - assertThat(result).isFailed().extracting(StoreFailure::getReason).isEqualTo(ALREADY_LEASED); - } - } - } diff --git a/spi/control-plane/control-plane-spi/src/main/java/org/eclipse/edc/connector/controlplane/services/spi/asset/AssetService.java b/spi/control-plane/control-plane-spi/src/main/java/org/eclipse/edc/connector/controlplane/services/spi/asset/AssetService.java index b4fb4eb5423..8428cdd3478 100644 --- a/spi/control-plane/control-plane-spi/src/main/java/org/eclipse/edc/connector/controlplane/services/spi/asset/AssetService.java +++ b/spi/control-plane/control-plane-spi/src/main/java/org/eclipse/edc/connector/controlplane/services/spi/asset/AssetService.java @@ -18,9 +18,7 @@ import org.eclipse.edc.spi.query.QuerySpec; import org.eclipse.edc.spi.result.ServiceResult; -import java.util.Collection; import java.util.List; -import java.util.stream.Stream; public interface AssetService { @@ -40,18 +38,6 @@ public interface AssetService { */ ServiceResult> search(QuerySpec query); - /** - * Query assets - * - * @param query request - * @return the collection of assets that matches the query - * @deprecated please use {@link #search(QuerySpec)} - */ - @Deprecated(since = "0.4.1") - default ServiceResult> query(QuerySpec query) { - return search(query).map(Collection::stream); - } - /** * Create an asset * diff --git a/spi/control-plane/control-plane-spi/src/main/java/org/eclipse/edc/connector/controlplane/services/spi/contractagreement/ContractAgreementService.java b/spi/control-plane/control-plane-spi/src/main/java/org/eclipse/edc/connector/controlplane/services/spi/contractagreement/ContractAgreementService.java index 14ae2088027..e8f59974332 100644 --- a/spi/control-plane/control-plane-spi/src/main/java/org/eclipse/edc/connector/controlplane/services/spi/contractagreement/ContractAgreementService.java +++ b/spi/control-plane/control-plane-spi/src/main/java/org/eclipse/edc/connector/controlplane/services/spi/contractagreement/ContractAgreementService.java @@ -19,9 +19,7 @@ import org.eclipse.edc.spi.query.QuerySpec; import org.eclipse.edc.spi.result.ServiceResult; -import java.util.Collection; import java.util.List; -import java.util.stream.Stream; /** * Service that permits actions and queries on ContractAgreement entity. @@ -44,18 +42,6 @@ public interface ContractAgreementService { */ ServiceResult> search(QuerySpec query); - /** - * Query contract agreements - * - * @param query request - * @return the collection of contract agreements that match the query - * @deprecated please use {{@link #search(QuerySpec)}} - */ - @Deprecated(since = "0.4.1") - default ServiceResult> query(QuerySpec query) { - return search(query).map(Collection::stream); - } - /** * Returns a contract negotiation by the agreement id. * diff --git a/spi/control-plane/control-plane-spi/src/main/java/org/eclipse/edc/connector/controlplane/services/spi/contractdefinition/ContractDefinitionService.java b/spi/control-plane/control-plane-spi/src/main/java/org/eclipse/edc/connector/controlplane/services/spi/contractdefinition/ContractDefinitionService.java index 4c3b3640afc..aafa3d8c405 100644 --- a/spi/control-plane/control-plane-spi/src/main/java/org/eclipse/edc/connector/controlplane/services/spi/contractdefinition/ContractDefinitionService.java +++ b/spi/control-plane/control-plane-spi/src/main/java/org/eclipse/edc/connector/controlplane/services/spi/contractdefinition/ContractDefinitionService.java @@ -18,9 +18,7 @@ import org.eclipse.edc.spi.query.QuerySpec; import org.eclipse.edc.spi.result.ServiceResult; -import java.util.Collection; import java.util.List; -import java.util.stream.Stream; /** * Service that permits actions and queries on ContractDefinition entity. @@ -43,18 +41,6 @@ public interface ContractDefinitionService { */ ServiceResult> search(QuerySpec query); - /** - * Query contract definitions - * - * @param query request - * @return the collection of contract definitions that match the query - * @deprecated please use {@link #search(QuerySpec)} - */ - @Deprecated(since = "0.4.1") - default ServiceResult> query(QuerySpec query) { - return search(query).map(Collection::stream); - } - /** * Create a contract definition with its related data address. If a definition with the same id exists, returns * CONFLICT failure. diff --git a/spi/control-plane/control-plane-spi/src/main/java/org/eclipse/edc/connector/controlplane/services/spi/contractnegotiation/ContractNegotiationService.java b/spi/control-plane/control-plane-spi/src/main/java/org/eclipse/edc/connector/controlplane/services/spi/contractnegotiation/ContractNegotiationService.java index 6f616d72292..fe65498b155 100644 --- a/spi/control-plane/control-plane-spi/src/main/java/org/eclipse/edc/connector/controlplane/services/spi/contractnegotiation/ContractNegotiationService.java +++ b/spi/control-plane/control-plane-spi/src/main/java/org/eclipse/edc/connector/controlplane/services/spi/contractnegotiation/ContractNegotiationService.java @@ -21,9 +21,7 @@ import org.eclipse.edc.spi.query.QuerySpec; import org.eclipse.edc.spi.result.ServiceResult; -import java.util.Collection; import java.util.List; -import java.util.stream.Stream; public interface ContractNegotiationService { @@ -43,18 +41,6 @@ public interface ContractNegotiationService { */ ServiceResult> search(QuerySpec query); - /** - * Query contract negotiations - * - * @param query request - * @return the collection of contract negotiations that match the query - * @deprecated please use {@link #search(QuerySpec)} - */ - @Deprecated(since = "0.4.1") - default ServiceResult> query(QuerySpec query) { - return search(query).map(Collection::stream); - } - /** * Get negotiation state * diff --git a/spi/control-plane/control-plane-spi/src/main/java/org/eclipse/edc/connector/controlplane/services/spi/policydefinition/PolicyDefinitionService.java b/spi/control-plane/control-plane-spi/src/main/java/org/eclipse/edc/connector/controlplane/services/spi/policydefinition/PolicyDefinitionService.java index ae0673baa17..a9146ae2a1c 100644 --- a/spi/control-plane/control-plane-spi/src/main/java/org/eclipse/edc/connector/controlplane/services/spi/policydefinition/PolicyDefinitionService.java +++ b/spi/control-plane/control-plane-spi/src/main/java/org/eclipse/edc/connector/controlplane/services/spi/policydefinition/PolicyDefinitionService.java @@ -20,9 +20,7 @@ import org.eclipse.edc.spi.result.ServiceResult; import org.jetbrains.annotations.NotNull; -import java.util.Collection; import java.util.List; -import java.util.stream.Stream; /** * The following interface is created for the implementation of the policy definition endpoint. @@ -47,18 +45,6 @@ public interface PolicyDefinitionService { */ ServiceResult> search(QuerySpec query); - /** - * Query policies - * - * @param query request - * @return the stream of policies that match the query - * @deprecated please use {@link #search(QuerySpec)} - */ - @Deprecated(since = "0.4.1") - default ServiceResult> query(QuerySpec query) { - return search(query).map(Collection::stream); - } - /** * Delete a policy * diff --git a/spi/control-plane/control-plane-spi/src/main/java/org/eclipse/edc/connector/controlplane/services/spi/transferprocess/TransferProcessService.java b/spi/control-plane/control-plane-spi/src/main/java/org/eclipse/edc/connector/controlplane/services/spi/transferprocess/TransferProcessService.java index b38f21132d7..914e91f6c76 100644 --- a/spi/control-plane/control-plane-spi/src/main/java/org/eclipse/edc/connector/controlplane/services/spi/transferprocess/TransferProcessService.java +++ b/spi/control-plane/control-plane-spi/src/main/java/org/eclipse/edc/connector/controlplane/services/spi/transferprocess/TransferProcessService.java @@ -27,9 +27,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.util.Collection; import java.util.List; -import java.util.stream.Stream; /** * Mediates access to and modification of {@link TransferProcess}es. @@ -53,18 +51,6 @@ public interface TransferProcessService { */ ServiceResult> search(QuerySpec query); - /** - * Query transferProcess. - * - * @param query request - * @return the collection of transferProcesses that match the query - * @deprecated please use {@link #search(QuerySpec)} - */ - @Deprecated(since = "0.4.1") - default ServiceResult> query(QuerySpec query) { - return search(query).map(Collection::stream); - } - /** * Returns the state of a transferProcess by its id. * diff --git a/spi/control-plane/transfer-spi/src/main/java/org/eclipse/edc/connector/controlplane/transfer/spi/store/TransferProcessStore.java b/spi/control-plane/transfer-spi/src/main/java/org/eclipse/edc/connector/controlplane/transfer/spi/store/TransferProcessStore.java index 3c4d77188fb..baa924d0314 100644 --- a/spi/control-plane/transfer-spi/src/main/java/org/eclipse/edc/connector/controlplane/transfer/spi/store/TransferProcessStore.java +++ b/spi/control-plane/transfer-spi/src/main/java/org/eclipse/edc/connector/controlplane/transfer/spi/store/TransferProcessStore.java @@ -18,7 +18,6 @@ import org.eclipse.edc.runtime.metamodel.annotation.ExtensionPoint; import org.eclipse.edc.spi.persistence.StateEntityStore; import org.eclipse.edc.spi.query.QuerySpec; -import org.eclipse.edc.spi.result.StoreResult; import org.jetbrains.annotations.Nullable; import java.util.stream.Stream; @@ -48,14 +47,4 @@ public interface TransferProcessStore extends StateEntityStore */ Stream findAll(QuerySpec querySpec); - /** - * Find the entity by the passed correlation id and lease it. - * If the entity is already leased, will return a failure. - * - * @param correlationId the entity correlation id. - * @return success if the entity is unleased, failure otherwise. - * @deprecated it will be deleted in the future - */ - @Deprecated(since = "0.4.1") - StoreResult findByCorrelationIdAndLease(String correlationId); } diff --git a/spi/control-plane/transfer-spi/src/testFixtures/java/org/eclipse/edc/connector/controlplane/transfer/spi/testfixtures/store/TransferProcessStoreTestBase.java b/spi/control-plane/transfer-spi/src/testFixtures/java/org/eclipse/edc/connector/controlplane/transfer/spi/testfixtures/store/TransferProcessStoreTestBase.java index 25b2f4ff27e..64874d4b133 100644 --- a/spi/control-plane/transfer-spi/src/testFixtures/java/org/eclipse/edc/connector/controlplane/transfer/spi/testfixtures/store/TransferProcessStoreTestBase.java +++ b/spi/control-plane/transfer-spi/src/testFixtures/java/org/eclipse/edc/connector/controlplane/transfer/spi/testfixtures/store/TransferProcessStoreTestBase.java @@ -979,38 +979,4 @@ void shouldReturnAlreadyLeased_whenEntityIsAlreadyLeased() { } } - @Nested - class FindByCorrelationIdAndLease { - @Test - void shouldReturnTheEntityAndLeaseIt() { - var id = UUID.randomUUID().toString(); - var correlationId = UUID.randomUUID().toString(); - getTransferProcessStore().save(TestFunctions.createTransferProcessBuilder(id).correlationId(correlationId).build()); - - var result = getTransferProcessStore().findByCorrelationIdAndLease(correlationId); - - assertThat(result).isSucceeded(); - assertThat(isLeasedBy(id, CONNECTOR_NAME)).isTrue(); - } - - @Test - void shouldReturnNotFound_whenEntityDoesNotExist() { - var result = getTransferProcessStore().findByCorrelationIdAndLease("unexistent"); - - assertThat(result).isFailed().extracting(StoreFailure::getReason).isEqualTo(NOT_FOUND); - } - - @Test - void shouldReturnAlreadyLeased_whenEntityIsAlreadyLeased() { - var id = UUID.randomUUID().toString(); - var correlationId = UUID.randomUUID().toString(); - getTransferProcessStore().save(TestFunctions.createTransferProcessBuilder(id).correlationId(correlationId).build()); - leaseEntity(id, "other owner"); - - var result = getTransferProcessStore().findByCorrelationIdAndLease(correlationId); - - assertThat(result).isFailed().extracting(StoreFailure::getReason).isEqualTo(ALREADY_LEASED); - } - } - }