Elffuss BraidHub

kikocis/EDC public

refactor: cleanup deprecated stuff (#4451)

Changesetd3ee30659a0cd24bc2404c4e456f893799100de5acbd126e345581ec9e5f6db9
Authorndr_brt <andrea.bertagnolli@gmail.com> · 2024-09-04 15:31 +02:00
CommitterGitHub <noreply@github.com> · 2024-09-04 15:31 +02:00
Parentscd5fc3f932d0

Browse the files at this changeset

109 files changed

modified DEPENDENCIES +5 −5
@@ -59,7 +59,7 @@
5959 maven/mavencentral/com.google.code.findbugs/jsr305/2.0.1, BSD-3-Clause AND CC-BY-2.5 AND LGPL-2.1+, approved, CQ13390
6060 maven/mavencentral/com.google.code.findbugs/jsr305/3.0.2, CC-BY-2.5, approved, #15220
6161 maven/mavencentral/com.google.code.gson/gson/2.10.1, Apache-2.0, approved, #6159
62-maven/mavencentral/com.google.crypto.tink/tink/1.15.0, , restricted, clearlydefined
62+maven/mavencentral/com.google.crypto.tink/tink/1.15.0, Apache-2.0, approved, clearlydefined
6363 maven/mavencentral/com.google.errorprone/error_prone_annotations/2.11.0, Apache-2.0, approved, clearlydefined
6464 maven/mavencentral/com.google.errorprone/error_prone_annotations/2.22.0, Apache-2.0, approved, #10661
6565 maven/mavencentral/com.google.errorprone/error_prone_annotations/2.28.0, Apache-2.0, approved, #15107
@@ -82,7 +82,7 @@
8282 maven/mavencentral/com.networknt/json-schema-validator/1.0.76, Apache-2.0, approved, CQ22638
8383 maven/mavencentral/com.nimbusds/nimbus-jose-jwt/9.28, Apache-2.0, approved, clearlydefined
8484 maven/mavencentral/com.nimbusds/nimbus-jose-jwt/9.40, Apache-2.0, approved, #15156
85-maven/mavencentral/com.puppycrawl.tools/checkstyle/10.18.1, LGPL-2.1-or-later, restricted, clearlydefined
85+maven/mavencentral/com.puppycrawl.tools/checkstyle/10.18.1, LGPL-2.1-or-later AND (Apache-2.0 AND LGPL-2.1-or-later) AND Apache-2.0, approved, #16060
8686 maven/mavencentral/com.samskivert/jmustache/1.15, BSD-2-Clause AND BSD-3-Clause, approved, clearlydefined
8787 maven/mavencentral/com.squareup.okhttp3/okhttp-dnsoverhttps/4.12.0, Apache-2.0, approved, #11159
8888 maven/mavencentral/com.squareup.okhttp3/okhttp/4.12.0, Apache-2.0, approved, #15227
@@ -195,7 +195,7 @@
195195 maven/mavencentral/net.minidev/accessors-smart/2.4.7, Apache-2.0, approved, #7515
196196 maven/mavencentral/net.minidev/json-smart/2.4.7, Apache-2.0, approved, #3288
197197 maven/mavencentral/net.sf.jopt-simple/jopt-simple/5.0.4, MIT, approved, CQ13174
198-maven/mavencentral/net.sf.saxon/Saxon-HE/12.5, NOASSERTION, restricted, clearlydefined
198+maven/mavencentral/net.sf.saxon/Saxon-HE/12.5, MPL-2.0-no-copyleft-exception AND (LicenseRef-scancode-proprietary-license AND MPL-2.0-no-copyleft-exception) AND (MPL-2.0-no-copyleft-exception AND X11) AND (MIT AND MPL-2.0-no-copyleft-exception) AND (MPL-1.0 AND MPL-2.0-no-copyleft-exception) AND (Apache-2.0 AND MPL-2.0-no-copyleft-exception) AND MPL-1.0, restricted, #16061
199199 maven/mavencentral/org.antlr/antlr4-runtime/4.13.2, BSD-3-Clause, approved, #10767
200200 maven/mavencentral/org.apache.commons/commons-compress/1.24.0, Apache-2.0 AND BSD-3-Clause AND bzip2-1.0.6 AND LicenseRef-Public-Domain, approved, #10368
201201 maven/mavencentral/org.apache.commons/commons-digester3/3.2, Apache-2.0, approved, clearlydefined
@@ -219,7 +219,7 @@
219219 maven/mavencentral/org.apache.httpcomponents/httpcore/4.4.13, Apache-2.0, approved, CQ23528
220220 maven/mavencentral/org.apache.httpcomponents/httpcore/4.4.14, Apache-2.0, approved, CQ23528
221221 maven/mavencentral/org.apache.httpcomponents/httpmime/4.5.13, Apache-2.0, approved, CQ11718
222-maven/mavencentral/org.apache.kafka/kafka-clients/3.8.0, Apache-2.0, restricted, clearlydefined
222+maven/mavencentral/org.apache.kafka/kafka-clients/3.8.0, Apache-2.0 AND (Apache-2.0 AND MIT) AND (Apache-2.0 AND BSD-3-Clause), approved, #16063
223223 maven/mavencentral/org.apache.maven.doxia/doxia-core/1.12.0, Apache-2.0, approved, clearlydefined
224224 maven/mavencentral/org.apache.maven.doxia/doxia-logging-api/1.12.0, Apache-2.0, approved, clearlydefined
225225 maven/mavencentral/org.apache.maven.doxia/doxia-module-xdoc/1.12.0, Apache-2.0, approved, clearlydefined
@@ -309,7 +309,7 @@
309309 maven/mavencentral/org.junit.platform/junit-platform-commons/1.11.0, EPL-2.0, approved, #15936
310310 maven/mavencentral/org.junit.platform/junit-platform-engine/1.11.0, EPL-2.0, approved, #15932
311311 maven/mavencentral/org.junit.platform/junit-platform-launcher/1.11.0, EPL-2.0, approved, #15934
312-maven/mavencentral/org.junit/junit-bom/5.11.0, , restricted, clearlydefined
312+maven/mavencentral/org.junit/junit-bom/5.11.0, EPL-2.0, approved, #16062
313313 maven/mavencentral/org.junit/junit-bom/5.9.2, EPL-2.0, approved, #4711
314314 maven/mavencentral/org.jvnet.mimepull/mimepull/1.9.15, CDDL-1.1 OR GPL-2.0-only WITH Classpath-exception-2.0, approved, CQ21484
315315 maven/mavencentral/org.latencyutils/LatencyUtils/2.0.3, CC0-1.0, approved, #15280
modified core/control-plane/control-plane-aggregate-services/src/main/java/org/eclipse/edc/connector/controlplane/services/catalog/CatalogProtocolServiceImpl.java +0 −5
@@ -28,16 +28,12 @@
2828 import org.jetbrains.annotations.NotNull;
2929
3030 import static java.lang.String.format;
31-import static org.eclipse.edc.spi.constants.CoreConstants.EDC_NAMESPACE;
3231
3332 public class CatalogProtocolServiceImpl implements CatalogProtocolService {
3433
3534 @PolicyScope
3635 public static final String CATALOGING_REQUEST_SCOPE = "request.catalog";
3736
38- @Deprecated(since = "0.5.1")
39- private static final String EDC_PROPERTY_PARTICIPANT_ID = EDC_NAMESPACE + "participantId";
40-
4137 private final DatasetResolver datasetResolver;
4238 private final DataServiceRegistry dataServiceRegistry;
4339 private final String participantId;
@@ -69,7 +65,6 @@
6965 .dataServices(dataServices)
7066 .datasets(datasets.toList())
7167 .participantId(participantId)
72- .property(EDC_PROPERTY_PARTICIPANT_ID, participantId)
7368 .build();
7469 }
7570 })
modified data-protocols/dsp/dsp-catalog/dsp-catalog-transform/src/main/java/org/eclipse/edc/protocol/dsp/catalog/transform/from/JsonObjectFromDataServiceTransformer.java +0 −6
@@ -27,8 +27,6 @@
2727 import static org.eclipse.edc.jsonld.spi.PropertyAndTypeNames.DCAT_DATA_SERVICE_TYPE;
2828 import static org.eclipse.edc.jsonld.spi.PropertyAndTypeNames.DCAT_ENDPOINT_DESCRIPTION_ATTRIBUTE;
2929 import static org.eclipse.edc.jsonld.spi.PropertyAndTypeNames.DCAT_ENDPOINT_URL_ATTRIBUTE;
30-import static org.eclipse.edc.jsonld.spi.PropertyAndTypeNames.DCT_ENDPOINT_URL_ATTRIBUTE;
31-import static org.eclipse.edc.jsonld.spi.PropertyAndTypeNames.DCT_TERMS_ATTRIBUTE;
3230
3331 /**
3432 * Converts from a {@link DataService} to a DCAT data service as a {@link JsonObject} in JSON-LD expanded form.
@@ -51,10 +49,6 @@
5149 addIfNotNull(dataService.getEndpointDescription(), DCAT_ENDPOINT_DESCRIPTION_ATTRIBUTE, objectBuilder);
5250 addIfNotNull(dataService.getEndpointUrl(), DCAT_ENDPOINT_URL_ATTRIBUTE, objectBuilder);
5351
54- // deprecated attributes, to be removed
55- addIfNotNull(dataService.getEndpointDescription(), DCT_TERMS_ATTRIBUTE, objectBuilder);
56- addIfNotNull(dataService.getEndpointUrl(), DCT_ENDPOINT_URL_ATTRIBUTE, objectBuilder);
57-
5852 return objectBuilder.build();
5953 }
6054
modified data-protocols/dsp/dsp-catalog/dsp-catalog-transform/src/test/java/org/eclipse/edc/protocol/dsp/catalog/transform/from/JsonObjectFromDataServiceTransformerTest.java +0 −19
@@ -29,8 +29,6 @@
2929 import static org.eclipse.edc.jsonld.spi.PropertyAndTypeNames.DCAT_DATA_SERVICE_TYPE;
3030 import static org.eclipse.edc.jsonld.spi.PropertyAndTypeNames.DCAT_ENDPOINT_DESCRIPTION_ATTRIBUTE;
3131 import static org.eclipse.edc.jsonld.spi.PropertyAndTypeNames.DCAT_ENDPOINT_URL_ATTRIBUTE;
32-import static org.eclipse.edc.jsonld.spi.PropertyAndTypeNames.DCT_ENDPOINT_URL_ATTRIBUTE;
33-import static org.eclipse.edc.jsonld.spi.PropertyAndTypeNames.DCT_TERMS_ATTRIBUTE;
3432 import static org.mockito.Mockito.mock;
3533
3634 class JsonObjectFromDataServiceTransformerTest {
@@ -62,21 +60,4 @@
6260 assertThat(result.getJsonString(DCAT_ENDPOINT_URL_ATTRIBUTE).getString()).isEqualTo("url");
6361 }
6462
65- @Deprecated
66- @Test
67- void deprecated_attributes() {
68- var dataService = DataService.Builder.newInstance()
69- .id("dataServiceId")
70- .endpointDescription("description")
71- .endpointUrl("url")
72- .build();
73-
74- var result = transformer.transform(dataService, context);
75-
76- assertThat(result).isNotNull();
77- assertThat(result.getJsonString(ID).getString()).isEqualTo(dataService.getId());
78- assertThat(result.getJsonString(TYPE).getString()).isEqualTo(DCAT_DATA_SERVICE_TYPE);
79- assertThat(result.getJsonString(DCT_TERMS_ATTRIBUTE).getString()).isEqualTo("description");
80- assertThat(result.getJsonString(DCT_ENDPOINT_URL_ATTRIBUTE).getString()).isEqualTo("url");
81- }
8263 }
modified data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractAgreementMessageTransformer.java +0 −6
@@ -29,12 +29,9 @@
2929 import static org.eclipse.edc.jsonld.spi.PropertyAndTypeNames.ODRL_ASSIGNEE_ATTRIBUTE;
3030 import static org.eclipse.edc.jsonld.spi.PropertyAndTypeNames.ODRL_ASSIGNER_ATTRIBUTE;
3131 import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_PROPERTY_AGREEMENT;
32-import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_ID;
33-import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_ID;
3432 import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_PROPERTY_TIMESTAMP;
3533 import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE;
3634 import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID;
37-import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROCESS_ID;
3835 import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID;
3936
4037
@@ -70,8 +67,6 @@
7067 .add(ID, agreement.getId())
7168 .add(ODRL_ASSIGNEE_ATTRIBUTE, agreement.getConsumerId())
7269 .add(ODRL_ASSIGNER_ATTRIBUTE, agreement.getProviderId())
73- .add(DSPACE_PROPERTY_CONSUMER_ID, agreement.getConsumerId())
74- .add(DSPACE_PROPERTY_PROVIDER_ID, agreement.getProviderId())
7570 .add(DSPACE_PROPERTY_TIMESTAMP, signing)
7671 .build();
7772
@@ -80,7 +75,6 @@
8075 .add(TYPE, DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE)
8176 .add(DSPACE_PROPERTY_PROVIDER_PID, agreementMessage.getProviderPid())
8277 .add(DSPACE_PROPERTY_CONSUMER_PID, agreementMessage.getConsumerPid())
83- .add(DSPACE_PROPERTY_PROCESS_ID, agreementMessage.getProcessId())
8478 .add(DSPACE_PROPERTY_AGREEMENT, copiedPolicy)
8579 .build();
8680 }
modified data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractAgreementVerificationMessageTransformer.java +0 −2
@@ -26,7 +26,6 @@
2626 import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.TYPE;
2727 import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_AGREEMENT_VERIFICATION_MESSAGE;
2828 import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID;
29-import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROCESS_ID;
3029 import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID;
3130
3231 /**
@@ -48,7 +47,6 @@
4847 .add(TYPE, DSPACE_TYPE_CONTRACT_AGREEMENT_VERIFICATION_MESSAGE)
4948 .add(DSPACE_PROPERTY_CONSUMER_PID, verificationMessage.getConsumerPid())
5049 .add(DSPACE_PROPERTY_PROVIDER_PID, verificationMessage.getProviderPid())
51- .add(DSPACE_PROPERTY_PROCESS_ID, verificationMessage.getProcessId())
5250 .build();
5351 }
5452 }
modified data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractNegotiationEventMessageTransformer.java +0 −2
@@ -29,7 +29,6 @@
2929 import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_VALUE_NEGOTIATION_EVENT_TYPE_ACCEPTED;
3030 import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_VALUE_NEGOTIATION_EVENT_TYPE_FINALIZED;
3131 import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID;
32-import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROCESS_ID;
3332 import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID;
3433
3534
@@ -52,7 +51,6 @@
5251 .add(TYPE, DSPACE_TYPE_CONTRACT_NEGOTIATION_EVENT_MESSAGE)
5352 .add(DSPACE_PROPERTY_CONSUMER_PID, eventMessage.getConsumerPid())
5453 .add(DSPACE_PROPERTY_PROVIDER_PID, eventMessage.getProviderPid())
55- .add(DSPACE_PROPERTY_PROCESS_ID, eventMessage.getProcessId())
5654 .add(DSPACE_PROPERTY_EVENT_TYPE, switch (eventMessage.getType()) {
5755 case ACCEPTED -> DSPACE_VALUE_NEGOTIATION_EVENT_TYPE_ACCEPTED;
5856 case FINALIZED -> DSPACE_VALUE_NEGOTIATION_EVENT_TYPE_FINALIZED;
modified data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractNegotiationTerminationMessageTransformer.java +1 −3
@@ -27,7 +27,6 @@
2727 import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_NEGOTIATION_TERMINATION_MESSAGE;
2828 import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CODE;
2929 import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID;
30-import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROCESS_ID;
3130 import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID;
3231 import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_REASON;
3332
@@ -49,8 +48,7 @@
4948 .add(ID, terminationMessage.getId())
5049 .add(TYPE, DSPACE_TYPE_CONTRACT_NEGOTIATION_TERMINATION_MESSAGE)
5150 .add(DSPACE_PROPERTY_CONSUMER_PID, terminationMessage.getConsumerPid())
52- .add(DSPACE_PROPERTY_PROVIDER_PID, terminationMessage.getProviderPid())
53- .add(DSPACE_PROPERTY_PROCESS_ID, terminationMessage.getProcessId());
51+ .add(DSPACE_PROPERTY_PROVIDER_PID, terminationMessage.getProviderPid());
5452
5553 addIfNotNull(terminationMessage.getRejectionReason(), DSPACE_PROPERTY_REASON, builder);
5654 addIfNotNull(terminationMessage.getCode(), DSPACE_PROPERTY_CODE, builder);
modified data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractNegotiationTransformer.java +0 −2
@@ -34,7 +34,6 @@
3434 import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_VALUE_NEGOTIATION_STATE_TERMINATED;
3535 import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_VALUE_NEGOTIATION_STATE_VERIFIED;
3636 import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID;
37-import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROCESS_ID;
3837 import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID;
3938 import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_STATE;
4039
@@ -58,7 +57,6 @@
5857 .add(TYPE, DSPACE_TYPE_CONTRACT_NEGOTIATION)
5958 .add(DSPACE_PROPERTY_CONSUMER_PID, pidFor(contractNegotiation, ContractNegotiation.Type.CONSUMER))
6059 .add(DSPACE_PROPERTY_PROVIDER_PID, pidFor(contractNegotiation, ContractNegotiation.Type.PROVIDER))
61- .add(DSPACE_PROPERTY_PROCESS_ID, pidFor(contractNegotiation, ContractNegotiation.Type.CONSUMER))
6260 .add(DSPACE_PROPERTY_STATE, state(contractNegotiation.getState(), context))
6361 .build();
6462 }
modified data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractOfferMessageTransformer.java +1 −3
@@ -29,7 +29,6 @@
2929 import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_OFFER_MESSAGE;
3030 import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CALLBACK_ADDRESS;
3131 import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID;
32-import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROCESS_ID;
3332 import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID;
3433
3534 /**
@@ -49,8 +48,7 @@
4948 var builder = jsonFactory.createObjectBuilder()
5049 .add(ID, message.getId())
5150 .add(TYPE, DSPACE_TYPE_CONTRACT_OFFER_MESSAGE)
52- .add(DSPACE_PROPERTY_PROVIDER_PID, message.getProviderPid())
53- .add(DSPACE_PROPERTY_PROCESS_ID, message.getProcessId());
51+ .add(DSPACE_PROPERTY_PROVIDER_PID, message.getProviderPid());
5452
5553 addIfNotNull(message.getConsumerPid(), DSPACE_PROPERTY_CONSUMER_PID, builder);
5654 addIfNotNull(message.getCallbackAddress(), DSPACE_PROPERTY_CALLBACK_ADDRESS, builder);
modified data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractRequestMessageTransformer.java +1 −3
@@ -29,7 +29,6 @@
2929 import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE;
3030 import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CALLBACK_ADDRESS;
3131 import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID;
32-import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROCESS_ID;
3332 import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID;
3433
3534
@@ -50,8 +49,7 @@
5049 var builder = jsonFactory.createObjectBuilder()
5150 .add(ID, requestMessage.getId())
5251 .add(TYPE, DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE)
53- .add(DSPACE_PROPERTY_CONSUMER_PID, requestMessage.getConsumerPid())
54- .add(DSPACE_PROPERTY_PROCESS_ID, requestMessage.getProcessId());
52+ .add(DSPACE_PROPERTY_CONSUMER_PID, requestMessage.getConsumerPid());
5553
5654 addIfNotNull(requestMessage.getProviderPid(), DSPACE_PROPERTY_PROVIDER_PID, builder);
5755 addIfNotNull(requestMessage.getCallbackAddress(), DSPACE_PROPERTY_CALLBACK_ADDRESS, builder);
modified data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractAgreementMessageTransformer.java +1 −20
@@ -41,8 +41,7 @@
4141 * Creates a {@link ContractAgreementMessage} from a {@link JsonObject}.
4242 */
4343 public class JsonObjectToContractAgreementMessageTransformer extends AbstractJsonLdTransformer<JsonObject, ContractAgreementMessage> {
44- private static final Set<String> EXCLUDED_POLICY_KEYWORDS =
45- Set.of(DSPACE_PROPERTY_CONSUMER_ID, DSPACE_PROPERTY_PROVIDER_ID, DSPACE_PROPERTY_TIMESTAMP);
44+ private static final Set<String> EXCLUDED_POLICY_KEYWORDS = Set.of(DSPACE_PROPERTY_TIMESTAMP, DSPACE_PROPERTY_CONSUMER_ID, DSPACE_PROPERTY_PROVIDER_ID);
4645
4746 public JsonObjectToContractAgreementMessageTransformer() {
4847 super(JsonObject.class, ContractAgreementMessage.class);
@@ -126,24 +125,6 @@
126125 .policy(policy)
127126 .assetId(policy.getTarget());
128127
129- if (assignee == null && !transformMandatoryString(jsonAgreement.get(DSPACE_PROPERTY_CONSUMER_ID), builder::consumerId, context)) {
130- context.problem()
131- .missingProperty()
132- .type(DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE)
133- .property(DSPACE_PROPERTY_CONSUMER_ID)
134- .report();
135- return null;
136- }
137-
138- if (assigner == null && !transformMandatoryString(jsonAgreement.get(DSPACE_PROPERTY_PROVIDER_ID), builder::providerId, context)) {
139- context.problem()
140- .missingProperty()
141- .type(DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE)
142- .property(DSPACE_PROPERTY_PROVIDER_ID)
143- .report();
144- return null;
145- }
146-
147128 var timestamp = transformString(jsonAgreement.get(DSPACE_PROPERTY_TIMESTAMP), context);
148129 if (timestamp == null) {
149130 context.problem()
modified data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractAgreementVerificationMessageTransformer.java +12 −22
@@ -23,7 +23,6 @@
2323
2424 import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_AGREEMENT_VERIFICATION_MESSAGE;
2525 import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID;
26-import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROCESS_ID;
2726 import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID;
2827
2928 /**
@@ -38,30 +37,21 @@
3837 @Override
3938 public @Nullable ContractAgreementVerificationMessage transform(@NotNull JsonObject object, @NotNull TransformerContext context) {
4039 var builder = ContractAgreementVerificationMessage.Builder.newInstance();
41- var processId = object.get(DSPACE_PROPERTY_PROCESS_ID);
4240 if (!transformMandatoryString(object.get(DSPACE_PROPERTY_CONSUMER_PID), builder::consumerPid, context)) {
43- if (processId == null) {
44- context.problem()
45- .missingProperty()
46- .type(DSPACE_TYPE_CONTRACT_AGREEMENT_VERIFICATION_MESSAGE)
47- .property(DSPACE_PROPERTY_CONSUMER_PID)
48- .report();
49- return null;
50- } else {
51- builder.consumerPid(transformString(processId, context));
52- }
41+ context.problem()
42+ .missingProperty()
43+ .type(DSPACE_TYPE_CONTRACT_AGREEMENT_VERIFICATION_MESSAGE)
44+ .property(DSPACE_PROPERTY_CONSUMER_PID)
45+ .report();
46+ return null;
5347 }
5448 if (!transformMandatoryString(object.get(DSPACE_PROPERTY_PROVIDER_PID), builder::providerPid, context)) {
55- if (processId == null) {
56- context.problem()
57- .missingProperty()
58- .type(DSPACE_TYPE_CONTRACT_AGREEMENT_VERIFICATION_MESSAGE)
59- .property(DSPACE_PROPERTY_PROVIDER_PID)
60- .report();
61- return null;
62- } else {
63- builder.providerPid(transformString(processId, context));
64- }
49+ context.problem()
50+ .missingProperty()
51+ .type(DSPACE_TYPE_CONTRACT_AGREEMENT_VERIFICATION_MESSAGE)
52+ .property(DSPACE_PROPERTY_PROVIDER_PID)
53+ .report();
54+ return null;
6555 }
6656
6757 return builder.build();
modified data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractAgreementMessageTransformerTest.java +0 −37
@@ -38,12 +38,9 @@
3838 import static org.eclipse.edc.jsonld.spi.PropertyAndTypeNames.ODRL_ASSIGNEE_ATTRIBUTE;
3939 import static org.eclipse.edc.jsonld.spi.PropertyAndTypeNames.ODRL_ASSIGNER_ATTRIBUTE;
4040 import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_PROPERTY_AGREEMENT;
41-import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_ID;
42-import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_ID;
4341 import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_PROPERTY_TIMESTAMP;
4442 import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE;
4543 import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID;
46-import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROCESS_ID;
4744 import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID;
4845 import static org.mockito.ArgumentMatchers.any;
4946 import static org.mockito.ArgumentMatchers.anyString;
@@ -77,7 +74,6 @@
7774 void transform() {
7875 var message = ContractAgreementMessage.Builder.newInstance()
7976 .protocol(DSP)
80- .processId("processId")
8177 .providerPid("providerPid")
8278 .consumerPid("consumerPid")
8379 .counterPartyAddress("https://example.com")
@@ -102,7 +98,6 @@
10298 assertThat(result.getString(TYPE)).isEqualTo(DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE);
10399 assertThat(result.getString(DSPACE_PROPERTY_PROVIDER_PID)).isEqualTo("providerPid");
104100 assertThat(result.getString(DSPACE_PROPERTY_CONSUMER_PID)).isEqualTo("consumerPid");
105- assertThat(result.getString(DSPACE_PROPERTY_PROCESS_ID)).isEqualTo("processId");
106101
107102 var jsonAgreement = result.getJsonObject(DSPACE_PROPERTY_AGREEMENT);
108103 assertThat(jsonAgreement).isNotNull();
@@ -114,38 +109,6 @@
114109 verify(context, never()).reportProblem(anyString());
115110 }
116111
117- @Deprecated(since = "0.5.1")
118- @Test
119- void shouldSetConsumerIdAndProviderIdForBackwardCompatibility() {
120- var message = ContractAgreementMessage.Builder.newInstance()
121- .protocol(DSP)
122- .processId("processId")
123- .providerPid("providerPid")
124- .consumerPid("consumerPid")
125- .counterPartyAddress("https://example.com")
126- .contractAgreement(ContractAgreement.Builder.newInstance()
127- .id(AGREEMENT_ID)
128- .providerId(PROVIDER_ID)
129- .consumerId(CONSUMER_ID)
130- .assetId("assetId")
131- .policy(policy()).build())
132- .build();
133- var policyObject = jsonFactory.createObjectBuilder()
134- .add(ID, "contractOfferId")
135- .build();
136-
137- when(context.transform(any(Policy.class), eq(JsonObject.class))).thenReturn(policyObject);
138-
139- var result = transformer.transform(message, context);
140-
141- assertThat(result).isNotNull();
142- var jsonAgreement = result.getJsonObject(DSPACE_PROPERTY_AGREEMENT);
143- assertThat(jsonAgreement.getString(DSPACE_PROPERTY_CONSUMER_ID)).isEqualTo(CONSUMER_ID);
144- assertThat(jsonAgreement.getString(DSPACE_PROPERTY_PROVIDER_ID)).isEqualTo(PROVIDER_ID);
145-
146- verify(context, never()).reportProblem(anyString());
147- }
148-
149112 @Test
150113 void transform_policyError() {
151114 var message = ContractAgreementMessage.Builder.newInstance()
modified data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractAgreementVerificationMessageTransformerTest.java +0 −3
@@ -27,7 +27,6 @@
2727 import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.TYPE;
2828 import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_AGREEMENT_VERIFICATION_MESSAGE;
2929 import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID;
30-import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROCESS_ID;
3130 import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID;
3231 import static org.mockito.ArgumentMatchers.anyString;
3332 import static org.mockito.Mockito.mock;
@@ -47,7 +46,6 @@
4746 var value = "example";
4847 var message = ContractAgreementVerificationMessage.Builder.newInstance()
4948 .protocol(value)
50- .processId("processId")
5149 .consumerPid("consumerPid")
5250 .providerPid("providerPid")
5351 .counterPartyAddress(value)
@@ -60,7 +58,6 @@
6058 assertThat(result.getJsonString(TYPE).getString()).isEqualTo(DSPACE_TYPE_CONTRACT_AGREEMENT_VERIFICATION_MESSAGE);
6159 assertThat(result.getJsonString(DSPACE_PROPERTY_CONSUMER_PID).getString()).isEqualTo("consumerPid");
6260 assertThat(result.getJsonString(DSPACE_PROPERTY_PROVIDER_PID).getString()).isEqualTo("providerPid");
63- assertThat(result.getJsonString(DSPACE_PROPERTY_PROCESS_ID).getString()).isEqualTo("processId");
6461
6562 verify(context, never()).reportProblem(anyString());
6663 }
modified data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractNegotiationEventMessageTransformerTest.java +0 −3
@@ -30,7 +30,6 @@
3030 import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_NEGOTIATION_EVENT_MESSAGE;
3131 import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_VALUE_NEGOTIATION_EVENT_TYPE_ACCEPTED;
3232 import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID;
33-import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROCESS_ID;
3433 import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID;
3534 import static org.mockito.ArgumentMatchers.anyString;
3635 import static org.mockito.Mockito.mock;
@@ -50,7 +49,6 @@
5049 void transform() {
5150 var message = ContractNegotiationEventMessage.Builder.newInstance()
5251 .protocol(DSP)
53- .processId("processId")
5452 .consumerPid("consumerPid")
5553 .providerPid("providerPid")
5654 .counterPartyAddress("https://test.com")
@@ -64,7 +62,6 @@
6462 assertThat(result.getString(TYPE)).isEqualTo(DSPACE_TYPE_CONTRACT_NEGOTIATION_EVENT_MESSAGE);
6563 assertThat(result.getString(DSPACE_PROPERTY_PROVIDER_PID)).isEqualTo("providerPid");
6664 assertThat(result.getString(DSPACE_PROPERTY_CONSUMER_PID)).isEqualTo("consumerPid");
67- assertThat(result.getString(DSPACE_PROPERTY_PROCESS_ID)).isEqualTo("processId");
6865 assertThat(result.getString(DSPACE_PROPERTY_EVENT_TYPE)).isEqualTo(DSPACE_VALUE_NEGOTIATION_EVENT_TYPE_ACCEPTED);
6966
7067 verify(context, never()).reportProblem(anyString());
modified data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractNegotiationTerminationMessageTransformerTest.java +0 −3
@@ -28,7 +28,6 @@
2828 import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_NEGOTIATION_TERMINATION_MESSAGE;
2929 import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CODE;
3030 import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID;
31-import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROCESS_ID;
3231 import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID;
3332 import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_REASON;
3433 import static org.mockito.ArgumentMatchers.anyString;
@@ -51,7 +50,6 @@
5150 void transform() {
5251 var message = ContractNegotiationTerminationMessage.Builder.newInstance()
5352 .protocol(DSP)
54- .processId("processId")
5553 .consumerPid("consumerPid")
5654 .providerPid("providerPid")
5755 .counterPartyAddress("https://test.com")
@@ -66,7 +64,6 @@
6664 assertThat(result.getString(TYPE)).isEqualTo(DSPACE_TYPE_CONTRACT_NEGOTIATION_TERMINATION_MESSAGE);
6765 assertThat(result.getString(DSPACE_PROPERTY_CONSUMER_PID)).isEqualTo("consumerPid");
6866 assertThat(result.getString(DSPACE_PROPERTY_PROVIDER_PID)).isEqualTo("providerPid");
69- assertThat(result.getString(DSPACE_PROPERTY_PROCESS_ID)).isEqualTo("processId");
7067 assertThat(result.getString(DSPACE_PROPERTY_CODE)).isEqualTo(REJECTION_CODE);
7168 assertThat(result.getString(DSPACE_PROPERTY_REASON)).isEqualTo(REJECTION_REASON);
7269
modified data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractNegotiationTransformerTest.java +0 −3
@@ -56,7 +56,6 @@
5656 import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_VALUE_NEGOTIATION_STATE_TERMINATED;
5757 import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_VALUE_NEGOTIATION_STATE_VERIFIED;
5858 import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID;
59-import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROCESS_ID;
6059 import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID;
6160 import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_STATE;
6261 import static org.mockito.ArgumentMatchers.anyString;
@@ -95,7 +94,6 @@
9594 assertThat(result.getString(TYPE)).isEqualTo(DSPACE_TYPE_CONTRACT_NEGOTIATION);
9695 assertThat(result.getString(DSPACE_PROPERTY_CONSUMER_PID)).isEqualTo("consumerPid");
9796 assertThat(result.getString(DSPACE_PROPERTY_PROVIDER_PID)).isEqualTo("providerPid");
98- assertThat(result.getString(DSPACE_PROPERTY_PROCESS_ID)).isEqualTo("consumerPid");
9997
10098 verify(context, never()).reportProblem(anyString());
10199 }
@@ -119,7 +117,6 @@
119117 assertThat(result.getString(TYPE)).isEqualTo(DSPACE_TYPE_CONTRACT_NEGOTIATION);
120118 assertThat(result.getString(DSPACE_PROPERTY_CONSUMER_PID)).isEqualTo("consumerPid");
121119 assertThat(result.getString(DSPACE_PROPERTY_PROVIDER_PID)).isEqualTo("providerPid");
122- assertThat(result.getString(DSPACE_PROPERTY_PROCESS_ID)).isEqualTo("consumerPid");
123120
124121 verify(context, never()).reportProblem(anyString());
125122 }
modified data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractOfferMessageTransformerTest.java +0 −3
@@ -34,7 +34,6 @@
3434 import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_OFFER_MESSAGE;
3535 import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CALLBACK_ADDRESS;
3636 import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID;
37-import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROCESS_ID;
3837 import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID;
3938 import static org.mockito.ArgumentMatchers.any;
4039 import static org.mockito.ArgumentMatchers.anyString;
@@ -67,7 +66,6 @@
6766 var message = ContractOfferMessage.Builder.newInstance()
6867 .id(MESSAGE_ID)
6968 .callbackAddress(CALLBACK_ADDRESS)
70- .processId("processId")
7169 .providerPid("providerPid")
7270 .consumerPid("consumerPid")
7371 .protocol(PROTOCOL)
@@ -88,7 +86,6 @@
8886 assertThat(result.getJsonObject(DSPACE_PROPERTY_OFFER).getJsonString(ID).getString()).isEqualTo(CONTRACT_OFFER_ID);
8987 assertThat(result.getString(DSPACE_PROPERTY_PROVIDER_PID)).isEqualTo("providerPid");
9088 assertThat(result.getString(DSPACE_PROPERTY_CONSUMER_PID)).isEqualTo("consumerPid");
91- assertThat(result.getString(DSPACE_PROPERTY_PROCESS_ID)).isEqualTo("processId");
9289
9390 verify(context, never()).reportProblem(anyString());
9491 }
modified data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractRequestMessageTransformerTest.java +0 −3
@@ -34,7 +34,6 @@
3434 import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE;
3535 import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CALLBACK_ADDRESS;
3636 import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID;
37-import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROCESS_ID;
3837 import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID;
3938 import static org.mockito.ArgumentMatchers.any;
4039 import static org.mockito.ArgumentMatchers.anyString;
@@ -67,7 +66,6 @@
6766 @Test
6867 void verify_contractOffer() {
6968 var message = contractRequestMessageBuilder()
70- .processId("processId")
7169 .consumerPid("consumerPid")
7270 .providerPid("providerPid")
7371 .contractOffer(contractOffer())
@@ -85,7 +83,6 @@
8583 assertThat(result.getJsonObject(DSPACE_PROPERTY_OFFER).getString(ID)).isEqualTo(CONTRACT_OFFER_ID);
8684 assertThat(result.getJsonString(DSPACE_PROPERTY_CONSUMER_PID).getString()).isEqualTo("consumerPid");
8785 assertThat(result.getJsonString(DSPACE_PROPERTY_PROVIDER_PID).getString()).isEqualTo("providerPid");
88- assertThat(result.getJsonString(DSPACE_PROPERTY_PROCESS_ID).getString()).isEqualTo("processId");
8986
9087 verify(context, never()).reportProblem(anyString());
9188 }
modified data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractAgreementMessageTransformerTest.java +0 −42
@@ -40,8 +40,6 @@
4040 import static org.eclipse.edc.jsonld.spi.PropertyAndTypeNames.ODRL_POLICY_TYPE_AGREEMENT;
4141 import static org.eclipse.edc.protocol.dsp.negotiation.transform.to.TestInput.getExpanded;
4242 import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_PROPERTY_AGREEMENT;
43-import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_ID;
44-import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_ID;
4543 import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_PROPERTY_TIMESTAMP;
4644 import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE;
4745 import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID;
@@ -113,46 +111,6 @@
113111 verify(context, never()).reportProblem(anyString());
114112 }
115113
116- @Deprecated
117- @Test
118- void transformFallbackConsumerIdProviderId_whenAssigneeAndAssignerAreMissing() {
119- var message = jsonFactory.createObjectBuilder()
120- .add(ID, MESSAGE_ID)
121- .add(TYPE, DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE)
122- .add(DSPACE_PROPERTY_CONSUMER_PID, "consumerPid")
123- .add(DSPACE_PROPERTY_PROVIDER_PID, "providerPid")
124- .add(DSPACE_PROPERTY_AGREEMENT, jsonFactory.createObjectBuilder()
125- .add(ID, AGREEMENT_ID)
126- .add(TYPE, ODRL_POLICY_TYPE_AGREEMENT)
127- .add(DSPACE_PROPERTY_CONSUMER_ID, CONSUMER_ID)
128- .add(DSPACE_PROPERTY_PROVIDER_ID, PROVIDER_ID)
129- .add(DSPACE_PROPERTY_TIMESTAMP, TIMESTAMP)
130- .build())
131- .build();
132-
133- var policy = policyBuilder().assignee(null).assigner(null).build();
134- when(context.transform(any(JsonObject.class), eq(Policy.class))).thenReturn(policy);
135-
136- var result = transformer.transform(getExpanded(message), context);
137-
138- assertThat(result).isNotNull();
139- assertThat(result.getClass()).isEqualTo(ContractAgreementMessage.class);
140- assertThat(result.getProtocol()).isNotEmpty();
141- assertThat(result.getConsumerPid()).isEqualTo("consumerPid");
142- assertThat(result.getProviderPid()).isEqualTo("providerPid");
143-
144- var agreement = result.getContractAgreement();
145- assertThat(agreement).isNotNull();
146- assertThat(agreement.getClass()).isEqualTo(ContractAgreement.class);
147- assertThat(agreement.getId()).isEqualTo(AGREEMENT_ID);
148- assertThat(agreement.getConsumerId()).isEqualTo(CONSUMER_ID);
149- assertThat(agreement.getProviderId()).isEqualTo(PROVIDER_ID);
150- assertThat(agreement.getAssetId()).isEqualTo(TARGET);
151- assertThat(agreement.getContractSigningDate()).isEqualTo(Instant.parse(TIMESTAMP).getEpochSecond());
152-
153- verify(context, never()).reportProblem(anyString());
154- }
155-
156114 @Test
157115 void transform_nullPolicy() {
158116 var value = "example";
modified data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractAgreementVerificationMessageTransformerTest.java +0 −20
@@ -29,7 +29,6 @@
2929 import static org.eclipse.edc.protocol.dsp.negotiation.transform.to.TestInput.getExpanded;
3030 import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_AGREEMENT_VERIFICATION_MESSAGE;
3131 import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID;
32-import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROCESS_ID;
3332 import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID;
3433 import static org.mockito.ArgumentMatchers.anyString;
3534 import static org.mockito.ArgumentMatchers.contains;
@@ -72,25 +71,6 @@
7271 verify(context, never()).reportProblem(anyString());
7372 }
7473
75- @Test
76- void transform_processId() {
77- var message = jsonFactory.createObjectBuilder()
78- .add(JsonLdKeywords.ID, "messageId")
79- .add(JsonLdKeywords.TYPE, DSPACE_TYPE_CONTRACT_AGREEMENT_VERIFICATION_MESSAGE)
80- .add(DSPACE_PROPERTY_PROCESS_ID, "processId")
81- .build();
82-
83- var result = transformer.transform(getExpanded(message), context);
84-
85- assertThat(result).isNotNull();
86- assertThat(result.getClass()).isEqualTo(ContractAgreementVerificationMessage.class);
87- assertThat(result.getProtocol()).isNotEmpty();
88- assertThat(result.getConsumerPid()).isEqualTo("processId");
89- assertThat(result.getProviderPid()).isEqualTo("processId");
90-
91- verify(context, never()).reportProblem(anyString());
92- }
93-
9474 @Test
9575 void verify_failTransformWhenConsumerPidMissing() {
9676 var message = jsonFactory.createObjectBuilder()
modified data-protocols/dsp/dsp-spi/src/main/java/org/eclipse/edc/protocol/dsp/spi/type/DspNegotiationPropertyAndTypeNames.java +0 −2
@@ -38,9 +38,7 @@
3838 String DSPACE_PROPERTY_AGREEMENT = DSPACE_SCHEMA + "agreement";
3939 String DSPACE_PROPERTY_OFFER = DSPACE_SCHEMA + "offer";
4040 String DSPACE_PROPERTY_TIMESTAMP = DSPACE_SCHEMA + "timestamp";
41- @Deprecated(since = "0.5.1")
4241 String DSPACE_PROPERTY_CONSUMER_ID = DSPACE_SCHEMA + "consumerId";
43- @Deprecated(since = "0.5.1")
4442 String DSPACE_PROPERTY_PROVIDER_ID = DSPACE_SCHEMA + "providerId";
4543
4644 // event types
modified data-protocols/dsp/dsp-spi/src/main/java/org/eclipse/edc/protocol/dsp/spi/type/DspPropertyAndTypeNames.java +0 −1
@@ -25,7 +25,6 @@
2525 String DSPACE_PROPERTY_REASON = DSPACE_SCHEMA + "reason";
2626 String DSPACE_PROPERTY_CONSUMER_PID = DSPACE_SCHEMA + "consumerPid";
2727 String DSPACE_PROPERTY_PROVIDER_PID = DSPACE_SCHEMA + "providerPid";
28- @Deprecated(since = "0.5.1")
2928 String DSPACE_PROPERTY_PROCESS_ID = DSPACE_SCHEMA + "processId";
3029 String DSPACE_PROPERTY_CALLBACK_ADDRESS = DSPACE_SCHEMA + "callbackAddress";
3130 String DSPACE_PROPERTY_STATE = DSPACE_SCHEMA + "state";
modified data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/from/JsonObjectFromTransferCompletionMessageTransformer.java +0 −2
@@ -25,7 +25,6 @@
2525 import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.ID;
2626 import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.TYPE;
2727 import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID;
28-import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROCESS_ID;
2928 import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID;
3029 import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE;
3130
@@ -46,7 +45,6 @@
4645 .add(TYPE, DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE)
4746 .add(DSPACE_PROPERTY_CONSUMER_PID, transferCompletionMessage.getConsumerPid())
4847 .add(DSPACE_PROPERTY_PROVIDER_PID, transferCompletionMessage.getProviderPid())
49- .add(DSPACE_PROPERTY_PROCESS_ID, transferCompletionMessage.getProcessId())
5048 .build();
5149 }
5250 }
modified data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/from/JsonObjectFromTransferRequestMessageTransformer.java +1 −5
@@ -27,10 +27,8 @@
2727 import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.ID;
2828 import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.TYPE;
2929 import static org.eclipse.edc.jsonld.spi.PropertyAndTypeNames.DCT_FORMAT_ATTRIBUTE;
30-import static org.eclipse.edc.jsonld.spi.PropertyAndTypeNames.DEPRECATED_DCT_FORMAT_ATTRIBUTE;
3130 import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CALLBACK_ADDRESS;
3231 import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID;
33-import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROCESS_ID;
3432 import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_PROPERTY_CONTRACT_AGREEMENT_ID;
3533 import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_PROPERTY_DATA_ADDRESS;
3634 import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE;
@@ -54,11 +52,9 @@
5452 .add(ID, transferRequestMessage.getId())
5553 .add(TYPE, DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE)
5654 .add(DSPACE_PROPERTY_CONTRACT_AGREEMENT_ID, transferRequestMessage.getContractId())
57- .add(DEPRECATED_DCT_FORMAT_ATTRIBUTE, format)
5855 .add(DCT_FORMAT_ATTRIBUTE, format)
5956 .add(DSPACE_PROPERTY_CALLBACK_ADDRESS, transferRequestMessage.getCallbackAddress())
60- .add(DSPACE_PROPERTY_CONSUMER_PID, transferRequestMessage.getConsumerPid())
61- .add(DSPACE_PROPERTY_PROCESS_ID, transferRequestMessage.getProcessId());
57+ .add(DSPACE_PROPERTY_CONSUMER_PID, transferRequestMessage.getConsumerPid());
6258
6359 if (transferRequestMessage.getDataDestination() != null && transferRequestMessage.getDataDestination().getProperties().size() > 1) {
6460 builder.add(DSPACE_PROPERTY_DATA_ADDRESS, context.transform(transferRequestMessage.getDataDestination(), JsonObject.class));
modified data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/from/JsonObjectFromTransferStartMessageTransformer.java +1 −3
@@ -25,7 +25,6 @@
2525 import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.ID;
2626 import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.TYPE;
2727 import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID;
28-import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROCESS_ID;
2928 import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID;
3029 import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_PROPERTY_DATA_ADDRESS;
3130 import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_START_MESSAGE;
@@ -45,8 +44,7 @@
4544 .add(ID, transferStartMessage.getId())
4645 .add(TYPE, DSPACE_TYPE_TRANSFER_START_MESSAGE)
4746 .add(DSPACE_PROPERTY_PROVIDER_PID, transferStartMessage.getProviderPid())
48- .add(DSPACE_PROPERTY_CONSUMER_PID, transferStartMessage.getConsumerPid())
49- .add(DSPACE_PROPERTY_PROCESS_ID, transferStartMessage.getProcessId());
47+ .add(DSPACE_PROPERTY_CONSUMER_PID, transferStartMessage.getConsumerPid());
5048
5149 if (transferStartMessage.getDataAddress() != null) {
5250 builder.add(DSPACE_PROPERTY_DATA_ADDRESS, context.transform(transferStartMessage.getDataAddress(), JsonObject.class));
modified data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/from/JsonObjectFromTransferTerminationMessageTransformer.java +1 −3
@@ -26,7 +26,6 @@
2626 import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.TYPE;
2727 import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CODE;
2828 import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID;
29-import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROCESS_ID;
3029 import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID;
3130 import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_REASON;
3231 import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE;
@@ -46,8 +45,7 @@
4645 .add(ID, transferTerminationMessage.getId())
4746 .add(TYPE, DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE)
4847 .add(DSPACE_PROPERTY_CONSUMER_PID, transferTerminationMessage.getConsumerPid())
49- .add(DSPACE_PROPERTY_PROVIDER_PID, transferTerminationMessage.getProviderPid())
50- .add(DSPACE_PROPERTY_PROCESS_ID, transferTerminationMessage.getProcessId());
48+ .add(DSPACE_PROPERTY_PROVIDER_PID, transferTerminationMessage.getProviderPid());
5149
5250 addIfNotNull(transferTerminationMessage.getCode(), DSPACE_PROPERTY_CODE, builder);
5351 addIfNotNull(transferTerminationMessage.getReason(), DSPACE_PROPERTY_REASON, builder);
modified data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferRequestMessageTransformer.java +2 −5
@@ -23,7 +23,6 @@
2323 import org.jetbrains.annotations.Nullable;
2424
2525 import static org.eclipse.edc.jsonld.spi.PropertyAndTypeNames.DCT_FORMAT_ATTRIBUTE;
26-import static org.eclipse.edc.jsonld.spi.PropertyAndTypeNames.DEPRECATED_DCT_FORMAT_ATTRIBUTE;
2726 import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CALLBACK_ADDRESS;
2827 import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID;
2928 import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_PROPERTY_CONTRACT_AGREEMENT_ID;
@@ -52,10 +51,8 @@
5251 visitProperties(messageObject, k -> switch (k) {
5352 case DSPACE_PROPERTY_CONTRACT_AGREEMENT_ID -> v -> builder.contractId(transformString(v, context));
5453 case DSPACE_PROPERTY_CALLBACK_ADDRESS -> v -> builder.callbackAddress(transformString(v, context));
55- case DSPACE_PROPERTY_DATA_ADDRESS ->
56- v -> builder.dataDestination(transformObject(v, DataAddress.class, context));
57- case DCT_FORMAT_ATTRIBUTE, DEPRECATED_DCT_FORMAT_ATTRIBUTE ->
58- v -> builder.transferType(transformString(v, context));
54+ case DSPACE_PROPERTY_DATA_ADDRESS -> v -> builder.dataDestination(transformObject(v, DataAddress.class, context));
55+ case DCT_FORMAT_ATTRIBUTE -> v -> builder.transferType(transformString(v, context));
5956 default -> doNothing();
6057 });
6158
modified data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/from/JsonObjectFromTransferCompletionMessageTransformerTest.java +0 −2
@@ -26,7 +26,6 @@
2626
2727 import static org.assertj.core.api.Assertions.assertThat;
2828 import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID;
29-import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROCESS_ID;
3029 import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID;
3130 import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE;
3231 import static org.mockito.ArgumentMatchers.anyString;
@@ -58,7 +57,6 @@
5857 assertThat(result.getString(JsonLdKeywords.TYPE)).isEqualTo(DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE);
5958 assertThat(result.getString(DSPACE_PROPERTY_CONSUMER_PID)).isEqualTo("consumerPid");
6059 assertThat(result.getString(DSPACE_PROPERTY_PROVIDER_PID)).isEqualTo("providerPid");
61- assertThat(result.getString(DSPACE_PROPERTY_PROCESS_ID)).isEqualTo("processId");
6260
6361 verify(context, never()).reportProblem(anyString());
6462 }
modified data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/from/JsonObjectFromTransferRequestMessageTransformerTest.java +0 −4
@@ -29,10 +29,8 @@
2929
3030 import static org.assertj.core.api.Assertions.assertThat;
3131 import static org.eclipse.edc.jsonld.spi.PropertyAndTypeNames.DCT_FORMAT_ATTRIBUTE;
32-import static org.eclipse.edc.jsonld.spi.PropertyAndTypeNames.DEPRECATED_DCT_FORMAT_ATTRIBUTE;
3332 import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CALLBACK_ADDRESS;
3433 import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID;
35-import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROCESS_ID;
3634 import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_PROPERTY_CONTRACT_AGREEMENT_ID;
3735 import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_PROPERTY_DATA_ADDRESS;
3836 import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE;
@@ -86,9 +84,7 @@
8684 assertThat(result.getJsonString(JsonLdKeywords.TYPE).getString()).isEqualTo(DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE);
8785 assertThat(result.getJsonString(DSPACE_PROPERTY_CONTRACT_AGREEMENT_ID).getString()).isEqualTo(contractId);
8886 assertThat(result.getJsonString(DCT_FORMAT_ATTRIBUTE).getString()).isEqualTo(dataAddressType);
89- assertThat(result.getJsonString(DEPRECATED_DCT_FORMAT_ATTRIBUTE).getString()).isEqualTo(dataAddressType);
9087 assertThat(result.getJsonString(DSPACE_PROPERTY_CALLBACK_ADDRESS).getString()).isEqualTo(callbackAddress);
91- assertThat(result.getJsonString(DSPACE_PROPERTY_PROCESS_ID).getString()).isEqualTo("processId");
9288 assertThat(result.getJsonString(DSPACE_PROPERTY_CONSUMER_PID).getString()).isEqualTo("consumerPid");
9389 assertThat(result.getJsonObject(DSPACE_PROPERTY_DATA_ADDRESS).getString("keyName")).isEqualTo(dataAddressKey);
9490
modified data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/from/JsonObjectFromTransferStartMessageTransformerTest.java +0 −3
@@ -28,7 +28,6 @@
2828
2929 import static org.assertj.core.api.Assertions.assertThat;
3030 import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID;
31-import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROCESS_ID;
3231 import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID;
3332 import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_PROPERTY_DATA_ADDRESS;
3433 import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_START_MESSAGE;
@@ -51,7 +50,6 @@
5150 void transformTransferStartMessage() {
5251 var dataAddress = DataAddress.Builder.newInstance().type("type").build();
5352 var message = TransferStartMessage.Builder.newInstance()
54- .processId("processId")
5553 .consumerPid("consumerPid")
5654 .providerPid("providerPid")
5755 .protocol("testProtocol")
@@ -65,7 +63,6 @@
6563
6664 assertThat(result).isNotNull();
6765 assertThat(result.getString(JsonLdKeywords.TYPE)).isEqualTo(DSPACE_TYPE_TRANSFER_START_MESSAGE);
68- assertThat(result.getString(DSPACE_PROPERTY_PROCESS_ID)).isEqualTo("processId");
6966 assertThat(result.getString(DSPACE_PROPERTY_PROVIDER_PID)).isEqualTo("providerPid");
7067 assertThat(result.getString(DSPACE_PROPERTY_CONSUMER_PID)).isEqualTo("consumerPid");
7168 assertThat(result.getJsonObject(DSPACE_PROPERTY_DATA_ADDRESS)).isEqualTo(dataAddressJson);
modified data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/from/JsonObjectFromTransferTerminationMessageTransformerTest.java +0 −3
@@ -27,7 +27,6 @@
2727 import static org.assertj.core.api.Assertions.assertThat;
2828 import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CODE;
2929 import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID;
30-import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROCESS_ID;
3130 import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID;
3231 import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_REASON;
3332 import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE;
@@ -48,7 +47,6 @@
4847 @Test
4948 void transformTransferTerminationMessage() {
5049 var message = TransferTerminationMessage.Builder.newInstance()
51- .processId("processId")
5250 .consumerPid("consumerPid")
5351 .providerPid("providerPid")
5452 .protocol("dsp")
@@ -62,7 +60,6 @@
6260 assertThat(result.getJsonString(JsonLdKeywords.TYPE).getString()).isEqualTo(DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE);
6361 assertThat(result.getJsonString(DSPACE_PROPERTY_CONSUMER_PID).getString()).isEqualTo("consumerPid");
6462 assertThat(result.getJsonString(DSPACE_PROPERTY_PROVIDER_PID).getString()).isEqualTo("providerPid");
65- assertThat(result.getJsonString(DSPACE_PROPERTY_PROCESS_ID).getString()).isEqualTo("processId");
6663 assertThat(result.getJsonString(DSPACE_PROPERTY_CODE).getString()).isEqualTo("testCode");
6764 assertThat(result.getJsonString(DSPACE_PROPERTY_REASON).getString()).isEqualTo("testReason");
6865
modified data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferRequestMessageTransformerTest.java +0 −22
@@ -25,7 +25,6 @@
2525 import static org.assertj.core.api.Assertions.assertThat;
2626 import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.TYPE;
2727 import static org.eclipse.edc.jsonld.spi.PropertyAndTypeNames.DCT_FORMAT_ATTRIBUTE;
28-import static org.eclipse.edc.jsonld.spi.PropertyAndTypeNames.DEPRECATED_DCT_FORMAT_ATTRIBUTE;
2928 import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CALLBACK_ADDRESS;
3029 import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID;
3130 import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_PROPERTY_CONTRACT_AGREEMENT_ID;
@@ -98,27 +97,6 @@
9897 verify(context, never()).reportProblem(anyString());
9998 }
10099
101- @Deprecated(since = "0.5.1")
102- @Test
103- void jsonObjectToTransferRequestWithDataAddress_withDeprecatedDctNamespace() {
104- var dataDestination = DataAddress.Builder.newInstance().type("any").build();
105- when(context.transform(any(), eq(DataAddress.class))).thenReturn(dataDestination);
106- var json = Json.createObjectBuilder()
107- .add(TYPE, DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE)
108- .add(DSPACE_PROPERTY_CONTRACT_AGREEMENT_ID, contractId)
109- .add(DEPRECATED_DCT_FORMAT_ATTRIBUTE, destinationType)
110- .add(DSPACE_PROPERTY_DATA_ADDRESS, createDataAddress())
111- .add(DSPACE_PROPERTY_CALLBACK_ADDRESS, callbackAddress)
112- .add(DSPACE_PROPERTY_CONSUMER_PID, "processId")
113- .build();
114-
115- var result = transformer.transform(getExpanded(json), context);
116-
117- assertThat(result).isNotNull();
118- assertThat(result.getTransferType()).isEqualTo(destinationType);
119- verify(context, never()).reportProblem(anyString());
120- }
121-
122100 @Test
123101 void shouldReturnNullAndReportError_whenConsumerPidNotSet() {
124102 when(context.problem()).thenReturn(new ProblemBuilder(context));
modified extensions/common/api/control-api-configuration/src/main/resources/control-api-version.json +3 −3
@@ -1,8 +1,8 @@
11 [
22 {
3- "version": "1.0.1",
3+ "version": "1.0.2",
44 "urlPath": "/v1",
5- "lastUpdated": "2024-06-02T14:30:00Z",
5+ "lastUpdated": "2024-09-04T14:30:00Z",
66 "maturity": "stable"
77 }
8-]
No newline at the end of the file
8+]
modified extensions/control-plane/api/management-api/contract-negotiation-api/src/main/java/org/eclipse/edc/connector/controlplane/api/management/contractnegotiation/ContractNegotiationApiExtension.java +1 −1
@@ -74,7 +74,7 @@
7474 managementApiTransformerRegistry.register(new JsonObjectFromContractNegotiationTransformer(factory));
7575 managementApiTransformerRegistry.register(new JsonObjectFromNegotiationStateTransformer(factory));
7676
77- validatorRegistry.register(CONTRACT_REQUEST_TYPE, ContractRequestValidator.instance(monitor));
77+ validatorRegistry.register(CONTRACT_REQUEST_TYPE, ContractRequestValidator.instance());
7878 validatorRegistry.register(TERMINATE_NEGOTIATION_TYPE, TerminateNegotiationValidator.instance());
7979
8080 webService.registerResource(ApiContext.MANAGEMENT, new ContractNegotiationApiV2Controller(service, managementApiTransformerRegistry, monitor, validatorRegistry));
modified extensions/control-plane/api/management-api/contract-negotiation-api/src/main/java/org/eclipse/edc/connector/controlplane/api/management/contractnegotiation/v2/ContractNegotiationApiV2.java +0 −1
@@ -141,7 +141,6 @@
141141 String protocol,
142142 @Schema(requiredMode = REQUIRED)
143143 String counterPartyAddress,
144- @Deprecated(since = "0.5.1")
145144 @Schema(deprecated = true, description = "please use policy.assigner instead")
146145 String providerId,
147146 @Schema(requiredMode = REQUIRED)
modified extensions/control-plane/api/management-api/contract-negotiation-api/src/main/java/org/eclipse/edc/connector/controlplane/api/management/contractnegotiation/validation/ContractRequestValidator.java +1 −6
@@ -15,9 +15,7 @@
1515 package org.eclipse.edc.connector.controlplane.api.management.contractnegotiation.validation;
1616
1717 import jakarta.json.JsonObject;
18-import org.eclipse.edc.spi.monitor.Monitor;
1918 import org.eclipse.edc.validator.jsonobject.JsonObjectValidator;
20-import org.eclipse.edc.validator.jsonobject.validators.LogDeprecatedValue;
2119 import org.eclipse.edc.validator.jsonobject.validators.MandatoryIdNotBlank;
2220 import org.eclipse.edc.validator.jsonobject.validators.MandatoryObject;
2321 import org.eclipse.edc.validator.jsonobject.validators.MandatoryValue;
@@ -25,18 +23,15 @@
2523 import org.eclipse.edc.validator.spi.Validator;
2624
2725 import static org.eclipse.edc.connector.controlplane.contract.spi.types.negotiation.ContractRequest.CONTRACT_REQUEST_COUNTER_PARTY_ADDRESS;
28-import static org.eclipse.edc.connector.controlplane.contract.spi.types.negotiation.ContractRequest.CONTRACT_REQUEST_TYPE;
2926 import static org.eclipse.edc.connector.controlplane.contract.spi.types.negotiation.ContractRequest.POLICY;
3027 import static org.eclipse.edc.connector.controlplane.contract.spi.types.negotiation.ContractRequest.PROTOCOL;
31-import static org.eclipse.edc.connector.controlplane.contract.spi.types.negotiation.ContractRequest.PROVIDER_ID;
3228 import static org.eclipse.edc.jsonld.spi.PropertyAndTypeNames.ODRL_ASSIGNER_ATTRIBUTE;
3329 import static org.eclipse.edc.jsonld.spi.PropertyAndTypeNames.ODRL_POLICY_TYPE_OFFER;
3430 import static org.eclipse.edc.jsonld.spi.PropertyAndTypeNames.ODRL_TARGET_ATTRIBUTE;
3531
3632 public class ContractRequestValidator {
37- public static Validator<JsonObject> instance(Monitor monitor) {
33+ public static Validator<JsonObject> instance() {
3834 return JsonObjectValidator.newValidator()
39- .verify(PROVIDER_ID, path -> new LogDeprecatedValue(path, CONTRACT_REQUEST_TYPE, ODRL_ASSIGNER_ATTRIBUTE, monitor))
4035 .verify(CONTRACT_REQUEST_COUNTER_PARTY_ADDRESS, MandatoryValue::new)
4136 .verify(PROTOCOL, MandatoryValue::new)
4237 .verify(POLICY, MandatoryObject::new)
modified extensions/control-plane/api/management-api/contract-negotiation-api/src/test/java/org/eclipse/edc/connector/controlplane/api/management/contractnegotiation/BaseContractNegotiationApiTest.java +1 −1
@@ -67,7 +67,7 @@
6767
6868 @Test
6969 void contractRequestExample() throws JsonProcessingException {
70- var validator = ContractRequestValidator.instance(monitor);
70+ var validator = ContractRequestValidator.instance();
7171
7272 var jsonObject = objectMapper.readValue(CONTRACT_REQUEST_EXAMPLE, JsonObject.class);
7373 assertThat(jsonObject).isNotNull();
modified extensions/control-plane/api/management-api/contract-negotiation-api/src/test/java/org/eclipse/edc/connector/controlplane/api/management/contractnegotiation/validation/ContractRequestValidatorTest.java +1 −19
@@ -25,14 +25,11 @@
2525
2626 import static jakarta.json.Json.createArrayBuilder;
2727 import static jakarta.json.Json.createObjectBuilder;
28-import static java.lang.String.format;
2928 import static org.assertj.core.api.Assertions.assertThat;
3029 import static org.assertj.core.api.InstanceOfAssertFactories.list;
3130 import static org.eclipse.edc.connector.controlplane.contract.spi.types.negotiation.ContractRequest.CONTRACT_REQUEST_COUNTER_PARTY_ADDRESS;
32-import static org.eclipse.edc.connector.controlplane.contract.spi.types.negotiation.ContractRequest.CONTRACT_REQUEST_TYPE;
3331 import static org.eclipse.edc.connector.controlplane.contract.spi.types.negotiation.ContractRequest.POLICY;
3432 import static org.eclipse.edc.connector.controlplane.contract.spi.types.negotiation.ContractRequest.PROTOCOL;
35-import static org.eclipse.edc.connector.controlplane.contract.spi.types.negotiation.ContractRequest.PROVIDER_ID;
3633 import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.ID;
3734 import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.TYPE;
3835 import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.VALUE;
@@ -41,12 +38,11 @@
4138 import static org.eclipse.edc.jsonld.spi.PropertyAndTypeNames.ODRL_TARGET_ATTRIBUTE;
4239 import static org.eclipse.edc.junit.assertions.AbstractResultAssert.assertThat;
4340 import static org.mockito.Mockito.mock;
44-import static org.mockito.Mockito.verify;
4541
4642 class ContractRequestValidatorTest {
4743
4844 private final Monitor monitor = mock();
49- private final Validator<JsonObject> validator = ContractRequestValidator.instance(monitor);
45+ private final Validator<JsonObject> validator = ContractRequestValidator.instance();
5046
5147 @Test
5248 void shouldSuccess_whenObjectIsValid() {
@@ -115,20 +111,6 @@
115111 .anySatisfy(violation -> assertThat(violation.path()).isEqualTo(PROTOCOL));
116112 }
117113
118- @Test
119- void shouldSucceed_whenDeprecatedProviderIdIsUsedWarningLogged() {
120- var expectedLogMessage = format("The attribute %s has been deprecated in type %s, please use %s",
121- PROVIDER_ID, CONTRACT_REQUEST_TYPE, ODRL_ASSIGNER_ATTRIBUTE);
122-
123- var input = Json.createObjectBuilder()
124- .add(PROVIDER_ID, value("provider_id"))
125- .build();
126-
127- validator.validate(input);
128-
129- verify(monitor).warning(expectedLogMessage);
130- }
131-
132114 private JsonArrayBuilder value(String value) {
133115 return createArrayBuilder().add(createObjectBuilder().add(VALUE, value));
134116 }
deleted extensions/control-plane/transfer/transfer-data-plane/README.md +0 −43
@@ -1,43 +0,0 @@
1-# Transfer Data Plane
2-
3-This extension provides services for delegating data transfer to the Data Plane. Especially two types of data transfers are supported:
4-
5-- Consumer Pull: data consumer pulls actively the data by hitting an endpoint exposed by the provider. This use-case is typically
6- used in cases where the data provider wants to use its Data Plane as a http proxy for querying data to an API.
7-- Provider Push: if data request is successfully processed, then the provider pushes data from its data source to the consumer.
8-
9-## Background
10-
11-The Data Plane is the component performing the actual data exchange between the provider and the consumer. Once an agreement
12-is established between the consumer and the provider, then the consumer can trigger the data request that will initiate the data exchange.
13-When at this stage, the present extension is used for delegating the data transfer to the appropriate Data Plane instance.
14-
15-### Scope
16-
17-This extension is to be used for every data transfer use-case relying on the EDC data plane.
18-
19-### Use Cases
20-
21-#### Consumer pull
22-
23-Let us consider that a data provider wants to expose a REST API serving flight schedule data. This REST API takes in input
24-a set of query parameters which enables to restrict the amount of data returned in the response, e.g. departure date, boarding airport...
25-A consumer of this API will potentially be interested in hitting this API several times, potentially with different parameters, depending
26-on how the consumer backend application are exploiting the data.
27-
28-For this use-case, the Provider Push data transfer type would not be relevant, as it would require to establish a new contract before
29-the consumer send a new http request, which would potentially overload the Control Plane. The Consumer Pull data transfer comes handy in that case.
30-
31-To trigger this data transfer type, the destination type of the `DataRequest` must be set to `HttpProxy`.
32-
33-#### Provider push
34-
35-A consumer wants to perform a one-time transfer of a large amount of data stored in a S3 bucket on provider side, and
36-put these data into its Azure Blob Storage.
37-
38-## Technical Details
39-
40-### Interfaces
41-
42-This extension introduces a Control Plane endpoint used by the Data Plane for validating the access token received in input
43-of its public API. OpenApi documentation can be found [here](../../../../resources/openapi/yaml/transfer-data-plane.yaml).
deleted extensions/control-plane/transfer/transfer-data-plane/build.gradle.kts +0 −51
@@ -1,51 +0,0 @@
1-/*
2- * Copyright (c) 2022 Amadeus
3- *
4- * This program and the accompanying materials are made available under the
5- * terms of the Apache License, Version 2.0 which is available at
6- * https://www.apache.org/licenses/LICENSE-2.0
7- *
8- * SPDX-License-Identifier: Apache-2.0
9- *
10- * Contributors:
11- * Amadeus - initial API and implementation
12- *
13- */
14-
15-plugins {
16- `java-library`
17- id(libs.plugins.swagger.get().pluginId)
18-}
19-
20-dependencies {
21- api(project(":spi:common:core-spi"))
22- api(project(":spi:control-plane:contract-spi"))
23- api(project(":spi:control-plane:transfer-spi"))
24- api(project(":spi:common:web-spi"))
25-
26- api(project(":spi:control-plane:transfer-data-plane-spi"))
27- api(project(":spi:data-plane:data-plane-spi"))
28- api(project(":extensions:data-plane:data-plane-client"))
29- api(project(":spi:data-plane-selector:data-plane-selector-spi"))
30-
31- implementation(project(":spi:common:keys-spi"))
32- implementation(project(":core:common:token-core"))
33-
34- api(libs.jakarta.rsApi)
35- api(libs.nimbus.jwt)
36- // Note: nimbus requires bouncycastle as mentioned in documentation:
37- // https://www.javadoc.io/doc/com.nimbusds/nimbus-jose-jwt/7.2.1/com/nimbusds/jose/jwk/JWK.html#parseFromPEMEncodedObjects-java.lang.String-
38- api(libs.bouncyCastle.bcpkixJdk18on)
39-
40- testImplementation(project(":core:common:junit"))
41- testImplementation(libs.jersey.multipart)
42-}
43-
44-edcBuild {
45- swagger {
46- apiGroup.set("control-api")
47- }
48-}
49-
50-
51-
deleted extensions/control-plane/transfer/transfer-data-plane/src/main/java/org/eclipse/edc/connector/controlplane/transfer/dataplane/TransferDataPlaneCoreExtension.java +0 −133
@@ -1,133 +0,0 @@
1-/*
2- * Copyright (c) 2022 Amadeus
3- *
4- * This program and the accompanying materials are made available under the
5- * terms of the Apache License, Version 2.0 which is available at
6- * https://www.apache.org/licenses/LICENSE-2.0
7- *
8- * SPDX-License-Identifier: Apache-2.0
9- *
10- * Contributors:
11- * Amadeus - initial API and implementation
12- * Mercedes-Benz Tech Innovation GmbH - DataEncrypter can be provided by extensions
13- *
14- */
15-
16-package org.eclipse.edc.connector.controlplane.transfer.dataplane;
17-
18-import org.eclipse.edc.connector.controlplane.transfer.dataplane.api.ConsumerPullTransferTokenValidationApiController;
19-import org.eclipse.edc.connector.controlplane.transfer.dataplane.flow.ConsumerPullTransferDataFlowController;
20-import org.eclipse.edc.connector.controlplane.transfer.dataplane.flow.ProviderPushTransferDataFlowController;
21-import org.eclipse.edc.connector.controlplane.transfer.dataplane.proxy.ConsumerPullDataPlaneProxyResolver;
22-import org.eclipse.edc.connector.controlplane.transfer.dataplane.spi.security.DataEncrypter;
23-import org.eclipse.edc.connector.controlplane.transfer.dataplane.spi.token.ConsumerPullTokenExpirationDateFunction;
24-import org.eclipse.edc.connector.controlplane.transfer.dataplane.validation.ExpirationDateValidationRule;
25-import org.eclipse.edc.connector.controlplane.transfer.spi.flow.DataFlowManager;
26-import org.eclipse.edc.connector.dataplane.selector.spi.DataPlaneSelectorService;
27-import org.eclipse.edc.connector.dataplane.selector.spi.client.DataPlaneClientFactory;
28-import org.eclipse.edc.jwt.signer.spi.JwsSignerProvider;
29-import org.eclipse.edc.keys.spi.LocalPublicKeyService;
30-import org.eclipse.edc.keys.spi.PrivateKeyResolver;
31-import org.eclipse.edc.runtime.metamodel.annotation.Extension;
32-import org.eclipse.edc.runtime.metamodel.annotation.Inject;
33-import org.eclipse.edc.runtime.metamodel.annotation.Setting;
34-import org.eclipse.edc.spi.system.ServiceExtension;
35-import org.eclipse.edc.spi.system.ServiceExtensionContext;
36-import org.eclipse.edc.spi.types.TypeManager;
37-import org.eclipse.edc.token.JwtGenerationService;
38-import org.eclipse.edc.token.spi.TokenValidationRulesRegistry;
39-import org.eclipse.edc.token.spi.TokenValidationService;
40-import org.eclipse.edc.validator.spi.DataAddressValidatorRegistry;
41-import org.eclipse.edc.validator.spi.ValidationResult;
42-import org.eclipse.edc.web.spi.WebService;
43-import org.eclipse.edc.web.spi.configuration.ApiContext;
44-import org.eclipse.edc.web.spi.configuration.context.ControlApiUrl;
45-
46-import java.time.Clock;
47-
48-@Extension(value = TransferDataPlaneCoreExtension.NAME)
49-public class TransferDataPlaneCoreExtension implements ServiceExtension {
50-
51- @Setting(value = "Alias of private key used for signing tokens, retrieved from private key resolver")
52- public static final String TOKEN_SIGNER_PRIVATE_KEY_ALIAS = "edc.transfer.proxy.token.signer.privatekey.alias";
53-
54- @Setting(value = "Alias of public key used for verifying the tokens, retrieved from the vault")
55- public static final String TOKEN_VERIFIER_PUBLIC_KEY_ALIAS = "edc.transfer.proxy.token.verifier.publickey.alias";
56-
57- public static final String NAME = "Transfer Data Plane Core";
58- public static final String TRANSFER_DATAPLANE_TOKEN_CONTEXT = "dataplane-transfer";
59-
60- @Inject
61- private WebService webService;
62-
63- @Inject
64- private DataFlowManager dataFlowManager;
65-
66- @Inject
67- private Clock clock;
68-
69- @Inject
70- private DataEncrypter dataEncrypter;
71-
72- @Inject
73- private DataPlaneSelectorService selectorService;
74-
75- @Inject
76- private DataPlaneClientFactory clientFactory;
77-
78- @Inject
79- private ConsumerPullTokenExpirationDateFunction tokenExpirationDateFunction;
80-
81- @Inject(required = false)
82- private ControlApiUrl callbackUrl;
83-
84- @Inject
85- private TypeManager typeManager;
86-
87- @Inject
88- private LocalPublicKeyService publicKeyService;
89-
90- @Inject
91- private PrivateKeyResolver privateKeyResolver;
92-
93- @Inject
94- private DataAddressValidatorRegistry dataAddressValidatorRegistry;
95-
96- @Inject
97- private TokenValidationRulesRegistry tokenValidationRulesRegistry;
98-
99- @Inject
100- private TokenValidationService tokenValidationService;
101- @Inject
102- private JwsSignerProvider jwsSignerProvider;
103-
104- @Override
105- public String name() {
106- return NAME;
107- }
108-
109- @Override
110- public void initialize(ServiceExtensionContext context) {
111- var monitor = context.getMonitor();
112- monitor.warning("The transfer-data-plane extension has been deprecated, please switch to the Data Plane Signaling feature.");
113- var publicKeyAlias = context.getSetting(TOKEN_VERIFIER_PUBLIC_KEY_ALIAS, null);
114- var privateKeyAlias = context.getSetting(TOKEN_SIGNER_PRIVATE_KEY_ALIAS, null);
115-
116- if (publicKeyAlias != null && privateKeyAlias != null) {
117- var controller = new ConsumerPullTransferTokenValidationApiController(tokenValidationService, dataEncrypter, typeManager, (i) -> publicKeyService.resolveKey(publicKeyAlias));
118- webService.registerResource(ApiContext.CONTROL, controller);
119-
120- var resolver = new ConsumerPullDataPlaneProxyResolver(dataEncrypter, typeManager, new JwtGenerationService(jwsSignerProvider), () -> privateKeyAlias, () -> publicKeyAlias, tokenExpirationDateFunction);
121- dataFlowManager.register(new ConsumerPullTransferDataFlowController(selectorService, resolver));
122- } else {
123- monitor.info("One of these settings is not configured, so the connector won't be able to provide 'consumer-pull' transfers: [%s, %s]"
124- .formatted(TOKEN_VERIFIER_PUBLIC_KEY_ALIAS, TOKEN_SIGNER_PRIVATE_KEY_ALIAS));
125- }
126-
127- tokenValidationRulesRegistry.addRule(TRANSFER_DATAPLANE_TOKEN_CONTEXT, new ExpirationDateValidationRule(clock));
128-
129- dataFlowManager.register(new ProviderPushTransferDataFlowController(callbackUrl, selectorService, clientFactory));
130- dataAddressValidatorRegistry.registerDestinationValidator("HttpProxy", dataAddress -> ValidationResult.success());
131- }
132-
133-}
deleted extensions/control-plane/transfer/transfer-data-plane/src/main/java/org/eclipse/edc/connector/controlplane/transfer/dataplane/TransferDataPlaneDefaultServicesExtension.java +0 −62
@@ -1,62 +0,0 @@
1-/*
2- * Copyright (c) 2022 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
3- *
4- * This program and the accompanying materials are made available under the
5- * terms of the Apache License, Version 2.0 which is available at
6- * https://www.apache.org/licenses/LICENSE-2.0
7- *
8- * SPDX-License-Identifier: Apache-2.0
9- *
10- * Contributors:
11- * Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation
12- *
13- */
14-
15-package org.eclipse.edc.connector.controlplane.transfer.dataplane;
16-
17-import org.eclipse.edc.connector.controlplane.transfer.dataplane.security.NoopDataEncrypter;
18-import org.eclipse.edc.connector.controlplane.transfer.dataplane.spi.security.DataEncrypter;
19-import org.eclipse.edc.connector.controlplane.transfer.dataplane.spi.token.ConsumerPullTokenExpirationDateFunction;
20-import org.eclipse.edc.runtime.metamodel.annotation.Extension;
21-import org.eclipse.edc.runtime.metamodel.annotation.Inject;
22-import org.eclipse.edc.runtime.metamodel.annotation.Provider;
23-import org.eclipse.edc.runtime.metamodel.annotation.Setting;
24-import org.eclipse.edc.spi.result.Result;
25-import org.eclipse.edc.spi.system.ServiceExtension;
26-import org.eclipse.edc.spi.system.ServiceExtensionContext;
27-
28-import java.time.Clock;
29-import java.util.Date;
30-
31-/**
32- * Provides default service implementations for fallback
33- * Omitted {@link Extension since this module already contains {@link TransferDataPlaneCoreExtension }}
34- */
35-public class TransferDataPlaneDefaultServicesExtension implements ServiceExtension {
36-
37- private static final String DEFAULT_TOKEN_VALIDITY_SECONDS = "600"; // 10min
38- @Setting(value = "Validity (in seconds) of tokens issued by the Control Plane for targeting the Data Plane public API.", type = "long", defaultValue = DEFAULT_TOKEN_VALIDITY_SECONDS)
39- private static final String TOKEN_VALIDITY_SECONDS = "edc.transfer.proxy.token.validity.seconds";
40-
41- public static final String NAME = "Transfer Data Plane Default Services";
42-
43- @Inject
44- private Clock clock;
45-
46- @Override
47- public String name() {
48- return NAME;
49- }
50-
51- @Provider(isDefault = true)
52- public DataEncrypter getDataEncrypter(ServiceExtensionContext context) {
53- context.getMonitor().warning("No DataEncrypter registered, a no-op implementation will be used, not suitable for production environments");
54- return new NoopDataEncrypter();
55- }
56-
57- @Provider(isDefault = true)
58- public ConsumerPullTokenExpirationDateFunction tokenExpirationDateFunction(ServiceExtensionContext context) {
59- var validity = context.getSetting(TOKEN_VALIDITY_SECONDS, Integer.parseInt(DEFAULT_TOKEN_VALIDITY_SECONDS));
60- return (contentAddress, contractId) -> Result.success(Date.from(clock.instant().plusSeconds(validity)));
61- }
62-}
deleted extensions/control-plane/transfer/transfer-data-plane/src/main/java/org/eclipse/edc/connector/controlplane/transfer/dataplane/api/ConsumerPullTransferTokenValidationApi.java +0 −35
@@ -1,35 +0,0 @@
1-/*
2- * Copyright (c) 2022 Amadeus
3- *
4- * This program and the accompanying materials are made available under the
5- * terms of the Apache License, Version 2.0 which is available at
6- * https://www.apache.org/licenses/LICENSE-2.0
7- *
8- * SPDX-License-Identifier: Apache-2.0
9- *
10- * Contributors:
11- * Amadeus - Initial implementation
12- *
13- */
14-
15-package org.eclipse.edc.connector.controlplane.transfer.dataplane.api;
16-
17-import io.swagger.v3.oas.annotations.OpenAPIDefinition;
18-import io.swagger.v3.oas.annotations.Operation;
19-import io.swagger.v3.oas.annotations.responses.ApiResponse;
20-import io.swagger.v3.oas.annotations.tags.Tag;
21-import org.eclipse.edc.spi.types.domain.DataAddress;
22-
23-@OpenAPIDefinition
24-@Tag(name = "Consumer Pull Token Validation")
25-public interface ConsumerPullTransferTokenValidationApi {
26-
27- @Operation(description = "Checks that the provided token has been signed by the present entity and asserts its validity. " +
28- "If token is valid, then the data address contained in its claims is decrypted and returned back to the caller.",
29- responses = {
30- @ApiResponse(responseCode = "200", description = "Token is valid"),
31- @ApiResponse(responseCode = "400", description = "Request was malformed"),
32- @ApiResponse(responseCode = "403", description = "Token is invalid") }
33- )
34- DataAddress validate(String token);
35-}
deleted extensions/control-plane/transfer/transfer-data-plane/src/main/java/org/eclipse/edc/connector/controlplane/transfer/dataplane/api/ConsumerPullTransferTokenValidationApiController.java +0 −77
@@ -1,77 +0,0 @@
1-/*
2- * Copyright (c) 2022 Amadeus
3- *
4- * This program and the accompanying materials are made available under the
5- * terms of the Apache License, Version 2.0 which is available at
6- * https://www.apache.org/licenses/LICENSE-2.0
7- *
8- * SPDX-License-Identifier: Apache-2.0
9- *
10- * Contributors:
11- * Amadeus - initial API and implementation
12- *
13- */
14-
15-package org.eclipse.edc.connector.controlplane.transfer.dataplane.api;
16-
17-import jakarta.ws.rs.GET;
18-import jakarta.ws.rs.HeaderParam;
19-import jakarta.ws.rs.Path;
20-import jakarta.ws.rs.Produces;
21-import jakarta.ws.rs.core.HttpHeaders;
22-import jakarta.ws.rs.core.MediaType;
23-import org.eclipse.edc.connector.controlplane.transfer.dataplane.spi.security.DataEncrypter;
24-import org.eclipse.edc.keys.spi.PublicKeyResolver;
25-import org.eclipse.edc.spi.iam.ClaimToken;
26-import org.eclipse.edc.spi.types.TypeManager;
27-import org.eclipse.edc.spi.types.domain.DataAddress;
28-import org.eclipse.edc.token.spi.TokenValidationService;
29-import org.eclipse.edc.web.spi.exception.InvalidRequestException;
30-import org.eclipse.edc.web.spi.exception.NotAuthorizedException;
31-
32-import static java.lang.String.format;
33-import static org.eclipse.edc.connector.controlplane.transfer.dataplane.spi.TransferDataPlaneConstants.DATA_ADDRESS;
34-
35-@Path("/token")
36-public class ConsumerPullTransferTokenValidationApiController implements ConsumerPullTransferTokenValidationApi {
37- private final TokenValidationService service;
38- private final DataEncrypter dataEncrypter;
39- private final TypeManager typeManager;
40- private final PublicKeyResolver publicKeyResolver;
41-
42- public ConsumerPullTransferTokenValidationApiController(TokenValidationService service, DataEncrypter dataEncrypter, TypeManager typeManager, PublicKeyResolver publicKeyResolver) {
43- this.service = service;
44- this.dataEncrypter = dataEncrypter;
45- this.typeManager = typeManager;
46- this.publicKeyResolver = publicKeyResolver;
47- }
48-
49- /**
50- * Validate the token provided in input and decrypt the {@link DataAddress}
51- * contained in its claims.
52- *
53- * @param token Input token.
54- * @return Decrypted DataAddress contained in the input token claims.
55- */
56- @GET
57- @Produces({ MediaType.APPLICATION_JSON })
58- @Override
59- public DataAddress validate(@HeaderParam(HttpHeaders.AUTHORIZATION) String token) {
60- return service.validate(token, publicKeyResolver)
61- .map(this::extractDataAddressClaim)
62- .map(this::toDataAddress)
63- .orElseThrow(failure -> new NotAuthorizedException("Token validation failed: " + failure.getFailureDetail()));
64- }
65-
66- String extractDataAddressClaim(ClaimToken claims) {
67- var claim = claims.getClaim(DATA_ADDRESS);
68- if (!(claim instanceof String)) {
69- throw new InvalidRequestException(format("Missing claim `%s` in token", DATA_ADDRESS));
70- }
71- return (String) claim;
72- }
73-
74- private DataAddress toDataAddress(String claim) {
75- return typeManager.readValue(dataEncrypter.decrypt(claim), DataAddress.class);
76- }
77-}
deleted extensions/control-plane/transfer/transfer-data-plane/src/main/java/org/eclipse/edc/connector/controlplane/transfer/dataplane/flow/ConsumerPullTransferDataFlowController.java +0 −98
@@ -1,98 +0,0 @@
1-/*
2- * Copyright (c) 2022 Amadeus
3- *
4- * This program and the accompanying materials are made available under the
5- * terms of the Apache License, Version 2.0 which is available at
6- * https://www.apache.org/licenses/LICENSE-2.0
7- *
8- * SPDX-License-Identifier: Apache-2.0
9- *
10- * Contributors:
11- * Amadeus - initial API and implementation
12- *
13- */
14-
15-package org.eclipse.edc.connector.controlplane.transfer.dataplane.flow;
16-
17-import org.eclipse.edc.connector.controlplane.asset.spi.domain.Asset;
18-import org.eclipse.edc.connector.controlplane.transfer.dataplane.proxy.ConsumerPullDataPlaneProxyResolver;
19-import org.eclipse.edc.connector.controlplane.transfer.spi.flow.DataFlowController;
20-import org.eclipse.edc.connector.controlplane.transfer.spi.types.DataFlowResponse;
21-import org.eclipse.edc.connector.controlplane.transfer.spi.types.TransferProcess;
22-import org.eclipse.edc.connector.dataplane.selector.spi.DataPlaneSelectorService;
23-import org.eclipse.edc.policy.model.Policy;
24-import org.eclipse.edc.spi.response.StatusResult;
25-import org.eclipse.edc.spi.types.domain.DataAddress;
26-import org.jetbrains.annotations.NotNull;
27-
28-import java.util.Optional;
29-import java.util.Set;
30-
31-import static java.lang.String.format;
32-import static org.eclipse.edc.connector.controlplane.transfer.dataplane.spi.TransferDataPlaneConstants.HTTP_PROXY;
33-import static org.eclipse.edc.spi.response.ResponseStatus.FATAL_ERROR;
34-import static org.eclipse.edc.spi.response.StatusResult.failure;
35-import static org.eclipse.edc.spi.types.domain.transfer.FlowType.PULL;
36-
37-@Deprecated(since = "0.5.1")
38-public class ConsumerPullTransferDataFlowController implements DataFlowController {
39-
40- private final DataPlaneSelectorService selectorService;
41- private final ConsumerPullDataPlaneProxyResolver resolver;
42-
43- private final Set<String> transferTypes = Set.of("%s-%s".formatted("HttpData", PULL));
44-
45- public ConsumerPullTransferDataFlowController(DataPlaneSelectorService selectorService, ConsumerPullDataPlaneProxyResolver resolver) {
46- this.selectorService = selectorService;
47- this.resolver = resolver;
48- }
49-
50- @Override
51- public boolean canHandle(TransferProcess transferProcess) {
52- // Backward compatibility: can handle if destination type is `HttpProxy` or the transfer type is `Http-PULL`
53- return HTTP_PROXY.equals(transferProcess.getDestinationType()) ||
54- (Optional.ofNullable(transferProcess.getTransferType()).map(transferTypes::contains).orElse(false));
55- }
56-
57- @Override
58- public @NotNull StatusResult<DataFlowResponse> start(TransferProcess transferProcess, Policy policy) {
59- var contentAddress = transferProcess.getContentDataAddress();
60-
61- return Optional.ofNullable(selectorService.select(contentAddress, destinationAddress(transferProcess)))
62- .map(instance -> resolver.toDataAddress(transferProcess, contentAddress, instance)
63- .map(this::toResponse)
64- .map(StatusResult::success)
65- .orElse(failure -> failure(FATAL_ERROR, "Failed to generate proxy: " + failure.getFailureDetail())))
66- .orElse(failure(FATAL_ERROR, format("Failed to find DataPlaneInstance for source/destination: %s/%s", contentAddress.getType(), HTTP_PROXY)));
67- }
68-
69- @Override
70- public StatusResult<Void> suspend(TransferProcess transferProcess) {
71- throw new RuntimeException("not implemented");
72- }
73-
74- @Override
75- public StatusResult<Void> terminate(TransferProcess transferProcess) {
76- return StatusResult.success();
77- }
78-
79- @Override
80- public Set<String> transferTypesFor(Asset asset) {
81- return transferTypes;
82- }
83-
84- // Shim translation from "Http-PULL" to HttpProxy dataAddress
85- private DataAddress destinationAddress(TransferProcess transferProcess) {
86- if (transferTypes.contains(transferProcess.getDestinationType())) {
87- var dadBuilder = DataAddress.Builder.newInstance();
88- transferProcess.getDataDestination().getProperties().forEach(dadBuilder::property);
89- return dadBuilder.type(HTTP_PROXY).build();
90- } else {
91- return transferProcess.getDataDestination();
92- }
93- }
94-
95- private DataFlowResponse toResponse(DataAddress address) {
96- return DataFlowResponse.Builder.newInstance().dataAddress(address).build();
97- }
98-}
deleted extensions/control-plane/transfer/transfer-data-plane/src/main/java/org/eclipse/edc/connector/controlplane/transfer/dataplane/flow/ProviderPushTransferDataFlowController.java +0 −116
@@ -1,116 +0,0 @@
1-/*
2- * Copyright (c) 2022 Amadeus
3- *
4- * This program and the accompanying materials are made available under the
5- * terms of the Apache License, Version 2.0 which is available at
6- * https://www.apache.org/licenses/LICENSE-2.0
7- *
8- * SPDX-License-Identifier: Apache-2.0
9- *
10- * Contributors:
11- * Amadeus - initial API and implementation
12- *
13- */
14-
15-package org.eclipse.edc.connector.controlplane.transfer.dataplane.flow;
16-
17-import org.eclipse.edc.connector.controlplane.asset.spi.domain.Asset;
18-import org.eclipse.edc.connector.controlplane.transfer.spi.flow.DataFlowController;
19-import org.eclipse.edc.connector.controlplane.transfer.spi.types.DataFlowResponse;
20-import org.eclipse.edc.connector.controlplane.transfer.spi.types.TransferProcess;
21-import org.eclipse.edc.connector.dataplane.selector.spi.DataPlaneSelectorService;
22-import org.eclipse.edc.connector.dataplane.selector.spi.client.DataPlaneClientFactory;
23-import org.eclipse.edc.connector.dataplane.selector.spi.instance.DataPlaneInstance;
24-import org.eclipse.edc.policy.model.Policy;
25-import org.eclipse.edc.spi.response.ResponseStatus;
26-import org.eclipse.edc.spi.response.StatusResult;
27-import org.eclipse.edc.spi.types.domain.transfer.DataFlowStartMessage;
28-import org.eclipse.edc.web.spi.configuration.context.ControlApiUrl;
29-import org.jetbrains.annotations.NotNull;
30-
31-import java.util.Collection;
32-import java.util.Optional;
33-import java.util.Set;
34-import java.util.UUID;
35-import java.util.function.Predicate;
36-
37-import static java.util.stream.Collectors.toSet;
38-import static org.eclipse.edc.connector.controlplane.transfer.dataplane.spi.TransferDataPlaneConstants.HTTP_PROXY;
39-import static org.eclipse.edc.spi.types.domain.transfer.FlowType.PULL;
40-import static org.eclipse.edc.spi.types.domain.transfer.FlowType.PUSH;
41-
42-@Deprecated(since = "0.5.1")
43-public class ProviderPushTransferDataFlowController implements DataFlowController {
44-
45- private final ControlApiUrl callbackUrl;
46- private final DataPlaneSelectorService selectorClient;
47- private final DataPlaneClientFactory clientFactory;
48-
49- private final Set<String> transferTypes = Set.of("%s-%s".formatted("HttpData", PULL));
50-
51- public ProviderPushTransferDataFlowController(ControlApiUrl callbackUrl, DataPlaneSelectorService selectorClient, DataPlaneClientFactory clientFactory) {
52- this.callbackUrl = callbackUrl;
53- this.selectorClient = selectorClient;
54- this.clientFactory = clientFactory;
55- }
56-
57- @Override
58- public boolean canHandle(TransferProcess transferProcess) {
59- // Backward compatibility: adds check if a transfer type is provided, it should not be Http-PULL
60- return !HTTP_PROXY.equals(transferProcess.getDestinationType()) &&
61- (Optional.ofNullable(transferProcess.getTransferType()).map(type -> !transferTypes.contains(type)).orElse(true));
62-
63- }
64-
65- @Override
66- public @NotNull StatusResult<DataFlowResponse> start(TransferProcess transferProcess, Policy policy) {
67- var dataFlowRequest = DataFlowStartMessage.Builder.newInstance()
68- .id(UUID.randomUUID().toString())
69- .processId(transferProcess.getId())
70- .sourceDataAddress(transferProcess.getContentDataAddress())
71- .destinationDataAddress(transferProcess.getDataDestination())
72- .flowType(PUSH)
73- .callbackAddress(callbackUrl != null ? callbackUrl.get() : null)
74- .build();
75-
76- var dataPlaneInstance = selectorClient.select(transferProcess.getContentDataAddress(), transferProcess.getDataDestination());
77-
78- var dataPlaneInstanceId = dataPlaneInstance != null ? dataPlaneInstance.getId() : null;
79- return clientFactory.createClient(dataPlaneInstance)
80- .start(dataFlowRequest)
81- .map(it -> DataFlowResponse.Builder.newInstance().dataPlaneId(dataPlaneInstanceId).build());
82- }
83-
84- @Override
85- public StatusResult<Void> suspend(TransferProcess transferProcess) {
86- throw new RuntimeException("not implemented");
87- }
88-
89- @Override
90- public StatusResult<Void> terminate(TransferProcess transferProcess) {
91- return selectorClient.getAll().getContent().stream() // result is not evaluated because this class is deprecated
92- .filter(dataPlaneInstanceFilter(transferProcess))
93- .map(clientFactory::createClient)
94- .map(client -> client.terminate(transferProcess.getId()))
95- .reduce(StatusResult::merge)
96- .orElse(StatusResult.failure(ResponseStatus.FATAL_ERROR, "Failed to select the data plane for terminating the transfer process %s".formatted(transferProcess.getId())));
97- }
98-
99- @Override
100- public Set<String> transferTypesFor(Asset asset) {
101- return selectorClient.getAll().getContent().stream() // result is not evaluated because this class is deprecated
102- .filter(it -> it.getAllowedSourceTypes().contains(asset.getDataAddress().getType()))
103- .map(DataPlaneInstance::getAllowedDestTypes)
104- .flatMap(Collection::stream)
105- .map(it -> "%s-%s".formatted(it, PUSH))
106- .collect(toSet());
107- }
108-
109- private Predicate<DataPlaneInstance> dataPlaneInstanceFilter(TransferProcess transferProcess) {
110- if (transferProcess.getDataPlaneId() != null) {
111- return (dataPlaneInstance -> dataPlaneInstance.getId().equals(transferProcess.getDataPlaneId()));
112- } else {
113- return (d) -> true;
114- }
115- }
116-}
deleted extensions/control-plane/transfer/transfer-data-plane/src/main/java/org/eclipse/edc/connector/controlplane/transfer/dataplane/proxy/ConsumerPullDataPlaneProxyResolver.java +0 −93
@@ -1,93 +0,0 @@
1-/*
2- * Copyright (c) 2023 Amadeus
3- *
4- * This program and the accompanying materials are made available under the
5- * terms of the Apache License, Version 2.0 which is available at
6- * https://www.apache.org/licenses/LICENSE-2.0
7- *
8- * SPDX-License-Identifier: Apache-2.0
9- *
10- * Contributors:
11- * Amadeus - initial API and implementation
12- *
13- */
14-
15-package org.eclipse.edc.connector.controlplane.transfer.dataplane.proxy;
16-
17-import jakarta.ws.rs.core.HttpHeaders;
18-import org.eclipse.edc.connector.controlplane.transfer.dataplane.spi.security.DataEncrypter;
19-import org.eclipse.edc.connector.controlplane.transfer.dataplane.spi.token.ConsumerPullTokenExpirationDateFunction;
20-import org.eclipse.edc.connector.controlplane.transfer.spi.types.TransferProcess;
21-import org.eclipse.edc.connector.dataplane.selector.spi.instance.DataPlaneInstance;
22-import org.eclipse.edc.spi.iam.TokenRepresentation;
23-import org.eclipse.edc.spi.result.Result;
24-import org.eclipse.edc.spi.types.TypeManager;
25-import org.eclipse.edc.spi.types.domain.DataAddress;
26-import org.eclipse.edc.spi.types.domain.edr.EndpointDataReference;
27-import org.eclipse.edc.token.spi.KeyIdDecorator;
28-import org.eclipse.edc.token.spi.TokenGenerationService;
29-
30-import java.util.Optional;
31-import java.util.function.Supplier;
32-
33-import static org.eclipse.edc.spi.constants.CoreConstants.EDC_NAMESPACE;
34-
35-@Deprecated(since = "0.5.1")
36-public class ConsumerPullDataPlaneProxyResolver {
37-
38- private static final String PUBLIC_API_URL_PROPERTY_DEPRECATED = "publicApiUrl";
39- private static final String PUBLIC_API_URL_PROPERTY = EDC_NAMESPACE + "publicApiUrl";
40-
41- private final DataEncrypter dataEncrypter;
42- private final TypeManager typeManager;
43- private final TokenGenerationService tokenGenerationService;
44- private final Supplier<String> privateKeyIdSupplier;
45- private final Supplier<String> publicKeyIdSupplier;
46- private final ConsumerPullTokenExpirationDateFunction tokenExpirationDateFunction;
47-
48- public ConsumerPullDataPlaneProxyResolver(DataEncrypter dataEncrypter, TypeManager typeManager, TokenGenerationService tokenGenerationService,
49- Supplier<String> privateKeyIdSupplier, Supplier<String> publicKeyIdSupplier,
50- ConsumerPullTokenExpirationDateFunction tokenExpirationDateFunction) {
51- this.dataEncrypter = dataEncrypter;
52- this.typeManager = typeManager;
53- this.tokenExpirationDateFunction = tokenExpirationDateFunction;
54- this.tokenGenerationService = tokenGenerationService;
55- this.privateKeyIdSupplier = privateKeyIdSupplier;
56- this.publicKeyIdSupplier = publicKeyIdSupplier;
57- }
58-
59- private static Object getPublicApiUrl(DataPlaneInstance instance) {
60- return Optional.ofNullable(instance.getProperties().get(PUBLIC_API_URL_PROPERTY))
61- .orElseGet(() -> instance.getProperties().get(PUBLIC_API_URL_PROPERTY_DEPRECATED));
62- }
63-
64- public Result<DataAddress> toDataAddress(TransferProcess transferProcess, DataAddress address, DataPlaneInstance instance) {
65- return resolveProxyUrl(instance)
66- .compose(proxyUrl -> generateAccessToken(address, transferProcess.getContractId())
67- .map(token -> DataAddress.Builder.newInstance()
68- .type(EndpointDataReference.EDR_SIMPLE_TYPE)
69- .property(EndpointDataReference.ID, transferProcess.getCorrelationId())
70- .property(EndpointDataReference.CONTRACT_ID, transferProcess.getContractId())
71- .property(EndpointDataReference.ENDPOINT, proxyUrl)
72- .property(EndpointDataReference.AUTH_KEY, HttpHeaders.AUTHORIZATION)
73- .property(EndpointDataReference.AUTH_CODE, token)
74- .build()));
75- }
76-
77- private Result<String> resolveProxyUrl(DataPlaneInstance instance) {
78- return Optional.ofNullable(getPublicApiUrl(instance))
79- .map(url -> Result.success((String) url))
80- .orElse(Result.failure(String.format("Missing property `%s` (deprecated: `%s`) in DataPlaneInstance", PUBLIC_API_URL_PROPERTY, PUBLIC_API_URL_PROPERTY_DEPRECATED)));
81- }
82-
83- private Result<String> generateAccessToken(DataAddress source, String contractId) {
84- var encryptedDataAddress = dataEncrypter.encrypt(typeManager.writeValueAsString(source));
85- return tokenExpirationDateFunction.expiresAt(source, contractId)
86- .compose(expiration -> {
87- var keyIdDecorator = new KeyIdDecorator(publicKeyIdSupplier.get());
88- var dataAddressDecorator = new ConsumerPullDataPlaneProxyTokenDecorator(expiration, encryptedDataAddress);
89- return tokenGenerationService.generate(privateKeyIdSupplier.get(), keyIdDecorator, dataAddressDecorator);
90- })
91- .map(TokenRepresentation::getToken);
92- }
93-}
deleted extensions/control-plane/transfer/transfer-data-plane/src/main/java/org/eclipse/edc/connector/controlplane/transfer/dataplane/proxy/ConsumerPullDataPlaneProxyTokenDecorator.java +0 −45
@@ -1,45 +0,0 @@
1-/*
2- * Copyright (c) 2022 Amadeus
3- *
4- * This program and the accompanying materials are made available under the
5- * terms of the Apache License, Version 2.0 which is available at
6- * https://www.apache.org/licenses/LICENSE-2.0
7- *
8- * SPDX-License-Identifier: Apache-2.0
9- *
10- * Contributors:
11- * Amadeus - initial API and implementation
12- *
13- */
14-
15-package org.eclipse.edc.connector.controlplane.transfer.dataplane.proxy;
16-
17-import org.eclipse.edc.spi.iam.TokenParameters;
18-import org.eclipse.edc.token.spi.TokenDecorator;
19-
20-import java.util.Date;
21-
22-import static com.nimbusds.jwt.JWTClaimNames.EXPIRATION_TIME;
23-import static org.eclipse.edc.connector.controlplane.transfer.dataplane.spi.TransferDataPlaneConstants.DATA_ADDRESS;
24-
25-/**
26- * Decorator for access token used in input of Data Plane public API. The token is composed of:
27- * - a contract id (used to check if contract between consumer and provider is still valid).
28- * - the address of the data source formatted as an encrypted string.
29- */
30-class ConsumerPullDataPlaneProxyTokenDecorator implements TokenDecorator {
31-
32- private final Date expirationDate;
33- private final String encryptedDataAddress;
34-
35- ConsumerPullDataPlaneProxyTokenDecorator(Date expirationDate, String encryptedDataAddress) {
36- this.expirationDate = expirationDate;
37- this.encryptedDataAddress = encryptedDataAddress;
38- }
39-
40- @Override
41- public TokenParameters.Builder decorate(TokenParameters.Builder tokenParameters) {
42- return tokenParameters.claims(EXPIRATION_TIME, expirationDate)
43- .claims(DATA_ADDRESS, encryptedDataAddress);
44- }
45-}
deleted extensions/control-plane/transfer/transfer-data-plane/src/main/java/org/eclipse/edc/connector/controlplane/transfer/dataplane/security/NoopDataEncrypter.java +0 −33
@@ -1,33 +0,0 @@
1-/*
2- * Copyright (c) 2022 Amadeus
3- *
4- * This program and the accompanying materials are made available under the
5- * terms of the Apache License, Version 2.0 which is available at
6- * https://www.apache.org/licenses/LICENSE-2.0
7- *
8- * SPDX-License-Identifier: Apache-2.0
9- *
10- * Contributors:
11- * Amadeus - Initial implementation
12- *
13- */
14-
15-package org.eclipse.edc.connector.controlplane.transfer.dataplane.security;
16-
17-
18-import org.eclipse.edc.connector.controlplane.transfer.dataplane.spi.security.DataEncrypter;
19-
20-/**
21- * No-op implementation of {@link DataEncrypter}.
22- */
23-public class NoopDataEncrypter implements DataEncrypter {
24- @Override
25- public String encrypt(String raw) {
26- return raw;
27- }
28-
29- @Override
30- public String decrypt(String encrypted) {
31- return encrypted;
32- }
33-}
deleted extensions/control-plane/transfer/transfer-data-plane/src/main/java/org/eclipse/edc/connector/controlplane/transfer/dataplane/validation/ExpirationDateValidationRule.java +0 −53
@@ -1,53 +0,0 @@
1-/*
2- * Copyright (c) 2022 Amadeus
3- *
4- * This program and the accompanying materials are made available under the
5- * terms of the Apache License, Version 2.0 which is available at
6- * https://www.apache.org/licenses/LICENSE-2.0
7- *
8- * SPDX-License-Identifier: Apache-2.0
9- *
10- * Contributors:
11- * Amadeus - initial API and implementation
12- *
13- */
14-
15-package org.eclipse.edc.connector.controlplane.transfer.dataplane.validation;
16-
17-import org.eclipse.edc.spi.iam.ClaimToken;
18-import org.eclipse.edc.spi.result.Result;
19-import org.eclipse.edc.token.spi.TokenValidationRule;
20-import org.jetbrains.annotations.NotNull;
21-import org.jetbrains.annotations.Nullable;
22-
23-import java.time.Clock;
24-import java.util.Map;
25-
26-import static com.nimbusds.jwt.JWTClaimNames.EXPIRATION_TIME;
27-
28-/**
29- * Assert that token containing these claims is not expired yet.
30- */
31-public class ExpirationDateValidationRule implements TokenValidationRule {
32-
33- private final Clock clock;
34-
35- public ExpirationDateValidationRule(Clock clock) {
36- this.clock = clock;
37- }
38-
39- @Override
40- public Result<Void> checkRule(@NotNull ClaimToken toVerify, @Nullable Map<String, Object> additional) {
41- var expiration = toVerify.getInstantClaim(EXPIRATION_TIME);
42- if (expiration == null) {
43- return Result.failure("Missing expiration time in token");
44- }
45-
46- // check contract expiration date
47- if (clock.instant().isAfter(expiration)) {
48- return Result.failure("Token has expired on " + expiration);
49- }
50-
51- return Result.success();
52- }
53-}
deleted extensions/control-plane/transfer/transfer-data-plane/src/main/resources/META-INF/services/org.eclipse.edc.spi.system.ServiceExtension +0 −16
@@ -1,16 +0,0 @@
1-#
2-# Copyright (c) 2022 Amadeus
3-#
4-# This program and the accompanying materials are made available under the
5-# terms of the Apache License, Version 2.0 which is available at
6-# https://www.apache.org/licenses/LICENSE-2.0
7-#
8-# SPDX-License-Identifier: Apache-2.0
9-#
10-# Contributors:
11-# Amadeus - initial API and implementation
12-#
13-#
14-
15-org.eclipse.edc.connector.controlplane.transfer.dataplane.TransferDataPlaneCoreExtension
16-org.eclipse.edc.connector.controlplane.transfer.dataplane.TransferDataPlaneDefaultServicesExtension
No newline at the end of the file
deleted extensions/control-plane/transfer/transfer-data-plane/src/test/java/org/eclipse/edc/connector/controlplane/transfer/dataplane/TransferDataPlaneCoreExtensionTest.java +0 −99
@@ -1,99 +0,0 @@
1-/*
2- * Copyright (c) 2022 Amadeus
3- *
4- * This program and the accompanying materials are made available under the
5- * terms of the Apache License, Version 2.0 which is available at
6- * https://www.apache.org/licenses/LICENSE-2.0
7- *
8- * SPDX-License-Identifier: Apache-2.0
9- *
10- * Contributors:
11- * Amadeus - Initial implementation
12- *
13- */
14-
15-package org.eclipse.edc.connector.controlplane.transfer.dataplane;
16-
17-import org.eclipse.edc.connector.controlplane.transfer.dataplane.api.ConsumerPullTransferTokenValidationApiController;
18-import org.eclipse.edc.connector.controlplane.transfer.dataplane.flow.ConsumerPullTransferDataFlowController;
19-import org.eclipse.edc.connector.controlplane.transfer.dataplane.flow.ProviderPushTransferDataFlowController;
20-import org.eclipse.edc.connector.controlplane.transfer.spi.flow.DataFlowManager;
21-import org.eclipse.edc.junit.extensions.DependencyInjectionExtension;
22-import org.eclipse.edc.spi.monitor.Monitor;
23-import org.eclipse.edc.spi.security.Vault;
24-import org.eclipse.edc.spi.system.ServiceExtensionContext;
25-import org.eclipse.edc.spi.system.configuration.Config;
26-import org.eclipse.edc.web.spi.WebService;
27-import org.eclipse.edc.web.spi.configuration.ApiContext;
28-import org.junit.jupiter.api.BeforeEach;
29-import org.junit.jupiter.api.Test;
30-import org.junit.jupiter.api.extension.ExtendWith;
31-
32-import java.io.IOException;
33-import java.util.Objects;
34-
35-import static org.eclipse.edc.connector.controlplane.transfer.dataplane.TransferDataPlaneCoreExtension.TOKEN_SIGNER_PRIVATE_KEY_ALIAS;
36-import static org.eclipse.edc.connector.controlplane.transfer.dataplane.TransferDataPlaneCoreExtension.TOKEN_VERIFIER_PUBLIC_KEY_ALIAS;
37-import static org.mockito.ArgumentMatchers.any;
38-import static org.mockito.ArgumentMatchers.eq;
39-import static org.mockito.ArgumentMatchers.isA;
40-import static org.mockito.Mockito.mock;
41-import static org.mockito.Mockito.never;
42-import static org.mockito.Mockito.verify;
43-import static org.mockito.Mockito.verifyNoInteractions;
44-import static org.mockito.Mockito.when;
45-
46-@ExtendWith(DependencyInjectionExtension.class)
47-class TransferDataPlaneCoreExtensionTest {
48-
49- private final Vault vault = mock();
50- private final WebService webService = mock();
51- private final DataFlowManager dataFlowManager = mock();
52- private final Monitor monitor = mock();
53-
54- @BeforeEach
55- public void setUp(ServiceExtensionContext context) {
56- context.registerService(WebService.class, webService);
57- context.registerService(DataFlowManager.class, dataFlowManager);
58- context.registerService(Vault.class, vault);
59-
60- when(context.getMonitor()).thenReturn(monitor);
61- }
62-
63- @Test
64- void verifyInitializeSuccess(TransferDataPlaneCoreExtension extension, ServiceExtensionContext context) throws IOException {
65- var publicKeyAlias = "publicKey";
66- var privateKeyAlias = "privateKey";
67- var config = mock(Config.class);
68- when(context.getConfig()).thenReturn(config);
69- when(config.getString(TOKEN_VERIFIER_PUBLIC_KEY_ALIAS, null)).thenReturn(publicKeyAlias);
70- when(config.getString(TOKEN_SIGNER_PRIVATE_KEY_ALIAS, null)).thenReturn(privateKeyAlias);
71- when(vault.resolveSecret(publicKeyAlias)).thenReturn(publicKeyPem());
72-
73- extension.initialize(context);
74-
75- verify(dataFlowManager).register(any(ConsumerPullTransferDataFlowController.class));
76- verify(dataFlowManager).register(any(ProviderPushTransferDataFlowController.class));
77- verify(webService).registerResource(eq(ApiContext.CONTROL), any(ConsumerPullTransferTokenValidationApiController.class));
78- }
79-
80- @Test
81- void shouldNotRegisterConsumerPullControllers_whenSettingsAreMissing(TransferDataPlaneCoreExtension extension, ServiceExtensionContext context) {
82- var config = mock(Config.class);
83- when(context.getConfig()).thenReturn(config);
84- when(config.getString(TOKEN_VERIFIER_PUBLIC_KEY_ALIAS, null)).thenReturn(null);
85- when(config.getString(TOKEN_SIGNER_PRIVATE_KEY_ALIAS, null)).thenReturn(null);
86-
87- extension.initialize(context);
88-
89- verify(dataFlowManager, never()).register(isA(ConsumerPullTransferDataFlowController.class));
90- verifyNoInteractions(webService);
91- verify(monitor).info(any(String.class));
92- }
93-
94- private String publicKeyPem() throws IOException {
95- try (var resource = TransferDataPlaneCoreExtensionTest.class.getClassLoader().getResourceAsStream("rsa-pubkey.pem")) {
96- return new String(Objects.requireNonNull(resource).readAllBytes());
97- }
98- }
99-}
deleted extensions/control-plane/transfer/transfer-data-plane/src/test/java/org/eclipse/edc/connector/controlplane/transfer/dataplane/api/ConsumerPullTransferTokenValidationApiControllerTest.java +0 −105
@@ -1,105 +0,0 @@
1-/*
2- * Copyright (c) 2022 Amadeus
3- *
4- * This program and the accompanying materials are made available under the
5- * terms of the Apache License, Version 2.0 which is available at
6- * https://www.apache.org/licenses/LICENSE-2.0
7- *
8- * SPDX-License-Identifier: Apache-2.0
9- *
10- * Contributors:
11- * Amadeus - Initial implementation
12- *
13- */
14-
15-package org.eclipse.edc.connector.controlplane.transfer.dataplane.api;
16-
17-import org.eclipse.edc.connector.controlplane.transfer.dataplane.spi.security.DataEncrypter;
18-import org.eclipse.edc.json.JacksonTypeManager;
19-import org.eclipse.edc.keys.spi.PublicKeyResolver;
20-import org.eclipse.edc.spi.iam.ClaimToken;
21-import org.eclipse.edc.spi.result.Result;
22-import org.eclipse.edc.spi.types.TypeManager;
23-import org.eclipse.edc.spi.types.domain.DataAddress;
24-import org.eclipse.edc.token.spi.TokenValidationService;
25-import org.eclipse.edc.web.spi.exception.InvalidRequestException;
26-import org.eclipse.edc.web.spi.exception.NotAuthorizedException;
27-import org.junit.jupiter.api.BeforeEach;
28-import org.junit.jupiter.api.Test;
29-
30-import java.util.Map;
31-import java.util.UUID;
32-
33-import static org.assertj.core.api.Assertions.assertThat;
34-import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
35-import static org.eclipse.edc.connector.controlplane.transfer.dataplane.spi.TransferDataPlaneConstants.DATA_ADDRESS;
36-import static org.mockito.ArgumentMatchers.anyString;
37-import static org.mockito.ArgumentMatchers.eq;
38-import static org.mockito.Mockito.mock;
39-import static org.mockito.Mockito.never;
40-import static org.mockito.Mockito.verify;
41-import static org.mockito.Mockito.when;
42-
43-class ConsumerPullTransferTokenValidationApiControllerTest {
44-
45- private static final TypeManager TYPE_MANAGER = new JacksonTypeManager();
46-
47- private final DataEncrypter encrypterMock = mock(DataEncrypter.class);
48- private final TokenValidationService tokenValidationServiceMock = mock(TokenValidationService.class);
49- private final PublicKeyResolver publicKeyResolver = mock();
50- private ConsumerPullTransferTokenValidationApiController controller;
51-
52- @BeforeEach
53- void setUp() {
54- controller = new ConsumerPullTransferTokenValidationApiController(tokenValidationServiceMock, encrypterMock, TYPE_MANAGER, publicKeyResolver);
55- }
56-
57- @Test
58- void verifyValidateSuccess() {
59- var token = UUID.randomUUID().toString();
60- var encryptedDataAddress = UUID.randomUUID().toString();
61- var decryptedDataAddress = DataAddress.Builder.newInstance().type(UUID.randomUUID().toString()).build();
62- var claims = ClaimToken.Builder.newInstance()
63- .claims(Map.of(
64- "key1", "value1",
65- DATA_ADDRESS, encryptedDataAddress
66- )
67- )
68- .build();
69-
70- when(tokenValidationServiceMock.validate(token, publicKeyResolver)).thenReturn(Result.success(claims));
71- when(encrypterMock.decrypt(encryptedDataAddress)).thenReturn(TYPE_MANAGER.writeValueAsString(decryptedDataAddress));
72-
73- var responseAddress = controller.validate(token);
74- assertThat(responseAddress.getType()).isEqualTo(decryptedDataAddress.getType());
75-
76- verify(tokenValidationServiceMock).validate(anyString(), eq(publicKeyResolver));
77- verify(encrypterMock).decrypt(anyString());
78- }
79-
80- @Test
81- void verifyTokenValidationFailureThrowsException() {
82- var token = UUID.randomUUID().toString();
83- var errorMsg = UUID.randomUUID().toString();
84-
85- when(tokenValidationServiceMock.validate(token, publicKeyResolver)).thenReturn(Result.failure(errorMsg));
86-
87- assertThatExceptionOfType(NotAuthorizedException.class).isThrownBy(() -> controller.validate(token));
88-
89- verify(encrypterMock, never()).decrypt(anyString());
90- }
91-
92- @Test
93- void verifyMissingAddressThrowsException() {
94- var token = UUID.randomUUID().toString();
95- var claims = ClaimToken.Builder.newInstance()
96- .claims(Map.of("key1", "value1"))
97- .build();
98-
99- when(tokenValidationServiceMock.validate(token, publicKeyResolver)).thenReturn(Result.success(claims));
100-
101- assertThatExceptionOfType(InvalidRequestException.class).isThrownBy(() -> controller.validate(token));
102-
103- verify(encrypterMock, never()).decrypt(anyString());
104- }
105-}
deleted extensions/control-plane/transfer/transfer-data-plane/src/test/java/org/eclipse/edc/connector/controlplane/transfer/dataplane/flow/ConsumerPullTransferDataFlowControllerTest.java +0 −166
@@ -1,166 +0,0 @@
1-/*
2- * Copyright (c) 2022 Amadeus
3- *
4- * This program and the accompanying materials are made available under the
5- * terms of the Apache License, Version 2.0 which is available at
6- * https://www.apache.org/licenses/LICENSE-2.0
7- *
8- * SPDX-License-Identifier: Apache-2.0
9- *
10- * Contributors:
11- * Amadeus - Initial implementation
12- *
13- */
14-
15-package org.eclipse.edc.connector.controlplane.transfer.dataplane.flow;
16-
17-import org.eclipse.edc.connector.controlplane.asset.spi.domain.Asset;
18-import org.eclipse.edc.connector.controlplane.transfer.dataplane.proxy.ConsumerPullDataPlaneProxyResolver;
19-import org.eclipse.edc.connector.controlplane.transfer.spi.types.TransferProcess;
20-import org.eclipse.edc.connector.dataplane.selector.spi.DataPlaneSelectorService;
21-import org.eclipse.edc.connector.dataplane.selector.spi.instance.DataPlaneInstance;
22-import org.eclipse.edc.policy.model.Policy;
23-import org.eclipse.edc.spi.result.Failure;
24-import org.eclipse.edc.spi.result.Result;
25-import org.eclipse.edc.spi.types.domain.DataAddress;
26-import org.junit.jupiter.api.Test;
27-
28-import java.util.UUID;
29-
30-import static org.assertj.core.api.Assertions.assertThat;
31-import static org.eclipse.edc.connector.controlplane.transfer.dataplane.spi.TransferDataPlaneConstants.HTTP_PROXY;
32-import static org.eclipse.edc.junit.assertions.AbstractResultAssert.assertThat;
33-import static org.mockito.ArgumentMatchers.any;
34-import static org.mockito.ArgumentMatchers.argThat;
35-import static org.mockito.Mockito.mock;
36-import static org.mockito.Mockito.when;
37-
38-class ConsumerPullTransferDataFlowControllerTest {
39-
40- private final DataPlaneSelectorService selectorService = mock();
41- private final ConsumerPullDataPlaneProxyResolver resolver = mock();
42-
43- private final ConsumerPullTransferDataFlowController flowController = new ConsumerPullTransferDataFlowController(selectorService, resolver);
44-
45- private static final String HTTP_DATA_PULL = "HttpData-PULL";
46-
47- @Test
48- void verifyCanHandle() {
49- assertThat(flowController.canHandle(transferProcess(HTTP_PROXY))).isTrue();
50- assertThat(flowController.canHandle(transferProcess(HTTP_DATA_PULL, HTTP_DATA_PULL))).isTrue();
51- assertThat(flowController.canHandle(transferProcess(HTTP_DATA_PULL, null))).isFalse();
52- assertThat(flowController.canHandle(transferProcess("not-http-proxy"))).isFalse();
53- }
54-
55- @Test
56- void initiateFlow_success() {
57- var proxyAddress = dataAddress();
58- var instance = mock(DataPlaneInstance.class);
59- var transferProcess = transferProcessBuilder(HTTP_PROXY)
60- .contentDataAddress(dataAddress())
61- .build();
62-
63- when(selectorService.select(any(), argThat(destination -> destination.getType().equals(HTTP_PROXY)))).thenReturn(instance);
64- when(resolver.toDataAddress(any(), any(), any())).thenReturn(Result.success(proxyAddress));
65-
66- var result = flowController.start(transferProcess, null);
67-
68- assertThat(result).isSucceeded().satisfies(response -> {
69- assertThat(response.getDataAddress()).isEqualTo(proxyAddress);
70- });
71- }
72-
73- @Test
74- void initiateFlow_success_withTransferType() {
75- var proxyAddress = dataAddress();
76- var instance = mock(DataPlaneInstance.class);
77- var transferProcess = transferProcessBuilder(HTTP_PROXY)
78- .transferType(HTTP_DATA_PULL)
79- .contentDataAddress(dataAddress())
80- .build();
81-
82- when(selectorService.select(any(), argThat(destination -> destination.getType().equals(HTTP_PROXY)))).thenReturn(instance);
83- when(resolver.toDataAddress(any(), any(), any())).thenReturn(Result.success(proxyAddress));
84-
85- var result = flowController.start(transferProcess, null);
86-
87- assertThat(result).isSucceeded().satisfies(response -> {
88- assertThat(response.getDataAddress()).isEqualTo(proxyAddress);
89- });
90- }
91-
92- @Test
93- void initiateFlow_returnsFailureIfNoDataPlaneInstance() {
94- var transferProcess = transferProcessBuilder(HTTP_PROXY)
95- .contentDataAddress(dataAddress())
96- .build();
97-
98- var result = flowController.start(transferProcess, null);
99-
100-
101- assertThat(result).isFailed().extracting(Failure::getFailureDetail).asString()
102- .isEqualTo(String.format("Failed to find DataPlaneInstance for source/destination: %s/%s", transferProcess.getContentDataAddress().getType(), HTTP_PROXY));
103- }
104-
105- @Test
106- void initiateFlow_returnsFailureIfAddressResolutionFails() {
107- var errorMsg = "Test Error Message";
108- var instance = mock(DataPlaneInstance.class);
109- var transferProcess = transferProcessBuilder(HTTP_PROXY)
110- .contentDataAddress(dataAddress())
111- .build();
112-
113- when(selectorService.select(any(), argThat(destination -> destination.getType().equals(HTTP_PROXY)))).thenReturn(instance);
114- when(resolver.toDataAddress(any(), any(), any())).thenReturn(Result.failure(errorMsg));
115-
116- var result = flowController.start(transferProcess, Policy.Builder.newInstance().build());
117-
118- assertThat(result).isFailed().extracting(Failure::getFailureDetail).asString().contains(errorMsg);
119- }
120-
121- @Test
122- void terminate_shouldAlwaysReturnSuccess() {
123- var transferProcess = transferProcessBuilder(HTTP_PROXY)
124- .contentDataAddress(dataAddress())
125- .build();
126-
127- var result = flowController.terminate(transferProcess);
128-
129- assertThat(result).isSucceeded();
130- }
131-
132- @Test
133- void transferTypes_shouldReturnHttpPull() {
134- var asset = Asset.Builder.newInstance().dataAddress(DataAddress.Builder.newInstance().type("any").build()).build();
135-
136- var transferTypes = flowController.transferTypesFor(asset);
137-
138- assertThat(transferTypes).hasSize(1).contains(HTTP_DATA_PULL);
139- }
140-
141- private TransferProcess transferProcess(String destinationType) {
142- return transferProcess(destinationType, null);
143- }
144-
145- private TransferProcess.Builder transferProcessBuilder(String destinationType) {
146- return TransferProcess.Builder.newInstance()
147- .correlationId(UUID.randomUUID().toString())
148- .protocol("protocol")
149- .contractId(UUID.randomUUID().toString())
150- .assetId(UUID.randomUUID().toString())
151- .counterPartyAddress("test.connector.address")
152- .dataDestination(DataAddress.Builder.newInstance().type(destinationType).build());
153- }
154-
155- private TransferProcess transferProcess(String destinationType, String transferType) {
156- return transferProcessBuilder(destinationType)
157- .transferType(transferType)
158- .dataDestination(DataAddress.Builder.newInstance().type(destinationType).build())
159- .build();
160- }
161-
162- private DataAddress dataAddress() {
163- return DataAddress.Builder.newInstance().type(UUID.randomUUID().toString()).build();
164- }
165-
166-}
deleted extensions/control-plane/transfer/transfer-data-plane/src/test/java/org/eclipse/edc/connector/controlplane/transfer/dataplane/flow/ProviderPushTransferDataFlowControllerTest.java +0 −234
@@ -1,234 +0,0 @@
1-/*
2- * Copyright (c) 2022 Amadeus
3- *
4- * This program and the accompanying materials are made available under the
5- * terms of the Apache License, Version 2.0 which is available at
6- * https://www.apache.org/licenses/LICENSE-2.0
7- *
8- * SPDX-License-Identifier: Apache-2.0
9- *
10- * Contributors:
11- * Amadeus - Initial implementation
12- *
13- */
14-
15-package org.eclipse.edc.connector.controlplane.transfer.dataplane.flow;
16-
17-import org.eclipse.edc.connector.controlplane.asset.spi.domain.Asset;
18-import org.eclipse.edc.connector.controlplane.transfer.spi.types.DataFlowResponse;
19-import org.eclipse.edc.connector.controlplane.transfer.spi.types.TransferProcess;
20-import org.eclipse.edc.connector.dataplane.selector.spi.DataPlaneSelectorService;
21-import org.eclipse.edc.connector.dataplane.selector.spi.client.DataPlaneClient;
22-import org.eclipse.edc.connector.dataplane.selector.spi.client.DataPlaneClientFactory;
23-import org.eclipse.edc.connector.dataplane.selector.spi.instance.DataPlaneInstance;
24-import org.eclipse.edc.policy.model.Policy;
25-import org.eclipse.edc.spi.response.ResponseStatus;
26-import org.eclipse.edc.spi.response.StatusResult;
27-import org.eclipse.edc.spi.result.ServiceResult;
28-import org.eclipse.edc.spi.types.domain.DataAddress;
29-import org.eclipse.edc.spi.types.domain.transfer.DataFlowResponseMessage;
30-import org.eclipse.edc.spi.types.domain.transfer.DataFlowStartMessage;
31-import org.jetbrains.annotations.NotNull;
32-import org.junit.jupiter.api.Test;
33-import org.mockito.ArgumentCaptor;
34-
35-import java.net.URI;
36-import java.util.List;
37-import java.util.UUID;
38-
39-import static org.assertj.core.api.Assertions.assertThat;
40-import static org.eclipse.edc.connector.controlplane.transfer.dataplane.spi.TransferDataPlaneConstants.HTTP_PROXY;
41-import static org.eclipse.edc.junit.assertions.AbstractResultAssert.assertThat;
42-import static org.mockito.ArgumentMatchers.any;
43-import static org.mockito.Mockito.mock;
44-import static org.mockito.Mockito.verify;
45-import static org.mockito.Mockito.when;
46-
47-class ProviderPushTransferDataFlowControllerTest {
48-
49- private static final String HTTP_DATA_PULL = "HttpData-PULL";
50- private final DataPlaneClient dataPlaneClient = mock();
51- private final DataPlaneClientFactory dataPlaneClientFactory = mock();
52- private final DataPlaneSelectorService selectorService = mock();
53- private final ProviderPushTransferDataFlowController flowController =
54- new ProviderPushTransferDataFlowController(() -> URI.create("http://localhost"), selectorService, dataPlaneClientFactory);
55-
56- @NotNull
57- private static DataPlaneInstance.Builder dataPlaneInstanceBuilder() {
58- return DataPlaneInstance.Builder.newInstance().url("http://any");
59- }
60-
61- @Test
62- void canHandle() {
63- assertThat(flowController.canHandle(transferProcess(HTTP_PROXY))).isFalse();
64- assertThat(flowController.canHandle(transferProcess(HTTP_PROXY))).isFalse();
65- assertThat(flowController.canHandle(transferProcess(HTTP_DATA_PULL, HTTP_DATA_PULL))).isFalse();
66- assertThat(flowController.canHandle(transferProcess("not-http-proxy"))).isTrue();
67- }
68-
69- @Test
70- void initiateFlow_transferSuccess() {
71- var source = testDataAddress();
72- var transferProcess = transferProcessBuilder("test")
73- .contentDataAddress(testDataAddress())
74- .build();
75-
76- when(dataPlaneClient.start(any(DataFlowStartMessage.class))).thenReturn(StatusResult.success(mock(DataFlowResponseMessage.class)));
77- var dataPlaneInstance = createDataPlaneInstance();
78- when(selectorService.select(any(), any())).thenReturn(dataPlaneInstance);
79- when(dataPlaneClientFactory.createClient(any())).thenReturn(dataPlaneClient);
80-
81- var result = flowController.start(transferProcess, Policy.Builder.newInstance().build());
82-
83- assertThat(result).isSucceeded().extracting(DataFlowResponse::getDataPlaneId).isEqualTo(dataPlaneInstance.getId());
84- var captor = ArgumentCaptor.forClass(DataFlowStartMessage.class);
85- verify(dataPlaneClient).start(captor.capture());
86- var captured = captor.getValue();
87- assertThat(captured.getProcessId()).isEqualTo(transferProcess.getId());
88- assertThat(captured.getSourceDataAddress()).usingRecursiveComparison().isEqualTo(source);
89- assertThat(captured.getDestinationDataAddress()).usingRecursiveComparison().isEqualTo(transferProcess.getDataDestination());
90- assertThat(captured.getProperties()).isEmpty();
91- assertThat(captured.getCallbackAddress()).isNotNull();
92- }
93-
94- @Test
95- void initiateFlow_transferSuccess_withoutDataPlane() {
96- var source = testDataAddress();
97- var transferProcess = transferProcessBuilder("test")
98- .contentDataAddress(testDataAddress())
99- .build();
100-
101- when(dataPlaneClient.start(any(DataFlowStartMessage.class))).thenReturn(StatusResult.success(mock(DataFlowResponseMessage.class)));
102- when(selectorService.select(any(), any())).thenReturn(null);
103- when(dataPlaneClientFactory.createClient(any())).thenReturn(dataPlaneClient);
104-
105- var result = flowController.start(transferProcess, Policy.Builder.newInstance().build());
106-
107- assertThat(result).isSucceeded().extracting(DataFlowResponse::getDataPlaneId).isNull();
108- var captor = ArgumentCaptor.forClass(DataFlowStartMessage.class);
109- verify(dataPlaneClient).start(captor.capture());
110- var captured = captor.getValue();
111- assertThat(captured.getProcessId()).isEqualTo(transferProcess.getId());
112- assertThat(captured.getSourceDataAddress()).usingRecursiveComparison().isEqualTo(source);
113- assertThat(captured.getDestinationDataAddress()).usingRecursiveComparison().isEqualTo(transferProcess.getDataDestination());
114- assertThat(captured.getProperties()).isEmpty();
115- assertThat(captured.getCallbackAddress()).isNotNull();
116- }
117-
118- @Test
119- void initiateFlow_returnFailedResultIfTransferFails() {
120- var errorMsg = "error";
121- var transferProcess = transferProcessBuilder("test")
122- .contentDataAddress(testDataAddress())
123- .build();
124-
125- when(dataPlaneClient.start(any())).thenReturn(StatusResult.failure(ResponseStatus.FATAL_ERROR, errorMsg));
126- var dataPlaneInstance = createDataPlaneInstance();
127- when(selectorService.select(any(), any())).thenReturn(dataPlaneInstance);
128- when(dataPlaneClientFactory.createClient(any())).thenReturn(dataPlaneClient);
129-
130- var result = flowController.start(transferProcess, Policy.Builder.newInstance().build());
131-
132- verify(dataPlaneClient).start(any());
133-
134- assertThat(result.failed()).isTrue();
135- assertThat(result.getFailureMessages()).allSatisfy(s -> assertThat(s).contains(errorMsg));
136- }
137-
138- @Test
139- void terminate_shouldCallTerminate() {
140- var transferProcess = transferProcessBuilder("test")
141- .id("transferProcessId")
142- .contentDataAddress(testDataAddress())
143- .build();
144- when(dataPlaneClient.terminate(any())).thenReturn(StatusResult.success());
145- var dataPlaneInstance = createDataPlaneInstance();
146- when(dataPlaneClientFactory.createClient(any())).thenReturn(dataPlaneClient);
147- when(selectorService.getAll()).thenReturn(ServiceResult.success(List.of(dataPlaneInstance)));
148-
149- var result = flowController.terminate(transferProcess);
150-
151- assertThat(result).isSucceeded();
152- verify(dataPlaneClient).terminate("transferProcessId");
153- }
154-
155- @Test
156- void terminate_shouldCallTerminateOnTheRightDataPlane() {
157- var dataPlaneInstance = createDataPlaneInstance();
158- var mockedDataPlane = mock(DataPlaneInstance.class);
159- var transferProcess = transferProcessBuilder("test")
160- .id("transferProcessId")
161- .contentDataAddress(testDataAddress())
162- .dataPlaneId(dataPlaneInstance.getId())
163- .build();
164- when(mockedDataPlane.getId()).thenReturn("notValidId");
165- when(dataPlaneClient.terminate(any())).thenReturn(StatusResult.success());
166- when(dataPlaneClientFactory.createClient(any())).thenReturn(dataPlaneClient);
167- when(selectorService.getAll()).thenReturn(ServiceResult.success(List.of(dataPlaneInstance, mockedDataPlane)));
168-
169- var result = flowController.terminate(transferProcess);
170-
171- assertThat(result).isSucceeded();
172- verify(dataPlaneClient).terminate("transferProcessId");
173- verify(mockedDataPlane).getId();
174- }
175-
176- @Test
177- void terminate_shouldFail_withInvalidDataPlaneId() {
178- var dataPlaneInstance = createDataPlaneInstance();
179- var transferProcess = transferProcessBuilder("test")
180- .id("transferProcessId")
181- .contentDataAddress(testDataAddress())
182- .dataPlaneId("invalid")
183- .build();
184- when(dataPlaneClient.terminate(any())).thenReturn(StatusResult.success());
185- when(dataPlaneClientFactory.createClient(any())).thenReturn(dataPlaneClient);
186- when(selectorService.getAll()).thenReturn(ServiceResult.success(List.of(dataPlaneInstance)));
187-
188- var result = flowController.terminate(transferProcess);
189-
190- assertThat(result).isFailed().detail().contains("Failed to select the data plane for terminating the transfer process");
191- }
192-
193- @Test
194- void transferTypes_shouldReturnTypesForSpecifiedAsset() {
195- when(selectorService.getAll()).thenReturn(ServiceResult.success(List.of(
196- dataPlaneInstanceBuilder().allowedSourceType("TargetSrc").allowedDestType("TargetDest").build(),
197- dataPlaneInstanceBuilder().allowedSourceType("TargetSrc").allowedDestType("AnotherTargetDest").build(),
198- dataPlaneInstanceBuilder().allowedSourceType("AnotherSrc").allowedDestType("ThisWontBeListed").build()
199- )));
200- var asset = Asset.Builder.newInstance().dataAddress(DataAddress.Builder.newInstance().type("TargetSrc").build()).build();
201-
202- var transferTypes = flowController.transferTypesFor(asset);
203-
204- assertThat(transferTypes).containsExactly("TargetDest-PUSH", "AnotherTargetDest-PUSH");
205- }
206-
207- private DataPlaneInstance createDataPlaneInstance() {
208- return dataPlaneInstanceBuilder().build();
209- }
210-
211- private DataAddress testDataAddress() {
212- return DataAddress.Builder.newInstance().type("test-type").build();
213- }
214-
215- private TransferProcess transferProcess(String destinationType) {
216- return transferProcess(destinationType, null);
217- }
218-
219- private TransferProcess transferProcess(String destinationType, String transferType) {
220- return transferProcessBuilder(destinationType)
221- .transferType(transferType)
222- .build();
223- }
224-
225- private TransferProcess.Builder transferProcessBuilder(String destinationType) {
226- return TransferProcess.Builder.newInstance()
227- .correlationId(UUID.randomUUID().toString())
228- .protocol("test-protocol")
229- .contractId(UUID.randomUUID().toString())
230- .assetId(UUID.randomUUID().toString())
231- .counterPartyAddress("test.connector.address")
232- .dataDestination(DataAddress.Builder.newInstance().type(destinationType).build());
233- }
234-}
deleted extensions/control-plane/transfer/transfer-data-plane/src/test/java/org/eclipse/edc/connector/controlplane/transfer/dataplane/proxy/ConsumerPullDataPlaneProxyResolverTest.java +0 −177
@@ -1,177 +0,0 @@
1-/*
2- * Copyright (c) 2022 Amadeus
3- *
4- * This program and the accompanying materials are made available under the
5- * terms of the Apache License, Version 2.0 which is available at
6- * https://www.apache.org/licenses/LICENSE-2.0
7- *
8- * SPDX-License-Identifier: Apache-2.0
9- *
10- * Contributors:
11- * Amadeus - initial API and implementation
12- *
13- */
14-
15-package org.eclipse.edc.connector.controlplane.transfer.dataplane.proxy;
16-
17-import jakarta.ws.rs.core.HttpHeaders;
18-import org.eclipse.edc.connector.controlplane.transfer.dataplane.spi.security.DataEncrypter;
19-import org.eclipse.edc.connector.controlplane.transfer.dataplane.spi.token.ConsumerPullTokenExpirationDateFunction;
20-import org.eclipse.edc.connector.controlplane.transfer.spi.types.TransferProcess;
21-import org.eclipse.edc.connector.dataplane.selector.spi.instance.DataPlaneInstance;
22-import org.eclipse.edc.json.JacksonTypeManager;
23-import org.eclipse.edc.spi.iam.TokenParameters;
24-import org.eclipse.edc.spi.iam.TokenRepresentation;
25-import org.eclipse.edc.spi.result.Result;
26-import org.eclipse.edc.spi.types.TypeManager;
27-import org.eclipse.edc.spi.types.domain.DataAddress;
28-import org.eclipse.edc.spi.types.domain.edr.EndpointDataReference;
29-import org.eclipse.edc.token.spi.TokenDecorator;
30-import org.eclipse.edc.token.spi.TokenGenerationService;
31-import org.junit.jupiter.api.Test;
32-import org.mockito.ArgumentCaptor;
33-
34-import java.sql.Date;
35-import java.time.Instant;
36-import java.util.UUID;
37-
38-import static com.nimbusds.jwt.JWTClaimNames.EXPIRATION_TIME;
39-import static org.assertj.core.api.Assertions.assertThat;
40-import static org.eclipse.edc.connector.controlplane.transfer.dataplane.spi.TransferDataPlaneConstants.DATA_ADDRESS;
41-import static org.eclipse.edc.connector.controlplane.transfer.dataplane.spi.TransferDataPlaneConstants.HTTP_PROXY;
42-import static org.mockito.ArgumentMatchers.any;
43-import static org.mockito.ArgumentMatchers.anyString;
44-import static org.mockito.Mockito.mock;
45-import static org.mockito.Mockito.when;
46-
47-class ConsumerPullDataPlaneProxyResolverTest {
48-
49- private static final TypeManager TYPE_MANAGER = new JacksonTypeManager();
50-
51- private final DataEncrypter dataEncrypter = mock();
52- private final TokenGenerationService tokenGenerationService = mock();
53- private final ConsumerPullTokenExpirationDateFunction tokenExpirationDateFunction = mock();
54-
55- private final ConsumerPullDataPlaneProxyResolver resolver = new ConsumerPullDataPlaneProxyResolver(dataEncrypter, TYPE_MANAGER, tokenGenerationService, () -> "test-private-key", () -> "test-public-key", tokenExpirationDateFunction);
56-
57- private static DataAddress dataAddress() {
58- return DataAddress.Builder.newInstance().type(UUID.randomUUID().toString()).build();
59- }
60-
61- @Test
62- void verifyToDataAddressSuccess() {
63- var address = dataAddress();
64- var encryptedAddress = "encryptedAddress";
65- var expiration = Date.from(Instant.now().plusSeconds(100));
66- var proxyUrl = "test.proxy.url";
67- var token = "token-test";
68- var instance = DataPlaneInstance.Builder.newInstance()
69- .id(UUID.randomUUID().toString())
70- .url("http://some.test.url")
71- .property("publicApiUrl", proxyUrl)
72- .build();
73- var transferProcess = transferProcessBuilder().build();
74-
75- var captor = ArgumentCaptor.forClass(TokenDecorator[].class);
76- when(dataEncrypter.encrypt(TYPE_MANAGER.writeValueAsString(address))).thenReturn(encryptedAddress);
77- when(tokenExpirationDateFunction.expiresAt(address, transferProcess.getContractId())).thenReturn(Result.success(expiration));
78- when(tokenGenerationService.generate(anyString(), captor.capture()))
79- .thenReturn(Result.success(TokenRepresentation.Builder.newInstance().token(token).build()));
80-
81- var result = resolver.toDataAddress(transferProcess, address, instance);
82-
83- assertThat(result.succeeded()).isTrue();
84- var proxyAddress = result.getContent();
85- assertThat(proxyAddress.getType()).isEqualTo(EndpointDataReference.EDR_SIMPLE_TYPE);
86- assertThat(proxyAddress.getProperties())
87- .containsEntry(EndpointDataReference.ID, transferProcess.getCorrelationId())
88- .containsEntry(EndpointDataReference.CONTRACT_ID, transferProcess.getContractId())
89- .containsEntry(EndpointDataReference.ENDPOINT, proxyUrl)
90- .containsEntry(EndpointDataReference.AUTH_KEY, HttpHeaders.AUTHORIZATION)
91- .containsEntry(EndpointDataReference.AUTH_CODE, token);
92-
93- var decorators = captor.getValue();
94-
95- assertThat(decorators)
96- .anySatisfy(decorator -> {
97- var builder = TokenParameters.Builder.newInstance();
98- decorator.decorate(builder);
99- assertThat(builder.build().getClaims())
100- .containsEntry(DATA_ADDRESS, encryptedAddress)
101- .containsEntry(EXPIRATION_TIME, expiration);
102- });
103-
104- assertThat(decorators).anySatisfy(decorator -> {
105- var builder = TokenParameters.Builder.newInstance();
106- decorator.decorate(builder);
107- assertThat(builder.build().getHeaders())
108- .containsEntry("kid", "test-public-key");
109- });
110- }
111-
112- @Test
113- void verifyToDataAddressReturnsFailureIfMissingPublicApiUrl() {
114- var instance = DataPlaneInstance.Builder.newInstance()
115- .id(UUID.randomUUID().toString())
116- .url("http://some.test.url")
117- .build();
118- var transferProcess = transferProcessBuilder().build();
119-
120- var result = resolver.toDataAddress(transferProcess, dataAddress(), instance);
121-
122- assertThat(result.failed()).isTrue();
123- assertThat(result.getFailureDetail()).isEqualTo("Missing property `https://w3id.org/edc/v0.0.1/ns/publicApiUrl` (deprecated: `publicApiUrl`) in DataPlaneInstance");
124- }
125-
126- @Test
127- void verifyToDataAddressReturnsFailureIfTokenExpirationDateFunctionFails() {
128- var address = dataAddress();
129- var errorMsg = "error test";
130- var instance = DataPlaneInstance.Builder.newInstance()
131- .id(UUID.randomUUID().toString())
132- .url("http://some.test.url")
133- .property("publicApiUrl", "test.proxy.url")
134- .build();
135- var transferProcess = transferProcessBuilder().build();
136-
137- when(dataEncrypter.encrypt(TYPE_MANAGER.writeValueAsString(address))).thenReturn("encryptedAddress");
138- when(tokenExpirationDateFunction.expiresAt(any(), any())).thenReturn(Result.failure(errorMsg));
139-
140- var result = resolver.toDataAddress(transferProcess, address, instance);
141-
142- assertThat(result.failed()).isTrue();
143- assertThat(result.getFailureDetail()).contains(errorMsg);
144- }
145-
146- @Test
147- void verifyToDataAddressReturnsFailureIfTokenGenerationFails() {
148- var address = dataAddress();
149- var errorMsg = "error test";
150- var transferProcess = transferProcessBuilder().build();
151- var expiration = Date.from(Instant.now().plusSeconds(100));
152- var instance = DataPlaneInstance.Builder.newInstance()
153- .id(UUID.randomUUID().toString())
154- .url("http://some.test.url")
155- .property("publicApiUrl", "test.proxy.url")
156- .build();
157-
158- when(dataEncrypter.encrypt(TYPE_MANAGER.writeValueAsString(address))).thenReturn("encryptedAddress");
159- when(tokenExpirationDateFunction.expiresAt(address, transferProcess.getContractId())).thenReturn(Result.success(expiration));
160- when(tokenGenerationService.generate(anyString(), any(TokenDecorator[].class))).thenReturn(Result.failure(errorMsg));
161-
162- var result = resolver.toDataAddress(transferProcess, address, instance);
163-
164- assertThat(result.failed()).isTrue();
165- assertThat(result.getFailureDetail()).contains(errorMsg);
166- }
167-
168- private TransferProcess.Builder transferProcessBuilder() {
169- return TransferProcess.Builder.newInstance()
170- .correlationId(UUID.randomUUID().toString())
171- .protocol("test-protocol")
172- .contractId(UUID.randomUUID().toString())
173- .assetId(UUID.randomUUID().toString())
174- .counterPartyAddress("test.connector.address")
175- .dataDestination(DataAddress.Builder.newInstance().type(HTTP_PROXY).build());
176- }
177-}
deleted extensions/control-plane/transfer/transfer-data-plane/src/test/java/org/eclipse/edc/connector/controlplane/transfer/dataplane/proxy/ConsumerPullDataPlaneProxyTokenDecoratorTest.java +0 −59
@@ -1,59 +0,0 @@
1-/*
2- * Copyright (c) 2022 Amadeus
3- *
4- * This program and the accompanying materials are made available under the
5- * terms of the Apache License, Version 2.0 which is available at
6- * https://www.apache.org/licenses/LICENSE-2.0
7- *
8- * SPDX-License-Identifier: Apache-2.0
9- *
10- * Contributors:
11- * Amadeus - initial API and implementation
12- *
13- */
14-
15-package org.eclipse.edc.connector.controlplane.transfer.dataplane.proxy;
16-
17-import org.eclipse.edc.spi.iam.TokenParameters;
18-import org.junit.jupiter.api.BeforeEach;
19-import org.junit.jupiter.api.Test;
20-
21-import java.time.Instant;
22-import java.util.Date;
23-import java.util.HashMap;
24-import java.util.UUID;
25-import java.util.concurrent.ThreadLocalRandom;
26-
27-import static com.nimbusds.jwt.JWTClaimNames.EXPIRATION_TIME;
28-import static org.assertj.core.api.Assertions.assertThat;
29-import static org.eclipse.edc.connector.controlplane.transfer.dataplane.spi.TransferDataPlaneConstants.DATA_ADDRESS;
30-
31-class ConsumerPullDataPlaneProxyTokenDecoratorTest {
32-
33- private Date expiration;
34- private String encryptedDataAddress;
35-
36- private ConsumerPullDataPlaneProxyTokenDecorator decorator;
37-
38- @BeforeEach
39- public void setUp() {
40- expiration = Date.from(Instant.now().plusSeconds(ThreadLocalRandom.current().nextInt(1, 10)));
41- encryptedDataAddress = UUID.randomUUID().toString();
42- decorator = new ConsumerPullDataPlaneProxyTokenDecorator(expiration, encryptedDataAddress);
43- }
44-
45- @Test
46- void verifyDecorate() {
47-
48- var headers = new HashMap<String, Object>();
49- var claims = new HashMap<String, Object>();
50- var b = TokenParameters.Builder.newInstance();
51- decorator.decorate(b);
52-
53-
54- assertThat(b.build().getHeaders()).isEmpty();
55- assertThat(b.build().getClaims())
56- .containsEntry(DATA_ADDRESS, encryptedDataAddress)
57- .containsEntry(EXPIRATION_TIME, expiration);
58- }
59-}
No newline at the end of the file
deleted extensions/control-plane/transfer/transfer-data-plane/src/test/java/org/eclipse/edc/connector/controlplane/transfer/dataplane/validation/ExpirationDateValidationRuleTest.java +0 −67
@@ -1,67 +0,0 @@
1-/*
2- * Copyright (c) 2022 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
3- *
4- * This program and the accompanying materials are made available under the
5- * terms of the Apache License, Version 2.0 which is available at
6- * https://www.apache.org/licenses/LICENSE-2.0
7- *
8- * SPDX-License-Identifier: Apache-2.0
9- *
10- * Contributors:
11- * Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation
12- *
13- */
14-
15-package org.eclipse.edc.connector.controlplane.transfer.dataplane.validation;
16-
17-import org.eclipse.edc.spi.iam.ClaimToken;
18-import org.eclipse.edc.spi.result.Result;
19-import org.junit.jupiter.api.Test;
20-
21-import java.sql.Date;
22-import java.time.Clock;
23-import java.time.Instant;
24-
25-import static com.nimbusds.jwt.JWTClaimNames.EXPIRATION_TIME;
26-import static java.time.ZoneOffset.UTC;
27-import static java.util.Collections.emptyMap;
28-import static org.assertj.core.api.Assertions.assertThat;
29-
30-class ExpirationDateValidationRuleTest {
31-
32- private final Instant now = Instant.now();
33- private final ExpirationDateValidationRule rule = new ExpirationDateValidationRule(Clock.fixed(now, UTC));
34-
35- @Test
36- void failsWithoutExpiration() {
37- var token = ClaimToken.Builder.newInstance().build();
38-
39- var result = rule.checkRule(token, emptyMap());
40-
41- assertThat(result).matches(Result::failed)
42- .extracting(Result::getFailureDetail).isEqualTo("Missing expiration time in token");
43- }
44-
45- @Test
46- void failsIfTokenIsExpired() {
47- var token = ClaimToken.Builder.newInstance()
48- .claim(EXPIRATION_TIME, Date.from(now))
49- .build();
50-
51- var result = rule.checkRule(token, emptyMap());
52-
53- assertThat(result).matches(Result::failed)
54- .extracting(Result::getFailureDetail).asString().startsWith("Token has expired on");
55- }
56-
57- @Test
58- void succeedIfTokenIsNotExpired() {
59- var token = ClaimToken.Builder.newInstance()
60- .claim(EXPIRATION_TIME, Date.from(now.plusMillis(1)))
61- .build();
62-
63- var result = rule.checkRule(token, emptyMap());
64-
65- assertThat(result).matches(Result::succeeded);
66- }
67-}
No newline at the end of the file
deleted extensions/control-plane/transfer/transfer-data-plane/src/test/resources/rsa-pubkey.pem +0 −9
@@ -1,9 +0,0 @@
1------BEGIN PUBLIC KEY-----
2-MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAi4zQvCGMlQ0N7wsKIU8N
3-5aExdhxPPiFqUvV27+WtbPdREEVAmOESUeW00+JO2EBSjuIf4ny4yCRhykr8CjqQ
4-HFN+ehXaTjw8HyOK7izbExdMe0Bb+SoNcduYL6KRLqUp4QF5fym0vTulRPQ/lT3n
5-IVUfh4BoEasiWc+cP/7y0qDtsjmiDlPUTRi6UJJHDOokS1P800weSRbDMQmX3zFO
6-+fztK6zklnbBhuZHjmnuIvqKncFvAgs2ZQkuYEhz/dWAqs5Jepyy4S7SZ4stvHzJ
7-zpwimRHWJEm0XEK56wrGt7V5j63fXvl72KpncWyNHm+2Obru1OrPBGaHm0kNZnCi
8-jwIDAQAB
9------END PUBLIC KEY-----
No newline at the end of the file
deleted extensions/data-plane/data-plane-client-embedded/build.gradle.kts +0 −32
@@ -1,32 +0,0 @@
1-/*
2- * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
3- *
4- * This program and the accompanying materials are made available under the
5- * terms of the Apache License, Version 2.0 which is available at
6- * https://www.apache.org/licenses/LICENSE-2.0
7- *
8- * SPDX-License-Identifier: Apache-2.0
9- *
10- * Contributors:
11- * Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation
12- *
13- */
14-
15-
16-plugins {
17- `java-library`
18-}
19-
20-dependencies {
21- api(project(":spi:data-plane:data-plane-spi"))
22- api(project(":spi:data-plane-selector:data-plane-selector-spi"))
23-
24- implementation(libs.opentelemetry.instrumentation.annotations)
25-
26- testImplementation(project(":core:common:junit"))
27- testImplementation(libs.restAssured)
28- testImplementation(libs.mockserver.netty)
29- testImplementation(libs.mockserver.client)
30-}
31-
32-
deleted extensions/data-plane/data-plane-client-embedded/src/main/java/org/eclipse/edc/connector/dataplane/client/EmbeddedDataPlaneClient.java +0 −67
@@ -1,67 +0,0 @@
1-/*
2- * Copyright (c) 2022 Amadeus
3- *
4- * This program and the accompanying materials are made available under the
5- * terms of the Apache License, Version 2.0 which is available at
6- * https://www.apache.org/licenses/LICENSE-2.0
7- *
8- * SPDX-License-Identifier: Apache-2.0
9- *
10- * Contributors:
11- * Amadeus - initial API and implementation
12- *
13- */
14-
15-package org.eclipse.edc.connector.dataplane.client;
16-
17-import io.opentelemetry.instrumentation.annotations.WithSpan;
18-import org.eclipse.edc.connector.dataplane.selector.spi.client.DataPlaneClient;
19-import org.eclipse.edc.connector.dataplane.spi.manager.DataPlaneManager;
20-import org.eclipse.edc.spi.response.ResponseStatus;
21-import org.eclipse.edc.spi.response.StatusResult;
22-import org.eclipse.edc.spi.types.domain.transfer.DataFlowResponseMessage;
23-import org.eclipse.edc.spi.types.domain.transfer.DataFlowStartMessage;
24-
25-import java.util.Objects;
26-
27-/**
28- * Implementation of a {@link DataPlaneClient} that uses a local {@link DataPlaneManager},
29- * i.e. one that runs in the same JVM as the control plane.
30- */
31-public class EmbeddedDataPlaneClient implements DataPlaneClient {
32-
33- private final DataPlaneManager dataPlaneManager;
34-
35- public EmbeddedDataPlaneClient(DataPlaneManager dataPlaneManager) {
36- this.dataPlaneManager = Objects.requireNonNull(dataPlaneManager, "Data plane manager");
37- }
38-
39- @WithSpan
40- @Override
41- public StatusResult<DataFlowResponseMessage> start(DataFlowStartMessage request) {
42- var result = dataPlaneManager.validate(request);
43- if (result.failed()) {
44- return StatusResult.failure(ResponseStatus.FATAL_ERROR, result.getFailureDetail());
45- }
46- var startResult = dataPlaneManager.start(request);
47- if (startResult.failed()) {
48- return StatusResult.failure(ResponseStatus.FATAL_ERROR, startResult.getFailureDetail());
49- }
50- return StatusResult.success(startResult.getContent());
51- }
52-
53- @Override
54- public StatusResult<Void> suspend(String transferProcessId) {
55- return dataPlaneManager.suspend(transferProcessId);
56- }
57-
58- @Override
59- public StatusResult<Void> terminate(String transferProcessId) {
60- return dataPlaneManager.terminate(transferProcessId);
61- }
62-
63- @Override
64- public StatusResult<Void> checkAvailability() {
65- return StatusResult.success();
66- }
67-}
deleted extensions/data-plane/data-plane-client-embedded/src/test/java/org/eclipse/edc/connector/dataplane/client/EmbeddedDataPlaneClientTest.java +0 −112
@@ -1,112 +0,0 @@
1-/*
2- * Copyright (c) 2022 Amadeus
3- *
4- * This program and the accompanying materials are made available under the
5- * terms of the Apache License, Version 2.0 which is available at
6- * https://www.apache.org/licenses/LICENSE-2.0
7- *
8- * SPDX-License-Identifier: Apache-2.0
9- *
10- * Contributors:
11- * Amadeus - initial API and implementation
12- *
13- */
14-
15-package org.eclipse.edc.connector.dataplane.client;
16-
17-import org.eclipse.edc.connector.dataplane.selector.spi.client.DataPlaneClient;
18-import org.eclipse.edc.connector.dataplane.spi.manager.DataPlaneManager;
19-import org.eclipse.edc.spi.response.StatusResult;
20-import org.eclipse.edc.spi.result.Result;
21-import org.eclipse.edc.spi.types.domain.DataAddress;
22-import org.eclipse.edc.spi.types.domain.transfer.DataFlowResponseMessage;
23-import org.eclipse.edc.spi.types.domain.transfer.DataFlowStartMessage;
24-import org.junit.jupiter.api.Test;
25-
26-import static org.assertj.core.api.Assertions.assertThat;
27-import static org.eclipse.edc.junit.assertions.AbstractResultAssert.assertThat;
28-import static org.mockito.ArgumentMatchers.any;
29-import static org.mockito.Mockito.mock;
30-import static org.mockito.Mockito.never;
31-import static org.mockito.Mockito.verify;
32-import static org.mockito.Mockito.when;
33-
34-class EmbeddedDataPlaneClientTest {
35-
36- private final DataPlaneManager dataPlaneManager = mock();
37- private final DataPlaneClient client = new EmbeddedDataPlaneClient(dataPlaneManager);
38-
39- private static DataFlowStartMessage createDataFlowRequest() {
40- return DataFlowStartMessage.Builder.newInstance()
41- .id("123")
42- .processId("456")
43- .sourceDataAddress(DataAddress.Builder.newInstance().type("test").build())
44- .destinationDataAddress(DataAddress.Builder.newInstance().type("test").build())
45- .build();
46- }
47-
48- @Test
49- void transfer_shouldSucceed_whenTransferInitiatedCorrectly() {
50- var response = DataFlowResponseMessage.Builder.newInstance().dataAddress(DataAddress.Builder.newInstance().type("type").build()).build();
51- var request = createDataFlowRequest();
52- when(dataPlaneManager.validate(any())).thenReturn(Result.success(true));
53- when(dataPlaneManager.start(any())).thenReturn(Result.success(response));
54-
55- var result = client.start(request);
56-
57- verify(dataPlaneManager).validate(request);
58- verify(dataPlaneManager).start(request);
59-
60- assertThat(result).isSucceeded().isEqualTo(response);
61- }
62-
63- @Test
64- void transfer_shouldReturnFailedResult_whenValidationFailure() {
65- var errorMsg = "error";
66- var request = createDataFlowRequest();
67- when(dataPlaneManager.validate(any())).thenReturn(Result.failure(errorMsg));
68- when(dataPlaneManager.start(any())).thenReturn(Result.success(DataFlowResponseMessage.Builder.newInstance().build()));
69-
70- var result = client.start(request);
71-
72- verify(dataPlaneManager).validate(request);
73- verify(dataPlaneManager, never()).start(any());
74-
75- assertThat(result).isFailed().messages().hasSize(1).allSatisfy(s -> assertThat(s).contains(errorMsg));
76- }
77-
78- @Test
79- void transfer_shouldReturnFailedResult_whenStartFailure() {
80- var errorMsg = "error";
81- var request = createDataFlowRequest();
82- when(dataPlaneManager.validate(any())).thenReturn(Result.success(true));
83- when(dataPlaneManager.start(any())).thenReturn(Result.failure(errorMsg));
84-
85- var result = client.start(request);
86-
87- verify(dataPlaneManager).validate(request);
88- verify(dataPlaneManager).start(request);
89-
90- assertThat(result).isFailed().messages().hasSize(1).allSatisfy(s -> assertThat(s).contains(errorMsg));
91- }
92-
93- @Test
94- void suspend_shouldProxyCallToManager() {
95- when(dataPlaneManager.suspend(any())).thenReturn(StatusResult.success());
96-
97- var result = client.suspend("dataFlowId");
98-
99- assertThat(result).isSucceeded();
100- verify(dataPlaneManager).suspend("dataFlowId");
101- }
102-
103- @Test
104- void terminate_shouldProxyCallToManager() {
105- when(dataPlaneManager.terminate(any())).thenReturn(StatusResult.success());
106-
107- var result = client.terminate("dataFlowId");
108-
109- assertThat(result).isSucceeded();
110- verify(dataPlaneManager).terminate("dataFlowId");
111- }
112-}
deleted extensions/data-plane/data-plane-client/build.gradle.kts +0 −39
@@ -1,39 +0,0 @@
1-/*
2- * Copyright (c) 2022 Microsoft Corporation
3- *
4- * This program and the accompanying materials are made available under the
5- * terms of the Apache License, Version 2.0 which is available at
6- * https://www.apache.org/licenses/LICENSE-2.0
7- *
8- * SPDX-License-Identifier: Apache-2.0
9- *
10- * Contributors:
11- * Microsoft Corporation - initial API and implementation
12- * Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - improvements
13- *
14- */
15-
16-
17-plugins {
18- `java-library`
19-}
20-
21-dependencies {
22- api(project(":spi:common:auth-spi"))
23- api(project(":spi:common:http-spi"))
24- api(project(":spi:data-plane:data-plane-spi"))
25- api(project(":spi:data-plane-selector:data-plane-selector-spi"))
26- implementation(project(":core:common:lib:util-lib"))
27- implementation(project(":extensions:data-plane:data-plane-client-embedded"))
28-
29- implementation(libs.opentelemetry.instrumentation.annotations)
30-
31- testImplementation(project(":core:common:junit"))
32- testImplementation(libs.restAssured)
33- testImplementation(libs.mockserver.netty)
34- testImplementation(libs.mockserver.client)
35-
36- testImplementation(testFixtures(project(":core:common:lib:http-lib")))
37-}
38-
39-
deleted extensions/data-plane/data-plane-client/src/main/java/org/eclipse/edc/connector/dataplane/client/DataPlaneClientExtension.java +0 −68
@@ -1,68 +0,0 @@
1-/*
2- * Copyright (c) 2022 Microsoft Corporation
3- *
4- * This program and the accompanying materials are made available under the
5- * terms of the Apache License, Version 2.0 which is available at
6- * https://www.apache.org/licenses/LICENSE-2.0
7- *
8- * SPDX-License-Identifier: Apache-2.0
9- *
10- * Contributors:
11- * Microsoft Corporation - initial API and implementation
12- *
13- */
14-
15-package org.eclipse.edc.connector.dataplane.client;
16-
17-import org.eclipse.edc.connector.dataplane.selector.spi.client.DataPlaneClientFactory;
18-import org.eclipse.edc.connector.dataplane.spi.manager.DataPlaneManager;
19-import org.eclipse.edc.http.spi.ControlApiHttpClient;
20-import org.eclipse.edc.runtime.metamodel.annotation.Extension;
21-import org.eclipse.edc.runtime.metamodel.annotation.Inject;
22-import org.eclipse.edc.runtime.metamodel.annotation.Provider;
23-import org.eclipse.edc.spi.system.ServiceExtension;
24-import org.eclipse.edc.spi.system.ServiceExtensionContext;
25-import org.eclipse.edc.spi.types.TypeManager;
26-
27-import java.util.Objects;
28-
29-/**
30- * This extension provides the Data Plane API:
31- * - Control API: set of endpoints to trigger/monitor/cancel data transfers that should be accessible only from the Control Plane.
32- * - Public API: generic endpoint open to other participants of the Dataspace and used to proxy a data request to the actual data source.
33- *
34- * @deprecated replaced by data-plane-signaling.
35- */
36-@Extension(value = DataPlaneClientExtension.NAME)
37-@Deprecated(since = "0.6.0")
38-public class DataPlaneClientExtension implements ServiceExtension {
39- public static final String NAME = "DEPRECATED: Data Plane Client";
40-
41- @Inject(required = false)
42- private DataPlaneManager dataPlaneManager;
43- @Inject(required = false)
44- private ControlApiHttpClient httpClient;
45- @Inject
46- private TypeManager typeManager;
47-
48- @Override
49- public String name() {
50- return NAME;
51- }
52-
53- @Provider
54- public DataPlaneClientFactory dataPlaneClientFactory(ServiceExtensionContext context) {
55- context.getMonitor().warning("the `data-plane-client` extension has been deprecated, please switch to data-plane-signaling");
56- if (dataPlaneManager != null) {
57- // Data plane manager is embedded in the current runtime
58- context.getMonitor().debug(() -> "Using embedded Data Plane client.");
59- return instance -> new EmbeddedDataPlaneClient(dataPlaneManager);
60- }
61-
62- context.getMonitor().debug(() -> "Using remote Data Plane client.");
63- Objects.requireNonNull(httpClient, "To use remote Data Plane client, a ControlApiHttpClient instance must be registered");
64- return instance -> new RemoteDataPlaneClient(httpClient, typeManager.getMapper(), instance);
65- }
66-}
67-
68-
deleted extensions/data-plane/data-plane-client/src/main/java/org/eclipse/edc/connector/dataplane/client/RemoteDataPlaneClient.java +0 −86
@@ -1,86 +0,0 @@
1-/*
2- * Copyright (c) 2022 Amadeus
3- *
4- * This program and the accompanying materials are made available under the
5- * terms of the Apache License, Version 2.0 which is available at
6- * https://www.apache.org/licenses/LICENSE-2.0
7- *
8- * SPDX-License-Identifier: Apache-2.0
9- *
10- * Contributors:
11- * Amadeus - initial API and implementation
12- *
13- */
14-
15-package org.eclipse.edc.connector.dataplane.client;
16-
17-import com.fasterxml.jackson.core.JsonProcessingException;
18-import com.fasterxml.jackson.databind.ObjectMapper;
19-import io.opentelemetry.instrumentation.annotations.WithSpan;
20-import okhttp3.MediaType;
21-import okhttp3.Request;
22-import okhttp3.RequestBody;
23-import org.eclipse.edc.connector.dataplane.selector.spi.client.DataPlaneClient;
24-import org.eclipse.edc.connector.dataplane.selector.spi.instance.DataPlaneInstance;
25-import org.eclipse.edc.connector.dataplane.spi.manager.DataPlaneManager;
26-import org.eclipse.edc.http.spi.ControlApiHttpClient;
27-import org.eclipse.edc.spi.EdcException;
28-import org.eclipse.edc.spi.response.StatusResult;
29-import org.eclipse.edc.spi.types.domain.transfer.DataFlowResponseMessage;
30-import org.eclipse.edc.spi.types.domain.transfer.DataFlowStartMessage;
31-
32-import static org.eclipse.edc.spi.response.ResponseStatus.FATAL_ERROR;
33-
34-/**
35- * Implementation of a {@link DataPlaneClient} that uses a remote {@link DataPlaneManager} accessible from a REST API.
36- *
37- * @deprecated replaced by data-plane-signaling.
38- */
39-@Deprecated(since = "0.6.0")
40-public class RemoteDataPlaneClient implements DataPlaneClient {
41- public static final MediaType TYPE_JSON = MediaType.parse("application/json");
42- private final ControlApiHttpClient httpClient;
43- private final ObjectMapper mapper;
44- private final DataPlaneInstance dataPlane;
45-
46- public RemoteDataPlaneClient(ControlApiHttpClient httpClient, ObjectMapper mapper, DataPlaneInstance dataPlane) {
47- this.httpClient = httpClient;
48- this.mapper = mapper;
49- this.dataPlane = dataPlane;
50- }
51-
52- @WithSpan
53- @Override
54- public StatusResult<DataFlowResponseMessage> start(DataFlowStartMessage dataFlowStartMessage) {
55- RequestBody body;
56- try {
57- body = RequestBody.create(mapper.writeValueAsString(dataFlowStartMessage), TYPE_JSON);
58- } catch (JsonProcessingException e) {
59- throw new EdcException(e);
60- }
61- var builder = new Request.Builder().post(body).url(dataPlane.getUrl());
62-
63- return httpClient.execute(builder)
64- .map(it -> StatusResult.success(DataFlowResponseMessage.Builder.newInstance().build()))
65- .orElse(f -> StatusResult.failure(FATAL_ERROR, f.getFailureDetail()));
66- }
67-
68- @Override
69- public StatusResult<Void> suspend(String transferProcessId) {
70- throw new RuntimeException("not implemented");
71- }
72-
73- @Override
74- public StatusResult<Void> terminate(String transferProcessId) {
75- var builder = new Request.Builder().delete().url(dataPlane.getUrl() + "/" + transferProcessId);
76-
77- return httpClient.execute(builder)
78- .map(it -> StatusResult.success())
79- .orElse(f -> StatusResult.failure(FATAL_ERROR, f.getFailureDetail()));
80- }
81-
82- @Override
83- public StatusResult<Void> checkAvailability() {
84- throw new UnsupportedOperationException("feature not implemented for deprecated client");
85- }
86-}
deleted extensions/data-plane/data-plane-client/src/main/resources/META-INF/services/org.eclipse.edc.spi.system.ServiceExtension +0 −1
@@ -1,1 +0,0 @@
1-org.eclipse.edc.connector.dataplane.client.DataPlaneClientExtension
deleted extensions/data-plane/data-plane-client/src/test/java/org/eclipse/edc/connector/dataplane/client/DataPlaneClientExtensionTest.java +0 −68
@@ -1,68 +0,0 @@
1-/*
2- * Copyright (c) 2022 Amadeus
3- *
4- * This program and the accompanying materials are made available under the
5- * terms of the Apache License, Version 2.0 which is available at
6- * https://www.apache.org/licenses/LICENSE-2.0
7- *
8- * SPDX-License-Identifier: Apache-2.0
9- *
10- * Contributors:
11- * Amadeus - initial API and implementation
12- *
13- */
14-
15-package org.eclipse.edc.connector.dataplane.client;
16-
17-import dev.failsafe.RetryPolicy;
18-import org.eclipse.edc.boot.system.injection.ObjectFactory;
19-import org.eclipse.edc.connector.dataplane.selector.spi.instance.DataPlaneInstance;
20-import org.eclipse.edc.connector.dataplane.spi.manager.DataPlaneManager;
21-import org.eclipse.edc.http.spi.EdcHttpClient;
22-import org.eclipse.edc.json.JacksonTypeManager;
23-import org.eclipse.edc.junit.extensions.DependencyInjectionExtension;
24-import org.eclipse.edc.spi.system.ServiceExtensionContext;
25-import org.eclipse.edc.spi.types.TypeManager;
26-import org.junit.jupiter.api.BeforeEach;
27-import org.junit.jupiter.api.Test;
28-import org.junit.jupiter.api.extension.ExtendWith;
29-
30-import static org.assertj.core.api.Assertions.assertThat;
31-import static org.mockito.Mockito.mock;
32-
33-@ExtendWith(DependencyInjectionExtension.class)
34-class DataPlaneClientExtensionTest {
35-
36- @BeforeEach
37- void setUp(ServiceExtensionContext context) {
38- context.registerService(TypeManager.class, new JacksonTypeManager());
39- }
40-
41- @Test
42- void verifyReturnEmbeddedClient(ServiceExtensionContext context, ObjectFactory factory) {
43- context.registerService(DataPlaneManager.class, mock(DataPlaneManager.class));
44-
45- var extension = factory.constructInstance(DataPlaneClientExtension.class);
46-
47- var client = extension.dataPlaneClientFactory(context).createClient(createDataPlaneInstance());
48-
49- assertThat(client).isInstanceOf(EmbeddedDataPlaneClient.class);
50- }
51-
52- @Test
53- void verifyReturnRemoteClient(ServiceExtensionContext context, ObjectFactory factory) {
54- context.registerService(DataPlaneManager.class, null);
55- context.registerService(EdcHttpClient.class, mock(EdcHttpClient.class));
56- context.registerService(RetryPolicy.class, mock(RetryPolicy.class));
57-
58- var extension = factory.constructInstance(DataPlaneClientExtension.class);
59-
60- var client = extension.dataPlaneClientFactory(context).createClient(createDataPlaneInstance());
61-
62- assertThat(client).isInstanceOf(RemoteDataPlaneClient.class);
63- }
64-
65- private DataPlaneInstance createDataPlaneInstance() {
66- return DataPlaneInstance.Builder.newInstance().url("http://any").build();
67- }
68-}
deleted extensions/data-plane/data-plane-client/src/test/java/org/eclipse/edc/connector/dataplane/client/RemoteDataPlaneClientTest.java +0 −167
@@ -1,167 +0,0 @@
1-/*
2- * Copyright (c) 2022 Amadeus
3- *
4- * This program and the accompanying materials are made available under the
5- * terms of the Apache License, Version 2.0 which is available at
6- * https://www.apache.org/licenses/LICENSE-2.0
7- *
8- * SPDX-License-Identifier: Apache-2.0
9- *
10- * Contributors:
11- * Amadeus - initial API and implementation
12- *
13- */
14-
15-package org.eclipse.edc.connector.dataplane.client;
16-
17-import com.fasterxml.jackson.core.JsonProcessingException;
18-import com.fasterxml.jackson.databind.ObjectMapper;
19-import org.eclipse.edc.connector.dataplane.selector.spi.client.DataPlaneClient;
20-import org.eclipse.edc.connector.dataplane.selector.spi.instance.DataPlaneInstance;
21-import org.eclipse.edc.connector.dataplane.spi.response.TransferErrorResponse;
22-import org.eclipse.edc.http.client.ControlApiHttpClientImpl;
23-import org.eclipse.edc.http.spi.ControlApiHttpClient;
24-import org.eclipse.edc.json.JacksonTypeManager;
25-import org.eclipse.edc.spi.response.ResponseStatus;
26-import org.eclipse.edc.spi.types.domain.DataAddress;
27-import org.eclipse.edc.spi.types.domain.transfer.DataFlowStartMessage;
28-import org.junit.jupiter.api.AfterAll;
29-import org.junit.jupiter.api.AfterEach;
30-import org.junit.jupiter.api.BeforeAll;
31-import org.junit.jupiter.api.Test;
32-import org.mockserver.integration.ClientAndServer;
33-import org.mockserver.model.HttpRequest;
34-import org.mockserver.model.HttpResponse;
35-import org.mockserver.model.HttpStatusCode;
36-import org.mockserver.model.MediaType;
37-import org.mockserver.verify.VerificationTimes;
38-
39-import java.util.List;
40-import java.util.UUID;
41-
42-import static org.assertj.core.api.Assertions.assertThat;
43-import static org.eclipse.edc.http.client.testfixtures.HttpTestUtils.testHttpClient;
44-import static org.eclipse.edc.junit.assertions.AbstractResultAssert.assertThat;
45-import static org.eclipse.edc.util.io.Ports.getFreePort;
46-import static org.mockito.Mockito.mock;
47-import static org.mockserver.integration.ClientAndServer.startClientAndServer;
48-import static org.mockserver.matchers.Times.once;
49-import static org.mockserver.model.HttpRequest.request;
50-import static org.mockserver.model.HttpResponse.response;
51-import static org.mockserver.model.HttpStatusCode.CONFLICT_409;
52-import static org.mockserver.model.HttpStatusCode.NO_CONTENT_204;
53-import static org.mockserver.stop.Stop.stopQuietly;
54-
55-class RemoteDataPlaneClientTest {
56-
57- private static final ObjectMapper MAPPER = new JacksonTypeManager().getMapper();
58-
59- private static final int DATA_PLANE_API_PORT = getFreePort();
60- private static final String DATA_PLANE_PATH = "/transfer";
61- private static final String DATA_PLANE_API_URI = "http://localhost:" + DATA_PLANE_API_PORT + DATA_PLANE_PATH;
62- private static ClientAndServer dataPlane;
63- private final DataPlaneInstance instance = DataPlaneInstance.Builder.newInstance().url(DATA_PLANE_API_URI).build();
64- private final ControlApiHttpClient httpClient = new ControlApiHttpClientImpl(testHttpClient(), mock());
65-
66- private final DataPlaneClient dataPlaneClient = new RemoteDataPlaneClient(httpClient, MAPPER, instance);
67-
68- @BeforeAll
69- public static void setUp() {
70- dataPlane = startClientAndServer(DATA_PLANE_API_PORT);
71- }
72-
73- @AfterAll
74- public static void tearDown() {
75- stopQuietly(dataPlane);
76- }
77-
78- @AfterEach
79- public void resetMockServer() {
80- dataPlane.reset();
81- }
82-
83- @Test
84- void transfer_verifyReturnFatalErrorIfReceiveResponseWithNullBody() throws JsonProcessingException {
85- var flowRequest = createDataFlowRequest();
86-
87- var httpRequest = new HttpRequest().withPath(DATA_PLANE_PATH).withBody(MAPPER.writeValueAsString(flowRequest));
88- dataPlane.when(request()).respond(response().withStatusCode(HttpStatusCode.BAD_REQUEST_400.code()));
89-
90- var result = dataPlaneClient.start(flowRequest);
91-
92- dataPlane.verify(httpRequest);
93-
94- assertThat(result).isFailed().satisfies(failure -> {
95- assertThat(failure.status()).isEqualTo(ResponseStatus.FATAL_ERROR);
96- assertThat(failure.getMessages()).anySatisfy(s -> assertThat(s).contains("400"));
97- });
98- }
99-
100- @Test
101- void transfer_verifyReturnFatalErrorIfReceiveErrorInResponse() throws JsonProcessingException {
102- var flowRequest = createDataFlowRequest();
103-
104- var httpRequest = new HttpRequest().withPath(DATA_PLANE_PATH).withBody(MAPPER.writeValueAsString(flowRequest));
105- var errorMsg = UUID.randomUUID().toString();
106- dataPlane.when(httpRequest, once()).respond(withResponse(errorMsg));
107-
108- var result = dataPlaneClient.start(flowRequest);
109-
110- dataPlane.verify(httpRequest);
111-
112- assertThat(result).isFailed().satisfies(failure -> {
113- assertThat(failure.status()).isEqualTo(ResponseStatus.FATAL_ERROR);
114- assertThat(failure.getMessages()).anySatisfy(s -> assertThat(s).contains("404"));
115- });
116- }
117-
118- @Test
119- void transfer_verifyTransferSuccess() throws JsonProcessingException {
120- var flowRequest = createDataFlowRequest();
121-
122- var httpRequest = new HttpRequest().withPath(DATA_PLANE_PATH).withBody(MAPPER.writeValueAsString(flowRequest));
123- dataPlane.when(httpRequest, once()).respond(response().withStatusCode(HttpStatusCode.OK_200.code()));
124-
125- var result = dataPlaneClient.start(flowRequest);
126-
127- dataPlane.verify(httpRequest, VerificationTimes.once());
128-
129- assertThat(result.succeeded()).isTrue();
130- }
131-
132- @Test
133- void terminate_shouldCallTerminateOnAllTheAvailableDataPlanes() {
134- var httpRequest = new HttpRequest().withMethod("DELETE").withPath(DATA_PLANE_PATH + "/processId");
135- dataPlane.when(httpRequest, once()).respond(response().withStatusCode(NO_CONTENT_204.code()));
136-
137- var result = dataPlaneClient.terminate("processId");
138-
139- assertThat(result).isSucceeded();
140- dataPlane.verify(httpRequest, VerificationTimes.once());
141- }
142-
143- @Test
144- void terminate_shouldFail_whenConflictResponse() {
145- var httpRequest = new HttpRequest().withMethod("DELETE").withPath(DATA_PLANE_PATH + "/processId");
146- dataPlane.when(httpRequest, once()).respond(response().withStatusCode(CONFLICT_409.code()));
147-
148- var result = dataPlaneClient.terminate("processId");
149-
150- assertThat(result).isFailed();
151- }
152-
153- private HttpResponse withResponse(String errorMsg) throws JsonProcessingException {
154- return response().withStatusCode(HttpStatusCode.BAD_REQUEST_400.code())
155- .withBody(MAPPER.writeValueAsString(new TransferErrorResponse(List.of(errorMsg))), MediaType.APPLICATION_JSON);
156- }
157-
158- private DataFlowStartMessage createDataFlowRequest() {
159- return DataFlowStartMessage.Builder.newInstance()
160- .id("123")
161- .processId("456")
162- .sourceDataAddress(DataAddress.Builder.newInstance().type("test").build())
163- .destinationDataAddress(DataAddress.Builder.newInstance().type("test").build())
164- .build();
165- }
166-
167-}
deleted extensions/data-plane/data-plane-control-api/README.md +0 −72
@@ -1,72 +0,0 @@
1-# Data Plane API
2-
3-This extension provides the interfaces and implementations for the Data Plane API, which are respectively:
4-
5-- the Control API which is used by the Control Plane to delegate the data transfer to its Data Plane,
6-- the Public API which is essentially a data proxy enabling a consumer to actively query data out from the provider data source.
7-
8-### Scope
9-
10-These APIs have been designed to support the different data transfer types that the Data Plane must support, which are:
11-
12-- Consumer Data Pull: the consumer backend applications use the Data Plane to proxy data request until the provided data source.
13- This data transfer type is exclusively built around the Public API of the Data Plane.
14-- Provider Push and Streaming: once contract is agreed by both participants, the Control Plane of the provider delegates
15- the data transfer to its Data Plane through the Control API.
16-
17-### Use Cases
18-
19-#### Use Case #1
20-
21-Provider wants to expose a Rest API taking as input some query parameters that restrict the amount of data returned for each query.
22-Here it is not feasible for the data consumer to negotiate a contract for each query that will hit the provider data source API.
23-Here the approach for the consumer would then be to
24-[negotiate with the provider the possibility to access the data source through a proxy](../../control-plane/data-plane-transfer/data-plane-transfer-sync/).
25-If the negotiation ends successfully, the consumer will be provided an access token that its backend applications can then use when querying the Data Plane public API.
26-
27-This approach enables the consumer backend application to pass directly the query parameters, path parameters and body
28-in the request to Data Plane public API. If the provider data source allows it, these parameters will then be conveyed until the data source.
29-
30-### Use Case #2
31-
32-Provider exposes some data located in a Cloud storage, such as AWS S3 or Azure storage. Consumer wants to copy these data
33-into its own storage system (which can be of a different type than the one of the provider). Here the consumer will negotiate a
34-_simple_ data transfer, by notifying to which location the data should be copied. Once contract is agreed between both parties,
35-the provider will automatically trigger the data transfer by delegating the data copy to is Data Plane system, through its Control API.
36-
37-## Technical Details
38-
39-### Interfaces
40-
41-OpenApi documentation can be found [here](../../../resources/openapi/yaml/data-plane-api.yaml).
42-
43-### Dependencies
44-
45-_Provide some information about dependencies, e.g., used extensions._
46-
47-| Name | Description |
48-|:--------|:---------------------------------------------|
49-| web-spi | Essentially for the Controllers registration |
50-
51-## Design Principles
52-
53-Both public and control APIs rely on the `DataPlaneManager` for executing the actual data transfer, see [Data Plane Framework](../../../core/data-plane/data-plane-framework/README.md) for more details.
54-
55-The Data Plane public API takes an access token in input from the `Authorization` header, which is validated and decode by calling the
56-validation server. If the validation is successful, then the Data Plane is executed in order to query the data from the data address returned by the validation server.
57-As mentioned earlier, the Data Plane public API is essentially a data proxy, which by definition will convey the information from the request (query parameters, path information, request body)
58-into the `DataPlaneManager` through the `DataFlowRequest` properties. If the data source allows it, then the request information will
59-be used in the request to the actual data source.
60-
61-### Security
62-
63-Data Plane public API is, by nature, opened to external incoming http calls. Because it accepts any set of query params, path parameters and request body,
64-it could be used by malicious attackers to attempt an attack e.g. DDoS.
65-
66-By default, Jetty, which is the embedded HTTP server in the EDC, provides some security against this:
67-
68-- max request header size of 8 KB: every call whose request header size is larger is discarded,
69-- max form content size of 200 KB: every form request call whose body is larger than this is discarded,
70-- max form content keys of 1000: every form request call which contains more keys is discarded.
71-
72-No other limits are implemented as of now, so we strongly recommend putting a reverse proxy in front of the Data Plane public API, such as Nginx, configured to block malicious calls.
No newline at the end of the file
deleted extensions/data-plane/data-plane-control-api/build.gradle.kts +0 −41
@@ -1,41 +0,0 @@
1-/*
2- * Copyright (c) 2022 Microsoft Corporation
3- *
4- * This program and the accompanying materials are made available under the
5- * terms of the Apache License, Version 2.0 which is available at
6- * https://www.apache.org/licenses/LICENSE-2.0
7- *
8- * SPDX-License-Identifier: Apache-2.0
9- *
10- * Contributors:
11- * Microsoft Corporation - initial API and implementation
12- * Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - improvements
13- * Mercedes-Benz Tech Innovation GmbH - publish public api context into dedicated swagger hub page
14- *
15- */
16-
17-
18-plugins {
19- `java-library`
20- id(libs.plugins.swagger.get().pluginId)
21-}
22-
23-dependencies {
24- api(project(":spi:common:web-spi"))
25- api(project(":spi:data-plane:data-plane-spi"))
26-
27- implementation(libs.jakarta.rsApi)
28-
29- testImplementation(project(":extensions:common:http"))
30- testImplementation(project(":core:common:junit"))
31- testImplementation(libs.jersey.multipart)
32- testImplementation(libs.restAssured)
33- testImplementation(testFixtures(project(":extensions:common:http:jersey-core")))
34-}
35-edcBuild {
36- swagger {
37- apiGroup.set("control-api")
38- }
39-}
40-
41-
deleted extensions/data-plane/data-plane-control-api/src/main/java/org/eclipse/edc/connector/dataplane/api/DataPlaneControlApiExtension.java +0 −53
@@ -1,53 +0,0 @@
1-/*
2- * Copyright (c) 2022 Microsoft Corporation
3- *
4- * This program and the accompanying materials are made available under the
5- * terms of the Apache License, Version 2.0 which is available at
6- * https://www.apache.org/licenses/LICENSE-2.0
7- *
8- * SPDX-License-Identifier: Apache-2.0
9- *
10- * Contributors:
11- * Microsoft Corporation - initial API and implementation
12- * Mercedes-Benz Tech Innovation GmbH - publish public api context into dedicated swagger hub page
13- *
14- */
15-
16-package org.eclipse.edc.connector.dataplane.api;
17-
18-import org.eclipse.edc.connector.dataplane.api.controller.DataPlaneControlApiController;
19-import org.eclipse.edc.connector.dataplane.spi.manager.DataPlaneManager;
20-import org.eclipse.edc.runtime.metamodel.annotation.Extension;
21-import org.eclipse.edc.runtime.metamodel.annotation.Inject;
22-import org.eclipse.edc.spi.system.ServiceExtension;
23-import org.eclipse.edc.spi.system.ServiceExtensionContext;
24-import org.eclipse.edc.web.spi.WebService;
25-import org.eclipse.edc.web.spi.configuration.ApiContext;
26-
27-/**
28- * This extension provides set of endpoints to trigger/monitor/cancel data transfers that should be accessible only
29- * by the Control Plane.
30- *
31- * @deprecated please use data-plane signaling feature.
32- */
33-@Extension(value = DataPlaneControlApiExtension.NAME)
34-@Deprecated(since = "0.6.0")
35-public class DataPlaneControlApiExtension implements ServiceExtension {
36- public static final String NAME = "Data Plane Control API";
37-
38- @Inject
39- private DataPlaneManager dataPlaneManager;
40-
41- @Inject
42- private WebService webService;
43-
44- @Override
45- public String name() {
46- return NAME;
47- }
48-
49- @Override
50- public void initialize(ServiceExtensionContext context) {
51- webService.registerResource(ApiContext.CONTROL, new DataPlaneControlApiController(dataPlaneManager));
52- }
53-}
deleted extensions/data-plane/data-plane-control-api/src/main/java/org/eclipse/edc/connector/dataplane/api/controller/DataPlaneControlApi.java +0 −52
@@ -1,52 +0,0 @@
1-/*
2- * Copyright (c) 2022 Amadeus
3- *
4- * This program and the accompanying materials are made available under the
5- * terms of the Apache License, Version 2.0 which is available at
6- * https://www.apache.org/licenses/LICENSE-2.0
7- *
8- * SPDX-License-Identifier: Apache-2.0
9- *
10- * Contributors:
11- * Amadeus - Initial implementation
12- *
13- */
14-
15-package org.eclipse.edc.connector.dataplane.api.controller;
16-
17-import io.swagger.v3.oas.annotations.OpenAPIDefinition;
18-import io.swagger.v3.oas.annotations.Operation;
19-import io.swagger.v3.oas.annotations.responses.ApiResponse;
20-import io.swagger.v3.oas.annotations.tags.Tag;
21-import jakarta.ws.rs.container.AsyncResponse;
22-import org.eclipse.edc.connector.dataplane.spi.DataFlowStates;
23-import org.eclipse.edc.spi.types.domain.transfer.DataFlowStartMessage;
24-
25-@OpenAPIDefinition
26-@Tag(name = "Data Plane control API",
27- description = "Api targeted by the Control Plane to delegate a data transfer (Provider Push or Streaming) " +
28- "to the Data Plane after the contract has been successfully negotiated and agreed between the two participants. ")
29-public interface DataPlaneControlApi {
30-
31- @Operation(description = "Initiates a data transfer for the given request. The transfer will be performed asynchronously.",
32- responses = {
33- @ApiResponse(responseCode = "400", description = "Failed to validate request"),
34- @ApiResponse(responseCode = "200", description = "Data transfer initiated"),
35- }
36- )
37- void initiateTransfer(DataFlowStartMessage request, AsyncResponse response);
38-
39- @Operation(description = "Get the current state of a data transfer.",
40- responses = @ApiResponse(responseCode = "200", description = "Missing access token")
41- )
42- DataFlowStates getTransferState(String transferProcessId);
43-
44- @Operation(description = "Terminates a data transfer.",
45- responses = {
46- @ApiResponse(responseCode = "204", description = "Data transfer terminated"),
47- @ApiResponse(responseCode = "404", description = "Data transfer not handled by the data plane"),
48- @ApiResponse(responseCode = "409", description = "Cannot terminate the transfer"),
49- }
50- )
51- void terminateTransfer(String transferProcessId, AsyncResponse response);
52-}
deleted extensions/data-plane/data-plane-control-api/src/main/java/org/eclipse/edc/connector/dataplane/api/controller/DataPlaneControlApiController.java +0 −87
@@ -1,87 +0,0 @@
1-/*
2- * Copyright (c) 2022 Microsoft Corporation
3- *
4- * This program and the accompanying materials are made available under the
5- * terms of the Apache License, Version 2.0 which is available at
6- * https://www.apache.org/licenses/LICENSE-2.0
7- *
8- * SPDX-License-Identifier: Apache-2.0
9- *
10- * Contributors:
11- * Microsoft Corporation - initial API and implementation
12- *
13- */
14-
15-package org.eclipse.edc.connector.dataplane.api.controller;
16-
17-import jakarta.ws.rs.Consumes;
18-import jakarta.ws.rs.DELETE;
19-import jakarta.ws.rs.GET;
20-import jakarta.ws.rs.POST;
21-import jakarta.ws.rs.Path;
22-import jakarta.ws.rs.PathParam;
23-import jakarta.ws.rs.Produces;
24-import jakarta.ws.rs.container.AsyncResponse;
25-import jakarta.ws.rs.container.Suspended;
26-import jakarta.ws.rs.core.MediaType;
27-import jakarta.ws.rs.core.Response;
28-import org.eclipse.edc.connector.dataplane.spi.DataFlowStates;
29-import org.eclipse.edc.connector.dataplane.spi.manager.DataPlaneManager;
30-import org.eclipse.edc.connector.dataplane.spi.response.TransferErrorResponse;
31-import org.eclipse.edc.spi.types.domain.transfer.DataFlowStartMessage;
32-
33-import java.util.List;
34-
35-import static jakarta.ws.rs.core.Response.status;
36-import static java.lang.String.format;
37-
38-@Path("/transfer")
39-@Consumes({ MediaType.APPLICATION_JSON })
40-@Produces({ MediaType.APPLICATION_JSON })
41-public class DataPlaneControlApiController implements DataPlaneControlApi {
42- private final DataPlaneManager dataPlaneManager;
43-
44- public DataPlaneControlApiController(DataPlaneManager dataPlaneManager) {
45- this.dataPlaneManager = dataPlaneManager;
46- }
47-
48- @POST
49- @Override
50- public void initiateTransfer(DataFlowStartMessage request, @Suspended AsyncResponse response) {
51- // TODO token authentication
52- var result = dataPlaneManager.validate(request);
53- if (result.succeeded()) {
54- dataPlaneManager.start(request);
55- response.resume(Response.ok().build());
56- } else {
57- var resp = result.getFailureMessages().isEmpty() ?
58- badRequest(format("Failed to validate request: %s", request.getId())) :
59- badRequest(result.getFailureMessages());
60- response.resume(resp);
61- }
62- }
63-
64- @GET
65- @Override
66- @Path("/{transferProcessId}")
67- public DataFlowStates getTransferState(@PathParam("transferProcessId") String transferProcessId) {
68- return dataPlaneManager.getTransferState(transferProcessId);
69- }
70-
71- @DELETE
72- @Path("/{transferProcessId}")
73- @Override
74- public void terminateTransfer(@PathParam("transferProcessId") String transferProcessId, @Suspended AsyncResponse response) {
75- dataPlaneManager.terminate(transferProcessId)
76- .onSuccess(r -> response.resume(Response.noContent().build()))
77- .onFailure(f -> response.resume(badRequest(List.of("Cannot terminate transfer: " + f.getFailureDetail()))));
78- }
79-
80- private Response badRequest(String error) {
81- return badRequest(List.of(error));
82- }
83-
84- private Response badRequest(List<String> errors) {
85- return status(Response.Status.BAD_REQUEST).entity(new TransferErrorResponse(errors)).build();
86- }
87-}
deleted extensions/data-plane/data-plane-control-api/src/main/resources/META-INF/services/org.eclipse.edc.spi.system.ServiceExtension +0 −1
@@ -1,1 +0,0 @@
1-org.eclipse.edc.connector.dataplane.api.DataPlaneControlApiExtension
deleted extensions/data-plane/data-plane-control-api/src/test/java/org/eclipse/edc/connector/dataplane/api/controller/DataPlaneControlApiControllerTest.java +0 −131
@@ -1,131 +0,0 @@
1-/*
2- * Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
3- *
4- * This program and the accompanying materials are made available under the
5- * terms of the Apache License, Version 2.0 which is available at
6- * https://www.apache.org/licenses/LICENSE-2.0
7- *
8- * SPDX-License-Identifier: Apache-2.0
9- *
10- * Contributors:
11- * Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation
12- *
13- */
14-
15-package org.eclipse.edc.connector.dataplane.api.controller;
16-
17-import io.restassured.http.ContentType;
18-import io.restassured.specification.RequestSpecification;
19-import jakarta.ws.rs.core.HttpHeaders;
20-import jakarta.ws.rs.core.Response;
21-import org.eclipse.edc.connector.dataplane.spi.manager.DataPlaneManager;
22-import org.eclipse.edc.junit.annotations.ApiTest;
23-import org.eclipse.edc.spi.response.StatusResult;
24-import org.eclipse.edc.spi.result.Result;
25-import org.eclipse.edc.spi.types.domain.DataAddress;
26-import org.eclipse.edc.spi.types.domain.transfer.DataFlowStartMessage;
27-import org.eclipse.edc.web.jersey.testfixtures.RestControllerTestBase;
28-import org.hamcrest.CoreMatchers;
29-import org.junit.jupiter.api.Test;
30-
31-import java.util.List;
32-import java.util.UUID;
33-
34-import static io.restassured.RestAssured.given;
35-import static org.eclipse.edc.spi.response.ResponseStatus.FATAL_ERROR;
36-import static org.mockito.ArgumentMatchers.any;
37-import static org.mockito.ArgumentMatchers.isA;
38-import static org.mockito.Mockito.mock;
39-import static org.mockito.Mockito.never;
40-import static org.mockito.Mockito.verify;
41-import static org.mockito.Mockito.when;
42-
43-@ApiTest
44-class DataPlaneControlApiControllerTest extends RestControllerTestBase {
45-
46- private final DataPlaneManager manager = mock();
47-
48- @Test
49- void should_callDataPlaneManager_if_requestIsValid() {
50- var flowRequest = DataFlowStartMessage.Builder.newInstance()
51- .id(UUID.randomUUID().toString())
52- .processId(UUID.randomUUID().toString())
53- .sourceDataAddress(testDestAddress())
54- .destinationDataAddress(testDestAddress())
55- .build();
56-
57- when(manager.validate(isA(DataFlowStartMessage.class))).thenReturn(Result.success(Boolean.TRUE));
58-
59- baseRequest()
60- .contentType(ContentType.JSON)
61- .body(flowRequest)
62- .post("/transfer")
63- .then()
64- .statusCode(Response.Status.OK.getStatusCode());
65-
66- verify(manager).start(isA(DataFlowStartMessage.class));
67- }
68-
69- @Test
70- void should_returnBadRequest_if_requestIsInValid() {
71- var errorMsg = "test error message";
72- var flowRequest = DataFlowStartMessage.Builder.newInstance()
73- .id(UUID.randomUUID().toString())
74- .processId(UUID.randomUUID().toString())
75- .sourceDataAddress(testDestAddress())
76- .destinationDataAddress(testDestAddress())
77- .build();
78-
79- when(manager.validate(isA(DataFlowStartMessage.class))).thenReturn(Result.failure(errorMsg));
80-
81- baseRequest()
82- .contentType(ContentType.JSON)
83- .body(flowRequest)
84- .post("/transfer")
85- .then()
86- .statusCode(Response.Status.BAD_REQUEST.getStatusCode())
87- .body("errors", CoreMatchers.equalTo(List.of(errorMsg)));
88-
89- verify(manager, never()).start(any());
90- }
91-
92- @Test
93- void delete_shouldReturnOk_whenTerminationSucceeds() {
94- when(manager.terminate(any())).thenReturn(StatusResult.success());
95-
96- baseRequest()
97- .delete("/transfer/transferId")
98- .then()
99- .statusCode(204);
100-
101- verify(manager).terminate("transferId");
102- }
103-
104- @Test
105- void delete_shouldReturnError_whenTerminationFails() {
106- when(manager.terminate(any())).thenReturn(StatusResult.failure(FATAL_ERROR));
107-
108- baseRequest()
109- .delete("/transfer/transferId")
110- .then()
111- .statusCode(400);
112-
113- verify(manager).terminate("transferId");
114- }
115-
116- @Override
117- protected Object controller() {
118- return new DataPlaneControlApiController(manager);
119- }
120-
121- private RequestSpecification baseRequest() {
122- return given()
123- .baseUri("http://localhost:" + port)
124- .header(HttpHeaders.AUTHORIZATION, "auth")
125- .when();
126- }
127-
128- private DataAddress testDestAddress() {
129- return DataAddress.Builder.newInstance().type("test").build();
130- }
131-}
modified extensions/data-plane/data-plane-integration-tests/build.gradle.kts +1 −0
@@ -26,6 +26,7 @@
2626
2727 testImplementation(project(":core:common:connector-core"))
2828 testImplementation(project(":core:common:junit"))
29+ testImplementation(project(":extensions:common:json-ld"))
2930 testImplementation(testFixtures(project(":extensions:data-plane:data-plane-http")))
3031 }
3132
modified extensions/data-plane/data-plane-integration-tests/src/test/java/org/eclipse/edc/connector/dataplane/http/DataPlaneHttpIntegrationTests.java +126 −145
@@ -14,20 +14,23 @@
1414
1515 package org.eclipse.edc.connector.dataplane.http;
1616
17-import com.fasterxml.jackson.databind.node.ObjectNode;
1817 import io.netty.handler.codec.http.HttpHeaderNames;
1918 import io.netty.handler.codec.http.HttpMethod;
2019 import io.restassured.http.ContentType;
20+import io.restassured.response.Response;
21+import jakarta.json.Json;
22+import jakarta.json.JsonArrayBuilder;
23+import jakarta.json.JsonObject;
24+import jakarta.json.JsonObjectBuilder;
2125 import org.apache.http.HttpStatus;
2226 import org.eclipse.edc.connector.dataplane.http.spi.HttpDataAddress;
2327 import org.eclipse.edc.connector.dataplane.spi.DataFlowStates;
24-import org.eclipse.edc.connector.dataplane.spi.schema.DataFlowRequestSchema;
28+import org.eclipse.edc.connector.dataplane.spi.iam.DataPlaneAuthorizationService;
2529 import org.eclipse.edc.junit.annotations.ComponentTest;
2630 import org.eclipse.edc.junit.extensions.EmbeddedRuntime;
2731 import org.eclipse.edc.junit.extensions.RuntimeExtension;
2832 import org.eclipse.edc.junit.extensions.RuntimePerClassExtension;
29-import org.eclipse.edc.spi.types.TypeManager;
30-import org.eclipse.edc.spi.types.domain.transfer.DataFlowStartMessage;
33+import org.eclipse.edc.spi.result.Result;
3134 import org.junit.jupiter.api.AfterAll;
3235 import org.junit.jupiter.api.AfterEach;
3336 import org.junit.jupiter.api.BeforeAll;
@@ -45,10 +48,8 @@
4548
4649 import java.nio.charset.StandardCharsets;
4750 import java.time.Duration;
48-import java.util.HashMap;
4951 import java.util.Map;
5052 import java.util.UUID;
51-import java.util.stream.Collectors;
5253
5354 import static io.netty.handler.codec.http.HttpHeaderNames.AUTHORIZATION;
5455 import static io.restassured.RestAssured.given;
@@ -57,11 +58,15 @@
5758 import static java.lang.String.valueOf;
5859 import static java.util.Collections.emptyMap;
5960 import static org.awaitility.Awaitility.await;
60-import static org.eclipse.edc.connector.dataplane.http.testfixtures.TestFunctions.createRequest;
6161 import static org.eclipse.edc.connector.dataplane.spi.DataFlowStates.NOTIFIED;
62+import static org.eclipse.edc.spi.constants.CoreConstants.EDC_NAMESPACE;
63+import static org.eclipse.edc.spi.types.domain.transfer.DataFlowStartMessage.EDC_DATA_FLOW_START_MESSAGE_TYPE;
6264 import static org.eclipse.edc.util.io.Ports.getFreePort;
6365 import static org.hamcrest.CoreMatchers.equalTo;
6466 import static org.hamcrest.Matchers.containsString;
67+import static org.mockito.ArgumentMatchers.any;
68+import static org.mockito.Mockito.mock;
69+import static org.mockito.Mockito.when;
6570 import static org.mockserver.integration.ClientAndServer.startClientAndServer;
6671 import static org.mockserver.matchers.Times.exactly;
6772 import static org.mockserver.matchers.Times.once;
@@ -76,34 +81,24 @@
7681 import static org.mockserver.model.Parameter.param;
7782 import static org.mockserver.stop.Stop.stopQuietly;
7883
79-/**
80- * System Test for Data Plane HTTP extension.
81- */
84+
8285 @ComponentTest
8386 public class DataPlaneHttpIntegrationTests {
8487
85- private static final int VALIDATION_API_PORT = getFreePort();
86- private static final String VALIDATION_API_HOST = "http://localhost:" + VALIDATION_API_PORT;
8788 private static final int PUBLIC_API_PORT = getFreePort();
8889 private static final int CONTROL_API_PORT = getFreePort();
8990 private static final int HTTP_SOURCE_API_PORT = getFreePort();
9091 private static final int HTTP_SINK_API_PORT = getFreePort();
91- private static final String CONTROL_API_HOST = "http://localhost:" + CONTROL_API_PORT;
9292 private static final String HTTP_SOURCE_API_HOST = "http://localhost:" + HTTP_SOURCE_API_PORT;
9393 private static final String HTTP_SINK_API_HOST = "http://localhost:" + HTTP_SINK_API_PORT;
9494 private static final String CONTROL_PATH = "/control";
9595 private static final String PUBLIC_PATH = "/public";
9696 private static final String PUBLIC_API_HOST = "http://localhost:" + PUBLIC_API_PORT;
97- private static final String TRANSFER_PATH = format("%s/transfer", CONTROL_PATH);
98- private static final String TRANSFER_RESULT_PATH = format("%s/{processId}", TRANSFER_PATH);
99- private static final String PROCESS_ID = "processId";
100- private static final String HTTP_API_PATH = "sample";
10197 private static final String AUTH_HEADER_KEY = AUTHORIZATION.toString();
10298 private static final String SOURCE_AUTH_VALUE = "source-auth-key";
10399 private static final String SINK_AUTH_VALUE = "sink-auth-key";
104100 private static ClientAndServer httpSourceMockServer;
105101 private static ClientAndServer httpSinkMockServer;
106- private static ClientAndServer validationApiMockServer;
107102 private final Duration timeout = Duration.ofSeconds(30);
108103
109104 private static final EmbeddedRuntime RUNTIME = new EmbeddedRuntime(
@@ -113,10 +108,8 @@
113108 "web.http.public.path", PUBLIC_PATH,
114109 "web.http.control.port", valueOf(CONTROL_API_PORT),
115110 "web.http.control.path", CONTROL_PATH,
116- "edc.dataplane.token.validation.endpoint", VALIDATION_API_HOST,
117111 "edc.core.retry.retries.max", "0"
118112 ),
119- ":extensions:common:metrics:micrometer-core",
120113 ":core:data-plane:data-plane-core",
121114 ":extensions:common:api:control-api-configuration",
122115 ":extensions:common:http",
@@ -124,40 +117,38 @@
124117 ":extensions:common:configuration:configuration-filesystem",
125118 ":extensions:control-plane:api:control-plane-api-client",
126119 ":extensions:data-plane:data-plane-http",
127- ":extensions:data-plane:data-plane-control-api",
128- ":extensions:data-plane:data-plane-public-api"
129- );
120+ ":extensions:data-plane:data-plane-public-api-v2",
121+ ":extensions:data-plane:data-plane-signaling:data-plane-signaling-api"
122+ ).registerServiceMock(DataPlaneAuthorizationService.class, mock());
130123
131124 @BeforeAll
132125 public static void setUp() {
133126 httpSourceMockServer = startClientAndServer(HTTP_SOURCE_API_PORT);
134127 httpSinkMockServer = startClientAndServer(HTTP_SINK_API_PORT);
135- validationApiMockServer = startClientAndServer(VALIDATION_API_PORT);
136128 }
137129
138130 @AfterAll
139131 public static void tearDown() {
140132 stopQuietly(httpSourceMockServer);
141133 stopQuietly(httpSinkMockServer);
142- stopQuietly(validationApiMockServer);
143134 }
144135
145136 @AfterEach
146137 public void resetMockServer() {
147138 httpSourceMockServer.reset();
148139 httpSinkMockServer.reset();
149- validationApiMockServer.reset();
150140 }
151141
152142 @Nested
153143 class Pull {
154144
145+ private static final String HTTP_API_PATH = "sample";
146+
155147 @RegisterExtension
156148 static RuntimeExtension dataPlane = new RuntimePerClassExtension(RUNTIME);
157149
158150 @Test
159- void transfer_pull_withSourceQueryParamsAndPath_success(TypeManager typeManager) {
160- // prepare data source and validation servers
151+ void transfer_pull_withSourceQueryParamsAndPath_success(DataPlaneAuthorizationService dataPlaneAuthorizationService) {
161152 var token = UUID.randomUUID().toString();
162153 var responseBody = "some info";
163154 var queryParams = Map.of(
@@ -168,11 +159,7 @@
168159
169160 var sourceRequest = getRequest(queryParams, HTTP_API_PATH);
170161 httpSourceMockServer.when(sourceRequest, once()).respond(successfulResponse(responseBody, PLAIN_TEXT_UTF_8));
171-
172- // prepare validation server of the control plane
173- var validationRequest = request().withMethod(HttpMethod.GET.name()).withHeader(AUTH_HEADER_KEY, token);
174- validationApiMockServer.when(validationRequest, once())
175- .respond(successfulResponse(typeManager.writeValueAsString(sourceDataAddress), PLAIN_TEXT_UTF_8));
162+ when(dataPlaneAuthorizationService.authorize(any(), any())).thenReturn(Result.success(sourceDataAddress));
176163
177164 given()
178165 .baseUri(PUBLIC_API_HOST)
@@ -190,22 +177,7 @@
190177 }
191178
192179 @Test
193- void transfer_invalidInput_failure(TypeManager typeManager) {
194- var processId = UUID.randomUUID().toString();
195- var invalidRequest = transferRequestPayload(processId, typeManager).remove("processId");
196-
197- given()
198- .baseUri(CONTROL_API_HOST)
199- .contentType(ContentType.JSON)
200- .body(invalidRequest)
201- .when()
202- .post(TRANSFER_PATH)
203- .then()
204- .assertThat().statusCode(HttpStatus.SC_BAD_REQUEST);
205- }
206-
207- @Test
208- void shouldProxyMethodAndBody_whenSet(TypeManager typeManager) {
180+ void shouldProxyMethodAndBody_whenSet(DataPlaneAuthorizationService dataPlaneAuthorizationService) {
209181 var sourceAddress = HttpDataAddress.Builder.newInstance()
210182 .baseUrl(HTTP_SOURCE_API_HOST)
211183 .proxyMethod(TRUE.toString())
@@ -213,8 +185,7 @@
213185 .proxyBody(TRUE.toString())
214186 .build();
215187 httpSourceMockServer.when(request(), once()).respond(successfulResponse("any", PLAIN_TEXT_UTF_8));
216- validationApiMockServer.when(request(), once())
217- .respond(successfulResponse(typeManager.writeValueAsString(sourceAddress), PLAIN_TEXT_UTF_8));
188+ when(dataPlaneAuthorizationService.authorize(any(), any())).thenReturn(Result.success(sourceAddress));
218189
219190 given()
220191 .baseUri(PUBLIC_API_HOST)
@@ -229,6 +200,16 @@
229200
230201 httpSourceMockServer.verify(request().withMethod("PUT").withBody("body"), VerificationTimes.once());
231202 }
203+
204+ private HttpDataAddress sourceDataAddress() {
205+ return HttpDataAddress.Builder.newInstance()
206+ .baseUrl(HTTP_SOURCE_API_HOST)
207+ .proxyPath(TRUE.toString())
208+ .proxyQueryParams(TRUE.toString())
209+ .authKey(AUTH_HEADER_KEY)
210+ .authCode(SOURCE_AUTH_VALUE)
211+ .build();
212+ }
232213 }
233214
234215 @Nested
@@ -238,26 +219,23 @@
238219 static RuntimeExtension dataPlane = new RuntimePerClassExtension(RUNTIME);
239220
240221 @Test
241- void transfer_toHttpSink_success(TypeManager typeManager) {
222+ void transfer_toHttpSink_success() {
242223 var body = UUID.randomUUID().toString();
243224 var processId = UUID.randomUUID().toString();
244- httpSourceMockServer.when(getRequest(HTTP_API_PATH), once()).respond(successfulResponse(body, APPLICATION_JSON));
245-
246- // HTTP Sink Request & Response
225+ httpSourceMockServer.when(getRequest(""), once()).respond(successfulResponse(body, APPLICATION_JSON));
247226 httpSinkMockServer.when(request(), once()).respond(successfulResponse());
248227
249- initiateTransfer(transferRequestPayload(processId, typeManager));
228+ initiate(transferRequestPayload(processId))
229+ .then()
230+ .assertThat().statusCode(HttpStatus.SC_OK);
250231
251232 await().atMost(timeout).untilAsserted(() -> expectState(processId, NOTIFIED));
252- // Verify HTTP Source server called exactly once.
253- httpSourceMockServer.verify(getRequest(HTTP_API_PATH), VerificationTimes.once());
254- // Verify HTTP Sink server called exactly once.
233+ httpSourceMockServer.verify(getRequest(""), VerificationTimes.once());
255234 httpSinkMockServer.verify(postRequest(body, APPLICATION_JSON), VerificationTimes.once());
256235 }
257236
258237 @Test
259- void transfer_toHttpSink_withSourceQueryParams_success(TypeManager typeManager) {
260- // HTTP Source Request & Response
238+ void transfer_toHttpSink_withSourcePathAndQueryParams_success() {
261239 var body = UUID.randomUUID().toString();
262240 var processId = UUID.randomUUID().toString();
263241 var queryParams = Map.of(
@@ -265,32 +243,37 @@
265243 "param2", "any other value"
266244 );
267245
268- httpSourceMockServer.when(getRequest(queryParams, HTTP_API_PATH), once()).respond(successfulResponse(body, APPLICATION_OCTET_STREAM));
269-
270- // HTTP Sink Request & Response
246+ httpSourceMockServer.when(getRequest(queryParams, "path"), once()).respond(successfulResponse(body, APPLICATION_OCTET_STREAM));
271247 httpSinkMockServer.when(postRequest(body, APPLICATION_OCTET_STREAM), once()).respond(successfulResponse());
272248
273- initiateTransfer(transferRequestPayload(processId, queryParams, typeManager));
249+ var sourceDataAddress = Json.createObjectBuilder()
250+ .add("@type", "dspace:DataAddress")
251+ .add("dspace:endpointType", "HttpData")
252+ .add("dspace:endpointProperties", sourceAddressProperties()
253+ .add(dspaceProperty(EDC_NAMESPACE + "path", "path"))
254+ .add(dspaceProperty(EDC_NAMESPACE + "queryParams", "param1=any value&param2=any other value"))
255+ );
256+
257+ initiate(transferRequestPayload(processId, sourceDataAddress))
258+ .then()
259+ .assertThat().statusCode(HttpStatus.SC_OK);
274260
275261 await().atMost(timeout).untilAsserted(() -> expectState(processId, NOTIFIED));
276- // Verify HTTP Source server called exactly once.
277- httpSourceMockServer.verify(getRequest(queryParams, HTTP_API_PATH), VerificationTimes.once());
278- // Verify HTTP Sink server called exactly once.
262+ httpSourceMockServer.verify(getRequest(queryParams, "path"), VerificationTimes.once());
279263 httpSinkMockServer.verify(postRequest(body, APPLICATION_OCTET_STREAM), VerificationTimes.once());
280264 }
281265
282266 @Test
283- void transfer_toHttpSink_sourceNotAvailable_noInteractionWithSink(TypeManager typeManager) {
267+ void transfer_toHttpSink_sourceNotAvailable_noInteractionWithSink() {
284268 var processId = UUID.randomUUID().toString();
285- // HTTP Source Request & Error Response
286- httpSourceMockServer.when(getRequest(HTTP_API_PATH)).error(withDropConnection());
269+ httpSourceMockServer.when(getRequest("")).error(withDropConnection());
287270
288- initiateTransfer(transferRequestPayload(processId, typeManager));
271+ initiate(transferRequestPayload(processId))
272+ .then()
273+ .assertThat().statusCode(HttpStatus.SC_OK);
289274
290275 await().atMost(timeout).untilAsserted(() -> expectState(processId, NOTIFIED));
291- // Verify HTTP Source server called at lest once.
292- httpSourceMockServer.verify(getRequest(HTTP_API_PATH), VerificationTimes.atLeast(1));
293- // Verify zero interaction with HTTP Sink.
276+ httpSourceMockServer.verify(getRequest(""), VerificationTimes.atLeast(1));
294277 httpSinkMockServer.verifyZeroInteractions();
295278 }
296279
@@ -298,44 +281,50 @@
298281 * Validate if intermittently source is dropping connection than DPF server retries to fetch data.
299282 */
300283 @Test
301- void transfer_toHttpSink_sourceTemporaryDropConnection_success(TypeManager typeManager) {
284+ void transfer_toHttpSink_sourceTemporaryDropConnection_success() {
302285 var processId = UUID.randomUUID().toString();
303- // First two calls to HTTP Source returns a failure response.
304- httpSourceMockServer.when(getRequest(HTTP_API_PATH), exactly(2)).error(withDropConnection());
286+ httpSourceMockServer.when(getRequest(""), exactly(2)).error(withDropConnection());
305287
306- // Next call to HTTP Source returns a valid response.
307288 var body = UUID.randomUUID().toString();
308- httpSourceMockServer.when(getRequest(HTTP_API_PATH), once()).respond(successfulResponse(body, PLAIN_TEXT_UTF_8));
289+ httpSourceMockServer.when(getRequest(""), once()).respond(successfulResponse(body, PLAIN_TEXT_UTF_8));
309290
310- // HTTP Sink Request & Response
311291 httpSinkMockServer.when(postRequest(body, APPLICATION_OCTET_STREAM), once()).respond(successfulResponse());
312292
313- initiateTransfer(transferRequestPayload(processId, typeManager));
293+ initiate(transferRequestPayload(processId))
294+ .then()
295+ .assertThat().statusCode(HttpStatus.SC_OK);
314296
315297 await().atMost(timeout).untilAsserted(() -> expectState(processId, NOTIFIED));
316- // Verify HTTP Source server called exactly 3 times.
317- httpSourceMockServer.verify(getRequest(HTTP_API_PATH), VerificationTimes.exactly(3));
318- // Verify HTTP Sink server called exactly once.
298+ httpSourceMockServer.verify(getRequest(""), VerificationTimes.exactly(3));
319299 httpSinkMockServer.verify(postRequest(body, PLAIN_TEXT_UTF_8), VerificationTimes.once());
320300 }
321301
322- private void initiateTransfer(Object payload) {
323- given()
324- .baseUri(CONTROL_API_HOST)
302+ @Test
303+ void transfer_invalidInput_failure() {
304+ var processId = UUID.randomUUID().toString();
305+ var validRequest = transferRequestPayload(processId);
306+ var invalidRequest = Json.createObjectBuilder(validRequest).remove("transferTypeDestination").build();
307+
308+ initiate(invalidRequest)
309+ .then()
310+ .assertThat().statusCode(HttpStatus.SC_BAD_REQUEST);
311+ }
312+
313+ private Response initiate(JsonObject payload) {
314+ return given()
315+ .port(CONTROL_API_PORT)
325316 .contentType(ContentType.JSON)
326317 .body(payload)
327318 .when()
328- .post(TRANSFER_PATH)
329- .then()
330- .assertThat().statusCode(HttpStatus.SC_OK);
319+ .post("/control/v1/dataflows");
331320 }
332321
333322 private void expectState(String processId, DataFlowStates expectedState) {
334323 given()
335- .baseUri(CONTROL_API_HOST)
336- .pathParam(PROCESS_ID, processId)
324+ .port(CONTROL_API_PORT)
337325 .when()
338- .get(TRANSFER_RESULT_PATH)
326+ .pathParam("id", processId)
327+ .get("/control/v1/dataflows/{id}/state")
339328 .then()
340329 .assertThat().statusCode(HttpStatus.SC_OK)
341330 .body(containsString(expectedState.name()));
@@ -345,59 +334,51 @@
345334 return error()
346335 .withDropConnection(true);
347336 }
348- }
349337
350- /**
351- * Request payload to initiate DPF transfer.
352- *
353- * @param processId ProcessID of transfer.See {@link DataFlowStartMessage}
354- * @return JSON object. see {@link ObjectNode}.
355- */
356- private ObjectNode transferRequestPayload(String processId, TypeManager typeManager) {
357- return transferRequestPayload(processId, emptyMap(), typeManager);
358- }
338+ private JsonObject transferRequestPayload(String processId) {
339+ return transferRequestPayload(processId, sourceAddress());
340+ }
359341
360- /**
361- * Request payload with query params to initiate DPF transfer.
362- *
363- * @param processId ProcessID of transfer.See {@link DataFlowStartMessage}
364- * @param queryParams Query params name and value as key-value entries.
365- * @return JSON object. see {@link ObjectNode}.
366- */
367- private ObjectNode transferRequestPayload(String processId, Map<String, String> queryParams, TypeManager typeManager) {
368- var requestProperties = new HashMap<String, String>();
369- requestProperties.put(DataFlowRequestSchema.METHOD, HttpMethod.GET.name());
370- requestProperties.put(DataFlowRequestSchema.PATH, HTTP_API_PATH);
371-
372- if (!queryParams.isEmpty()) {
373- requestProperties.put(DataFlowRequestSchema.QUERY_PARAMS, queryParams.entrySet()
374- .stream()
375- .map(entry -> entry.getKey() + "=" + entry.getValue())
376- .collect(Collectors.joining("&")));
377- }
378-
379- var destinationDataAddress = HttpDataAddress.Builder.newInstance()
380- .baseUrl(HTTP_SINK_API_HOST)
381- .authKey(AUTH_HEADER_KEY)
382- .authCode(SINK_AUTH_VALUE)
383- .build();
384-
385- // Create valid dataflow request instance.
386- var request = createRequest(requestProperties, sourceDataAddress(), destinationDataAddress)
387- .processId(processId)
388- .build();
389-
390- return typeManager.getMapper().convertValue(request, ObjectNode.class);
391- }
342+ private JsonObject transferRequestPayload(String processId, JsonObjectBuilder sourceDataAddress) {
343+ return Json.createObjectBuilder()
344+ .add("@context", Json.createObjectBuilder().add("@vocab", EDC_NAMESPACE).add("dspace", "https://w3id.org/dspace/v0.8/"))
345+ .add("@type", EDC_DATA_FLOW_START_MESSAGE_TYPE)
346+ .add("@id", UUID.randomUUID().toString())
347+ .add("processId", processId)
348+ .add("sourceDataAddress", sourceDataAddress)
349+ .add("destinationDataAddress", Json.createObjectBuilder()
350+ .add("dspace:endpointType", "HttpData")
351+ .add("dspace:endpointProperties", Json.createArrayBuilder()
352+ .add(dspaceProperty(EDC_NAMESPACE + "baseUrl", HTTP_SINK_API_HOST))
353+ .add(dspaceProperty(EDC_NAMESPACE + "authKey", AUTH_HEADER_KEY))
354+ .add(dspaceProperty(EDC_NAMESPACE + "authCode", SINK_AUTH_VALUE))
355+ )
356+ )
357+ .add("flowType", "PUSH")
358+ .add("transferTypeDestination", "HttpData-PUSH")
359+ .build();
360+ }
361+
362+ private JsonObjectBuilder sourceAddress() {
363+ return Json.createObjectBuilder()
364+ .add("@type", "dspace:DataAddress")
365+ .add("dspace:endpointType", "HttpData")
366+ .add("dspace:endpointProperties", sourceAddressProperties());
367+ }
368+
369+ private JsonArrayBuilder sourceAddressProperties() {
370+ return Json.createArrayBuilder()
371+ .add(dspaceProperty(EDC_NAMESPACE + "baseUrl", HTTP_SOURCE_API_HOST))
372+ .add(dspaceProperty(EDC_NAMESPACE + "authKey", AUTH_HEADER_KEY))
373+ .add(dspaceProperty(EDC_NAMESPACE + "authCode", SOURCE_AUTH_VALUE));
374+ }
375+
376+ private JsonObjectBuilder dspaceProperty(String name, String value) {
377+ return Json.createObjectBuilder()
378+ .add("dspace:name", name)
379+ .add("dspace:value", value);
380+ }
392381
393- private HttpDataAddress sourceDataAddress() {
394- return HttpDataAddress.Builder.newInstance()
395- .baseUrl(HTTP_SOURCE_API_HOST)
396- .proxyPath(TRUE.toString())
397- .proxyQueryParams(TRUE.toString())
398- .authKey(AUTH_HEADER_KEY)
399- .authCode(SOURCE_AUTH_VALUE)
400- .build();
401382 }
402383
403384 /**
@@ -420,7 +401,7 @@
420401 var paramsList = queryParams.entrySet()
421402 .stream()
422403 .map(entry -> param(entry.getKey(), entry.getValue()))
423- .collect(Collectors.toList());
404+ .toList();
424405
425406 request.withQueryStringParameters(new Parameters(paramsList).withKeyMatchStyle(MATCHING_KEY));
426407
deleted extensions/data-plane/data-plane-public-api/README.md +0 −1
@@ -1,1 +0,0 @@
1-# Data Plane Public API
deleted extensions/data-plane/data-plane-public-api/build.gradle.kts +0 −48
@@ -1,48 +0,0 @@
1-/*
2- * Copyright (c) 2022 Microsoft Corporation
3- *
4- * This program and the accompanying materials are made available under the
5- * terms of the Apache License, Version 2.0 which is available at
6- * https://www.apache.org/licenses/LICENSE-2.0
7- *
8- * SPDX-License-Identifier: Apache-2.0
9- *
10- * Contributors:
11- * Microsoft Corporation - initial API and implementation
12- * Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - improvements
13- * Mercedes-Benz Tech Innovation GmbH - publish public api context into dedicated swagger hub page
14- *
15- */
16-
17-
18-plugins {
19- `java-library`
20- id(libs.plugins.swagger.get().pluginId)
21-}
22-
23-dependencies {
24- api(project(":spi:common:http-spi"))
25- api(project(":spi:common:web-spi"))
26- api(project(":spi:data-plane:data-plane-spi"))
27- implementation(project(":core:common:lib:util-lib"))
28-
29- implementation(project(":core:data-plane:data-plane-util"))
30- implementation(libs.jakarta.rsApi)
31-
32- testImplementation(project(":extensions:common:http"))
33- testImplementation(project(":core:common:junit"))
34- testImplementation(libs.jersey.multipart)
35- testImplementation(libs.restAssured)
36- testImplementation(libs.mockserver.netty)
37- testImplementation(libs.mockserver.client)
38-
39- testImplementation(testFixtures(project(":core:common:lib:http-lib")))
40- testImplementation(testFixtures(project(":extensions:common:http:jersey-core")))
41-}
42-edcBuild {
43- swagger {
44- apiGroup.set("public-api")
45- }
46-}
47-
48-
deleted extensions/data-plane/data-plane-public-api/src/main/java/org/eclipse/edc/connector/dataplane/api/DataPlanePublicApiExtension.java +0 −108
@@ -1,108 +0,0 @@
1-/*
2- * Copyright (c) 2022 Microsoft Corporation
3- *
4- * This program and the accompanying materials are made available under the
5- * terms of the Apache License, Version 2.0 which is available at
6- * https://www.apache.org/licenses/LICENSE-2.0
7- *
8- * SPDX-License-Identifier: Apache-2.0
9- *
10- * Contributors:
11- * Microsoft Corporation - initial API and implementation
12- * Mercedes-Benz Tech Innovation GmbH - publish public api context into dedicated swagger hub page
13- *
14- */
15-
16-package org.eclipse.edc.connector.dataplane.api;
17-
18-import org.eclipse.edc.connector.dataplane.api.controller.DataPlanePublicApiController;
19-import org.eclipse.edc.connector.dataplane.api.validation.ConsumerPullTransferDataAddressResolver;
20-import org.eclipse.edc.connector.dataplane.spi.pipeline.PipelineService;
21-import org.eclipse.edc.http.spi.EdcHttpClient;
22-import org.eclipse.edc.runtime.metamodel.annotation.Extension;
23-import org.eclipse.edc.runtime.metamodel.annotation.Inject;
24-import org.eclipse.edc.runtime.metamodel.annotation.Setting;
25-import org.eclipse.edc.runtime.metamodel.annotation.SettingContext;
26-import org.eclipse.edc.spi.system.ExecutorInstrumentation;
27-import org.eclipse.edc.spi.system.ServiceExtension;
28-import org.eclipse.edc.spi.system.ServiceExtensionContext;
29-import org.eclipse.edc.spi.types.TypeManager;
30-import org.eclipse.edc.web.spi.WebServer;
31-import org.eclipse.edc.web.spi.WebService;
32-import org.eclipse.edc.web.spi.configuration.ApiContext;
33-import org.eclipse.edc.web.spi.configuration.WebServiceConfigurer;
34-import org.eclipse.edc.web.spi.configuration.WebServiceSettings;
35-
36-import java.util.concurrent.Executors;
37-
38-/**
39- * This extension provides generic endpoints which are open to public participants of the Dataspace to execute
40- * requests on the actual data source.
41- *
42- * @deprecated will be replaced by v2.
43- */
44-@Extension(value = DataPlanePublicApiExtension.NAME)
45-@Deprecated(since = "0.6.0")
46-public class DataPlanePublicApiExtension implements ServiceExtension {
47- public static final String NAME = "Data Plane Public API";
48-
49- @SettingContext("Public API context setting key")
50- private static final String PUBLIC_CONFIG_KEY = "web.http." + ApiContext.PUBLIC;
51-
52- @Setting(value = "Token validation server endpoint", required = true)
53- private static final String CONTROL_PLANE_VALIDATION_ENDPOINT = "edc.dataplane.token.validation.endpoint";
54-
55- private static final int DEFAULT_THREAD_POOL = 10;
56-
57- private static final WebServiceSettings PUBLIC_SETTINGS = WebServiceSettings.Builder.newInstance()
58- .apiConfigKey(PUBLIC_CONFIG_KEY)
59- .contextAlias(ApiContext.PUBLIC)
60- .defaultPath("/api/v1/public")
61- .defaultPort(8185)
62- .name(NAME)
63- .build();
64-
65- @Inject
66- private WebServer webServer;
67-
68- @Inject
69- private WebServiceConfigurer webServiceConfigurer;
70-
71- @Inject
72- private PipelineService pipelineService;
73-
74- @Inject
75- private WebService webService;
76-
77- @Inject
78- private EdcHttpClient httpClient;
79-
80- @Inject
81- private TypeManager typeManager;
82-
83- @Inject
84- private ExecutorInstrumentation executorInstrumentation;
85-
86- @Override
87- public String name() {
88- return NAME;
89- }
90-
91- @Override
92- public void initialize(ServiceExtensionContext context) {
93- var config = context.getConfig(PUBLIC_CONFIG_KEY);
94- var validationEndpoint = context.getConfig().getString(CONTROL_PLANE_VALIDATION_ENDPOINT);
95- var dataAddressResolver = new ConsumerPullTransferDataAddressResolver(httpClient, validationEndpoint, typeManager.getMapper());
96- webServiceConfigurer.configure(config, webServer, PUBLIC_SETTINGS);
97- var executorService = executorInstrumentation.instrument(
98- Executors.newFixedThreadPool(DEFAULT_THREAD_POOL),
99- "Data plane proxy transfers"
100- );
101- var monitor = context.getMonitor().withPrefix("DataPlane Public API");
102- var publicApiController = new DataPlanePublicApiController(pipelineService, dataAddressResolver, executorService, monitor);
103- webService.registerResource(ApiContext.PUBLIC, publicApiController);
104-
105- monitor.warning("This public API controller is scheduled for removal. Please consider upgrading your deployment " +
106- "to the data-plane-public-api-v2 module. The Data Plane Public API will then be available under at /v2/ prefix.");
107- }
108-}
deleted extensions/data-plane/data-plane-public-api/src/main/java/org/eclipse/edc/connector/dataplane/api/controller/ContainerRequestContextApi.java +0 −68
@@ -1,68 +0,0 @@
1-/*
2- * Copyright (c) 2022 Amadeus
3- *
4- * This program and the accompanying materials are made available under the
5- * terms of the Apache License, Version 2.0 which is available at
6- * https://www.apache.org/licenses/LICENSE-2.0
7- *
8- * SPDX-License-Identifier: Apache-2.0
9- *
10- * Contributors:
11- * Amadeus - initial API and implementation
12- *
13- */
14-
15-package org.eclipse.edc.connector.dataplane.api.controller;
16-
17-import jakarta.ws.rs.container.ContainerRequestContext;
18-
19-import java.util.Map;
20-
21-/**
22- * Wrapper around {@link ContainerRequestContext} enabling mocking.
23- */
24-public interface ContainerRequestContextApi {
25-
26- /**
27- * Get the request headers. Note that if more than one value is associated to a specific header,
28- * only the first one is retained.
29- *
30- * @return Headers map.
31- */
32- Map<String, String> headers();
33-
34- /**
35- * Format query of the request as string, e.g. "hello=world\&amp;foo=bar".
36- *
37- * @return Query param string.
38- */
39- String queryParams();
40-
41- /**
42- * Format the request body into a string.
43- *
44- * @return Request body.
45- */
46- String body();
47-
48- /**
49- * Get the media type from incoming request.
50- *
51- * @return Media type.
52- */
53- String mediaType();
54-
55- /**
56- * Return request path, e.g. "hello/world/foo/bar".
57- *
58- * @return Path string.
59- */
60- String path();
61-
62- /**
63- * Get http method from the incoming request, e.g. "GET", "POST"...
64- *
65- * @return Http method.
66- */
67- String method();
68-}
deleted extensions/data-plane/data-plane-public-api/src/main/java/org/eclipse/edc/connector/dataplane/api/controller/ContainerRequestContextApiImpl.java +0 −108
@@ -1,108 +0,0 @@
1-/*
2- * Copyright (c) 2022 Amadeus
3- *
4- * This program and the accompanying materials are made available under the
5- * terms of the Apache License, Version 2.0 which is available at
6- * https://www.apache.org/licenses/LICENSE-2.0
7- *
8- * SPDX-License-Identifier: Apache-2.0
9- *
10- * Contributors:
11- * Amadeus - initial API and implementation
12- *
13- */
14-
15-package org.eclipse.edc.connector.dataplane.api.controller;
16-
17-import jakarta.ws.rs.container.ContainerRequestContext;
18-import jakarta.ws.rs.core.MediaType;
19-import org.eclipse.edc.spi.EdcException;
20-
21-import java.io.BufferedReader;
22-import java.io.IOException;
23-import java.io.InputStreamReader;
24-import java.util.List;
25-import java.util.Map;
26-import java.util.Optional;
27-import java.util.stream.Collectors;
28-
29-/**
30- * This class provides a set of API wrapping a {@link ContainerRequestContext}.
31- */
32-public class ContainerRequestContextApiImpl implements ContainerRequestContextApi {
33-
34- private static final String QUERY_PARAM_SEPARATOR = "&";
35-
36- private final ContainerRequestContext context;
37-
38- public ContainerRequestContextApiImpl(ContainerRequestContext context) {
39- this.context = context;
40- }
41-
42- @Override
43- public Map<String, String> headers() {
44- return context.getHeaders().entrySet()
45- .stream()
46- .filter(entry -> !entry.getValue().isEmpty())
47- .collect(Collectors.toMap(Map.Entry::getKey, entry -> entry.getValue().get(0)));
48- }
49-
50- @Override
51- public String queryParams() {
52- return context.getUriInfo().getQueryParameters().entrySet()
53- .stream()
54- .map(entry -> new QueryParam(entry.getKey(), entry.getValue()))
55- .filter(QueryParam::isValid)
56- .map(QueryParam::toString)
57- .collect(Collectors.joining(QUERY_PARAM_SEPARATOR));
58- }
59-
60- @Override
61- public String body() {
62- try (BufferedReader br = new BufferedReader(new InputStreamReader(context.getEntityStream()))) {
63- return br.lines().collect(Collectors.joining("\n"));
64- } catch (IOException e) {
65- throw new EdcException("Failed to read request body: " + e.getMessage());
66- }
67- }
68-
69- @Override
70- public String path() {
71- var pathInfo = context.getUriInfo().getPath();
72- return pathInfo.startsWith("/") ? pathInfo.substring(1) : pathInfo;
73- }
74-
75- @Override
76- public String mediaType() {
77- return Optional.ofNullable(context.getMediaType())
78- .map(MediaType::toString)
79- .orElse(null);
80- }
81-
82- @Override
83- public String method() {
84- return context.getMethod();
85- }
86-
87- private static final class QueryParam {
88-
89- private final String key;
90- private final List<String> values;
91- private final boolean valid;
92-
93- private QueryParam(String key, List<String> values) {
94- this.key = key;
95- this.values = values;
96- this.valid = key != null && values != null && !values.isEmpty();
97- }
98-
99- public boolean isValid() {
100- return valid;
101- }
102-
103- @Override
104- public String toString() {
105- return valid ? key + "=" + values.get(0) : "";
106- }
107- }
108-}
deleted extensions/data-plane/data-plane-public-api/src/main/java/org/eclipse/edc/connector/dataplane/api/controller/DataFlowRequestSupplier.java +0 −73
@@ -1,73 +0,0 @@
1-/*
2- * Copyright (c) 2022 Amadeus
3- *
4- * This program and the accompanying materials are made available under the
5- * terms of the Apache License, Version 2.0 which is available at
6- * https://www.apache.org/licenses/LICENSE-2.0
7- *
8- * SPDX-License-Identifier: Apache-2.0
9- *
10- * Contributors:
11- * Amadeus - initial API and implementation
12- *
13- */
14-
15-package org.eclipse.edc.connector.dataplane.api.controller;
16-
17-import org.eclipse.edc.connector.dataplane.util.sink.AsyncStreamingDataSink;
18-import org.eclipse.edc.spi.types.domain.DataAddress;
19-import org.eclipse.edc.spi.types.domain.transfer.DataFlowStartMessage;
20-import org.eclipse.edc.spi.types.domain.transfer.FlowType;
21-
22-import java.util.HashMap;
23-import java.util.Map;
24-import java.util.Optional;
25-import java.util.UUID;
26-import java.util.function.BiFunction;
27-
28-import static org.eclipse.edc.connector.dataplane.spi.schema.DataFlowRequestSchema.BODY;
29-import static org.eclipse.edc.connector.dataplane.spi.schema.DataFlowRequestSchema.MEDIA_TYPE;
30-import static org.eclipse.edc.connector.dataplane.spi.schema.DataFlowRequestSchema.METHOD;
31-import static org.eclipse.edc.connector.dataplane.spi.schema.DataFlowRequestSchema.PATH;
32-import static org.eclipse.edc.connector.dataplane.spi.schema.DataFlowRequestSchema.QUERY_PARAMS;
33-
34-public class DataFlowRequestSupplier implements BiFunction<ContainerRequestContextApi, DataAddress, DataFlowStartMessage> {
35-
36- /**
37- * Put all properties of the incoming request (method, request body, query params...) into a map.
38- */
39- private static Map<String, String> createProps(ContainerRequestContextApi contextApi) {
40- var props = new HashMap<String, String>();
41- props.put(METHOD, contextApi.method());
42- props.put(QUERY_PARAMS, contextApi.queryParams());
43- props.put(PATH, contextApi.path());
44- Optional.ofNullable(contextApi.mediaType())
45- .ifPresent(mediaType -> {
46- props.put(MEDIA_TYPE, mediaType);
47- props.put(BODY, contextApi.body());
48- });
49- return props;
50- }
51-
52- /**
53- * Create a {@link DataFlowStartMessage} based on incoming request and claims decoded from the access token.
54- *
55- * @param contextApi Api for accessing request properties.
56- * @param dataAddress Source data address.
57- * @return DataFlowRequest
58- */
59- @Override
60- public DataFlowStartMessage apply(ContainerRequestContextApi contextApi, DataAddress dataAddress) {
61- var props = createProps(contextApi);
62- return DataFlowStartMessage.Builder.newInstance()
63- .processId(UUID.randomUUID().toString())
64- .sourceDataAddress(dataAddress)
65- .flowType(FlowType.PULL)
66- .destinationDataAddress(DataAddress.Builder.newInstance()
67- .type(AsyncStreamingDataSink.TYPE)
68- .build())
69- .id(UUID.randomUUID().toString())
70- .properties(props)
71- .build();
72- }
73-}
deleted extensions/data-plane/data-plane-public-api/src/main/java/org/eclipse/edc/connector/dataplane/api/controller/DataPlanePublicApi.java +0 −90
@@ -1,90 +0,0 @@
1-/*
2- * Copyright (c) 2022 Amadeus
3- *
4- * This program and the accompanying materials are made available under the
5- * terms of the Apache License, Version 2.0 which is available at
6- * https://www.apache.org/licenses/LICENSE-2.0
7- *
8- * SPDX-License-Identifier: Apache-2.0
9- *
10- * Contributors:
11- * Amadeus - Initial implementation
12- *
13- */
14-
15-package org.eclipse.edc.connector.dataplane.api.controller;
16-
17-import io.swagger.v3.oas.annotations.OpenAPIDefinition;
18-import io.swagger.v3.oas.annotations.Operation;
19-import io.swagger.v3.oas.annotations.responses.ApiResponse;
20-import io.swagger.v3.oas.annotations.tags.Tag;
21-import jakarta.ws.rs.container.AsyncResponse;
22-import jakarta.ws.rs.container.ContainerRequestContext;
23-
24-@OpenAPIDefinition
25-@Tag(name = "Data Plane public API",
26- description = "The public API of the Data Plane is a data proxy enabling a data consumer to actively query" +
27- "data from the provider data source (e.g. backend Rest API, internal database...) through its Data Plane" +
28- "instance. Thus the Data Plane is the only entry/output door for the data, which avoids the provider to expose" +
29- "directly its data externally." +
30- "The Data Plane public API being a proxy, it supports all verbs (i.e. GET, POST, PUT, PATCH, DELETE), which" +
31- "can then conveyed until the data source is required. This is especially useful when the actual data source" +
32- "is a Rest API itself." +
33- "In the same manner, any set of arbitrary query parameters, path parameters and request body are supported " +
34- "(in the limits fixed by the HTTP server) and can also conveyed to the actual data source.")
35-@Deprecated(since = "0.6.0")
36-public interface DataPlanePublicApi {
37-
38- @Operation(description = "Send `GET` data query to the Data Plane.",
39- responses = {
40- @ApiResponse(responseCode = "400", description = "Missing access token"),
41- @ApiResponse(responseCode = "403", description = "Access token is expired or invalid"),
42- @ApiResponse(responseCode = "500", description = "Failed to transfer data")
43- },
44- deprecated = true
45- )
46- @Deprecated(since = "0.5.1")
47- void get(ContainerRequestContext context, AsyncResponse response);
48-
49- @Operation(description = "Send `POST` data query to the Data Plane.",
50- responses = {
51- @ApiResponse(responseCode = "400", description = "Missing access token"),
52- @ApiResponse(responseCode = "403", description = "Access token is expired or invalid"),
53- @ApiResponse(responseCode = "500", description = "Failed to transfer data")
54- },
55- deprecated = true
56- )
57- @Deprecated(since = "0.5.1")
58- void post(ContainerRequestContext context, AsyncResponse response);
59-
60- @Operation(description = "Send `PUT` data query to the Data Plane.",
61- responses = {
62- @ApiResponse(responseCode = "400", description = "Missing access token"),
63- @ApiResponse(responseCode = "403", description = "Access token is expired or invalid"),
64- @ApiResponse(responseCode = "500", description = "Failed to transfer data")
65- },
66- deprecated = true
67- )
68- @Deprecated(since = "0.5.1")
69- void put(ContainerRequestContext context, AsyncResponse response);
70-
71- @Operation(description = "Send `DELETE` data query to the Data Plane.",
72- responses = {
73- @ApiResponse(responseCode = "400", description = "Missing access token"),
74- @ApiResponse(responseCode = "403", description = "Access token is expired or invalid"),
75- @ApiResponse(responseCode = "500", description = "Failed to transfer data")
76- }
77- )
78- void delete(ContainerRequestContext context, AsyncResponse response);
79-
80- @Operation(description = "Send `PATCH` data query to the Data Plane.",
81- responses = {
82- @ApiResponse(responseCode = "400", description = "Missing access token"),
83- @ApiResponse(responseCode = "403", description = "Access token is expired or invalid"),
84- @ApiResponse(responseCode = "500", description = "Failed to transfer data")
85- },
86- deprecated = true
87- )
88- @Deprecated(since = "0.5.1")
89- void patch(ContainerRequestContext context, AsyncResponse response);
90-}
deleted extensions/data-plane/data-plane-public-api/src/main/java/org/eclipse/edc/connector/dataplane/api/controller/DataPlanePublicApiController.java +0 −168
@@ -1,168 +0,0 @@
1-/*
2- * Copyright (c) 2022 Amadeus
3- *
4- * This program and the accompanying materials are made available under the
5- * terms of the Apache License, Version 2.0 which is available at
6- * https://www.apache.org/licenses/LICENSE-2.0
7- *
8- * SPDX-License-Identifier: Apache-2.0
9- *
10- * Contributors:
11- * Amadeus - initial API and implementation
12- * Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - improvements
13- * Mercedes-Benz Tech Innovation GmbH - publish public api context into dedicated swagger hub page
14- *
15- */
16-
17-package org.eclipse.edc.connector.dataplane.api.controller;
18-
19-import jakarta.ws.rs.DELETE;
20-import jakarta.ws.rs.GET;
21-import jakarta.ws.rs.PATCH;
22-import jakarta.ws.rs.POST;
23-import jakarta.ws.rs.PUT;
24-import jakarta.ws.rs.Path;
25-import jakarta.ws.rs.Produces;
26-import jakarta.ws.rs.container.AsyncResponse;
27-import jakarta.ws.rs.container.ContainerRequestContext;
28-import jakarta.ws.rs.container.Suspended;
29-import jakarta.ws.rs.core.Context;
30-import jakarta.ws.rs.core.HttpHeaders;
31-import jakarta.ws.rs.core.Response;
32-import jakarta.ws.rs.core.StreamingOutput;
33-import org.eclipse.edc.connector.dataplane.spi.pipeline.PipelineService;
34-import org.eclipse.edc.connector.dataplane.spi.resolver.DataAddressResolver;
35-import org.eclipse.edc.connector.dataplane.spi.response.TransferErrorResponse;
36-import org.eclipse.edc.connector.dataplane.util.sink.AsyncStreamingDataSink;
37-import org.eclipse.edc.spi.monitor.Monitor;
38-
39-import java.util.List;
40-import java.util.concurrent.ExecutorService;
41-
42-import static jakarta.ws.rs.core.MediaType.APPLICATION_JSON;
43-import static jakarta.ws.rs.core.MediaType.WILDCARD;
44-import static jakarta.ws.rs.core.Response.Status.BAD_REQUEST;
45-import static jakarta.ws.rs.core.Response.Status.FORBIDDEN;
46-import static jakarta.ws.rs.core.Response.Status.INTERNAL_SERVER_ERROR;
47-import static jakarta.ws.rs.core.Response.status;
48-
49-@Path("{any:.*}")
50-@Produces(WILDCARD)
51-@Deprecated(since = "0.6.0")
52-public class DataPlanePublicApiController implements DataPlanePublicApi {
53-
54- private final PipelineService pipelineService;
55- private final DataAddressResolver dataAddressResolver;
56- private final DataFlowRequestSupplier requestSupplier;
57- private final ExecutorService executorService;
58- private final Monitor monitor;
59-
60- public DataPlanePublicApiController(PipelineService pipelineService, DataAddressResolver dataAddressResolver,
61- ExecutorService executorService, Monitor monitor) {
62- this.pipelineService = pipelineService;
63- this.dataAddressResolver = dataAddressResolver;
64- this.monitor = monitor;
65- this.requestSupplier = new DataFlowRequestSupplier();
66- this.executorService = executorService;
67- }
68-
69- private static Response error(Response.Status status, String error) {
70- return status(status).type(APPLICATION_JSON).entity(new TransferErrorResponse(List.of(error))).build();
71- }
72-
73- @GET
74- @Override
75- public void get(@Context ContainerRequestContext requestContext, @Suspended AsyncResponse response) {
76- handle(requestContext, response);
77- }
78-
79- /**
80- * Sends a {@link POST} request to the data source and returns data.
81- *
82- * @param requestContext Request context.
83- * @param response Data fetched from the data source.
84- */
85- @POST
86- @Override
87- public void post(@Context ContainerRequestContext requestContext, @Suspended AsyncResponse response) {
88- handle(requestContext, response);
89- }
90-
91- /**
92- * Sends a {@link PUT} request to the data source and returns data.
93- *
94- * @param requestContext Request context.
95- * @param response Data fetched from the data source.
96- */
97- @PUT
98- @Override
99- public void put(@Context ContainerRequestContext requestContext, @Suspended AsyncResponse response) {
100- handle(requestContext, response);
101- }
102-
103- /**
104- * Sends a {@link DELETE} request to the data source and returns data.
105- *
106- * @param requestContext Request context.
107- * @param response Data fetched from the data source.
108- */
109- @DELETE
110- @Override
111- public void delete(@Context ContainerRequestContext requestContext, @Suspended AsyncResponse response) {
112- handle(requestContext, response);
113- }
114-
115- /**
116- * Sends a {@link PATCH} request to the data source and returns data.
117- *
118- * @param requestContext Request context.
119- * @param response Data fetched from the data source.
120- */
121- @PATCH
122- @Override
123- public void patch(@Context ContainerRequestContext requestContext, @Suspended AsyncResponse response) {
124- handle(requestContext, response);
125- }
126-
127- private void handle(ContainerRequestContext context, AsyncResponse response) {
128-
129- monitor.warning("The DataPlane Public API is deprecated. Please consider upgrading to the /v2/ path. Your request will then be: %s"
130- .formatted(context.getUriInfo().getBaseUri() + "v2/" + context.getUriInfo().getPath()));
131- var contextApi = new ContainerRequestContextApiImpl(context);
132- var token = contextApi.headers().get(HttpHeaders.AUTHORIZATION);
133- if (token == null) {
134- response.resume(error(BAD_REQUEST, "Missing token"));
135- return;
136- }
137-
138- var tokenValidation = dataAddressResolver.resolve(token);
139- if (tokenValidation.failed()) {
140- response.resume(error(FORBIDDEN, tokenValidation.getFailureDetail()));
141- return;
142- }
143-
144- var dataAddress = tokenValidation.getContent();
145- var dataFlowRequest = requestSupplier.apply(contextApi, dataAddress);
146-
147- AsyncStreamingDataSink.AsyncResponseContext asyncResponseContext = callback -> {
148- StreamingOutput output = t -> callback.outputStreamConsumer().accept(t);
149- var resp = Response.ok(output).type(callback.mediaType()).build();
150- return response.resume(resp);
151- };
152-
153- var sink = new AsyncStreamingDataSink(asyncResponseContext, executorService);
154-
155- pipelineService.transfer(dataFlowRequest, sink)
156- .whenComplete((result, throwable) -> {
157- if (throwable == null) {
158- if (result.failed()) {
159- response.resume(error(INTERNAL_SERVER_ERROR, result.getFailureDetail()));
160- }
161- } else {
162- var error = "Unhandled exception occurred during data transfer: " + throwable.getMessage();
163- response.resume(error(INTERNAL_SERVER_ERROR, error));
164- }
165- });
166- }
167-
168-}
deleted extensions/data-plane/data-plane-public-api/src/main/java/org/eclipse/edc/connector/dataplane/api/validation/ConsumerPullTransferDataAddressResolver.java +0 −68
@@ -1,68 +0,0 @@
1-/*
2- * Copyright (c) 2022 Amadeus
3- *
4- * This program and the accompanying materials are made available under the
5- * terms of the Apache License, Version 2.0 which is available at
6- * https://www.apache.org/licenses/LICENSE-2.0
7- *
8- * SPDX-License-Identifier: Apache-2.0
9- *
10- * Contributors:
11- * Amadeus - initial API and implementation
12- *
13- */
14-
15-package org.eclipse.edc.connector.dataplane.api.validation;
16-
17-import com.fasterxml.jackson.databind.ObjectMapper;
18-import jakarta.ws.rs.core.HttpHeaders;
19-import okhttp3.Request;
20-import org.eclipse.edc.connector.dataplane.spi.resolver.DataAddressResolver;
21-import org.eclipse.edc.http.spi.EdcHttpClient;
22-import org.eclipse.edc.spi.result.Result;
23-import org.eclipse.edc.spi.types.domain.DataAddress;
24-
25-import java.io.IOException;
26-
27-import static java.lang.String.format;
28-
29-@Deprecated(since = "0.6.0")
30-public class ConsumerPullTransferDataAddressResolver implements DataAddressResolver {
31-
32- private final EdcHttpClient httpClient;
33- private final String endpoint;
34- private final ObjectMapper mapper;
35-
36- public ConsumerPullTransferDataAddressResolver(EdcHttpClient httpClient, String endpoint, ObjectMapper mapper) {
37- this.httpClient = httpClient;
38- this.endpoint = endpoint;
39- this.mapper = mapper;
40- }
41-
42- /**
43- * Resolves access token received in input of Data Plane public API (consumer pull) into the {@link DataAddress}
44- * of the requested data.
45- *
46- * @param token Access token received in input of the Data Plane public API
47- * @return Data address
48- */
49- @Override
50- public Result<DataAddress> resolve(String token) {
51- var request = new Request.Builder().url(endpoint).header(HttpHeaders.AUTHORIZATION, token).get().build();
52- try (var response = httpClient.execute(request)) {
53- var body = response.body();
54- var stringBody = body != null ? body.string() : null;
55- if (stringBody == null) {
56- return Result.failure("Token validation server returned null body");
57- }
58-
59- if (response.isSuccessful()) {
60- return Result.success(mapper.readValue(stringBody, DataAddress.class));
61- } else {
62- return Result.failure(format("Call to token validation sever failed: %s - %s. %s", response.code(), response.message(), stringBody));
63- }
64- } catch (IOException e) {
65- return Result.failure("Unhandled exception occurred during call to token validation server: " + e.getMessage());
66- }
67- }
68-}
deleted extensions/data-plane/data-plane-public-api/src/main/resources/META-INF/services/org.eclipse.edc.spi.system.ServiceExtension +0 −1
@@ -1,1 +0,0 @@
1-org.eclipse.edc.connector.dataplane.api.DataPlanePublicApiExtension
No newline at the end of the file
deleted extensions/data-plane/data-plane-public-api/src/test/java/org/eclipse/edc/connector/dataplane/api/controller/DataFlowStartMessageSupplierTest.java +0 −94
@@ -1,94 +0,0 @@
1-/*
2- * Copyright (c) 2022 Amadeus
3- *
4- * This program and the accompanying materials are made available under the
5- * terms of the Apache License, Version 2.0 which is available at
6- * https://www.apache.org/licenses/LICENSE-2.0
7- *
8- * SPDX-License-Identifier: Apache-2.0
9- *
10- * Contributors:
11- * Amadeus - initial API and implementation
12- *
13- */
14-
15-package org.eclipse.edc.connector.dataplane.api.controller;
16-
17-import jakarta.ws.rs.HttpMethod;
18-import jakarta.ws.rs.core.MediaType;
19-import org.eclipse.edc.connector.dataplane.spi.schema.DataFlowRequestSchema;
20-import org.eclipse.edc.connector.dataplane.util.sink.AsyncStreamingDataSink;
21-import org.eclipse.edc.spi.types.domain.DataAddress;
22-import org.junit.jupiter.api.Test;
23-
24-import java.util.Map;
25-
26-import static org.assertj.core.api.Assertions.assertThat;
27-import static org.mockito.Mockito.mock;
28-import static org.mockito.Mockito.when;
29-
30-class DataFlowStartMessageSupplierTest {
31-
32-
33- private final DataFlowRequestSupplier supplier = new DataFlowRequestSupplier();
34-
35- private static DataAddress createDataAddress() {
36- return DataAddress.Builder.newInstance().type("test-type").build();
37- }
38-
39- @Test
40- void verifyMapping_noInputBody() {
41- var contextApi = mock(ContainerRequestContextApi.class);
42- var address = createDataAddress();
43-
44- var method = HttpMethod.GET;
45- var queryParams = "test-query-param";
46- var path = "test-path";
47-
48- when(contextApi.method()).thenReturn(method);
49- when(contextApi.queryParams()).thenReturn(queryParams);
50- when(contextApi.path()).thenReturn(path);
51-
52- var request = supplier.apply(contextApi, address);
53-
54- assertThat(request.getId()).isNotBlank();
55- assertThat(request.getDestinationDataAddress().getType()).isEqualTo(AsyncStreamingDataSink.TYPE);
56- assertThat(request.getSourceDataAddress().getType()).isEqualTo(address.getType());
57- assertThat(request.getProperties()).containsExactlyInAnyOrderEntriesOf(Map.of(
58- DataFlowRequestSchema.PATH, path,
59- DataFlowRequestSchema.METHOD, method,
60- DataFlowRequestSchema.QUERY_PARAMS, queryParams
61-
62- ));
63- }
64-
65- @Test
66- void verifyMapping_withInputBody() {
67- var contextApi = mock(ContainerRequestContextApi.class);
68- var address = createDataAddress();
69-
70- var method = HttpMethod.GET;
71- var queryParams = "test-query-param";
72- var path = "test-path";
73- var body = "Test request body";
74-
75- when(contextApi.method()).thenReturn(method);
76- when(contextApi.queryParams()).thenReturn(queryParams);
77- when(contextApi.path()).thenReturn(path);
78- when(contextApi.mediaType()).thenReturn(MediaType.TEXT_PLAIN);
79- when(contextApi.body()).thenReturn(body);
80-
81- var request = supplier.apply(contextApi, address);
82-
83- assertThat(request.getId()).isNotBlank();
84- assertThat(request.getDestinationDataAddress().getType()).isEqualTo(AsyncStreamingDataSink.TYPE);
85- assertThat(request.getSourceDataAddress().getType()).isEqualTo(address.getType());
86- assertThat(request.getProperties()).containsExactlyInAnyOrderEntriesOf(Map.of(
87- DataFlowRequestSchema.PATH, path,
88- DataFlowRequestSchema.METHOD, method,
89- DataFlowRequestSchema.QUERY_PARAMS, queryParams,
90- DataFlowRequestSchema.BODY, body,
91- DataFlowRequestSchema.MEDIA_TYPE, MediaType.TEXT_PLAIN
92- ));
93- }
94-}
deleted extensions/data-plane/data-plane-public-api/src/test/java/org/eclipse/edc/connector/dataplane/api/controller/DataPlanePublicApiControllerTest.java +0 −190
@@ -1,190 +0,0 @@
1-/*
2- * Copyright (c) 2022 Amadeus
3- *
4- * This program and the accompanying materials are made available under the
5- * terms of the Apache License, Version 2.0 which is available at
6- * https://www.apache.org/licenses/LICENSE-2.0
7- *
8- * SPDX-License-Identifier: Apache-2.0
9- *
10- * Contributors:
11- * Amadeus - initial API and implementation
12- * Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - improvements
13- *
14- */
15-
16-package org.eclipse.edc.connector.dataplane.api.controller;
17-
18-import io.restassured.specification.RequestSpecification;
19-import jakarta.ws.rs.core.Response;
20-import org.eclipse.edc.connector.dataplane.spi.pipeline.DataSource;
21-import org.eclipse.edc.connector.dataplane.spi.pipeline.PipelineService;
22-import org.eclipse.edc.connector.dataplane.spi.pipeline.StreamResult;
23-import org.eclipse.edc.connector.dataplane.spi.resolver.DataAddressResolver;
24-import org.eclipse.edc.connector.dataplane.util.sink.AsyncStreamingDataSink;
25-import org.eclipse.edc.junit.annotations.ApiTest;
26-import org.eclipse.edc.spi.result.Result;
27-import org.eclipse.edc.spi.types.domain.DataAddress;
28-import org.eclipse.edc.spi.types.domain.transfer.DataFlowStartMessage;
29-import org.eclipse.edc.web.jersey.testfixtures.RestControllerTestBase;
30-import org.junit.jupiter.api.Test;
31-import org.mockito.ArgumentCaptor;
32-
33-import java.io.ByteArrayInputStream;
34-import java.io.InputStream;
35-import java.util.UUID;
36-import java.util.concurrent.CompletableFuture;
37-import java.util.concurrent.Executors;
38-import java.util.stream.Stream;
39-
40-import static io.restassured.RestAssured.given;
41-import static io.restassured.http.ContentType.JSON;
42-import static jakarta.ws.rs.core.HttpHeaders.AUTHORIZATION;
43-import static java.util.concurrent.CompletableFuture.completedFuture;
44-import static java.util.concurrent.CompletableFuture.failedFuture;
45-import static org.assertj.core.api.Assertions.assertThat;
46-import static org.eclipse.edc.connector.dataplane.spi.pipeline.StreamFailure.Reason.GENERAL_ERROR;
47-import static org.hamcrest.CoreMatchers.is;
48-import static org.hamcrest.CoreMatchers.not;
49-import static org.mockito.ArgumentMatchers.any;
50-import static org.mockito.Mockito.mock;
51-import static org.mockito.Mockito.verify;
52-import static org.mockito.Mockito.when;
53-
54-@ApiTest
55-class DataPlanePublicApiControllerTest extends RestControllerTestBase {
56-
57- private final PipelineService pipelineService = mock();
58- private final DataAddressResolver dataAddressResolver = mock();
59-
60- @Test
61- void should_returnBadRequest_if_missingAuthorizationHeader() {
62- baseRequest()
63- .post("/any")
64- .then()
65- .statusCode(Response.Status.BAD_REQUEST.getStatusCode())
66- .body("errors[0]", is("Missing token"));
67- }
68-
69- @Test
70- void shouldNotReturn302_whenUrlWithoutTrailingSlash() {
71- baseRequest()
72- .post("")
73- .then()
74- .statusCode(not(302));
75- }
76-
77- @Test
78- void should_returnForbidden_if_tokenValidationFails() {
79- var token = UUID.randomUUID().toString();
80- when(dataAddressResolver.resolve(any())).thenReturn(Result.failure("token is not value"));
81-
82- baseRequest()
83- .header(AUTHORIZATION, token)
84- .post("/any")
85- .then()
86- .statusCode(Response.Status.FORBIDDEN.getStatusCode())
87- .contentType(JSON)
88- .body("errors.size()", is(1));
89-
90- verify(dataAddressResolver).resolve(token);
91- }
92-
93- @Test
94- void should_returnInternalServerError_if_transferFails() {
95- var token = UUID.randomUUID().toString();
96- var errorMsg = UUID.randomUUID().toString();
97- when(dataAddressResolver.resolve(any())).thenReturn(Result.success(testDestAddress()));
98- when(pipelineService.transfer(any(), any()))
99- .thenReturn(completedFuture(StreamResult.error(errorMsg)));
100-
101- baseRequest()
102- .header(AUTHORIZATION, token)
103- .when()
104- .post("/any")
105- .then()
106- .statusCode(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode())
107- .contentType(JSON)
108- .body("errors[0]", is(GENERAL_ERROR + ": " + errorMsg));
109- }
110-
111- @Test
112- void should_returnInternalServerError_if_transferThrows() {
113- var token = UUID.randomUUID().toString();
114- var errorMsg = UUID.randomUUID().toString();
115- when(dataAddressResolver.resolve(any())).thenReturn(Result.success(testDestAddress()));
116- when(pipelineService.transfer(any(DataFlowStartMessage.class), any()))
117- .thenReturn(failedFuture(new RuntimeException(errorMsg)));
118-
119- baseRequest()
120- .header(AUTHORIZATION, token)
121- .when()
122- .post("/any")
123- .then()
124- .statusCode(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode())
125- .contentType(JSON)
126- .body("errors[0]", is("Unhandled exception occurred during data transfer: " + errorMsg));
127- }
128-
129- @Test
130- void shouldStreamSourceToResponse() {
131- when(dataAddressResolver.resolve(any())).thenReturn(Result.success(testDestAddress()));
132- when(pipelineService.transfer(any(), any())).thenAnswer(i -> {
133- ((AsyncStreamingDataSink) i.getArgument(1)).transfer(new TestDataSource("application/something", "data"));
134- return CompletableFuture.completedFuture(StreamResult.success());
135- });
136-
137- var responseBody = baseRequest()
138- .header(AUTHORIZATION, UUID.randomUUID().toString())
139- .when()
140- .post("/any?foo=bar")
141- .then()
142- .log().ifError()
143- .statusCode(Response.Status.OK.getStatusCode())
144- .contentType("application/something")
145- .extract().body().asString();
146-
147- assertThat(responseBody).isEqualTo("data");
148- var requestCaptor = ArgumentCaptor.forClass(DataFlowStartMessage.class);
149- verify(pipelineService).transfer(requestCaptor.capture(), any());
150- var request = requestCaptor.getValue();
151- assertThat(request.getDestinationDataAddress().getType()).isEqualTo(AsyncStreamingDataSink.TYPE);
152- assertThat(request.getSourceDataAddress().getType()).isEqualTo("test");
153- assertThat(request.getProperties()).containsEntry("method", "POST").containsEntry("pathSegments", "any").containsEntry("queryParams", "foo=bar");
154- }
155-
156- @Override
157- protected Object controller() {
158- return new DataPlanePublicApiController(pipelineService, dataAddressResolver, Executors.newSingleThreadExecutor(), mock());
159- }
160-
161- private RequestSpecification baseRequest() {
162- return given()
163- .baseUri("http://localhost:" + port)
164- .when();
165- }
166-
167- private DataAddress testDestAddress() {
168- return DataAddress.Builder.newInstance().type("test").build();
169- }
170-
171- private record TestDataSource(String mediaType, String data) implements DataSource, DataSource.Part {
172-
173- @Override
174- public StreamResult<Stream<Part>> openPartStream() {
175- return StreamResult.success(Stream.of(this));
176- }
177-
178- @Override
179- public String name() {
180- return "test";
181- }
182-
183- @Override
184- public InputStream openStream() {
185- return new ByteArrayInputStream(data.getBytes());
186- }
187-
188- }
189-
190-}
deleted extensions/data-plane/data-plane-public-api/src/test/java/org/eclipse/edc/connector/dataplane/api/validation/ConsumerPullTransferDataAddressResolverTest.java +0 −106
@@ -1,106 +0,0 @@
1-/*
2- * Copyright (c) 2022 Amadeus
3- *
4- * This program and the accompanying materials are made available under the
5- * terms of the Apache License, Version 2.0 which is available at
6- * https://www.apache.org/licenses/LICENSE-2.0
7- *
8- * SPDX-License-Identifier: Apache-2.0
9- *
10- * Contributors:
11- * Amadeus - initial API and implementation
12- *
13- */
14-
15-package org.eclipse.edc.connector.dataplane.api.validation;
16-
17-import com.fasterxml.jackson.core.JsonProcessingException;
18-import com.fasterxml.jackson.databind.ObjectMapper;
19-import jakarta.ws.rs.core.HttpHeaders;
20-import org.eclipse.edc.json.JacksonTypeManager;
21-import org.eclipse.edc.spi.types.domain.DataAddress;
22-import org.junit.jupiter.api.AfterAll;
23-import org.junit.jupiter.api.AfterEach;
24-import org.junit.jupiter.api.BeforeAll;
25-import org.junit.jupiter.api.BeforeEach;
26-import org.junit.jupiter.api.Test;
27-import org.mockserver.integration.ClientAndServer;
28-import org.mockserver.model.HttpRequest;
29-import org.mockserver.model.HttpResponse;
30-import org.mockserver.model.MediaType;
31-
32-import java.util.UUID;
33-
34-import static org.assertj.core.api.Assertions.assertThat;
35-import static org.eclipse.edc.http.client.testfixtures.HttpTestUtils.testHttpClient;
36-import static org.eclipse.edc.util.io.Ports.getFreePort;
37-import static org.mockserver.integration.ClientAndServer.startClientAndServer;
38-import static org.mockserver.matchers.Times.once;
39-import static org.mockserver.stop.Stop.stopQuietly;
40-
41-class ConsumerPullTransferDataAddressResolverTest {
42-
43- private static final ObjectMapper MAPPER = new JacksonTypeManager().getMapper();
44- private static final int PORT = getFreePort();
45- private static final String TOKEN_VALIDATION_SERVER_URL = "http://localhost:" + PORT;
46- private static ClientAndServer validationClientAndServer;
47-
48- private ConsumerPullTransferDataAddressResolver resolver;
49-
50- @BeforeAll
51- public static void startServer() {
52- validationClientAndServer = startClientAndServer(PORT);
53- }
54-
55- @AfterAll
56- public static void stopServer() {
57- stopQuietly(validationClientAndServer);
58- }
59-
60- @BeforeEach
61- public void setUp() {
62- resolver = new ConsumerPullTransferDataAddressResolver(testHttpClient(), TOKEN_VALIDATION_SERVER_URL, MAPPER);
63- }
64-
65- @AfterEach
66- public void tearDown() {
67- validationClientAndServer.reset();
68- }
69-
70- @Test
71- void verifySuccessTokenValidation() throws JsonProcessingException {
72- var token = UUID.randomUUID().toString();
73- var address = DataAddress.Builder.newInstance()
74- .type("test-type")
75- .build();
76-
77- validationClientAndServer.when(new HttpRequest().withHeader(HttpHeaders.AUTHORIZATION, token), once())
78- .respond(HttpResponse.response()
79- .withStatusCode(200)
80- .withBody(MAPPER.writeValueAsString(address))
81- .withContentType(MediaType.APPLICATION_JSON));
82-
83- var result = resolver.resolve(token);
84-
85- assertThat(result.succeeded()).isTrue();
86- assertThat(result.getContent().getType()).isEqualTo(address.getType());
87- }
88-
89- @Test
90- void verifyFailedResultReturnedIfServerResponseIsUnsuccessful() throws JsonProcessingException {
91- var token = UUID.randomUUID().toString();
92- var address = DataAddress.Builder.newInstance()
93- .type("test-type")
94- .build();
95-
96- validationClientAndServer.when(new HttpRequest().withHeader(HttpHeaders.AUTHORIZATION, token), once())
97- .respond(HttpResponse.response()
98- .withStatusCode(400)
99- .withBody(MAPPER.writeValueAsString(address))
100- .withContentType(MediaType.APPLICATION_JSON));
101-
102- var result = resolver.resolve(token);
103-
104- assertThat(result.failed()).isTrue();
105- }
106-}
deleted extensions/data-plane/data-plane-signaling/data-plane-signaling-api-configuration/build.gradle.kts +0 −38
@@ -1,38 +0,0 @@
1-/*
2- * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
3- *
4- * This program and the accompanying materials are made available under the
5- * terms of the Apache License, Version 2.0 which is available at
6- * https://www.apache.org/licenses/LICENSE-2.0
7- *
8- * SPDX-License-Identifier: Apache-2.0
9- *
10- * Contributors:
11- * Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation
12- *
13- */
14-
15-
16-plugins {
17- `java-library`
18-}
19-
20-dependencies {
21- api(project(":spi:common:json-ld-spi"))
22- api(project(":spi:common:web-spi"))
23- api(project(":spi:data-plane:data-plane-spi"))
24-
25- implementation(project(":core:common:lib:transform-lib"))
26- implementation(project(":extensions:common:http:lib:jersey-providers-lib"))
27- implementation(project(":extensions:data-plane:data-plane-signaling:data-plane-signaling-transform"))
28- implementation(libs.jakarta.rsApi)
29-
30- testImplementation(project(":core:common:junit"))
31-}
32-edcBuild {
33- swagger {
34- apiGroup.set("control-api")
35- }
36-}
37-
38-
deleted extensions/data-plane/data-plane-signaling/data-plane-signaling-api-configuration/src/main/java/org/eclipse/edc/connector/api/signaling/configuration/SignalingApiConfigurationExtension.java +0 −121
@@ -1,121 +0,0 @@
1-/*
2- * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
3- *
4- * This program and the accompanying materials are made available under the
5- * terms of the Apache License, Version 2.0 which is available at
6- * https://www.apache.org/licenses/LICENSE-2.0
7- *
8- * SPDX-License-Identifier: Apache-2.0
9- *
10- * Contributors:
11- * Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation
12- *
13- */
14-
15-package org.eclipse.edc.connector.api.signaling.configuration;
16-
17-import com.fasterxml.jackson.databind.ObjectMapper;
18-import jakarta.json.Json;
19-import org.eclipse.edc.connector.api.signaling.transform.from.JsonObjectFromDataFlowResponseMessageTransformer;
20-import org.eclipse.edc.connector.api.signaling.transform.to.JsonObjectToDataFlowStartMessageTransformer;
21-import org.eclipse.edc.connector.api.signaling.transform.to.JsonObjectToDataFlowSuspendMessageTransformer;
22-import org.eclipse.edc.connector.api.signaling.transform.to.JsonObjectToDataFlowTerminateMessageTransformer;
23-import org.eclipse.edc.jsonld.spi.JsonLd;
24-import org.eclipse.edc.runtime.metamodel.annotation.Extension;
25-import org.eclipse.edc.runtime.metamodel.annotation.Inject;
26-import org.eclipse.edc.runtime.metamodel.annotation.SettingContext;
27-import org.eclipse.edc.spi.system.ServiceExtension;
28-import org.eclipse.edc.spi.system.ServiceExtensionContext;
29-import org.eclipse.edc.spi.types.TypeManager;
30-import org.eclipse.edc.transform.spi.TypeTransformerRegistry;
31-import org.eclipse.edc.transform.transformer.dspace.from.JsonObjectFromDataAddressDspaceTransformer;
32-import org.eclipse.edc.transform.transformer.dspace.to.JsonObjectToDataAddressDspaceTransformer;
33-import org.eclipse.edc.web.jersey.providers.jsonld.JerseyJsonLdInterceptor;
34-import org.eclipse.edc.web.jersey.providers.jsonld.ObjectMapperProvider;
35-import org.eclipse.edc.web.spi.WebServer;
36-import org.eclipse.edc.web.spi.WebService;
37-import org.eclipse.edc.web.spi.configuration.ApiContext;
38-import org.eclipse.edc.web.spi.configuration.WebServiceConfigurer;
39-import org.eclipse.edc.web.spi.configuration.WebServiceSettings;
40-import org.jetbrains.annotations.NotNull;
41-
42-import java.util.Map;
43-
44-import static org.eclipse.edc.connector.api.signaling.configuration.SignalingApiConfigurationExtension.NAME;
45-import static org.eclipse.edc.jsonld.spi.Namespaces.DSPACE_PREFIX;
46-import static org.eclipse.edc.jsonld.spi.Namespaces.DSPACE_SCHEMA;
47-import static org.eclipse.edc.policy.model.OdrlNamespace.ODRL_PREFIX;
48-import static org.eclipse.edc.policy.model.OdrlNamespace.ODRL_SCHEMA;
49-import static org.eclipse.edc.spi.constants.CoreConstants.JSON_LD;
50-
51-@Deprecated(since = "0.6.4")
52-@Extension(value = NAME)
53-public class SignalingApiConfigurationExtension implements ServiceExtension {
54-
55- public static final String NAME = "DataPlane Signaling API Configuration Extension";
56-
57- @SettingContext("Signaling API context setting key")
58- private static final String SIGNALING_CONFIG_KEY = "web.http." + ApiContext.SIGNALING;
59-
60- public static final WebServiceSettings SETTINGS = WebServiceSettings.Builder.newInstance()
61- .apiConfigKey(SIGNALING_CONFIG_KEY)
62- .contextAlias(ApiContext.SIGNALING)
63- .defaultPath("/api/signaling")
64- .defaultPort(10080)
65- .useDefaultContext(false)
66- .name("DataPlane Signaling API")
67- .build();
68-
69- private static final String SIGNALING_SCOPE = "SIGNALING_API";
70-
71- @Inject
72- private WebService webService;
73- @Inject
74- private WebServiceConfigurer configurer;
75- @Inject
76- private WebServer webServer;
77- @Inject
78- private JsonLd jsonLd;
79- @Inject
80- private TypeManager typeManager;
81- @Inject
82- private TypeTransformerRegistry transformerRegistry;
83-
84- @Override
85- public String name() {
86- return NAME;
87- }
88-
89- @Override
90- public void initialize(ServiceExtensionContext context) {
91- var warningMessage = """
92- The data-plane-signaling-api-configuration extension is deprecated as the related 'web.http.signaling'
93- settings, please exclude from your build and configure your endpoints to the control-api context
94- """;
95- context.getMonitor().warning(warningMessage);
96- var config = context.getConfig(SIGNALING_CONFIG_KEY);
97- configurer.configure(config, webServer, SETTINGS);
98-
99- jsonLd.registerNamespace(ODRL_PREFIX, ODRL_SCHEMA, SIGNALING_SCOPE);
100- jsonLd.registerNamespace(DSPACE_PREFIX, DSPACE_SCHEMA, SIGNALING_SCOPE);
101-
102- var jsonLdMapper = getJsonLdMapper();
103- webService.registerResource(ApiContext.SIGNALING, new ObjectMapperProvider(jsonLdMapper));
104- webService.registerResource(ApiContext.SIGNALING, new JerseyJsonLdInterceptor(jsonLd, jsonLdMapper, SIGNALING_SCOPE));
105-
106- var factory = Json.createBuilderFactory(Map.of());
107-
108- var signalingApiTypeTransformerRegistry = transformerRegistry.forContext("signaling-api");
109- signalingApiTypeTransformerRegistry.register(new JsonObjectToDataFlowStartMessageTransformer());
110- signalingApiTypeTransformerRegistry.register(new JsonObjectToDataFlowSuspendMessageTransformer());
111- signalingApiTypeTransformerRegistry.register(new JsonObjectToDataFlowTerminateMessageTransformer());
112- signalingApiTypeTransformerRegistry.register(new JsonObjectToDataAddressDspaceTransformer());
113- signalingApiTypeTransformerRegistry.register(new JsonObjectFromDataFlowResponseMessageTransformer(factory));
114- signalingApiTypeTransformerRegistry.register(new JsonObjectFromDataAddressDspaceTransformer(factory, jsonLdMapper));
115- }
116-
117- @NotNull
118- private ObjectMapper getJsonLdMapper() {
119- return typeManager.getMapper(JSON_LD);
120- }
121-}
deleted extensions/data-plane/data-plane-signaling/data-plane-signaling-api-configuration/src/main/resources/META-INF/services/org.eclipse.edc.spi.system.ServiceExtension +0 −15
@@ -1,15 +0,0 @@
1-#
2-# Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
3-#
4-# This program and the accompanying materials are made available under the
5-# terms of the Apache License, Version 2.0 which is available at
6-# https://www.apache.org/licenses/LICENSE-2.0
7-#
8-# SPDX-License-Identifier: Apache-2.0
9-#
10-# Contributors:
11-# Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation
12-#
13-#
14-
15-org.eclipse.edc.connector.api.signaling.configuration.SignalingApiConfigurationExtension
deleted extensions/data-plane/data-plane-signaling/data-plane-signaling-api-configuration/src/test/java/org/eclipse/edc/connector/api/signaling/configuration/SignalingApiConfigurationExtensionTest.java +0 −78
@@ -1,78 +0,0 @@
1-/*
2- * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
3- *
4- * This program and the accompanying materials are made available under the
5- * terms of the Apache License, Version 2.0 which is available at
6- * https://www.apache.org/licenses/LICENSE-2.0
7- *
8- * SPDX-License-Identifier: Apache-2.0
9- *
10- * Contributors:
11- * Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation
12- *
13- */
14-
15-package org.eclipse.edc.connector.api.signaling.configuration;
16-
17-import org.eclipse.edc.boot.system.DefaultServiceExtensionContext;
18-import org.eclipse.edc.junit.extensions.DependencyInjectionExtension;
19-import org.eclipse.edc.spi.monitor.Monitor;
20-import org.eclipse.edc.spi.system.ServiceExtensionContext;
21-import org.eclipse.edc.spi.system.configuration.Config;
22-import org.eclipse.edc.spi.system.configuration.ConfigFactory;
23-import org.eclipse.edc.transform.spi.TypeTransformerRegistry;
24-import org.eclipse.edc.web.jersey.providers.jsonld.JerseyJsonLdInterceptor;
25-import org.eclipse.edc.web.jersey.providers.jsonld.ObjectMapperProvider;
26-import org.eclipse.edc.web.spi.WebService;
27-import org.eclipse.edc.web.spi.configuration.ApiContext;
28-import org.eclipse.edc.web.spi.configuration.WebServiceConfiguration;
29-import org.eclipse.edc.web.spi.configuration.WebServiceConfigurer;
30-import org.jetbrains.annotations.NotNull;
31-import org.junit.jupiter.api.BeforeEach;
32-import org.junit.jupiter.api.Test;
33-import org.junit.jupiter.api.extension.ExtendWith;
34-
35-import static org.eclipse.edc.connector.api.signaling.configuration.SignalingApiConfigurationExtension.SETTINGS;
36-import static org.mockito.ArgumentMatchers.any;
37-import static org.mockito.ArgumentMatchers.eq;
38-import static org.mockito.ArgumentMatchers.isA;
39-import static org.mockito.Mockito.mock;
40-import static org.mockito.Mockito.verify;
41-import static org.mockito.Mockito.when;
42-
43-@ExtendWith(DependencyInjectionExtension.class)
44-class SignalingApiConfigurationExtensionTest {
45-
46- private final WebServiceConfigurer configurer = mock();
47- private final Monitor monitor = mock();
48- private final WebService webService = mock();
49-
50- @BeforeEach
51- void setUp(ServiceExtensionContext context) {
52- TypeTransformerRegistry typeTransformerRegistry = mock();
53- when(typeTransformerRegistry.forContext(any())).thenReturn(mock());
54- context.registerService(TypeTransformerRegistry.class, typeTransformerRegistry);
55- context.registerService(WebService.class, webService);
56- context.registerService(WebServiceConfigurer.class, configurer);
57- }
58-
59- @Test
60- void initialize_shouldConfigureAndRegisterResource(SignalingApiConfigurationExtension extension) {
61- var context = contextWithConfig(ConfigFactory.empty());
62- var configuration = WebServiceConfiguration.Builder.newInstance().path("/path").port(1234).build();
63- when(configurer.configure(any(), any(), any())).thenReturn(configuration);
64-
65- extension.initialize(context);
66-
67- verify(configurer).configure(any(), any(), eq(SETTINGS));
68- verify(webService).registerResource(eq(ApiContext.SIGNALING), isA(ObjectMapperProvider.class));
69- verify(webService).registerResource(eq(ApiContext.SIGNALING), isA(JerseyJsonLdInterceptor.class));
70- }
71-
72- @NotNull
73- private DefaultServiceExtensionContext contextWithConfig(Config config) {
74- var context = new DefaultServiceExtensionContext(monitor, config);
75- context.initialize();
76- return context;
77- }
78-}
modified extensions/data-plane/data-plane-signaling/data-plane-signaling-client/build.gradle.kts +0 −1
@@ -25,7 +25,6 @@
2525 implementation(project(":core:common:lib:util-lib"))
2626 implementation(project(":core:common:lib:transform-lib"))
2727 implementation(project(":extensions:data-plane:data-plane-signaling:data-plane-signaling-transform"))
28- implementation(project(":extensions:data-plane:data-plane-client-embedded"))
2928
3029 implementation(libs.opentelemetry.instrumentation.annotations)
3130
added extensions/data-plane/data-plane-signaling/data-plane-signaling-client/src/main/java/org/eclipse/edc/connector/dataplane/client/EmbeddedDataPlaneClient.java +67 −0
@@ -0,0 +1,67 @@
1+/*
2+ * Copyright (c) 2022 Amadeus
3+ *
4+ * This program and the accompanying materials are made available under the
5+ * terms of the Apache License, Version 2.0 which is available at
6+ * https://www.apache.org/licenses/LICENSE-2.0
7+ *
8+ * SPDX-License-Identifier: Apache-2.0
9+ *
10+ * Contributors:
11+ * Amadeus - initial API and implementation
12+ *
13+ */
14+
15+package org.eclipse.edc.connector.dataplane.client;
16+
17+import io.opentelemetry.instrumentation.annotations.WithSpan;
18+import org.eclipse.edc.connector.dataplane.selector.spi.client.DataPlaneClient;
19+import org.eclipse.edc.connector.dataplane.spi.manager.DataPlaneManager;
20+import org.eclipse.edc.spi.response.ResponseStatus;
21+import org.eclipse.edc.spi.response.StatusResult;
22+import org.eclipse.edc.spi.types.domain.transfer.DataFlowResponseMessage;
23+import org.eclipse.edc.spi.types.domain.transfer.DataFlowStartMessage;
24+
25+import java.util.Objects;
26+
27+/**
28+ * Implementation of a {@link DataPlaneClient} that uses a local {@link DataPlaneManager},
29+ * i.e. one that runs in the same JVM as the control plane.
30+ */
31+public class EmbeddedDataPlaneClient implements DataPlaneClient {
32+
33+ private final DataPlaneManager dataPlaneManager;
34+
35+ public EmbeddedDataPlaneClient(DataPlaneManager dataPlaneManager) {
36+ this.dataPlaneManager = Objects.requireNonNull(dataPlaneManager, "Data plane manager");
37+ }
38+
39+ @WithSpan
40+ @Override
41+ public StatusResult<DataFlowResponseMessage> start(DataFlowStartMessage request) {
42+ var result = dataPlaneManager.validate(request);
43+ if (result.failed()) {
44+ return StatusResult.failure(ResponseStatus.FATAL_ERROR, result.getFailureDetail());
45+ }
46+ var startResult = dataPlaneManager.start(request);
47+ if (startResult.failed()) {
48+ return StatusResult.failure(ResponseStatus.FATAL_ERROR, startResult.getFailureDetail());
49+ }
50+ return StatusResult.success(startResult.getContent());
51+ }
52+
53+ @Override
54+ public StatusResult<Void> suspend(String transferProcessId) {
55+ return dataPlaneManager.suspend(transferProcessId);
56+ }
57+
58+ @Override
59+ public StatusResult<Void> terminate(String transferProcessId) {
60+ return dataPlaneManager.terminate(transferProcessId);
61+ }
62+
63+ @Override
64+ public StatusResult<Void> checkAvailability() {
65+ return StatusResult.success();
66+ }
67+}
added extensions/data-plane/data-plane-signaling/data-plane-signaling-client/src/test/java/org/eclipse/edc/connector/dataplane/client/EmbeddedDataPlaneClientTest.java +112 −0
@@ -0,0 +1,112 @@
1+/*
2+ * Copyright (c) 2022 Amadeus
3+ *
4+ * This program and the accompanying materials are made available under the
5+ * terms of the Apache License, Version 2.0 which is available at
6+ * https://www.apache.org/licenses/LICENSE-2.0
7+ *
8+ * SPDX-License-Identifier: Apache-2.0
9+ *
10+ * Contributors:
11+ * Amadeus - initial API and implementation
12+ *
13+ */
14+
15+package org.eclipse.edc.connector.dataplane.client;
16+
17+import org.eclipse.edc.connector.dataplane.selector.spi.client.DataPlaneClient;
18+import org.eclipse.edc.connector.dataplane.spi.manager.DataPlaneManager;
19+import org.eclipse.edc.spi.response.StatusResult;
20+import org.eclipse.edc.spi.result.Result;
21+import org.eclipse.edc.spi.types.domain.DataAddress;
22+import org.eclipse.edc.spi.types.domain.transfer.DataFlowResponseMessage;
23+import org.eclipse.edc.spi.types.domain.transfer.DataFlowStartMessage;
24+import org.junit.jupiter.api.Test;
25+
26+import static org.assertj.core.api.Assertions.assertThat;
27+import static org.eclipse.edc.junit.assertions.AbstractResultAssert.assertThat;
28+import static org.mockito.ArgumentMatchers.any;
29+import static org.mockito.Mockito.mock;
30+import static org.mockito.Mockito.never;
31+import static org.mockito.Mockito.verify;
32+import static org.mockito.Mockito.when;
33+
34+class EmbeddedDataPlaneClientTest {
35+
36+ private final DataPlaneManager dataPlaneManager = mock();
37+ private final DataPlaneClient client = new EmbeddedDataPlaneClient(dataPlaneManager);
38+
39+ private static DataFlowStartMessage createDataFlowRequest() {
40+ return DataFlowStartMessage.Builder.newInstance()
41+ .id("123")
42+ .processId("456")
43+ .sourceDataAddress(DataAddress.Builder.newInstance().type("test").build())
44+ .destinationDataAddress(DataAddress.Builder.newInstance().type("test").build())
45+ .build();
46+ }
47+
48+ @Test
49+ void transfer_shouldSucceed_whenTransferInitiatedCorrectly() {
50+ var response = DataFlowResponseMessage.Builder.newInstance().dataAddress(DataAddress.Builder.newInstance().type("type").build()).build();
51+ var request = createDataFlowRequest();
52+ when(dataPlaneManager.validate(any())).thenReturn(Result.success(true));
53+ when(dataPlaneManager.start(any())).thenReturn(Result.success(response));
54+
55+ var result = client.start(request);
56+
57+ verify(dataPlaneManager).validate(request);
58+ verify(dataPlaneManager).start(request);
59+
60+ assertThat(result).isSucceeded().isEqualTo(response);
61+ }
62+
63+ @Test
64+ void transfer_shouldReturnFailedResult_whenValidationFailure() {
65+ var errorMsg = "error";
66+ var request = createDataFlowRequest();
67+ when(dataPlaneManager.validate(any())).thenReturn(Result.failure(errorMsg));
68+ when(dataPlaneManager.start(any())).thenReturn(Result.success(DataFlowResponseMessage.Builder.newInstance().build()));
69+
70+ var result = client.start(request);
71+
72+ verify(dataPlaneManager).validate(request);
73+ verify(dataPlaneManager, never()).start(any());
74+
75+ assertThat(result).isFailed().messages().hasSize(1).allSatisfy(s -> assertThat(s).contains(errorMsg));
76+ }
77+
78+ @Test
79+ void transfer_shouldReturnFailedResult_whenStartFailure() {
80+ var errorMsg = "error";
81+ var request = createDataFlowRequest();
82+ when(dataPlaneManager.validate(any())).thenReturn(Result.success(true));
83+ when(dataPlaneManager.start(any())).thenReturn(Result.failure(errorMsg));
84+
85+ var result = client.start(request);
86+
87+ verify(dataPlaneManager).validate(request);
88+ verify(dataPlaneManager).start(request);
89+
90+ assertThat(result).isFailed().messages().hasSize(1).allSatisfy(s -> assertThat(s).contains(errorMsg));
91+ }
92+
93+ @Test
94+ void suspend_shouldProxyCallToManager() {
95+ when(dataPlaneManager.suspend(any())).thenReturn(StatusResult.success());
96+
97+ var result = client.suspend("dataFlowId");
98+
99+ assertThat(result).isSucceeded();
100+ verify(dataPlaneManager).suspend("dataFlowId");
101+ }
102+
103+ @Test
104+ void terminate_shouldProxyCallToManager() {
105+ when(dataPlaneManager.terminate(any())).thenReturn(StatusResult.success());
106+
107+ var result = client.terminate("dataFlowId");
108+
109+ assertThat(result).isSucceeded();
110+ verify(dataPlaneManager).terminate("dataFlowId");
111+ }
112+}
modified settings.gradle.kts +0 −6
@@ -174,7 +174,6 @@
174174 include(":extensions:control-plane:api:management-api:policy-definition-api")
175175 include(":extensions:control-plane:api:management-api:transfer-process-api")
176176 include(":extensions:control-plane:api:management-api:edr-cache-api")
177-include(":extensions:control-plane:transfer:transfer-data-plane")
178177 include(":extensions:control-plane:transfer:transfer-data-plane-signaling")
179178 include(":extensions:control-plane:transfer:transfer-pull-http-receiver")
180179 include(":extensions:control-plane:transfer:transfer-pull-http-dynamic-receiver")
@@ -192,15 +191,10 @@
192191 include(":extensions:control-plane:edr:edr-store-receiver")
193192
194193
195-include(":extensions:data-plane:data-plane-client")
196-include(":extensions:data-plane:data-plane-client-embedded")
197-include(":extensions:data-plane:data-plane-control-api")
198194 include(":extensions:data-plane:data-plane-self-registration")
199195 include(":extensions:data-plane:data-plane-signaling:data-plane-signaling-api")
200-include(":extensions:data-plane:data-plane-signaling:data-plane-signaling-api-configuration")
201196 include(":extensions:data-plane:data-plane-signaling:data-plane-signaling-client")
202197 include(":extensions:data-plane:data-plane-signaling:data-plane-signaling-transform")
203-include(":extensions:data-plane:data-plane-public-api")
204198 include(":extensions:data-plane:data-plane-public-api-v2")
205199
206200 include(":extensions:data-plane:data-plane-http")
modified spi/common/core-spi/src/main/java/org/eclipse/edc/spi/query/Criterion.java +0 −6
@@ -18,7 +18,6 @@
1818 import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder;
1919
2020 import java.util.Objects;
21-import java.util.function.Function;
2221
2322 import static java.lang.String.format;
2423 import static org.eclipse.edc.spi.constants.CoreConstants.EDC_NAMESPACE;
@@ -74,11 +73,6 @@
7473 return new Criterion(operandLeft, operator, getOperandRight());
7574 }
7675
77- @Deprecated(since = "0.5.0")
78- public Criterion withLeftOperand(Function<Object, Object> function) {
79- return new Criterion(function.apply(operandLeft), operator, getOperandRight());
80- }
81-
8276 @Override
8377 public int hashCode() {
8478 return Objects.hash(operandLeft, operator, operandRight);
modified spi/common/json-ld-spi/src/main/java/org/eclipse/edc/jsonld/spi/PropertyAndTypeNames.java +0 −6
@@ -40,13 +40,7 @@
4040 String EDC_CREATED_AT = EDC_NAMESPACE + "createdAt";
4141
4242 //DCT
43- @Deprecated(since = "0.5.1")
44- String DEPRECATED_DCT_FORMAT_ATTRIBUTE = "https://purl.org/dc/terms/format";
4543 String DCT_FORMAT_ATTRIBUTE = DCT_SCHEMA + "format";
46- @Deprecated(since = "0.6.2")
47- String DCT_TERMS_ATTRIBUTE = DCT_SCHEMA + "terms";
48- @Deprecated(since = "0.6.2")
49- String DCT_ENDPOINT_URL_ATTRIBUTE = DCT_SCHEMA + "endpointUrl";
5044
5145 String ODRL_POLICY_ATTRIBUTE = ODRL_SCHEMA + "hasPolicy";
5246 String ODRL_POLICY_TYPE_SET = ODRL_SCHEMA + "Set";
modified spi/control-plane/contract-spi/src/main/java/org/eclipse/edc/connector/controlplane/contract/spi/types/negotiation/ContractRequest.java +0 −2
@@ -31,8 +31,6 @@
3131 public static final String CONTRACT_REQUEST_TYPE = EDC_NAMESPACE + "ContractRequest";
3232 public static final String CONTRACT_REQUEST_COUNTER_PARTY_ADDRESS = EDC_NAMESPACE + "counterPartyAddress";
3333 public static final String PROTOCOL = EDC_NAMESPACE + "protocol";
34- @Deprecated(since = "0.5.1")
35- public static final String PROVIDER_ID = EDC_NAMESPACE + "providerId";
3634 public static final String POLICY = EDC_NAMESPACE + "policy";
3735 public static final String CALLBACK_ADDRESSES = EDC_NAMESPACE + "callbackAddresses";
3836
modified system-tests/e2e-dataplane-tests/runtimes/data-plane/build.gradle.kts +0 −2
@@ -23,10 +23,8 @@
2323 implementation(project(":extensions:control-plane:api:control-plane-api-client"))
2424 implementation(project(":extensions:data-plane:data-plane-http"))
2525 implementation(project(":extensions:data-plane:data-plane-iam"))
26- implementation(project(":extensions:data-plane:data-plane-control-api"))
2726 implementation(project(":extensions:data-plane:data-plane-public-api-v2"))
2827 implementation(project(":extensions:data-plane:data-plane-signaling:data-plane-signaling-api"))
29- implementation(project(":extensions:data-plane:data-plane-signaling:data-plane-signaling-api-configuration"))
3028 }
3129
3230 edcBuild {
modified system-tests/e2e-transfer-test/data-plane/build.gradle.kts +0 −1
@@ -26,7 +26,6 @@
2626 implementation(project(":extensions:data-plane:data-plane-http"))
2727 implementation(project(":extensions:data-plane:data-plane-kafka"))
2828 implementation(project(":extensions:data-plane:data-plane-http-oauth2"))
29- implementation(project(":extensions:data-plane:data-plane-control-api"))
3029 implementation(project(":extensions:data-plane:data-plane-public-api-v2"))
3130 implementation(project(":extensions:data-plane:data-plane-signaling:data-plane-signaling-api"))
3231 }
modified system-tests/management-api/management-api-test-runtime/build.gradle.kts +1 −1
@@ -26,7 +26,7 @@
2626 implementation(project(":extensions:common:api:control-api-configuration"))
2727 implementation(project(":extensions:control-plane:api:management-api"))
2828 implementation(project(":extensions:control-plane:api:management-api:secrets-api"))
29- implementation(project(":extensions:data-plane:data-plane-client"))
29+ implementation(project(":extensions:data-plane:data-plane-signaling:data-plane-signaling-client"))
3030
3131 implementation(project(":core:data-plane-selector:data-plane-selector-core"))
3232 }
modified system-tests/telemetry/telemetry-test-runtime/build.gradle.kts +1 −1
@@ -27,7 +27,7 @@
2727 implementation(project(":extensions:common:json-ld"))
2828 implementation(project(":extensions:common:api:control-api-configuration"))
2929 implementation(project(":extensions:control-plane:api:management-api"))
30- implementation(project(":extensions:data-plane:data-plane-client"))
30+ implementation(project(":extensions:data-plane:data-plane-signaling:data-plane-signaling-client"))
3131
3232 implementation(project(":core:data-plane-selector:data-plane-selector-core"))
3333
modified system-tests/version-api/version-api-test-runner/src/test/java/org/eclipse/edc/test/e2e/versionapi/Runtimes.java +2 −14
@@ -14,13 +14,13 @@
1414
1515 package org.eclipse.edc.test.e2e.versionapi;
1616
17+import org.eclipse.edc.connector.dataplane.selector.spi.client.DataPlaneClientFactory;
1718 import org.eclipse.edc.connector.dataplane.spi.manager.DataPlaneManager;
1819 import org.eclipse.edc.iam.identitytrust.sts.spi.service.StsClientService;
1920 import org.eclipse.edc.iam.identitytrust.sts.spi.service.StsClientTokenGeneratorService;
2021 import org.eclipse.edc.junit.extensions.EmbeddedRuntime;
2122 import org.eclipse.edc.junit.extensions.RuntimeExtension;
2223 import org.eclipse.edc.junit.extensions.RuntimePerClassExtension;
23-import org.eclipse.edc.sql.testfixtures.PostgresqlEndToEndInstance;
2424 import org.jetbrains.annotations.NotNull;
2525
2626 import java.util.HashMap;
@@ -33,6 +33,7 @@
3333 static RuntimeExtension inMemoryRuntime() {
3434 var rt = new RuntimePerClassExtension(new EmbeddedRuntime("control-plane", inMemoryConfiguration(), ":system-tests:version-api:version-api-test-runtime"));
3535 rt.registerServiceMock(DataPlaneManager.class, mock());
36+ rt.registerServiceMock(DataPlaneClientFactory.class, mock());
3637 rt.registerServiceMock(StsClientService.class, mock());
3738 rt.registerServiceMock(StsClientTokenGeneratorService.class, mock());
3839 return rt;
@@ -56,17 +57,4 @@
5657 };
5758 }
5859
59- @NotNull
60- static HashMap<String, String> postgresqlConfiguration() {
61- var config = new HashMap<String, String>() {
62- {
63- put("edc.datasource.default.url", PostgresqlEndToEndInstance.JDBC_URL_PREFIX + "runtime");
64- put("edc.datasource.default.user", PostgresqlEndToEndInstance.USER);
65- put("edc.datasource.default.password", PostgresqlEndToEndInstance.PASSWORD);
66- }
67- };
68-
69- config.putAll(inMemoryConfiguration());
70- return config;
71- }
7260 }
modified system-tests/version-api/version-api-test-runtime/build.gradle.kts +0 −2
@@ -26,9 +26,7 @@
2626 implementation(project(":extensions:control-plane:api:management-api"))
2727 implementation(project(":extensions:control-plane:api:management-api:secrets-api"))
2828 implementation(project(":extensions:common:api:version-api"))
29- implementation(project(":extensions:data-plane:data-plane-control-api"))
3029 implementation(project(":extensions:common:api:api-observability"))
31- implementation(project(":extensions:data-plane:data-plane-client"))
3230 implementation(project(":extensions:common:iam:identity-trust:identity-trust-sts:identity-trust-sts-api"))
3331 implementation(project(":core:data-plane-selector:data-plane-selector-core"))
3432 implementation(project(":extensions:common:api:control-api-configuration"))