From 856ad8e4558771e63790a0ddf9550455fb3333b6 Mon Sep 17 00:00:00 2001 From: Enrico Risa Date: Tue, 15 Oct 2024 17:47:45 +0200 Subject: [PATCH] refactor: extract dsp negotiation transform lib --- .../dsp/dsp-negotiation/build.gradle.kts | 1 + .../build.gradle.kts | 8 +-- .../build.gradle.kts | 28 ++++++++ ...omContractAgreementMessageTransformer.java | 35 ++++++---- ...reementVerificationMessageTransformer.java | 27 +++++--- ...omContractNegotiationErrorTransformer.java | 23 ++++--- ...actNegotiationEventMessageTransformer.java | 39 ++++++----- ...otiationTerminationMessageTransformer.java | 35 ++++++---- ...ectFromContractNegotiationTransformer.java | 61 +++++++++-------- ...ctFromContractOfferMessageTransformer.java | 35 ++++++---- ...FromContractRequestMessageTransformer.java | 35 ++++++---- ...ToContractAgreementMessageTransformer.java | 67 ++++++++++-------- ...reementVerificationMessageTransformer.java | 34 ++++++---- ...ctToContractNegotiationAckTransformer.java | 23 ++++--- ...actNegotiationEventMessageTransformer.java | 53 ++++++++------- ...otiationTerminationMessageTransformer.java | 45 ++++++------ ...jectToContractOfferMessageTransformer.java | 41 ++++++----- ...ctToContractRequestMessageTransformer.java | 47 +++++++------ ...ntractAgreementMessageTransformerTest.java | 20 +++--- ...entVerificationMessageTransformerTest.java | 12 ++-- ...ntractNegotiationErrorTransformerTest.java | 4 +- ...egotiationEventMessageTransformerTest.java | 18 ++--- ...tionTerminationMessageTransformerTest.java | 12 ++-- ...romContractNegotiationTransformerTest.java | 68 +++++++++---------- ...omContractOfferMessageTransformerTest.java | 12 ++-- ...ContractRequestMessageTransformerTest.java | 12 ++-- ...ntractAgreementMessageTransformerTest.java | 48 ++++++------- ...entVerificationMessageTransformerTest.java | 14 ++-- ...ContractNegotiationAckTransformerTest.java | 16 ++--- ...egotiationEventMessageTransformerTest.java | 36 +++++----- ...tionTerminationMessageTransformerTest.java | 16 ++--- ...ToContractOfferMessageTransformerTest.java | 24 +++---- ...ContractRequestMessageTransformerTest.java | 24 +++---- .../negotiation/transform/to/TestInput.java | 13 ++-- .../DspNegotiationPropertyAndTypeNames.java | 52 ++++++++------ .../dsp/spi/type/DspPropertyAndTypeNames.java | 9 ++- ...mTransferCompletionMessageTransformer.java | 8 +-- ...nObjectFromTransferProcessTransformer.java | 16 ++--- ...FromTransferRequestMessageTransformer.java | 4 +- ...ctFromTransferStartMessageTransformer.java | 8 +-- ...mTransferSuspensionMessageTransformer.java | 8 +-- ...TransferTerminationMessageTransformer.java | 8 +-- ...oTransferCompletionMessageTransformer.java | 12 ++-- ...ObjectToTransferProcessAckTransformer.java | 12 ++-- ...ctToTransferRequestMessageTransformer.java | 6 +- ...jectToTransferStartMessageTransformer.java | 12 ++-- ...oTransferSuspensionMessageTransformer.java | 12 ++-- ...TransferTerminationMessageTransformer.java | 12 ++-- ...nsferCompletionMessageTransformerTest.java | 8 +-- ...ectFromTransferProcessTransformerTest.java | 18 ++--- ...TransferRequestMessageTransformerTest.java | 4 +- ...omTransferStartMessageTransformerTest.java | 8 +-- ...nsferSuspensionMessageTransformerTest.java | 8 +-- ...sferTerminationMessageTransformerTest.java | 8 +-- ...nsferCompletionMessageTransformerTest.java | 8 +-- ...ctToTransferProcessAckTransformerTest.java | 12 ++-- ...TransferRequestMessageTransformerTest.java | 6 +- ...ToTransferStartMessageTransformerTest.java | 16 ++--- ...nsferSuspensionMessageTransformerTest.java | 8 +-- ...sferTerminationMessageTransformerTest.java | 8 +-- settings.gradle.kts | 1 + 61 files changed, 700 insertions(+), 578 deletions(-) create mode 100644 data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/build.gradle.kts rename data-protocols/dsp/dsp-negotiation/{dsp-negotiation-transform => lib/dsp-negotiation-transform-lib}/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractAgreementMessageTransformer.java (66%) rename data-protocols/dsp/dsp-negotiation/{dsp-negotiation-transform => lib/dsp-negotiation-transform-lib}/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractAgreementVerificationMessageTransformer.java (62%) rename data-protocols/dsp/dsp-negotiation/{dsp-negotiation-transform => lib/dsp-negotiation-transform-lib}/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractNegotiationErrorTransformer.java (64%) rename data-protocols/dsp/dsp-negotiation/{dsp-negotiation-transform => lib/dsp-negotiation-transform-lib}/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractNegotiationEventMessageTransformer.java (59%) rename data-protocols/dsp/dsp-negotiation/{dsp-negotiation-transform => lib/dsp-negotiation-transform-lib}/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractNegotiationTerminationMessageTransformer.java (58%) rename data-protocols/dsp/dsp-negotiation/{dsp-negotiation-transform => lib/dsp-negotiation-transform-lib}/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractNegotiationTransformer.java (57%) rename data-protocols/dsp/dsp-negotiation/{dsp-negotiation-transform => lib/dsp-negotiation-transform-lib}/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractOfferMessageTransformer.java (62%) rename data-protocols/dsp/dsp-negotiation/{dsp-negotiation-transform => lib/dsp-negotiation-transform-lib}/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractRequestMessageTransformer.java (61%) rename data-protocols/dsp/dsp-negotiation/{dsp-negotiation-transform => lib/dsp-negotiation-transform-lib}/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractAgreementMessageTransformer.java (61%) rename data-protocols/dsp/dsp-negotiation/{dsp-negotiation-transform => lib/dsp-negotiation-transform-lib}/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractAgreementVerificationMessageTransformer.java (56%) rename data-protocols/dsp/dsp-negotiation/{dsp-negotiation-transform => lib/dsp-negotiation-transform-lib}/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationAckTransformer.java (61%) rename data-protocols/dsp/dsp-negotiation/{dsp-negotiation-transform => lib/dsp-negotiation-transform-lib}/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationEventMessageTransformer.java (55%) rename data-protocols/dsp/dsp-negotiation/{dsp-negotiation-transform => lib/dsp-negotiation-transform-lib}/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationTerminationMessageTransformer.java (60%) rename data-protocols/dsp/dsp-negotiation/{dsp-negotiation-transform => lib/dsp-negotiation-transform-lib}/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractOfferMessageTransformer.java (60%) rename data-protocols/dsp/dsp-negotiation/{dsp-negotiation-transform => lib/dsp-negotiation-transform-lib}/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractRequestMessageTransformer.java (60%) rename data-protocols/dsp/dsp-negotiation/{dsp-negotiation-transform => lib/dsp-negotiation-transform-lib}/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractAgreementMessageTransformerTest.java (92%) rename data-protocols/dsp/dsp-negotiation/{dsp-negotiation-transform => lib/dsp-negotiation-transform-lib}/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractAgreementVerificationMessageTransformerTest.java (87%) rename data-protocols/dsp/dsp-negotiation/{dsp-negotiation-transform => lib/dsp-negotiation-transform-lib}/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractNegotiationErrorTransformerTest.java (95%) rename data-protocols/dsp/dsp-negotiation/{dsp-negotiation-transform => lib/dsp-negotiation-transform-lib}/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractNegotiationEventMessageTransformerTest.java (84%) rename data-protocols/dsp/dsp-negotiation/{dsp-negotiation-transform => lib/dsp-negotiation-transform-lib}/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractNegotiationTerminationMessageTransformerTest.java (92%) rename data-protocols/dsp/dsp-negotiation/{dsp-negotiation-transform => lib/dsp-negotiation-transform-lib}/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractNegotiationTransformerTest.java (83%) rename data-protocols/dsp/dsp-negotiation/{dsp-negotiation-transform => lib/dsp-negotiation-transform-lib}/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractOfferMessageTransformerTest.java (93%) rename data-protocols/dsp/dsp-negotiation/{dsp-negotiation-transform => lib/dsp-negotiation-transform-lib}/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractRequestMessageTransformerTest.java (93%) rename data-protocols/dsp/dsp-negotiation/{dsp-negotiation-transform => lib/dsp-negotiation-transform-lib}/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractAgreementMessageTransformerTest.java (83%) rename data-protocols/dsp/dsp-negotiation/{dsp-negotiation-transform => lib/dsp-negotiation-transform-lib}/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractAgreementVerificationMessageTransformerTest.java (88%) rename data-protocols/dsp/dsp-negotiation/{dsp-negotiation-transform => lib/dsp-negotiation-transform-lib}/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationAckTransformerTest.java (83%) rename data-protocols/dsp/dsp-negotiation/{dsp-negotiation-transform => lib/dsp-negotiation-transform-lib}/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationEventMessageTransformerTest.java (80%) rename data-protocols/dsp/dsp-negotiation/{dsp-negotiation-transform => lib/dsp-negotiation-transform-lib}/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationTerminationMessageTransformerTest.java (87%) rename data-protocols/dsp/dsp-negotiation/{dsp-negotiation-transform => lib/dsp-negotiation-transform-lib}/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractOfferMessageTransformerTest.java (89%) rename data-protocols/dsp/dsp-negotiation/{dsp-negotiation-transform => lib/dsp-negotiation-transform-lib}/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractRequestMessageTransformerTest.java (88%) rename data-protocols/dsp/dsp-negotiation/{dsp-negotiation-transform => lib/dsp-negotiation-transform-lib}/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/TestInput.java (81%) diff --git a/data-protocols/dsp/dsp-negotiation/build.gradle.kts b/data-protocols/dsp/dsp-negotiation/build.gradle.kts index def7fbfe44c..8ddf836bf79 100644 --- a/data-protocols/dsp/dsp-negotiation/build.gradle.kts +++ b/data-protocols/dsp/dsp-negotiation/build.gradle.kts @@ -22,4 +22,5 @@ dependencies { api(project(":data-protocols:dsp:dsp-negotiation:dsp-negotiation-http-dispatcher")) api(project(":data-protocols:dsp:dsp-negotiation:dsp-negotiation-transform")) api(project(":data-protocols:dsp:dsp-negotiation:lib:dsp-negotiation-validation-lib")) + api(project(":data-protocols:dsp:dsp-negotiation:lib:dsp-negotiation-transform-lib")) } diff --git a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/build.gradle.kts b/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/build.gradle.kts index 58f62c7a1c4..83db89ddbfd 100644 --- a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/build.gradle.kts +++ b/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/build.gradle.kts @@ -17,10 +17,8 @@ plugins { } dependencies { - api(project(":data-protocols:dsp:dsp-spi")) - api(project(":data-protocols:dsp:dsp-http-spi")) - api(project(":extensions:common:json-ld")) - api(project(":spi:common:json-ld-spi")) + api(project(":spi:common:core-spi")) api(project(":spi:common:transform-spi")) - api(project(":spi:control-plane:contract-spi")) + + implementation(project(":data-protocols:dsp:dsp-negotiation:lib:dsp-negotiation-transform-lib")) } diff --git a/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/build.gradle.kts b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/build.gradle.kts new file mode 100644 index 00000000000..1dae9134eb3 --- /dev/null +++ b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/build.gradle.kts @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0 + * + * SPDX-License-Identifier: Apache-2.0 + * + * Contributors: + * Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation + * + */ + +plugins { + `java-library` +} + +dependencies { + api(project(":spi:common:json-ld-spi")) + api(project(":data-protocols:dsp:dsp-spi")) + api(project(":spi:control-plane:contract-spi")) + implementation(project(":core:common:lib:transform-lib")) + + testImplementation(project(":core:common:junit")) + testImplementation(project(":extensions:common:json-ld")) + +} \ No newline at end of file diff --git a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractAgreementMessageTransformer.java b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractAgreementMessageTransformer.java similarity index 66% rename from data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractAgreementMessageTransformer.java rename to data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractAgreementMessageTransformer.java index c14b86c91d0..6a74f7a1cfc 100644 --- a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractAgreementMessageTransformer.java +++ b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractAgreementMessageTransformer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Fraunhofer Institute for Software and Systems Engineering + * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) * * This program and the accompanying materials are made available under the * terms of the Apache License, Version 2.0 which is available at @@ -8,7 +8,7 @@ * SPDX-License-Identifier: Apache-2.0 * * Contributors: - * Fraunhofer Institute for Software and Systems Engineering - initial API and implementation + * Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation * */ @@ -18,7 +18,7 @@ import jakarta.json.JsonBuilderFactory; import jakarta.json.JsonObject; import org.eclipse.edc.connector.controlplane.contract.spi.types.agreement.ContractAgreementMessage; -import org.eclipse.edc.jsonld.spi.transformer.AbstractJsonLdTransformer; +import org.eclipse.edc.jsonld.spi.transformer.AbstractNamespaceAwareJsonLdTransformer; import org.eclipse.edc.transform.spi.TransformerContext; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -26,24 +26,29 @@ import static java.time.Instant.ofEpochSecond; import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.ID; import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.TYPE; +import static org.eclipse.edc.jsonld.spi.Namespaces.DSPACE_SCHEMA; import static org.eclipse.edc.jsonld.spi.PropertyAndTypeNames.ODRL_ASSIGNEE_ATTRIBUTE; import static org.eclipse.edc.jsonld.spi.PropertyAndTypeNames.ODRL_ASSIGNER_ATTRIBUTE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_PROPERTY_AGREEMENT; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_PROPERTY_TIMESTAMP; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID; +import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_PROPERTY_AGREEMENT_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_PROPERTY_TIMESTAMP_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID_TERM; /** * Creates a dspace:ContractAgreementMessage as {@link JsonObject} from {@link ContractAgreementMessage}. */ -public class JsonObjectFromContractAgreementMessageTransformer extends AbstractJsonLdTransformer { +public class JsonObjectFromContractAgreementMessageTransformer extends AbstractNamespaceAwareJsonLdTransformer { private final JsonBuilderFactory jsonFactory; public JsonObjectFromContractAgreementMessageTransformer(JsonBuilderFactory jsonFactory) { - super(ContractAgreementMessage.class, JsonObject.class); + this(jsonFactory, DSPACE_SCHEMA); + } + + public JsonObjectFromContractAgreementMessageTransformer(JsonBuilderFactory jsonFactory, String namespace) { + super(ContractAgreementMessage.class, JsonObject.class, namespace); this.jsonFactory = jsonFactory; } @@ -67,15 +72,15 @@ public JsonObjectFromContractAgreementMessageTransformer(JsonBuilderFactory json .add(ID, agreement.getId()) .add(ODRL_ASSIGNEE_ATTRIBUTE, agreement.getConsumerId()) .add(ODRL_ASSIGNER_ATTRIBUTE, agreement.getProviderId()) - .add(DSPACE_PROPERTY_TIMESTAMP, signing) + .add(forNamespace(DSPACE_PROPERTY_TIMESTAMP_TERM), signing) .build(); return jsonFactory.createObjectBuilder() .add(ID, agreementMessage.getId()) - .add(TYPE, DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE_IRI) - .add(DSPACE_PROPERTY_PROVIDER_PID, agreementMessage.getProviderPid()) - .add(DSPACE_PROPERTY_CONSUMER_PID, agreementMessage.getConsumerPid()) - .add(DSPACE_PROPERTY_AGREEMENT, copiedPolicy) + .add(TYPE, forNamespace(DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE_TERM)) + .add(forNamespace(DSPACE_PROPERTY_PROVIDER_PID_TERM), agreementMessage.getProviderPid()) + .add(forNamespace(DSPACE_PROPERTY_CONSUMER_PID_TERM), agreementMessage.getConsumerPid()) + .add(forNamespace(DSPACE_PROPERTY_AGREEMENT_TERM), copiedPolicy) .build(); } diff --git a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractAgreementVerificationMessageTransformer.java b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractAgreementVerificationMessageTransformer.java similarity index 62% rename from data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractAgreementVerificationMessageTransformer.java rename to data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractAgreementVerificationMessageTransformer.java index f8eacf65b67..1a39b2893bd 100644 --- a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractAgreementVerificationMessageTransformer.java +++ b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractAgreementVerificationMessageTransformer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Fraunhofer Institute for Software and Systems Engineering + * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) * * This program and the accompanying materials are made available under the * terms of the Apache License, Version 2.0 which is available at @@ -8,7 +8,7 @@ * SPDX-License-Identifier: Apache-2.0 * * Contributors: - * Fraunhofer Institute for Software and Systems Engineering - initial API and implementation + * Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation * */ @@ -17,26 +17,31 @@ import jakarta.json.JsonBuilderFactory; import jakarta.json.JsonObject; import org.eclipse.edc.connector.controlplane.contract.spi.types.agreement.ContractAgreementVerificationMessage; -import org.eclipse.edc.jsonld.spi.transformer.AbstractJsonLdTransformer; +import org.eclipse.edc.jsonld.spi.transformer.AbstractNamespaceAwareJsonLdTransformer; import org.eclipse.edc.transform.spi.TransformerContext; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.ID; import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.TYPE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_AGREEMENT_VERIFICATION_MESSAGE_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID; +import static org.eclipse.edc.jsonld.spi.Namespaces.DSPACE_SCHEMA; +import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_AGREEMENT_VERIFICATION_MESSAGE_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID_TERM; /** * Creates a {@link JsonObject} from a {@link ContractAgreementVerificationMessage}. */ -public class JsonObjectFromContractAgreementVerificationMessageTransformer extends AbstractJsonLdTransformer { +public class JsonObjectFromContractAgreementVerificationMessageTransformer extends AbstractNamespaceAwareJsonLdTransformer { private final JsonBuilderFactory jsonFactory; public JsonObjectFromContractAgreementVerificationMessageTransformer(JsonBuilderFactory jsonFactory) { - super(ContractAgreementVerificationMessage.class, JsonObject.class); + this(jsonFactory, DSPACE_SCHEMA); + } + + public JsonObjectFromContractAgreementVerificationMessageTransformer(JsonBuilderFactory jsonFactory, String namespace) { + super(ContractAgreementVerificationMessage.class, JsonObject.class, namespace); this.jsonFactory = jsonFactory; } @@ -44,9 +49,9 @@ public JsonObjectFromContractAgreementVerificationMessageTransformer(JsonBuilder public @Nullable JsonObject transform(@NotNull ContractAgreementVerificationMessage verificationMessage, @NotNull TransformerContext context) { return jsonFactory.createObjectBuilder() .add(ID, verificationMessage.getId()) - .add(TYPE, DSPACE_TYPE_CONTRACT_AGREEMENT_VERIFICATION_MESSAGE_IRI) - .add(DSPACE_PROPERTY_CONSUMER_PID, verificationMessage.getConsumerPid()) - .add(DSPACE_PROPERTY_PROVIDER_PID, verificationMessage.getProviderPid()) + .add(TYPE, forNamespace(DSPACE_TYPE_CONTRACT_AGREEMENT_VERIFICATION_MESSAGE_TERM)) + .add(forNamespace(DSPACE_PROPERTY_CONSUMER_PID_TERM), verificationMessage.getConsumerPid()) + .add(forNamespace(DSPACE_PROPERTY_PROVIDER_PID_TERM), verificationMessage.getProviderPid()) .build(); } } diff --git a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractNegotiationErrorTransformer.java b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractNegotiationErrorTransformer.java similarity index 64% rename from data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractNegotiationErrorTransformer.java rename to data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractNegotiationErrorTransformer.java index 3a12ed95f4e..c7e3e9b3bd7 100644 --- a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractNegotiationErrorTransformer.java +++ b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractNegotiationErrorTransformer.java @@ -17,34 +17,39 @@ import jakarta.json.JsonBuilderFactory; import jakarta.json.JsonObject; import org.eclipse.edc.connector.controlplane.contract.spi.types.negotiation.ContractNegotiationError; -import org.eclipse.edc.jsonld.spi.transformer.AbstractJsonLdTransformer; +import org.eclipse.edc.jsonld.spi.transformer.AbstractNamespaceAwareJsonLdTransformer; import org.eclipse.edc.transform.spi.TransformerContext; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.TYPE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_NEGOTIATION_ERROR; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CODE_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_REASON_IRI; +import static org.eclipse.edc.jsonld.spi.Namespaces.DSPACE_SCHEMA; +import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_NEGOTIATION_ERROR_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CODE_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_REASON_TERM; /** * Transforms a {@link ContractNegotiationError} to a {@link JsonObject} in JSON-LD expanded form. */ -public class JsonObjectFromContractNegotiationErrorTransformer extends AbstractJsonLdTransformer { +public class JsonObjectFromContractNegotiationErrorTransformer extends AbstractNamespaceAwareJsonLdTransformer { private final JsonBuilderFactory jsonFactory; public JsonObjectFromContractNegotiationErrorTransformer(JsonBuilderFactory jsonFactory) { - super(ContractNegotiationError.class, JsonObject.class); + this(jsonFactory, DSPACE_SCHEMA); + } + + public JsonObjectFromContractNegotiationErrorTransformer(JsonBuilderFactory jsonFactory, String namespace) { + super(ContractNegotiationError.class, JsonObject.class, namespace); this.jsonFactory = jsonFactory; } @Override public @Nullable JsonObject transform(@NotNull ContractNegotiationError error, @NotNull TransformerContext context) { return jsonFactory.createObjectBuilder() - .add(TYPE, DSPACE_TYPE_CONTRACT_NEGOTIATION_ERROR) - .add(DSPACE_PROPERTY_CODE_IRI, error.getCode()) - .add(DSPACE_PROPERTY_REASON_IRI, jsonFactory.createArrayBuilder(error.getMessages())) + .add(TYPE, forNamespace(DSPACE_TYPE_CONTRACT_NEGOTIATION_ERROR_TERM)) + .add(forNamespace(DSPACE_PROPERTY_CODE_TERM), error.getCode()) + .add(forNamespace(DSPACE_PROPERTY_REASON_TERM), jsonFactory.createArrayBuilder(error.getMessages())) .build(); } } diff --git a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractNegotiationEventMessageTransformer.java b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractNegotiationEventMessageTransformer.java similarity index 59% rename from data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractNegotiationEventMessageTransformer.java rename to data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractNegotiationEventMessageTransformer.java index 41a1ebe8bd5..5df7fe1cb38 100644 --- a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractNegotiationEventMessageTransformer.java +++ b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractNegotiationEventMessageTransformer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Fraunhofer Institute for Software and Systems Engineering + * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) * * This program and the accompanying materials are made available under the * terms of the Apache License, Version 2.0 which is available at @@ -8,7 +8,7 @@ * SPDX-License-Identifier: Apache-2.0 * * Contributors: - * Fraunhofer Institute for Software and Systems Engineering - initial API and implementation + * Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation * */ @@ -17,30 +17,35 @@ import jakarta.json.JsonBuilderFactory; import jakarta.json.JsonObject; import org.eclipse.edc.connector.controlplane.contract.spi.types.agreement.ContractNegotiationEventMessage; -import org.eclipse.edc.jsonld.spi.transformer.AbstractJsonLdTransformer; +import org.eclipse.edc.jsonld.spi.transformer.AbstractNamespaceAwareJsonLdTransformer; import org.eclipse.edc.transform.spi.TransformerContext; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.ID; import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.TYPE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_PROPERTY_EVENT_TYPE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_NEGOTIATION_EVENT_MESSAGE_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_VALUE_NEGOTIATION_EVENT_TYPE_ACCEPTED; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_VALUE_NEGOTIATION_EVENT_TYPE_FINALIZED; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID; +import static org.eclipse.edc.jsonld.spi.Namespaces.DSPACE_SCHEMA; +import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_PROPERTY_EVENT_TYPE_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_NEGOTIATION_EVENT_MESSAGE_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_VALUE_NEGOTIATION_EVENT_TYPE_ACCEPTED_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_VALUE_NEGOTIATION_EVENT_TYPE_FINALIZED_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID_TERM; /** * Creates a {@link JsonObject} from a {@link ContractNegotiationEventMessage}. */ -public class JsonObjectFromContractNegotiationEventMessageTransformer extends AbstractJsonLdTransformer { +public class JsonObjectFromContractNegotiationEventMessageTransformer extends AbstractNamespaceAwareJsonLdTransformer { private final JsonBuilderFactory jsonFactory; public JsonObjectFromContractNegotiationEventMessageTransformer(JsonBuilderFactory jsonFactory) { - super(ContractNegotiationEventMessage.class, JsonObject.class); + this(jsonFactory, DSPACE_SCHEMA); + } + + public JsonObjectFromContractNegotiationEventMessageTransformer(JsonBuilderFactory jsonFactory, String namespace) { + super(ContractNegotiationEventMessage.class, JsonObject.class, namespace); this.jsonFactory = jsonFactory; } @@ -48,12 +53,12 @@ public JsonObjectFromContractNegotiationEventMessageTransformer(JsonBuilderFacto public @Nullable JsonObject transform(@NotNull ContractNegotiationEventMessage eventMessage, @NotNull TransformerContext context) { return jsonFactory.createObjectBuilder() .add(ID, eventMessage.getId()) - .add(TYPE, DSPACE_TYPE_CONTRACT_NEGOTIATION_EVENT_MESSAGE_IRI) - .add(DSPACE_PROPERTY_CONSUMER_PID, eventMessage.getConsumerPid()) - .add(DSPACE_PROPERTY_PROVIDER_PID, eventMessage.getProviderPid()) - .add(DSPACE_PROPERTY_EVENT_TYPE, switch (eventMessage.getType()) { - case ACCEPTED -> DSPACE_VALUE_NEGOTIATION_EVENT_TYPE_ACCEPTED; - case FINALIZED -> DSPACE_VALUE_NEGOTIATION_EVENT_TYPE_FINALIZED; + .add(TYPE, forNamespace(DSPACE_TYPE_CONTRACT_NEGOTIATION_EVENT_MESSAGE_TERM)) + .add(forNamespace(DSPACE_PROPERTY_CONSUMER_PID_TERM), eventMessage.getConsumerPid()) + .add(forNamespace(DSPACE_PROPERTY_PROVIDER_PID_TERM), eventMessage.getProviderPid()) + .add(forNamespace(DSPACE_PROPERTY_EVENT_TYPE_TERM), switch (eventMessage.getType()) { + case ACCEPTED -> forNamespace(DSPACE_VALUE_NEGOTIATION_EVENT_TYPE_ACCEPTED_TERM); + case FINALIZED -> forNamespace(DSPACE_VALUE_NEGOTIATION_EVENT_TYPE_FINALIZED_TERM); }) .build(); } diff --git a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractNegotiationTerminationMessageTransformer.java b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractNegotiationTerminationMessageTransformer.java similarity index 58% rename from data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractNegotiationTerminationMessageTransformer.java rename to data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractNegotiationTerminationMessageTransformer.java index d505f96924f..669d00f9bd8 100644 --- a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractNegotiationTerminationMessageTransformer.java +++ b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractNegotiationTerminationMessageTransformer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Fraunhofer Institute for Software and Systems Engineering + * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) * * This program and the accompanying materials are made available under the * terms of the Apache License, Version 2.0 which is available at @@ -8,7 +8,7 @@ * SPDX-License-Identifier: Apache-2.0 * * Contributors: - * Fraunhofer Institute for Software and Systems Engineering - initial API and implementation + * Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation * */ @@ -17,28 +17,33 @@ import jakarta.json.JsonBuilderFactory; import jakarta.json.JsonObject; import org.eclipse.edc.connector.controlplane.contract.spi.types.negotiation.ContractNegotiationTerminationMessage; -import org.eclipse.edc.jsonld.spi.transformer.AbstractJsonLdTransformer; +import org.eclipse.edc.jsonld.spi.transformer.AbstractNamespaceAwareJsonLdTransformer; import org.eclipse.edc.transform.spi.TransformerContext; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.ID; import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.TYPE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_NEGOTIATION_TERMINATION_MESSAGE_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CODE_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_REASON_IRI; +import static org.eclipse.edc.jsonld.spi.Namespaces.DSPACE_SCHEMA; +import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_NEGOTIATION_TERMINATION_MESSAGE_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CODE_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_REASON_TERM; /** * Creates a {@link JsonObject} from a {@link ContractNegotiationTerminationMessage}. */ -public class JsonObjectFromContractNegotiationTerminationMessageTransformer extends AbstractJsonLdTransformer { +public class JsonObjectFromContractNegotiationTerminationMessageTransformer extends AbstractNamespaceAwareJsonLdTransformer { private final JsonBuilderFactory jsonFactory; public JsonObjectFromContractNegotiationTerminationMessageTransformer(JsonBuilderFactory jsonFactory) { - super(ContractNegotiationTerminationMessage.class, JsonObject.class); + this(jsonFactory, DSPACE_SCHEMA); + } + + public JsonObjectFromContractNegotiationTerminationMessageTransformer(JsonBuilderFactory jsonFactory, String namespace) { + super(ContractNegotiationTerminationMessage.class, JsonObject.class, namespace); this.jsonFactory = jsonFactory; } @@ -46,12 +51,12 @@ public JsonObjectFromContractNegotiationTerminationMessageTransformer(JsonBuilde public @Nullable JsonObject transform(@NotNull ContractNegotiationTerminationMessage terminationMessage, @NotNull TransformerContext context) { var builder = jsonFactory.createObjectBuilder() .add(ID, terminationMessage.getId()) - .add(TYPE, DSPACE_TYPE_CONTRACT_NEGOTIATION_TERMINATION_MESSAGE_IRI) - .add(DSPACE_PROPERTY_CONSUMER_PID, terminationMessage.getConsumerPid()) - .add(DSPACE_PROPERTY_PROVIDER_PID, terminationMessage.getProviderPid()); + .add(TYPE, forNamespace(DSPACE_TYPE_CONTRACT_NEGOTIATION_TERMINATION_MESSAGE_TERM)) + .add(forNamespace(DSPACE_PROPERTY_CONSUMER_PID_TERM), terminationMessage.getConsumerPid()) + .add(forNamespace(DSPACE_PROPERTY_PROVIDER_PID_TERM), terminationMessage.getProviderPid()); - addIfNotNull(terminationMessage.getRejectionReason(), DSPACE_PROPERTY_REASON_IRI, builder); - addIfNotNull(terminationMessage.getCode(), DSPACE_PROPERTY_CODE_IRI, builder); + addIfNotNull(terminationMessage.getRejectionReason(), forNamespace(DSPACE_PROPERTY_REASON_TERM), builder); + addIfNotNull(terminationMessage.getCode(), forNamespace(DSPACE_PROPERTY_CODE_TERM), builder); return builder.build(); } diff --git a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractNegotiationTransformer.java b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractNegotiationTransformer.java similarity index 57% rename from data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractNegotiationTransformer.java rename to data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractNegotiationTransformer.java index f077e12b7af..0f69cd70ecd 100644 --- a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractNegotiationTransformer.java +++ b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractNegotiationTransformer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Fraunhofer Institute for Software and Systems Engineering + * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) * * This program and the accompanying materials are made available under the * terms of the Apache License, Version 2.0 which is available at @@ -8,7 +8,7 @@ * SPDX-License-Identifier: Apache-2.0 * * Contributors: - * Fraunhofer Institute for Software and Systems Engineering - initial API and implementation + * Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation * */ @@ -18,35 +18,40 @@ import jakarta.json.JsonObject; import org.eclipse.edc.connector.controlplane.contract.spi.types.negotiation.ContractNegotiation; import org.eclipse.edc.connector.controlplane.contract.spi.types.negotiation.ContractNegotiationStates; -import org.eclipse.edc.jsonld.spi.transformer.AbstractJsonLdTransformer; +import org.eclipse.edc.jsonld.spi.transformer.AbstractNamespaceAwareJsonLdTransformer; import org.eclipse.edc.transform.spi.TransformerContext; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.ID; import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.TYPE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_NEGOTIATION; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_VALUE_NEGOTIATION_STATE_ACCEPTED; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_VALUE_NEGOTIATION_STATE_AGREED; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_VALUE_NEGOTIATION_STATE_FINALIZED; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_VALUE_NEGOTIATION_STATE_OFFERED; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_VALUE_NEGOTIATION_STATE_REQUESTED; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_VALUE_NEGOTIATION_STATE_TERMINATED; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_VALUE_NEGOTIATION_STATE_VERIFIED; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_STATE; +import static org.eclipse.edc.jsonld.spi.Namespaces.DSPACE_SCHEMA; +import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_NEGOTIATION_IRI; +import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_VALUE_NEGOTIATION_STATE_ACCEPTED_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_VALUE_NEGOTIATION_STATE_AGREED_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_VALUE_NEGOTIATION_STATE_FINALIZED_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_VALUE_NEGOTIATION_STATE_OFFERED_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_VALUE_NEGOTIATION_STATE_REQUESTED_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_VALUE_NEGOTIATION_STATE_TERMINATED_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_VALUE_NEGOTIATION_STATE_VERIFIED_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_STATE_TERM; /** * Creates a {@link JsonObject} from a {@link ContractNegotiation}. */ -public class JsonObjectFromContractNegotiationTransformer extends AbstractJsonLdTransformer { +public class JsonObjectFromContractNegotiationTransformer extends AbstractNamespaceAwareJsonLdTransformer { private final JsonBuilderFactory jsonFactory; public JsonObjectFromContractNegotiationTransformer(JsonBuilderFactory jsonFactory) { - super(ContractNegotiation.class, JsonObject.class); + this(jsonFactory, DSPACE_SCHEMA); + } + + public JsonObjectFromContractNegotiationTransformer(JsonBuilderFactory jsonFactory, String namespace) { + super(ContractNegotiation.class, JsonObject.class, namespace); this.jsonFactory = jsonFactory; } @@ -54,10 +59,10 @@ public JsonObjectFromContractNegotiationTransformer(JsonBuilderFactory jsonFacto public @Nullable JsonObject transform(@NotNull ContractNegotiation contractNegotiation, @NotNull TransformerContext context) { return jsonFactory.createObjectBuilder() .add(ID, pidFor(contractNegotiation, contractNegotiation.getType())) - .add(TYPE, DSPACE_TYPE_CONTRACT_NEGOTIATION) - .add(DSPACE_PROPERTY_CONSUMER_PID, pidFor(contractNegotiation, ContractNegotiation.Type.CONSUMER)) - .add(DSPACE_PROPERTY_PROVIDER_PID, pidFor(contractNegotiation, ContractNegotiation.Type.PROVIDER)) - .add(DSPACE_PROPERTY_STATE, state(contractNegotiation.getState(), context)) + .add(TYPE, DSPACE_TYPE_CONTRACT_NEGOTIATION_IRI) + .add(forNamespace(DSPACE_PROPERTY_CONSUMER_PID_TERM), pidFor(contractNegotiation, ContractNegotiation.Type.CONSUMER)) + .add(forNamespace(DSPACE_PROPERTY_PROVIDER_PID_TERM), pidFor(contractNegotiation, ContractNegotiation.Type.PROVIDER)) + .add(forNamespace(DSPACE_PROPERTY_STATE_TERM), state(contractNegotiation.getState(), context)) .build(); } @@ -71,19 +76,19 @@ private String state(Integer state, TransformerContext context) { context.problem() .nullProperty() .type(ContractNegotiation.class) - .property(DSPACE_PROPERTY_STATE) + .property(forNamespace(DSPACE_PROPERTY_STATE_TERM)) .report(); return null; } return switch (negotiationState) { - case REQUESTING, REQUESTED -> DSPACE_VALUE_NEGOTIATION_STATE_REQUESTED; - case OFFERING, OFFERED -> DSPACE_VALUE_NEGOTIATION_STATE_OFFERED; - case ACCEPTING, ACCEPTED -> DSPACE_VALUE_NEGOTIATION_STATE_ACCEPTED; - case AGREEING, AGREED -> DSPACE_VALUE_NEGOTIATION_STATE_AGREED; - case VERIFYING, VERIFIED -> DSPACE_VALUE_NEGOTIATION_STATE_VERIFIED; - case FINALIZING, FINALIZED -> DSPACE_VALUE_NEGOTIATION_STATE_FINALIZED; - case TERMINATING, TERMINATED -> DSPACE_VALUE_NEGOTIATION_STATE_TERMINATED; + case REQUESTING, REQUESTED -> forNamespace(DSPACE_VALUE_NEGOTIATION_STATE_REQUESTED_TERM); + case OFFERING, OFFERED -> forNamespace(DSPACE_VALUE_NEGOTIATION_STATE_OFFERED_TERM); + case ACCEPTING, ACCEPTED -> forNamespace(DSPACE_VALUE_NEGOTIATION_STATE_ACCEPTED_TERM); + case AGREEING, AGREED -> forNamespace(DSPACE_VALUE_NEGOTIATION_STATE_AGREED_TERM); + case VERIFYING, VERIFIED -> forNamespace(DSPACE_VALUE_NEGOTIATION_STATE_VERIFIED_TERM); + case FINALIZING, FINALIZED -> forNamespace(DSPACE_VALUE_NEGOTIATION_STATE_FINALIZED_TERM); + case TERMINATING, TERMINATED -> forNamespace(DSPACE_VALUE_NEGOTIATION_STATE_TERMINATED_TERM); default -> { context.problem() .unexpectedType() diff --git a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractOfferMessageTransformer.java b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractOfferMessageTransformer.java similarity index 62% rename from data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractOfferMessageTransformer.java rename to data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractOfferMessageTransformer.java index 0e9d4532de9..a75316b05c1 100644 --- a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractOfferMessageTransformer.java +++ b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractOfferMessageTransformer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Fraunhofer Institute for Software and Systems Engineering + * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) * * This program and the accompanying materials are made available under the * terms of the Apache License, Version 2.0 which is available at @@ -8,7 +8,7 @@ * SPDX-License-Identifier: Apache-2.0 * * Contributors: - * Fraunhofer Institute for Software and Systems Engineering - initial API and implementation + * Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation * */ @@ -18,28 +18,33 @@ import jakarta.json.JsonBuilderFactory; import jakarta.json.JsonObject; import org.eclipse.edc.connector.controlplane.contract.spi.types.negotiation.ContractOfferMessage; -import org.eclipse.edc.jsonld.spi.transformer.AbstractJsonLdTransformer; +import org.eclipse.edc.jsonld.spi.transformer.AbstractNamespaceAwareJsonLdTransformer; import org.eclipse.edc.transform.spi.TransformerContext; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.ID; import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.TYPE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_PROPERTY_OFFER_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_OFFER_MESSAGE_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CALLBACK_ADDRESS_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID; +import static org.eclipse.edc.jsonld.spi.Namespaces.DSPACE_SCHEMA; +import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_PROPERTY_OFFER_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_OFFER_MESSAGE_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CALLBACK_ADDRESS_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID_TERM; /** * Creates a {@link JsonObject} from a {@link ContractOfferMessage}. */ -public class JsonObjectFromContractOfferMessageTransformer extends AbstractJsonLdTransformer { +public class JsonObjectFromContractOfferMessageTransformer extends AbstractNamespaceAwareJsonLdTransformer { private final JsonBuilderFactory jsonFactory; public JsonObjectFromContractOfferMessageTransformer(JsonBuilderFactory jsonFactory) { - super(ContractOfferMessage.class, JsonObject.class); + this(jsonFactory, DSPACE_SCHEMA); + } + + public JsonObjectFromContractOfferMessageTransformer(JsonBuilderFactory jsonFactory, String namespace) { + super(ContractOfferMessage.class, JsonObject.class, namespace); this.jsonFactory = jsonFactory; } @@ -47,11 +52,11 @@ public JsonObjectFromContractOfferMessageTransformer(JsonBuilderFactory jsonFact public @Nullable JsonObject transform(@NotNull ContractOfferMessage message, @NotNull TransformerContext context) { var builder = jsonFactory.createObjectBuilder() .add(ID, message.getId()) - .add(TYPE, DSPACE_TYPE_CONTRACT_OFFER_MESSAGE_IRI) - .add(DSPACE_PROPERTY_PROVIDER_PID, message.getProviderPid()); + .add(TYPE, forNamespace(DSPACE_TYPE_CONTRACT_OFFER_MESSAGE_TERM)) + .add(forNamespace(DSPACE_PROPERTY_PROVIDER_PID_TERM), message.getProviderPid()); - addIfNotNull(message.getConsumerPid(), DSPACE_PROPERTY_CONSUMER_PID, builder); - addIfNotNull(message.getCallbackAddress(), DSPACE_PROPERTY_CALLBACK_ADDRESS_IRI, builder); + addIfNotNull(message.getConsumerPid(), forNamespace(DSPACE_PROPERTY_CONSUMER_PID_TERM), builder); + addIfNotNull(message.getCallbackAddress(), forNamespace(DSPACE_PROPERTY_CALLBACK_ADDRESS_TERM), builder); var offer = message.getContractOffer(); var policy = context.transform(offer.getPolicy(), JsonObject.class); @@ -66,7 +71,7 @@ public JsonObjectFromContractOfferMessageTransformer(JsonBuilderFactory jsonFact var enrichedPolicy = Json.createObjectBuilder(policy) .add(ID, offer.getId()) .build(); - builder.add(DSPACE_PROPERTY_OFFER_IRI, enrichedPolicy); + builder.add(forNamespace(DSPACE_PROPERTY_OFFER_TERM), enrichedPolicy); return builder.build(); } diff --git a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractRequestMessageTransformer.java b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractRequestMessageTransformer.java similarity index 61% rename from data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractRequestMessageTransformer.java rename to data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractRequestMessageTransformer.java index d90e8310d6b..ab228788951 100644 --- a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractRequestMessageTransformer.java +++ b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractRequestMessageTransformer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Fraunhofer Institute for Software and Systems Engineering + * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) * * This program and the accompanying materials are made available under the * terms of the Apache License, Version 2.0 which is available at @@ -8,7 +8,7 @@ * SPDX-License-Identifier: Apache-2.0 * * Contributors: - * Fraunhofer Institute for Software and Systems Engineering - initial API and implementation + * Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation * */ @@ -18,29 +18,34 @@ import jakarta.json.JsonBuilderFactory; import jakarta.json.JsonObject; import org.eclipse.edc.connector.controlplane.contract.spi.types.negotiation.ContractRequestMessage; -import org.eclipse.edc.jsonld.spi.transformer.AbstractJsonLdTransformer; +import org.eclipse.edc.jsonld.spi.transformer.AbstractNamespaceAwareJsonLdTransformer; import org.eclipse.edc.transform.spi.TransformerContext; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.ID; import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.TYPE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_PROPERTY_OFFER_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CALLBACK_ADDRESS_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID; +import static org.eclipse.edc.jsonld.spi.Namespaces.DSPACE_SCHEMA; +import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_PROPERTY_OFFER_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CALLBACK_ADDRESS_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID_TERM; /** * Creates a {@link JsonObject} from a {@link ContractRequestMessage}. */ -public class JsonObjectFromContractRequestMessageTransformer extends AbstractJsonLdTransformer { +public class JsonObjectFromContractRequestMessageTransformer extends AbstractNamespaceAwareJsonLdTransformer { private final JsonBuilderFactory jsonFactory; public JsonObjectFromContractRequestMessageTransformer(JsonBuilderFactory jsonFactory) { - super(ContractRequestMessage.class, JsonObject.class); + this(jsonFactory, DSPACE_SCHEMA); + } + + public JsonObjectFromContractRequestMessageTransformer(JsonBuilderFactory jsonFactory, String namespace) { + super(ContractRequestMessage.class, JsonObject.class, namespace); this.jsonFactory = jsonFactory; } @@ -48,11 +53,11 @@ public JsonObjectFromContractRequestMessageTransformer(JsonBuilderFactory jsonFa public @Nullable JsonObject transform(@NotNull ContractRequestMessage requestMessage, @NotNull TransformerContext context) { var builder = jsonFactory.createObjectBuilder() .add(ID, requestMessage.getId()) - .add(TYPE, DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE_IRI) - .add(DSPACE_PROPERTY_CONSUMER_PID, requestMessage.getConsumerPid()); + .add(TYPE, forNamespace(DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE_TERM)) + .add(forNamespace(DSPACE_PROPERTY_CONSUMER_PID_TERM), requestMessage.getConsumerPid()); - addIfNotNull(requestMessage.getProviderPid(), DSPACE_PROPERTY_PROVIDER_PID, builder); - addIfNotNull(requestMessage.getCallbackAddress(), DSPACE_PROPERTY_CALLBACK_ADDRESS_IRI, builder); + addIfNotNull(requestMessage.getProviderPid(), forNamespace(DSPACE_PROPERTY_PROVIDER_PID_TERM), builder); + addIfNotNull(requestMessage.getCallbackAddress(), forNamespace(DSPACE_PROPERTY_CALLBACK_ADDRESS_TERM), builder); var policy = context.transform(requestMessage.getContractOffer().getPolicy(), JsonObject.class); if (policy == null) { @@ -67,7 +72,7 @@ public JsonObjectFromContractRequestMessageTransformer(JsonBuilderFactory jsonFa var enrichedPolicy = Json.createObjectBuilder(policy) .add(ID, requestMessage.getContractOffer().getId()) .build(); - builder.add(DSPACE_PROPERTY_OFFER_IRI, enrichedPolicy); + builder.add(forNamespace(DSPACE_PROPERTY_OFFER_TERM), enrichedPolicy); return builder.build(); } diff --git a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractAgreementMessageTransformer.java b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractAgreementMessageTransformer.java similarity index 61% rename from data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractAgreementMessageTransformer.java rename to data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractAgreementMessageTransformer.java index e219e15d021..10e1c88eafa 100644 --- a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractAgreementMessageTransformer.java +++ b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractAgreementMessageTransformer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Fraunhofer Institute for Software and Systems Engineering + * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) * * This program and the accompanying materials are made available under the * terms of the Apache License, Version 2.0 which is available at @@ -8,7 +8,7 @@ * SPDX-License-Identifier: Apache-2.0 * * Contributors: - * Fraunhofer Institute for Software and Systems Engineering - initial API and implementation + * Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation * */ @@ -18,7 +18,7 @@ import jakarta.json.JsonObject; import org.eclipse.edc.connector.controlplane.contract.spi.types.agreement.ContractAgreement; import org.eclipse.edc.connector.controlplane.contract.spi.types.agreement.ContractAgreementMessage; -import org.eclipse.edc.jsonld.spi.transformer.AbstractJsonLdTransformer; +import org.eclipse.edc.jsonld.spi.transformer.AbstractNamespaceAwareJsonLdTransformer; import org.eclipse.edc.policy.model.Policy; import org.eclipse.edc.transform.spi.TransformerContext; import org.jetbrains.annotations.NotNull; @@ -29,45 +29,54 @@ import java.util.Set; import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.ID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_PROPERTY_AGREEMENT; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_ID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_ID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_PROPERTY_TIMESTAMP; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID; +import static org.eclipse.edc.jsonld.spi.Namespaces.DSPACE_SCHEMA; +import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_PROPERTY_AGREEMENT_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_ID_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_ID_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_PROPERTY_TIMESTAMP_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID_TERM; /** * Creates a {@link ContractAgreementMessage} from a {@link JsonObject}. */ -public class JsonObjectToContractAgreementMessageTransformer extends AbstractJsonLdTransformer { - private static final Set EXCLUDED_POLICY_KEYWORDS = Set.of(DSPACE_PROPERTY_TIMESTAMP, DSPACE_PROPERTY_CONSUMER_ID, DSPACE_PROPERTY_PROVIDER_ID); +public class JsonObjectToContractAgreementMessageTransformer extends AbstractNamespaceAwareJsonLdTransformer { + private final Set excludedPolicyKeywords; public JsonObjectToContractAgreementMessageTransformer() { - super(JsonObject.class, ContractAgreementMessage.class); + this(DSPACE_SCHEMA); } + public JsonObjectToContractAgreementMessageTransformer(String namespace) { + super(JsonObject.class, ContractAgreementMessage.class, namespace); + excludedPolicyKeywords = Set.of(forNamespace(DSPACE_PROPERTY_TIMESTAMP_TERM), + forNamespace(forNamespace(DSPACE_PROPERTY_CONSUMER_ID_TERM)), + forNamespace(DSPACE_PROPERTY_PROVIDER_ID_TERM)); + } + + @Override public @Nullable ContractAgreementMessage transform(@NotNull JsonObject object, @NotNull TransformerContext context) { var messageBuilder = ContractAgreementMessage.Builder.newInstance(); - if (!transformMandatoryString(object.get(DSPACE_PROPERTY_CONSUMER_PID), messageBuilder::consumerPid, context)) { + if (!transformMandatoryString(object.get(forNamespace(DSPACE_PROPERTY_CONSUMER_PID_TERM)), messageBuilder::consumerPid, context)) { context.problem() .missingProperty() - .type(DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE_IRI) - .property(DSPACE_PROPERTY_CONSUMER_PID) + .type(forNamespace(DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE_TERM)) + .property(forNamespace(DSPACE_PROPERTY_CONSUMER_PID_TERM)) .report(); return null; } - if (!transformMandatoryString(object.get(DSPACE_PROPERTY_PROVIDER_PID), messageBuilder::providerPid, context)) { + if (!transformMandatoryString(object.get(forNamespace(DSPACE_PROPERTY_PROVIDER_PID_TERM)), messageBuilder::providerPid, context)) { context.problem() .missingProperty() - .type(DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE_IRI) - .property(DSPACE_PROPERTY_PROVIDER_PID) + .type(forNamespace(DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE_TERM)) + .property(forNamespace(DSPACE_PROPERTY_PROVIDER_PID_TERM)) .report(); return null; } - var jsonAgreement = returnMandatoryJsonObject(object.get(DSPACE_PROPERTY_AGREEMENT), context, DSPACE_PROPERTY_AGREEMENT); + var jsonAgreement = returnMandatoryJsonObject(object.get(forNamespace(DSPACE_PROPERTY_AGREEMENT_TERM)), context, forNamespace(DSPACE_PROPERTY_AGREEMENT_TERM)); if (jsonAgreement == null) { return null; } @@ -78,8 +87,8 @@ public JsonObjectToContractAgreementMessageTransformer() { if (policy == null) { context.problem() .invalidProperty() - .type(DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE_IRI) - .property(DSPACE_PROPERTY_AGREEMENT) + .type(forNamespace(DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE_TERM)) + .property(forNamespace(DSPACE_PROPERTY_AGREEMENT_TERM)) .report(); return null; } @@ -98,7 +107,7 @@ public JsonObjectToContractAgreementMessageTransformer() { private JsonObject filterAgreementProperties(JsonObject jsonAgreement) { var copiedJsonAgreement = Json.createObjectBuilder(); jsonAgreement.entrySet().stream() - .filter(e -> !EXCLUDED_POLICY_KEYWORDS.contains(e.getKey())) + .filter(e -> !excludedPolicyKeywords.contains(e.getKey())) .forEach(e -> copiedJsonAgreement.add(e.getKey(), e.getValue())); return copiedJsonAgreement.build(); } @@ -110,7 +119,7 @@ private ContractAgreement contractAgreement(JsonObject jsonAgreement, Policy pol if (agreementId == null) { context.problem() .missingProperty() - .type(DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE_IRI) + .type(forNamespace(DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE_TERM)) .property(ID) .report(); return null; @@ -125,12 +134,12 @@ private ContractAgreement contractAgreement(JsonObject jsonAgreement, Policy pol .policy(policy) .assetId(policy.getTarget()); - var timestamp = transformString(jsonAgreement.get(DSPACE_PROPERTY_TIMESTAMP), context); + var timestamp = transformString(jsonAgreement.get(forNamespace(DSPACE_PROPERTY_TIMESTAMP_TERM)), context); if (timestamp == null) { context.problem() .missingProperty() - .type(DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE_IRI) - .property(DSPACE_PROPERTY_TIMESTAMP) + .type(forNamespace(DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE_TERM)) + .property(forNamespace(DSPACE_PROPERTY_TIMESTAMP_TERM)) .report(); return null; } @@ -139,8 +148,8 @@ private ContractAgreement contractAgreement(JsonObject jsonAgreement, Policy pol } catch (DateTimeParseException e) { context.problem() .invalidProperty() - .type(DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE_IRI) - .property(DSPACE_PROPERTY_TIMESTAMP) + .type(forNamespace(DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE_TERM)) + .property(forNamespace(DSPACE_PROPERTY_TIMESTAMP_TERM)) .value(timestamp) .error(e.getMessage()) .report(); diff --git a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractAgreementVerificationMessageTransformer.java b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractAgreementVerificationMessageTransformer.java similarity index 56% rename from data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractAgreementVerificationMessageTransformer.java rename to data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractAgreementVerificationMessageTransformer.java index 55763e030d7..eb66575b714 100644 --- a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractAgreementVerificationMessageTransformer.java +++ b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractAgreementVerificationMessageTransformer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Fraunhofer Institute for Software and Systems Engineering + * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) * * This program and the accompanying materials are made available under the * terms of the Apache License, Version 2.0 which is available at @@ -8,7 +8,7 @@ * SPDX-License-Identifier: Apache-2.0 * * Contributors: - * Fraunhofer Institute for Software and Systems Engineering - initial API and implementation + * Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation * */ @@ -16,40 +16,46 @@ import jakarta.json.JsonObject; import org.eclipse.edc.connector.controlplane.contract.spi.types.agreement.ContractAgreementVerificationMessage; -import org.eclipse.edc.jsonld.spi.transformer.AbstractJsonLdTransformer; +import org.eclipse.edc.jsonld.spi.transformer.AbstractNamespaceAwareJsonLdTransformer; import org.eclipse.edc.transform.spi.TransformerContext; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_AGREEMENT_VERIFICATION_MESSAGE_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID; +import static org.eclipse.edc.jsonld.spi.Namespaces.DSPACE_SCHEMA; +import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_AGREEMENT_VERIFICATION_MESSAGE_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID_TERM; /** * Creates a {@link ContractAgreementVerificationMessage} from a {@link JsonObject}. */ -public class JsonObjectToContractAgreementVerificationMessageTransformer extends AbstractJsonLdTransformer { +public class JsonObjectToContractAgreementVerificationMessageTransformer extends AbstractNamespaceAwareJsonLdTransformer { public JsonObjectToContractAgreementVerificationMessageTransformer() { - super(JsonObject.class, ContractAgreementVerificationMessage.class); + this(DSPACE_SCHEMA); } + public JsonObjectToContractAgreementVerificationMessageTransformer(String namespace) { + super(JsonObject.class, ContractAgreementVerificationMessage.class, namespace); + } + + @Override public @Nullable ContractAgreementVerificationMessage transform(@NotNull JsonObject object, @NotNull TransformerContext context) { var builder = ContractAgreementVerificationMessage.Builder.newInstance(); - if (!transformMandatoryString(object.get(DSPACE_PROPERTY_CONSUMER_PID), builder::consumerPid, context)) { + if (!transformMandatoryString(object.get(forNamespace(DSPACE_PROPERTY_CONSUMER_PID_TERM)), builder::consumerPid, context)) { context.problem() .missingProperty() - .type(DSPACE_TYPE_CONTRACT_AGREEMENT_VERIFICATION_MESSAGE_IRI) - .property(DSPACE_PROPERTY_CONSUMER_PID) + .type(forNamespace(DSPACE_TYPE_CONTRACT_AGREEMENT_VERIFICATION_MESSAGE_TERM)) + .property(forNamespace(DSPACE_PROPERTY_CONSUMER_PID_TERM)) .report(); return null; } - if (!transformMandatoryString(object.get(DSPACE_PROPERTY_PROVIDER_PID), builder::providerPid, context)) { + if (!transformMandatoryString(object.get(forNamespace(DSPACE_PROPERTY_PROVIDER_PID_TERM)), builder::providerPid, context)) { context.problem() .missingProperty() - .type(DSPACE_TYPE_CONTRACT_AGREEMENT_VERIFICATION_MESSAGE_IRI) - .property(DSPACE_PROPERTY_PROVIDER_PID) + .type(forNamespace(DSPACE_TYPE_CONTRACT_AGREEMENT_VERIFICATION_MESSAGE_TERM)) + .property(forNamespace(DSPACE_PROPERTY_PROVIDER_PID_TERM)) .report(); return null; } diff --git a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationAckTransformer.java b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationAckTransformer.java similarity index 61% rename from data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationAckTransformer.java rename to data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationAckTransformer.java index e916f0dd3c7..dacdccfee5e 100644 --- a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationAckTransformer.java +++ b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationAckTransformer.java @@ -16,33 +16,38 @@ import jakarta.json.JsonObject; import org.eclipse.edc.connector.controlplane.contract.spi.types.protocol.ContractNegotiationAck; -import org.eclipse.edc.jsonld.spi.transformer.AbstractJsonLdTransformer; +import org.eclipse.edc.jsonld.spi.transformer.AbstractNamespaceAwareJsonLdTransformer; import org.eclipse.edc.transform.spi.TransformerContext; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_STATE; +import static org.eclipse.edc.jsonld.spi.Namespaces.DSPACE_SCHEMA; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_STATE_TERM; /** * Create a {@link ContractNegotiationAck} from {@link JsonObject} */ -public class JsonObjectToContractNegotiationAckTransformer extends AbstractJsonLdTransformer { +public class JsonObjectToContractNegotiationAckTransformer extends AbstractNamespaceAwareJsonLdTransformer { public JsonObjectToContractNegotiationAckTransformer() { - super(JsonObject.class, ContractNegotiationAck.class); + this(DSPACE_SCHEMA); + } + + public JsonObjectToContractNegotiationAckTransformer(String namespace) { + super(JsonObject.class, ContractNegotiationAck.class, namespace); } @Override public @Nullable ContractNegotiationAck transform(@NotNull JsonObject jsonObject, @NotNull TransformerContext context) { var builder = ContractNegotiationAck.Builder.newInstance(); - transformMandatoryString(jsonObject.get(DSPACE_PROPERTY_CONSUMER_PID), builder::consumerPid, context); - transformMandatoryString(jsonObject.get(DSPACE_PROPERTY_PROVIDER_PID), builder::providerPid, context); + transformMandatoryString(jsonObject.get(forNamespace(DSPACE_PROPERTY_CONSUMER_PID_TERM)), builder::consumerPid, context); + transformMandatoryString(jsonObject.get(forNamespace(DSPACE_PROPERTY_PROVIDER_PID_TERM)), builder::providerPid, context); return builder - .state(transformString(jsonObject.get(DSPACE_PROPERTY_STATE), context)) + .state(transformString(jsonObject.get(forNamespace(DSPACE_PROPERTY_STATE_TERM)), context)) .build(); } } diff --git a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationEventMessageTransformer.java b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationEventMessageTransformer.java similarity index 55% rename from data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationEventMessageTransformer.java rename to data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationEventMessageTransformer.java index adbd9d403af..077ca3191e8 100644 --- a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationEventMessageTransformer.java +++ b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationEventMessageTransformer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Fraunhofer Institute for Software and Systems Engineering + * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) * * This program and the accompanying materials are made available under the * terms of the Apache License, Version 2.0 which is available at @@ -8,7 +8,7 @@ * SPDX-License-Identifier: Apache-2.0 * * Contributors: - * Fraunhofer Institute for Software and Systems Engineering - initial API and implementation + * Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation * */ @@ -16,62 +16,67 @@ import jakarta.json.JsonObject; import org.eclipse.edc.connector.controlplane.contract.spi.types.agreement.ContractNegotiationEventMessage; -import org.eclipse.edc.jsonld.spi.transformer.AbstractJsonLdTransformer; +import org.eclipse.edc.jsonld.spi.transformer.AbstractNamespaceAwareJsonLdTransformer; import org.eclipse.edc.transform.spi.TransformerContext; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import static org.eclipse.edc.connector.controlplane.contract.spi.types.agreement.ContractNegotiationEventMessage.Type.ACCEPTED; import static org.eclipse.edc.connector.controlplane.contract.spi.types.agreement.ContractNegotiationEventMessage.Type.FINALIZED; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_PROPERTY_EVENT_TYPE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_NEGOTIATION_EVENT_MESSAGE_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_VALUE_NEGOTIATION_EVENT_TYPE_ACCEPTED; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_VALUE_NEGOTIATION_EVENT_TYPE_FINALIZED; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID; +import static org.eclipse.edc.jsonld.spi.Namespaces.DSPACE_SCHEMA; +import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_PROPERTY_EVENT_TYPE_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_NEGOTIATION_EVENT_MESSAGE_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_VALUE_NEGOTIATION_EVENT_TYPE_ACCEPTED_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_VALUE_NEGOTIATION_EVENT_TYPE_FINALIZED_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID_TERM; /** * Creates a {@link ContractNegotiationEventMessage} from a {@link JsonObject}. */ -public class JsonObjectToContractNegotiationEventMessageTransformer extends AbstractJsonLdTransformer { +public class JsonObjectToContractNegotiationEventMessageTransformer extends AbstractNamespaceAwareJsonLdTransformer { public JsonObjectToContractNegotiationEventMessageTransformer() { - super(JsonObject.class, ContractNegotiationEventMessage.class); + this(DSPACE_SCHEMA); + } + + public JsonObjectToContractNegotiationEventMessageTransformer(String namespace) { + super(JsonObject.class, ContractNegotiationEventMessage.class, namespace); } @Override public @Nullable ContractNegotiationEventMessage transform(@NotNull JsonObject object, @NotNull TransformerContext context) { var builder = ContractNegotiationEventMessage.Builder.newInstance(); - if (!transformMandatoryString(object.get(DSPACE_PROPERTY_CONSUMER_PID), builder::consumerPid, context)) { + if (!transformMandatoryString(object.get(forNamespace(DSPACE_PROPERTY_CONSUMER_PID_TERM)), builder::consumerPid, context)) { context.problem() .missingProperty() - .type(DSPACE_TYPE_CONTRACT_NEGOTIATION_EVENT_MESSAGE_IRI) - .property(DSPACE_PROPERTY_CONSUMER_PID) + .type(forNamespace(DSPACE_TYPE_CONTRACT_NEGOTIATION_EVENT_MESSAGE_TERM)) + .property(forNamespace(DSPACE_PROPERTY_CONSUMER_PID_TERM)) .report(); return null; } - if (!transformMandatoryString(object.get(DSPACE_PROPERTY_PROVIDER_PID), builder::providerPid, context)) { + if (!transformMandatoryString(object.get(forNamespace(DSPACE_PROPERTY_PROVIDER_PID_TERM)), builder::providerPid, context)) { context.problem() .missingProperty() - .type(DSPACE_TYPE_CONTRACT_NEGOTIATION_EVENT_MESSAGE_IRI) - .property(DSPACE_PROPERTY_PROVIDER_PID) + .type(forNamespace(DSPACE_TYPE_CONTRACT_NEGOTIATION_EVENT_MESSAGE_TERM)) + .property(forNamespace(DSPACE_PROPERTY_PROVIDER_PID_TERM)) .report(); return null; } - var eventType = transformString(object.get(DSPACE_PROPERTY_EVENT_TYPE), context); - if (DSPACE_VALUE_NEGOTIATION_EVENT_TYPE_ACCEPTED.equals(eventType)) { + var eventType = transformString(object.get(forNamespace(DSPACE_PROPERTY_EVENT_TYPE_TERM)), context); + if (forNamespace(DSPACE_VALUE_NEGOTIATION_EVENT_TYPE_ACCEPTED_TERM).equals(eventType)) { builder.type(ACCEPTED); - } else if (DSPACE_VALUE_NEGOTIATION_EVENT_TYPE_FINALIZED.equals(eventType)) { + } else if (forNamespace(DSPACE_VALUE_NEGOTIATION_EVENT_TYPE_FINALIZED_TERM).equals(eventType)) { builder.type(FINALIZED); } else { context.problem() .unexpectedType() - .type(DSPACE_TYPE_CONTRACT_NEGOTIATION_EVENT_MESSAGE_IRI) - .property(DSPACE_PROPERTY_EVENT_TYPE) - .expected(DSPACE_VALUE_NEGOTIATION_EVENT_TYPE_ACCEPTED) - .expected(DSPACE_VALUE_NEGOTIATION_EVENT_TYPE_FINALIZED) + .type(forNamespace(DSPACE_TYPE_CONTRACT_NEGOTIATION_EVENT_MESSAGE_TERM)) + .property(forNamespace(DSPACE_PROPERTY_EVENT_TYPE_TERM)) + .expected(forNamespace(DSPACE_VALUE_NEGOTIATION_EVENT_TYPE_ACCEPTED_TERM)) + .expected(forNamespace(DSPACE_VALUE_NEGOTIATION_EVENT_TYPE_FINALIZED_TERM)) .report(); return null; } diff --git a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationTerminationMessageTransformer.java b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationTerminationMessageTransformer.java similarity index 60% rename from data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationTerminationMessageTransformer.java rename to data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationTerminationMessageTransformer.java index 244bad74efc..fda6001222f 100644 --- a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationTerminationMessageTransformer.java +++ b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationTerminationMessageTransformer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Fraunhofer Institute for Software and Systems Engineering + * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) * * This program and the accompanying materials are made available under the * terms of the Apache License, Version 2.0 which is available at @@ -8,7 +8,7 @@ * SPDX-License-Identifier: Apache-2.0 * * Contributors: - * Fraunhofer Institute for Software and Systems Engineering - initial API and implementation + * Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation * */ @@ -17,54 +17,59 @@ import jakarta.json.JsonArray; import jakarta.json.JsonObject; import org.eclipse.edc.connector.controlplane.contract.spi.types.negotiation.ContractNegotiationTerminationMessage; -import org.eclipse.edc.jsonld.spi.transformer.AbstractJsonLdTransformer; +import org.eclipse.edc.jsonld.spi.transformer.AbstractNamespaceAwareJsonLdTransformer; import org.eclipse.edc.transform.spi.TransformerContext; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import static jakarta.json.JsonValue.ValueType.ARRAY; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_NEGOTIATION_TERMINATION_MESSAGE_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CODE_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_REASON_IRI; +import static org.eclipse.edc.jsonld.spi.Namespaces.DSPACE_SCHEMA; +import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_NEGOTIATION_TERMINATION_MESSAGE_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CODE_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_REASON_TERM; /** * Creates a {@link ContractNegotiationTerminationMessage} from a {@link JsonObject}. */ -public class JsonObjectToContractNegotiationTerminationMessageTransformer extends AbstractJsonLdTransformer { +public class JsonObjectToContractNegotiationTerminationMessageTransformer extends AbstractNamespaceAwareJsonLdTransformer { public JsonObjectToContractNegotiationTerminationMessageTransformer() { - super(JsonObject.class, ContractNegotiationTerminationMessage.class); + this(DSPACE_SCHEMA); + } + + public JsonObjectToContractNegotiationTerminationMessageTransformer(String namespace) { + super(JsonObject.class, ContractNegotiationTerminationMessage.class, namespace); } @Override public @Nullable ContractNegotiationTerminationMessage transform(@NotNull JsonObject object, @NotNull TransformerContext context) { var builder = ContractNegotiationTerminationMessage.Builder.newInstance(); - if (!transformMandatoryString(object.get(DSPACE_PROPERTY_CONSUMER_PID), builder::consumerPid, context)) { + if (!transformMandatoryString(object.get(forNamespace(DSPACE_PROPERTY_CONSUMER_PID_TERM)), builder::consumerPid, context)) { context.problem() .missingProperty() - .type(DSPACE_TYPE_CONTRACT_NEGOTIATION_TERMINATION_MESSAGE_IRI) - .property(DSPACE_PROPERTY_CONSUMER_PID) + .type(forNamespace(DSPACE_TYPE_CONTRACT_NEGOTIATION_TERMINATION_MESSAGE_TERM)) + .property(forNamespace(DSPACE_PROPERTY_CONSUMER_PID_TERM)) .report(); return null; } - if (!transformMandatoryString(object.get(DSPACE_PROPERTY_PROVIDER_PID), builder::providerPid, context)) { + if (!transformMandatoryString(object.get(forNamespace(DSPACE_PROPERTY_PROVIDER_PID_TERM)), builder::providerPid, context)) { context.problem() .missingProperty() - .type(DSPACE_TYPE_CONTRACT_NEGOTIATION_TERMINATION_MESSAGE_IRI) - .property(DSPACE_PROPERTY_PROVIDER_PID) + .type(forNamespace(DSPACE_TYPE_CONTRACT_NEGOTIATION_TERMINATION_MESSAGE_TERM)) + .property(forNamespace(DSPACE_PROPERTY_PROVIDER_PID_TERM)) .report(); return null; } - var code = object.get(DSPACE_PROPERTY_CODE_IRI); + var code = object.get(forNamespace(DSPACE_PROPERTY_CODE_TERM)); if (code != null) { // optional property transformString(code, builder::code, context); } - var reasons = object.get(DSPACE_PROPERTY_REASON_IRI); + var reasons = object.get(forNamespace(DSPACE_PROPERTY_REASON_TERM)); if (reasons != null) { // optional property if (reasons instanceof JsonArray) { var array = (JsonArray) reasons; @@ -74,8 +79,8 @@ public JsonObjectToContractNegotiationTerminationMessageTransformer() { } else { context.problem() .unexpectedType() - .type(DSPACE_TYPE_CONTRACT_NEGOTIATION_TERMINATION_MESSAGE_IRI) - .property(DSPACE_PROPERTY_REASON_IRI) + .type(forNamespace(DSPACE_TYPE_CONTRACT_NEGOTIATION_TERMINATION_MESSAGE_TERM)) + .property(forNamespace(DSPACE_PROPERTY_REASON_TERM)) .actual(reasons.getValueType().toString()) .expected(ARRAY) .report(); diff --git a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractOfferMessageTransformer.java b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractOfferMessageTransformer.java similarity index 60% rename from data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractOfferMessageTransformer.java rename to data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractOfferMessageTransformer.java index 3213daa86c0..c0a8347492d 100644 --- a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractOfferMessageTransformer.java +++ b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractOfferMessageTransformer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Fraunhofer Institute for Software and Systems Engineering + * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) * * This program and the accompanying materials are made available under the * terms of the Apache License, Version 2.0 which is available at @@ -8,7 +8,7 @@ * SPDX-License-Identifier: Apache-2.0 * * Contributors: - * Fraunhofer Institute for Software and Systems Engineering - initial API and implementation + * Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation * */ @@ -17,7 +17,7 @@ import jakarta.json.JsonObject; import org.eclipse.edc.connector.controlplane.contract.spi.types.negotiation.ContractOfferMessage; import org.eclipse.edc.connector.controlplane.contract.spi.types.offer.ContractOffer; -import org.eclipse.edc.jsonld.spi.transformer.AbstractJsonLdTransformer; +import org.eclipse.edc.jsonld.spi.transformer.AbstractNamespaceAwareJsonLdTransformer; import org.eclipse.edc.policy.model.Policy; import org.eclipse.edc.policy.model.PolicyType; import org.eclipse.edc.transform.spi.TransformerContext; @@ -26,50 +26,55 @@ import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.ID; import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.TYPE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_PROPERTY_OFFER_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_OFFER_MESSAGE_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CALLBACK_ADDRESS_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID; +import static org.eclipse.edc.jsonld.spi.Namespaces.DSPACE_SCHEMA; +import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_PROPERTY_OFFER_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_OFFER_MESSAGE_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CALLBACK_ADDRESS_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID_TERM; /** * Creates a {@link ContractOfferMessage} from a {@link JsonObject}. */ -public class JsonObjectToContractOfferMessageTransformer extends AbstractJsonLdTransformer { +public class JsonObjectToContractOfferMessageTransformer extends AbstractNamespaceAwareJsonLdTransformer { public JsonObjectToContractOfferMessageTransformer() { - super(JsonObject.class, ContractOfferMessage.class); + this(DSPACE_SCHEMA); + } + + public JsonObjectToContractOfferMessageTransformer(String namespace) { + super(JsonObject.class, ContractOfferMessage.class, namespace); } @Override public @Nullable ContractOfferMessage transform(@NotNull JsonObject jsonObject, @NotNull TransformerContext context) { var builder = ContractOfferMessage.Builder.newInstance(); - if (!transformMandatoryString(jsonObject.get(DSPACE_PROPERTY_PROVIDER_PID), builder::providerPid, context)) { - reportMissingProperty(DSPACE_TYPE_CONTRACT_OFFER_MESSAGE_IRI, DSPACE_PROPERTY_PROVIDER_PID, context); + if (!transformMandatoryString(jsonObject.get(forNamespace(DSPACE_PROPERTY_PROVIDER_PID_TERM)), builder::providerPid, context)) { + reportMissingProperty(forNamespace(DSPACE_TYPE_CONTRACT_OFFER_MESSAGE_TERM), forNamespace(DSPACE_PROPERTY_PROVIDER_PID_TERM), context); return null; } - var consumerPid = jsonObject.get(DSPACE_PROPERTY_CONSUMER_PID); + var consumerPid = jsonObject.get(forNamespace(DSPACE_PROPERTY_CONSUMER_PID_TERM)); if (consumerPid != null) { builder.consumerPid(transformString(consumerPid, context)); } - var callback = jsonObject.get(DSPACE_PROPERTY_CALLBACK_ADDRESS_IRI); + var callback = jsonObject.get(forNamespace(DSPACE_PROPERTY_CALLBACK_ADDRESS_TERM)); if (callback != null) { builder.callbackAddress(transformString(callback, context)); } - var contractOffer = returnJsonObject(jsonObject.get(DSPACE_PROPERTY_OFFER_IRI), context, DSPACE_PROPERTY_OFFER_IRI, false); + var contractOffer = returnJsonObject(jsonObject.get(forNamespace(DSPACE_PROPERTY_OFFER_TERM)), context, forNamespace(DSPACE_PROPERTY_OFFER_TERM), false); if (contractOffer != null) { context.setData(Policy.class, TYPE, PolicyType.OFFER); var policy = transformObject(contractOffer, Policy.class, context); if (policy == null) { - reportMissingProperty(DSPACE_TYPE_CONTRACT_OFFER_MESSAGE_IRI, DSPACE_PROPERTY_OFFER_IRI, context); + reportMissingProperty(forNamespace(DSPACE_TYPE_CONTRACT_OFFER_MESSAGE_TERM), forNamespace(DSPACE_PROPERTY_OFFER_TERM), context); return null; } var id = nodeId(contractOffer); if (id == null) { - reportMissingProperty(DSPACE_PROPERTY_OFFER_IRI, ID, context); + reportMissingProperty(forNamespace(DSPACE_PROPERTY_OFFER_TERM), ID, context); return null; } var offer = ContractOffer.Builder.newInstance() @@ -79,7 +84,7 @@ public JsonObjectToContractOfferMessageTransformer() { .build(); builder.contractOffer(offer); } else { - reportMissingProperty(DSPACE_TYPE_CONTRACT_OFFER_MESSAGE_IRI, DSPACE_PROPERTY_OFFER_IRI, context); + reportMissingProperty(forNamespace(DSPACE_TYPE_CONTRACT_OFFER_MESSAGE_TERM), forNamespace(DSPACE_PROPERTY_OFFER_TERM), context); return null; } diff --git a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractRequestMessageTransformer.java b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractRequestMessageTransformer.java similarity index 60% rename from data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractRequestMessageTransformer.java rename to data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractRequestMessageTransformer.java index 2dace6c43af..5c097701e5a 100644 --- a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractRequestMessageTransformer.java +++ b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractRequestMessageTransformer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Fraunhofer Institute for Software and Systems Engineering + * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) * * This program and the accompanying materials are made available under the * terms of the Apache License, Version 2.0 which is available at @@ -8,7 +8,7 @@ * SPDX-License-Identifier: Apache-2.0 * * Contributors: - * Fraunhofer Institute for Software and Systems Engineering - initial API and implementation + * Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation * */ @@ -17,59 +17,64 @@ import jakarta.json.JsonObject; import org.eclipse.edc.connector.controlplane.contract.spi.types.negotiation.ContractRequestMessage; import org.eclipse.edc.connector.controlplane.contract.spi.types.offer.ContractOffer; -import org.eclipse.edc.jsonld.spi.transformer.AbstractJsonLdTransformer; +import org.eclipse.edc.jsonld.spi.transformer.AbstractNamespaceAwareJsonLdTransformer; import org.eclipse.edc.policy.model.Policy; import org.eclipse.edc.transform.spi.TransformerContext; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.ID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_PROPERTY_OFFER_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CALLBACK_ADDRESS_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID; +import static org.eclipse.edc.jsonld.spi.Namespaces.DSPACE_SCHEMA; +import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_PROPERTY_OFFER_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CALLBACK_ADDRESS_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID_TERM; /** * Creates a {@link ContractRequestMessage} from a {@link JsonObject}. */ -public class JsonObjectToContractRequestMessageTransformer extends AbstractJsonLdTransformer { +public class JsonObjectToContractRequestMessageTransformer extends AbstractNamespaceAwareJsonLdTransformer { public JsonObjectToContractRequestMessageTransformer() { - super(JsonObject.class, ContractRequestMessage.class); + this(DSPACE_SCHEMA); + } + + public JsonObjectToContractRequestMessageTransformer(String namespace) { + super(JsonObject.class, ContractRequestMessage.class, namespace); } @Override public @Nullable ContractRequestMessage transform(@NotNull JsonObject requestObject, @NotNull TransformerContext context) { var builder = ContractRequestMessage.Builder.newInstance(); - if (!transformMandatoryString(requestObject.get(DSPACE_PROPERTY_CONSUMER_PID), builder::consumerPid, context)) { + if (!transformMandatoryString(requestObject.get(forNamespace(DSPACE_PROPERTY_CONSUMER_PID_TERM)), builder::consumerPid, context)) { context.problem() .missingProperty() - .type(DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE_IRI) - .property(DSPACE_PROPERTY_CONSUMER_PID) + .type(forNamespace(DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE_TERM)) + .property(forNamespace(DSPACE_PROPERTY_CONSUMER_PID_TERM)) .report(); return null; } - var providerPid = requestObject.get(DSPACE_PROPERTY_PROVIDER_PID); + var providerPid = requestObject.get(forNamespace(DSPACE_PROPERTY_PROVIDER_PID_TERM)); if (providerPid != null) { builder.providerPid(transformString(providerPid, context)); } - var callback = requestObject.get(DSPACE_PROPERTY_CALLBACK_ADDRESS_IRI); + var callback = requestObject.get(forNamespace(DSPACE_PROPERTY_CALLBACK_ADDRESS_TERM)); if (callback != null) { builder.callbackAddress(transformString(callback, context)); } - var contractOffer = returnJsonObject(requestObject.get(DSPACE_PROPERTY_OFFER_IRI), context, DSPACE_PROPERTY_OFFER_IRI, false); + var contractOffer = returnJsonObject(requestObject.get(forNamespace(DSPACE_PROPERTY_OFFER_TERM)), context, forNamespace(DSPACE_PROPERTY_OFFER_TERM), false); if (contractOffer != null) { var policy = transformObject(contractOffer, Policy.class, context); if (policy == null) { context.problem() .missingProperty() - .type(DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE_IRI) - .property(DSPACE_PROPERTY_OFFER_IRI) + .type(forNamespace(DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE_TERM)) + .property(forNamespace(DSPACE_PROPERTY_OFFER_TERM)) .report(); return null; } @@ -77,7 +82,7 @@ public JsonObjectToContractRequestMessageTransformer() { if (id == null) { context.problem() .missingProperty() - .type(DSPACE_PROPERTY_OFFER_IRI) + .type(forNamespace(DSPACE_PROPERTY_OFFER_TERM)) .property(ID) .report(); return null; @@ -89,8 +94,8 @@ public JsonObjectToContractRequestMessageTransformer() { } else { context.problem() .missingProperty() - .type(DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE_IRI) - .property(DSPACE_PROPERTY_OFFER_IRI) + .type(forNamespace(DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE_TERM)) + .property(forNamespace(DSPACE_PROPERTY_OFFER_TERM)) .report(); return null; } diff --git a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractAgreementMessageTransformerTest.java b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractAgreementMessageTransformerTest.java similarity index 92% rename from data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractAgreementMessageTransformerTest.java rename to data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractAgreementMessageTransformerTest.java index 1c298ff4f06..612b2e1bafa 100644 --- a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractAgreementMessageTransformerTest.java +++ b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractAgreementMessageTransformerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Fraunhofer Institute for Software and Systems Engineering + * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) * * This program and the accompanying materials are made available under the * terms of the Apache License, Version 2.0 which is available at @@ -8,7 +8,7 @@ * SPDX-License-Identifier: Apache-2.0 * * Contributors: - * Fraunhofer Institute for Software and Systems Engineering - initial API and implementation + * Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation * */ @@ -37,11 +37,11 @@ import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.TYPE; import static org.eclipse.edc.jsonld.spi.PropertyAndTypeNames.ODRL_ASSIGNEE_ATTRIBUTE; import static org.eclipse.edc.jsonld.spi.PropertyAndTypeNames.ODRL_ASSIGNER_ATTRIBUTE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_PROPERTY_AGREEMENT; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_PROPERTY_TIMESTAMP; +import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_PROPERTY_AGREEMENT_IRI; +import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_PROPERTY_TIMESTAMP_IRI; import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_IRI; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID_IRI; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.eq; @@ -95,13 +95,13 @@ void transform() { assertThat(result.getString(ID)).isNotNull(); assertThat(result.getString(ID)).isNotEmpty(); assertThat(result.getString(TYPE)).isEqualTo(DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE_IRI); - assertThat(result.getString(DSPACE_PROPERTY_PROVIDER_PID)).isEqualTo("providerPid"); - assertThat(result.getString(DSPACE_PROPERTY_CONSUMER_PID)).isEqualTo("consumerPid"); + assertThat(result.getString(DSPACE_PROPERTY_PROVIDER_PID_IRI)).isEqualTo("providerPid"); + assertThat(result.getString(DSPACE_PROPERTY_CONSUMER_PID_IRI)).isEqualTo("consumerPid"); - var jsonAgreement = result.getJsonObject(DSPACE_PROPERTY_AGREEMENT); + var jsonAgreement = result.getJsonObject(DSPACE_PROPERTY_AGREEMENT_IRI); assertThat(jsonAgreement).isNotNull(); assertThat(jsonAgreement.getString(ID)).isEqualTo(AGREEMENT_ID); - assertThat(jsonAgreement.getString(DSPACE_PROPERTY_TIMESTAMP)).isEqualTo(TIMESTAMP); + assertThat(jsonAgreement.getString(DSPACE_PROPERTY_TIMESTAMP_IRI)).isEqualTo(TIMESTAMP); assertThat(jsonAgreement.getString(ODRL_ASSIGNEE_ATTRIBUTE)).isEqualTo(CONSUMER_ID); assertThat(jsonAgreement.getString(ODRL_ASSIGNER_ATTRIBUTE)).isEqualTo(PROVIDER_ID); diff --git a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractAgreementVerificationMessageTransformerTest.java b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractAgreementVerificationMessageTransformerTest.java similarity index 87% rename from data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractAgreementVerificationMessageTransformerTest.java rename to data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractAgreementVerificationMessageTransformerTest.java index 7e42185dc6e..aea083a339d 100644 --- a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractAgreementVerificationMessageTransformerTest.java +++ b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractAgreementVerificationMessageTransformerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Fraunhofer Institute for Software and Systems Engineering + * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) * * This program and the accompanying materials are made available under the * terms of the Apache License, Version 2.0 which is available at @@ -8,7 +8,7 @@ * SPDX-License-Identifier: Apache-2.0 * * Contributors: - * Fraunhofer Institute for Software and Systems Engineering - initial API and implementation + * Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation * */ @@ -26,8 +26,8 @@ import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.ID; import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.TYPE; import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_AGREEMENT_VERIFICATION_MESSAGE_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_IRI; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID_IRI; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; @@ -56,8 +56,8 @@ void transform() { assertThat(result).isNotNull(); assertThat(result.getJsonString(ID).getString()).isNotEmpty(); assertThat(result.getJsonString(TYPE).getString()).isEqualTo(DSPACE_TYPE_CONTRACT_AGREEMENT_VERIFICATION_MESSAGE_IRI); - assertThat(result.getJsonString(DSPACE_PROPERTY_CONSUMER_PID).getString()).isEqualTo("consumerPid"); - assertThat(result.getJsonString(DSPACE_PROPERTY_PROVIDER_PID).getString()).isEqualTo("providerPid"); + assertThat(result.getJsonString(DSPACE_PROPERTY_CONSUMER_PID_IRI).getString()).isEqualTo("consumerPid"); + assertThat(result.getJsonString(DSPACE_PROPERTY_PROVIDER_PID_IRI).getString()).isEqualTo("providerPid"); verify(context, never()).reportProblem(anyString()); } diff --git a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractNegotiationErrorTransformerTest.java b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractNegotiationErrorTransformerTest.java similarity index 95% rename from data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractNegotiationErrorTransformerTest.java rename to data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractNegotiationErrorTransformerTest.java index 6338f75d08d..686f1d9be83 100644 --- a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractNegotiationErrorTransformerTest.java +++ b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractNegotiationErrorTransformerTest.java @@ -26,7 +26,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.TYPE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_NEGOTIATION_ERROR; +import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_NEGOTIATION_ERROR_IRI; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CODE_IRI; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_REASON_IRI; import static org.mockito.Mockito.mock; @@ -54,7 +54,7 @@ void transform_returnJsonObject() { var result = transformer.transform(error, context); assertThat(result).isNotNull(); - assertThat(result.getJsonString(TYPE).getString()).isEqualTo(DSPACE_TYPE_CONTRACT_NEGOTIATION_ERROR); + assertThat(result.getJsonString(TYPE).getString()).isEqualTo(DSPACE_TYPE_CONTRACT_NEGOTIATION_ERROR_IRI); assertThat(result.getString(DSPACE_PROPERTY_CODE_IRI)).isEqualTo("code"); assertThat(result.getJsonArray(DSPACE_PROPERTY_REASON_IRI)).contains(Json.createValue("message")); } diff --git a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractNegotiationEventMessageTransformerTest.java b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractNegotiationEventMessageTransformerTest.java similarity index 84% rename from data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractNegotiationEventMessageTransformerTest.java rename to data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractNegotiationEventMessageTransformerTest.java index f11a54b0a42..dfef1e86e60 100644 --- a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractNegotiationEventMessageTransformerTest.java +++ b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractNegotiationEventMessageTransformerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Fraunhofer Institute for Software and Systems Engineering + * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) * * This program and the accompanying materials are made available under the * terms of the Apache License, Version 2.0 which is available at @@ -8,7 +8,7 @@ * SPDX-License-Identifier: Apache-2.0 * * Contributors: - * Fraunhofer Institute for Software and Systems Engineering - initial API and implementation + * Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation * */ @@ -27,11 +27,11 @@ import static org.eclipse.edc.connector.controlplane.contract.spi.types.agreement.ContractNegotiationEventMessage.Type.ACCEPTED; import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.ID; import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.TYPE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_PROPERTY_EVENT_TYPE; +import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_PROPERTY_EVENT_TYPE_IRI; import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_NEGOTIATION_EVENT_MESSAGE_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_VALUE_NEGOTIATION_EVENT_TYPE_ACCEPTED; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID; +import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_VALUE_NEGOTIATION_EVENT_TYPE_ACCEPTED_IRI; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_IRI; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID_IRI; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; @@ -62,9 +62,9 @@ void transform() { assertThat(result).isNotNull(); assertThat(result.getString(ID)).isNotEmpty(); assertThat(result.getString(TYPE)).isEqualTo(DSPACE_TYPE_CONTRACT_NEGOTIATION_EVENT_MESSAGE_IRI); - assertThat(result.getString(DSPACE_PROPERTY_PROVIDER_PID)).isEqualTo("providerPid"); - assertThat(result.getString(DSPACE_PROPERTY_CONSUMER_PID)).isEqualTo("consumerPid"); - assertThat(result.getString(DSPACE_PROPERTY_EVENT_TYPE)).isEqualTo(DSPACE_VALUE_NEGOTIATION_EVENT_TYPE_ACCEPTED); + assertThat(result.getString(DSPACE_PROPERTY_PROVIDER_PID_IRI)).isEqualTo("providerPid"); + assertThat(result.getString(DSPACE_PROPERTY_CONSUMER_PID_IRI)).isEqualTo("consumerPid"); + assertThat(result.getString(DSPACE_PROPERTY_EVENT_TYPE_IRI)).isEqualTo(DSPACE_VALUE_NEGOTIATION_EVENT_TYPE_ACCEPTED_IRI); verify(context, never()).reportProblem(anyString()); } diff --git a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractNegotiationTerminationMessageTransformerTest.java b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractNegotiationTerminationMessageTransformerTest.java similarity index 92% rename from data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractNegotiationTerminationMessageTransformerTest.java rename to data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractNegotiationTerminationMessageTransformerTest.java index 9108bc6746f..daaf0cde0b2 100644 --- a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractNegotiationTerminationMessageTransformerTest.java +++ b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractNegotiationTerminationMessageTransformerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Fraunhofer Institute for Software and Systems Engineering + * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) * * This program and the accompanying materials are made available under the * terms of the Apache License, Version 2.0 which is available at @@ -8,7 +8,7 @@ * SPDX-License-Identifier: Apache-2.0 * * Contributors: - * Fraunhofer Institute for Software and Systems Engineering - initial API and implementation + * Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation * */ @@ -27,8 +27,8 @@ import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.TYPE; import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_NEGOTIATION_TERMINATION_MESSAGE_IRI; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CODE_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_IRI; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID_IRI; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_REASON_IRI; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.mock; @@ -62,8 +62,8 @@ void transform() { assertThat(result).isNotNull(); assertThat(result.getString(ID)).isNotEmpty(); assertThat(result.getString(TYPE)).isEqualTo(DSPACE_TYPE_CONTRACT_NEGOTIATION_TERMINATION_MESSAGE_IRI); - assertThat(result.getString(DSPACE_PROPERTY_CONSUMER_PID)).isEqualTo("consumerPid"); - assertThat(result.getString(DSPACE_PROPERTY_PROVIDER_PID)).isEqualTo("providerPid"); + assertThat(result.getString(DSPACE_PROPERTY_CONSUMER_PID_IRI)).isEqualTo("consumerPid"); + assertThat(result.getString(DSPACE_PROPERTY_PROVIDER_PID_IRI)).isEqualTo("providerPid"); assertThat(result.getString(DSPACE_PROPERTY_CODE_IRI)).isEqualTo(REJECTION_CODE); assertThat(result.getString(DSPACE_PROPERTY_REASON_IRI)).isEqualTo(REJECTION_REASON); diff --git a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractNegotiationTransformerTest.java b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractNegotiationTransformerTest.java similarity index 83% rename from data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractNegotiationTransformerTest.java rename to data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractNegotiationTransformerTest.java index e58174214d6..62905ac900e 100644 --- a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractNegotiationTransformerTest.java +++ b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractNegotiationTransformerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Fraunhofer Institute for Software and Systems Engineering + * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) * * This program and the accompanying materials are made available under the * terms of the Apache License, Version 2.0 which is available at @@ -8,7 +8,7 @@ * SPDX-License-Identifier: Apache-2.0 * * Contributors: - * Fraunhofer Institute for Software and Systems Engineering - initial API and implementation + * Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation * */ @@ -47,17 +47,17 @@ import static org.eclipse.edc.connector.controlplane.contract.spi.types.negotiation.ContractNegotiationStates.VERIFYING; import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.ID; import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.TYPE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_NEGOTIATION; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_VALUE_NEGOTIATION_STATE_ACCEPTED; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_VALUE_NEGOTIATION_STATE_AGREED; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_VALUE_NEGOTIATION_STATE_FINALIZED; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_VALUE_NEGOTIATION_STATE_OFFERED; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_VALUE_NEGOTIATION_STATE_REQUESTED; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_VALUE_NEGOTIATION_STATE_TERMINATED; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_VALUE_NEGOTIATION_STATE_VERIFIED; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_STATE; +import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_NEGOTIATION_IRI; +import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_VALUE_NEGOTIATION_STATE_ACCEPTED_IRI; +import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_VALUE_NEGOTIATION_STATE_AGREED_IRI; +import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_VALUE_NEGOTIATION_STATE_FINALIZED_IRI; +import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_VALUE_NEGOTIATION_STATE_OFFERED_IRI; +import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_VALUE_NEGOTIATION_STATE_REQUESTED_IRI; +import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_VALUE_NEGOTIATION_STATE_TERMINATED_IRI; +import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_VALUE_NEGOTIATION_STATE_VERIFIED_IRI; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_IRI; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID_IRI; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_STATE_IRI; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; @@ -91,9 +91,9 @@ void transform_consumer() { assertThat(result).isNotNull(); assertThat(result.getString(ID)).isEqualTo("consumerPid"); - assertThat(result.getString(TYPE)).isEqualTo(DSPACE_TYPE_CONTRACT_NEGOTIATION); - assertThat(result.getString(DSPACE_PROPERTY_CONSUMER_PID)).isEqualTo("consumerPid"); - assertThat(result.getString(DSPACE_PROPERTY_PROVIDER_PID)).isEqualTo("providerPid"); + assertThat(result.getString(TYPE)).isEqualTo(DSPACE_TYPE_CONTRACT_NEGOTIATION_IRI); + assertThat(result.getString(DSPACE_PROPERTY_CONSUMER_PID_IRI)).isEqualTo("consumerPid"); + assertThat(result.getString(DSPACE_PROPERTY_PROVIDER_PID_IRI)).isEqualTo("providerPid"); verify(context, never()).reportProblem(anyString()); } @@ -114,9 +114,9 @@ void transform_provider() { assertThat(result).isNotNull(); assertThat(result.getString(ID)).isEqualTo("providerPid"); - assertThat(result.getString(TYPE)).isEqualTo(DSPACE_TYPE_CONTRACT_NEGOTIATION); - assertThat(result.getString(DSPACE_PROPERTY_CONSUMER_PID)).isEqualTo("consumerPid"); - assertThat(result.getString(DSPACE_PROPERTY_PROVIDER_PID)).isEqualTo("providerPid"); + assertThat(result.getString(TYPE)).isEqualTo(DSPACE_TYPE_CONTRACT_NEGOTIATION_IRI); + assertThat(result.getString(DSPACE_PROPERTY_CONSUMER_PID_IRI)).isEqualTo("consumerPid"); + assertThat(result.getString(DSPACE_PROPERTY_PROVIDER_PID_IRI)).isEqualTo("providerPid"); verify(context, never()).reportProblem(anyString()); } @@ -137,7 +137,7 @@ void transform_status(ContractNegotiationStates inputState, String expectedDspSt var result = transformer.transform(negotiation, context); assertThat(result).isNotNull(); - assertThat(result.getString(DSPACE_PROPERTY_STATE)).isEqualTo(expectedDspState); + assertThat(result.getString(DSPACE_PROPERTY_STATE_IRI)).isEqualTo(expectedDspState); verify(context, never()).reportProblem(anyString()); } @@ -147,20 +147,20 @@ public static class Status implements ArgumentsProvider { @Override public Stream provideArguments(ExtensionContext context) { return Stream.of( - Arguments.arguments(REQUESTING, DSPACE_VALUE_NEGOTIATION_STATE_REQUESTED), - Arguments.arguments(REQUESTED, DSPACE_VALUE_NEGOTIATION_STATE_REQUESTED), - Arguments.arguments(OFFERING, DSPACE_VALUE_NEGOTIATION_STATE_OFFERED), - Arguments.arguments(OFFERED, DSPACE_VALUE_NEGOTIATION_STATE_OFFERED), - Arguments.arguments(ACCEPTING, DSPACE_VALUE_NEGOTIATION_STATE_ACCEPTED), - Arguments.arguments(ACCEPTED, DSPACE_VALUE_NEGOTIATION_STATE_ACCEPTED), - Arguments.arguments(AGREEING, DSPACE_VALUE_NEGOTIATION_STATE_AGREED), - Arguments.arguments(AGREED, DSPACE_VALUE_NEGOTIATION_STATE_AGREED), - Arguments.arguments(VERIFYING, DSPACE_VALUE_NEGOTIATION_STATE_VERIFIED), - Arguments.arguments(VERIFIED, DSPACE_VALUE_NEGOTIATION_STATE_VERIFIED), - Arguments.arguments(FINALIZING, DSPACE_VALUE_NEGOTIATION_STATE_FINALIZED), - Arguments.arguments(FINALIZED, DSPACE_VALUE_NEGOTIATION_STATE_FINALIZED), - Arguments.arguments(TERMINATING, DSPACE_VALUE_NEGOTIATION_STATE_TERMINATED), - Arguments.arguments(TERMINATED, DSPACE_VALUE_NEGOTIATION_STATE_TERMINATED) + Arguments.arguments(REQUESTING, DSPACE_VALUE_NEGOTIATION_STATE_REQUESTED_IRI), + Arguments.arguments(REQUESTED, DSPACE_VALUE_NEGOTIATION_STATE_REQUESTED_IRI), + Arguments.arguments(OFFERING, DSPACE_VALUE_NEGOTIATION_STATE_OFFERED_IRI), + Arguments.arguments(OFFERED, DSPACE_VALUE_NEGOTIATION_STATE_OFFERED_IRI), + Arguments.arguments(ACCEPTING, DSPACE_VALUE_NEGOTIATION_STATE_ACCEPTED_IRI), + Arguments.arguments(ACCEPTED, DSPACE_VALUE_NEGOTIATION_STATE_ACCEPTED_IRI), + Arguments.arguments(AGREEING, DSPACE_VALUE_NEGOTIATION_STATE_AGREED_IRI), + Arguments.arguments(AGREED, DSPACE_VALUE_NEGOTIATION_STATE_AGREED_IRI), + Arguments.arguments(VERIFYING, DSPACE_VALUE_NEGOTIATION_STATE_VERIFIED_IRI), + Arguments.arguments(VERIFIED, DSPACE_VALUE_NEGOTIATION_STATE_VERIFIED_IRI), + Arguments.arguments(FINALIZING, DSPACE_VALUE_NEGOTIATION_STATE_FINALIZED_IRI), + Arguments.arguments(FINALIZED, DSPACE_VALUE_NEGOTIATION_STATE_FINALIZED_IRI), + Arguments.arguments(TERMINATING, DSPACE_VALUE_NEGOTIATION_STATE_TERMINATED_IRI), + Arguments.arguments(TERMINATED, DSPACE_VALUE_NEGOTIATION_STATE_TERMINATED_IRI) ); } } diff --git a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractOfferMessageTransformerTest.java b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractOfferMessageTransformerTest.java similarity index 93% rename from data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractOfferMessageTransformerTest.java rename to data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractOfferMessageTransformerTest.java index 1a5173a97cb..44e2f83ac1d 100644 --- a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractOfferMessageTransformerTest.java +++ b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractOfferMessageTransformerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Fraunhofer Institute for Software and Systems Engineering + * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) * * This program and the accompanying materials are made available under the * terms of the Apache License, Version 2.0 which is available at @@ -8,7 +8,7 @@ * SPDX-License-Identifier: Apache-2.0 * * Contributors: - * Fraunhofer Institute for Software and Systems Engineering - initial API and implementation + * Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation * */ @@ -33,8 +33,8 @@ import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_PROPERTY_OFFER_IRI; import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_OFFER_MESSAGE_IRI; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CALLBACK_ADDRESS_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_IRI; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID_IRI; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.eq; @@ -84,8 +84,8 @@ void transform_shouldReturnJsonObject_whenValidMessage() { assertThat(result.getJsonObject(DSPACE_PROPERTY_OFFER_IRI)).isNotNull(); assertThat(result.getJsonObject(DSPACE_PROPERTY_OFFER_IRI)).isNotNull(); assertThat(result.getJsonObject(DSPACE_PROPERTY_OFFER_IRI).getJsonString(ID).getString()).isEqualTo(CONTRACT_OFFER_ID); - assertThat(result.getString(DSPACE_PROPERTY_PROVIDER_PID)).isEqualTo("providerPid"); - assertThat(result.getString(DSPACE_PROPERTY_CONSUMER_PID)).isEqualTo("consumerPid"); + assertThat(result.getString(DSPACE_PROPERTY_PROVIDER_PID_IRI)).isEqualTo("providerPid"); + assertThat(result.getString(DSPACE_PROPERTY_CONSUMER_PID_IRI)).isEqualTo("consumerPid"); verify(context, never()).reportProblem(anyString()); } diff --git a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractRequestMessageTransformerTest.java b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractRequestMessageTransformerTest.java similarity index 93% rename from data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractRequestMessageTransformerTest.java rename to data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractRequestMessageTransformerTest.java index 232edd90e49..9d0974dca44 100644 --- a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractRequestMessageTransformerTest.java +++ b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractRequestMessageTransformerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Fraunhofer Institute for Software and Systems Engineering + * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) * * This program and the accompanying materials are made available under the * terms of the Apache License, Version 2.0 which is available at @@ -8,7 +8,7 @@ * SPDX-License-Identifier: Apache-2.0 * * Contributors: - * Fraunhofer Institute for Software and Systems Engineering - initial API and implementation + * Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation * */ @@ -33,8 +33,8 @@ import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_PROPERTY_OFFER_IRI; import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE_IRI; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CALLBACK_ADDRESS_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_IRI; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID_IRI; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.eq; @@ -81,8 +81,8 @@ void verify_contractOffer() { assertThat(result.getJsonString(DSPACE_PROPERTY_CALLBACK_ADDRESS_IRI).getString()).isEqualTo(CALLBACK_ADDRESS); assertThat(result.getJsonObject(DSPACE_PROPERTY_OFFER_IRI)).isNotNull(); assertThat(result.getJsonObject(DSPACE_PROPERTY_OFFER_IRI).getString(ID)).isEqualTo(CONTRACT_OFFER_ID); - assertThat(result.getJsonString(DSPACE_PROPERTY_CONSUMER_PID).getString()).isEqualTo("consumerPid"); - assertThat(result.getJsonString(DSPACE_PROPERTY_PROVIDER_PID).getString()).isEqualTo("providerPid"); + assertThat(result.getJsonString(DSPACE_PROPERTY_CONSUMER_PID_IRI).getString()).isEqualTo("consumerPid"); + assertThat(result.getJsonString(DSPACE_PROPERTY_PROVIDER_PID_IRI).getString()).isEqualTo("providerPid"); verify(context, never()).reportProblem(anyString()); } diff --git a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractAgreementMessageTransformerTest.java b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractAgreementMessageTransformerTest.java similarity index 83% rename from data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractAgreementMessageTransformerTest.java rename to data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractAgreementMessageTransformerTest.java index 175dc4d53b9..5dbdb9ff9e4 100644 --- a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractAgreementMessageTransformerTest.java +++ b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractAgreementMessageTransformerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Fraunhofer Institute for Software and Systems Engineering + * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) * * This program and the accompanying materials are made available under the * terms of the Apache License, Version 2.0 which is available at @@ -8,7 +8,7 @@ * SPDX-License-Identifier: Apache-2.0 * * Contributors: - * Fraunhofer Institute for Software and Systems Engineering - initial API and implementation + * Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation * */ @@ -39,11 +39,11 @@ import static org.eclipse.edc.jsonld.spi.PropertyAndTypeNames.ODRL_ASSIGNER_ATTRIBUTE; import static org.eclipse.edc.jsonld.spi.PropertyAndTypeNames.ODRL_POLICY_TYPE_AGREEMENT; import static org.eclipse.edc.protocol.dsp.negotiation.transform.to.TestInput.getExpanded; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_PROPERTY_AGREEMENT; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_PROPERTY_TIMESTAMP; +import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_PROPERTY_AGREEMENT_IRI; +import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_PROPERTY_TIMESTAMP_IRI; import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_IRI; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID_IRI; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.contains; @@ -92,14 +92,14 @@ void transform() { var message = jsonFactory.createObjectBuilder() .add(ID, MESSAGE_ID) .add(TYPE, DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE_IRI) - .add(DSPACE_PROPERTY_CONSUMER_PID, "consumerPid") - .add(DSPACE_PROPERTY_PROVIDER_PID, "providerPid") - .add(DSPACE_PROPERTY_AGREEMENT, jsonFactory.createObjectBuilder() + .add(DSPACE_PROPERTY_CONSUMER_PID_IRI, "consumerPid") + .add(DSPACE_PROPERTY_PROVIDER_PID_IRI, "providerPid") + .add(DSPACE_PROPERTY_AGREEMENT_IRI, jsonFactory.createObjectBuilder() .add(ID, AGREEMENT_ID) .add(TYPE, ODRL_POLICY_TYPE_AGREEMENT) .add(ODRL_ASSIGNEE_ATTRIBUTE, CONSUMER_ID) .add(ODRL_ASSIGNER_ATTRIBUTE, PROVIDER_ID) - .add(DSPACE_PROPERTY_TIMESTAMP, TIMESTAMP) + .add(DSPACE_PROPERTY_TIMESTAMP_IRI, TIMESTAMP) .build()) .build(); @@ -131,16 +131,16 @@ void transform_nullPolicy() { var message = jsonFactory.createObjectBuilder() .add(ID, value) .add(TYPE, DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE_IRI) - .add(DSPACE_PROPERTY_CONSUMER_PID, "consumerPid") - .add(DSPACE_PROPERTY_PROVIDER_PID, "providerPid") - .add(DSPACE_PROPERTY_AGREEMENT, jsonFactory.createObjectBuilder() + .add(DSPACE_PROPERTY_CONSUMER_PID_IRI, "consumerPid") + .add(DSPACE_PROPERTY_PROVIDER_PID_IRI, "providerPid") + .add(DSPACE_PROPERTY_AGREEMENT_IRI, jsonFactory.createObjectBuilder() .add(ID, AGREEMENT_ID) .add(TYPE, ODRL_POLICY_TYPE_AGREEMENT) .add(ODRL_ASSIGNEE_ATTRIBUTE, CONSUMER_ID) .add(ODRL_ASSIGNER_ATTRIBUTE, PROVIDER_ID) - .add(DSPACE_PROPERTY_TIMESTAMP, TIMESTAMP) + .add(DSPACE_PROPERTY_TIMESTAMP_IRI, TIMESTAMP) .build()) - .add(DSPACE_PROPERTY_TIMESTAMP, "123") + .add(DSPACE_PROPERTY_TIMESTAMP_IRI, "123") .build(); when(context.transform(any(JsonObject.class), eq(Policy.class))).thenReturn(null); @@ -157,22 +157,22 @@ void transform_invalidTimestamp() { .add(TYPE, ODRL_POLICY_TYPE_AGREEMENT) .add(ODRL_ASSIGNEE_ATTRIBUTE, CONSUMER_ID) .add(ODRL_ASSIGNER_ATTRIBUTE, PROVIDER_ID) - .add(DSPACE_PROPERTY_TIMESTAMP, "Invalid Timestamp") + .add(DSPACE_PROPERTY_TIMESTAMP_IRI, "Invalid Timestamp") .build(); var message = jsonFactory.createObjectBuilder() .add(ID, "messageId") .add(TYPE, DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE_IRI) - .add(DSPACE_PROPERTY_CONSUMER_PID, "consumerPid") - .add(DSPACE_PROPERTY_PROVIDER_PID, "providerPid") - .add(DSPACE_PROPERTY_AGREEMENT, agreement) + .add(DSPACE_PROPERTY_CONSUMER_PID_IRI, "consumerPid") + .add(DSPACE_PROPERTY_PROVIDER_PID_IRI, "providerPid") + .add(DSPACE_PROPERTY_AGREEMENT_IRI, agreement) .build(); when(context.transform(any(JsonObject.class), eq(Policy.class))).thenReturn(policy()); assertThat(transformer.transform(getExpanded(message), context)).isNull(); - verify(context, times(1)).reportProblem(contains(DSPACE_PROPERTY_TIMESTAMP)); + verify(context, times(1)).reportProblem(contains(DSPACE_PROPERTY_TIMESTAMP_IRI)); } @Test @@ -187,16 +187,16 @@ void transform_missingTimestamp() { var message = jsonFactory.createObjectBuilder() .add(ID, "messageId") .add(TYPE, DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE_IRI) - .add(DSPACE_PROPERTY_CONSUMER_PID, "consumerPid") - .add(DSPACE_PROPERTY_PROVIDER_PID, "providerPid") - .add(DSPACE_PROPERTY_AGREEMENT, agreement) + .add(DSPACE_PROPERTY_CONSUMER_PID_IRI, "consumerPid") + .add(DSPACE_PROPERTY_PROVIDER_PID_IRI, "providerPid") + .add(DSPACE_PROPERTY_AGREEMENT_IRI, agreement) .build(); when(context.transform(any(JsonObject.class), eq(Policy.class))).thenReturn(policy()); assertThat(transformer.transform(getExpanded(message), context)).isNull(); - verify(context, times(1)).reportProblem(contains(DSPACE_PROPERTY_TIMESTAMP)); + verify(context, times(1)).reportProblem(contains(DSPACE_PROPERTY_TIMESTAMP_IRI)); } private Policy policy() { diff --git a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractAgreementVerificationMessageTransformerTest.java b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractAgreementVerificationMessageTransformerTest.java similarity index 88% rename from data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractAgreementVerificationMessageTransformerTest.java rename to data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractAgreementVerificationMessageTransformerTest.java index da0e21100f1..0d8f69699e0 100644 --- a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractAgreementVerificationMessageTransformerTest.java +++ b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractAgreementVerificationMessageTransformerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Fraunhofer Institute for Software and Systems Engineering + * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) * * This program and the accompanying materials are made available under the * terms of the Apache License, Version 2.0 which is available at @@ -8,7 +8,7 @@ * SPDX-License-Identifier: Apache-2.0 * * Contributors: - * Fraunhofer Institute for Software and Systems Engineering - initial API and implementation + * Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation * */ @@ -28,8 +28,8 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.eclipse.edc.protocol.dsp.negotiation.transform.to.TestInput.getExpanded; import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_AGREEMENT_VERIFICATION_MESSAGE_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_IRI; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID_IRI; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.contains; import static org.mockito.Mockito.mock; @@ -56,8 +56,8 @@ void transform() { var message = jsonFactory.createObjectBuilder() .add(JsonLdKeywords.ID, "messageId") .add(JsonLdKeywords.TYPE, DSPACE_TYPE_CONTRACT_AGREEMENT_VERIFICATION_MESSAGE_IRI) - .add(DSPACE_PROPERTY_CONSUMER_PID, "consumerPid") - .add(DSPACE_PROPERTY_PROVIDER_PID, "providerPid") + .add(DSPACE_PROPERTY_CONSUMER_PID_IRI, "consumerPid") + .add(DSPACE_PROPERTY_PROVIDER_PID_IRI, "providerPid") .build(); var result = transformer.transform(getExpanded(message), context); @@ -82,6 +82,6 @@ void verify_failTransformWhenConsumerPidMissing() { assertThat(result).isNull(); - verify(context, times(1)).reportProblem(contains(DSPACE_PROPERTY_CONSUMER_PID)); + verify(context, times(1)).reportProblem(contains(DSPACE_PROPERTY_CONSUMER_PID_IRI)); } } diff --git a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationAckTransformerTest.java b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationAckTransformerTest.java similarity index 83% rename from data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationAckTransformerTest.java rename to data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationAckTransformerTest.java index 9c2d4b97dca..b136bde9393 100644 --- a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationAckTransformerTest.java +++ b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationAckTransformerTest.java @@ -24,10 +24,10 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.eclipse.edc.protocol.dsp.negotiation.transform.to.TestInput.getExpanded; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_NEGOTIATION; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_STATE; +import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_NEGOTIATION_IRI; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_IRI; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID_IRI; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_STATE_IRI; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verifyNoInteractions; @@ -40,10 +40,10 @@ class JsonObjectToContractNegotiationAckTransformerTest { @Test void shouldTransform() { var message = jsonFactory.createObjectBuilder() - .add(JsonLdKeywords.TYPE, DSPACE_TYPE_CONTRACT_NEGOTIATION) - .add(DSPACE_PROPERTY_CONSUMER_PID, "consumerPid") - .add(DSPACE_PROPERTY_PROVIDER_PID, "providerPid") - .add(DSPACE_PROPERTY_STATE, "STATE") + .add(JsonLdKeywords.TYPE, DSPACE_TYPE_CONTRACT_NEGOTIATION_IRI) + .add(DSPACE_PROPERTY_CONSUMER_PID_IRI, "consumerPid") + .add(DSPACE_PROPERTY_PROVIDER_PID_IRI, "providerPid") + .add(DSPACE_PROPERTY_STATE_IRI, "STATE") .build(); var result = transformer.transform(getExpanded(message), context); diff --git a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationEventMessageTransformerTest.java b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationEventMessageTransformerTest.java similarity index 80% rename from data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationEventMessageTransformerTest.java rename to data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationEventMessageTransformerTest.java index 876cc20c815..a2b6d2fb751 100644 --- a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationEventMessageTransformerTest.java +++ b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationEventMessageTransformerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Fraunhofer Institute for Software and Systems Engineering + * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) * * This program and the accompanying materials are made available under the * terms of the Apache License, Version 2.0 which is available at @@ -8,7 +8,7 @@ * SPDX-License-Identifier: Apache-2.0 * * Contributors: - * Fraunhofer Institute for Software and Systems Engineering - initial API and implementation + * Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation * */ @@ -27,11 +27,11 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.eclipse.edc.protocol.dsp.negotiation.transform.to.TestInput.getExpanded; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_PROPERTY_EVENT_TYPE; +import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_PROPERTY_EVENT_TYPE_IRI; import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_NEGOTIATION_EVENT_MESSAGE_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_VALUE_NEGOTIATION_EVENT_TYPE_ACCEPTED; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID; +import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_VALUE_NEGOTIATION_EVENT_TYPE_ACCEPTED_IRI; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_IRI; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID_IRI; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.contains; import static org.mockito.Mockito.mock; @@ -58,9 +58,9 @@ void transform() { var message = jsonFactory.createObjectBuilder() .add(JsonLdKeywords.ID, "id1") .add(JsonLdKeywords.TYPE, DSPACE_TYPE_CONTRACT_NEGOTIATION_EVENT_MESSAGE_IRI) - .add(DSPACE_PROPERTY_CONSUMER_PID, "consumerPid") - .add(DSPACE_PROPERTY_PROVIDER_PID, "providerPid") - .add(DSPACE_PROPERTY_EVENT_TYPE, DSPACE_VALUE_NEGOTIATION_EVENT_TYPE_ACCEPTED) + .add(DSPACE_PROPERTY_CONSUMER_PID_IRI, "consumerPid") + .add(DSPACE_PROPERTY_PROVIDER_PID_IRI, "providerPid") + .add(DSPACE_PROPERTY_EVENT_TYPE_IRI, DSPACE_VALUE_NEGOTIATION_EVENT_TYPE_ACCEPTED_IRI) .build(); var result = transformer.transform(getExpanded(message), context); @@ -80,14 +80,14 @@ void verify_failTransformWhenProcessIdMissing() { var message = jsonFactory.createObjectBuilder() .add(JsonLdKeywords.ID, "id1") .add(JsonLdKeywords.TYPE, DSPACE_TYPE_CONTRACT_NEGOTIATION_EVENT_MESSAGE_IRI) - .add(DSPACE_PROPERTY_EVENT_TYPE, DSPACE_VALUE_NEGOTIATION_EVENT_TYPE_ACCEPTED) + .add(DSPACE_PROPERTY_EVENT_TYPE_IRI, DSPACE_VALUE_NEGOTIATION_EVENT_TYPE_ACCEPTED_IRI) .build(); var result = transformer.transform(getExpanded(message), context); assertThat(result).isNull(); - verify(context, times(1)).reportProblem(contains(DSPACE_PROPERTY_CONSUMER_PID)); + verify(context, times(1)).reportProblem(contains(DSPACE_PROPERTY_CONSUMER_PID_IRI)); } @Test @@ -95,15 +95,15 @@ void verify_failTransformWhenEventTypeMissing() { var message = jsonFactory.createObjectBuilder() .add(JsonLdKeywords.ID, "id1") .add(JsonLdKeywords.TYPE, DSPACE_TYPE_CONTRACT_NEGOTIATION_EVENT_MESSAGE_IRI) - .add(DSPACE_PROPERTY_CONSUMER_PID, "consumerPid") - .add(DSPACE_PROPERTY_PROVIDER_PID, "providerPid") + .add(DSPACE_PROPERTY_CONSUMER_PID_IRI, "consumerPid") + .add(DSPACE_PROPERTY_PROVIDER_PID_IRI, "providerPid") .build(); var result = transformer.transform(getExpanded(message), context); assertThat(result).isNull(); - verify(context, times(1)).reportProblem(contains(DSPACE_PROPERTY_EVENT_TYPE)); + verify(context, times(1)).reportProblem(contains(DSPACE_PROPERTY_EVENT_TYPE_IRI)); } @Test @@ -111,15 +111,15 @@ void verify_failTransformWhenEventTypeInvalid() { var message = jsonFactory.createObjectBuilder() .add(JsonLdKeywords.ID, "id1") .add(JsonLdKeywords.TYPE, DSPACE_TYPE_CONTRACT_NEGOTIATION_EVENT_MESSAGE_IRI) - .add(DSPACE_PROPERTY_CONSUMER_PID, "consumerPid") - .add(DSPACE_PROPERTY_PROVIDER_PID, "providerPid") - .add(DSPACE_PROPERTY_EVENT_TYPE, "InvalidType") + .add(DSPACE_PROPERTY_CONSUMER_PID_IRI, "consumerPid") + .add(DSPACE_PROPERTY_PROVIDER_PID_IRI, "providerPid") + .add(DSPACE_PROPERTY_EVENT_TYPE_IRI, "InvalidType") .build(); var result = transformer.transform(getExpanded(message), context); assertThat(result).isNull(); - verify(context, times(1)).reportProblem(contains(DSPACE_PROPERTY_EVENT_TYPE)); + verify(context, times(1)).reportProblem(contains(DSPACE_PROPERTY_EVENT_TYPE_IRI)); } } diff --git a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationTerminationMessageTransformerTest.java b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationTerminationMessageTransformerTest.java similarity index 87% rename from data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationTerminationMessageTransformerTest.java rename to data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationTerminationMessageTransformerTest.java index 3af19c69cf1..16caec60090 100644 --- a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationTerminationMessageTransformerTest.java +++ b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationTerminationMessageTransformerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Fraunhofer Institute for Software and Systems Engineering + * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) * * This program and the accompanying materials are made available under the * terms of the Apache License, Version 2.0 which is available at @@ -8,7 +8,7 @@ * SPDX-License-Identifier: Apache-2.0 * * Contributors: - * Fraunhofer Institute for Software and Systems Engineering - initial API and implementation + * Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation * */ @@ -28,8 +28,8 @@ import static org.eclipse.edc.protocol.dsp.negotiation.transform.to.TestInput.getExpanded; import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_NEGOTIATION_TERMINATION_MESSAGE_IRI; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CODE_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_IRI; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID_IRI; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_REASON_IRI; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.mock; @@ -53,8 +53,8 @@ void transform() { var message = jsonFactory.createObjectBuilder() .add(JsonLdKeywords.ID, "id1") .add(JsonLdKeywords.TYPE, DSPACE_TYPE_CONTRACT_NEGOTIATION_TERMINATION_MESSAGE_IRI) - .add(DSPACE_PROPERTY_CONSUMER_PID, "consumerPid") - .add(DSPACE_PROPERTY_PROVIDER_PID, "providerPid") + .add(DSPACE_PROPERTY_CONSUMER_PID_IRI, "consumerPid") + .add(DSPACE_PROPERTY_PROVIDER_PID_IRI, "providerPid") .add(DSPACE_PROPERTY_CODE_IRI, CODE) .add(DSPACE_PROPERTY_REASON_IRI, reasonArray) .build(); @@ -79,8 +79,8 @@ void verify_noCodeNodReason() { var message = jsonFactory.createObjectBuilder() .add(JsonLdKeywords.ID, "id1") .add(JsonLdKeywords.TYPE, DSPACE_TYPE_CONTRACT_NEGOTIATION_TERMINATION_MESSAGE_IRI) - .add(DSPACE_PROPERTY_CONSUMER_PID, "consumerPid") - .add(DSPACE_PROPERTY_PROVIDER_PID, "providerPid") + .add(DSPACE_PROPERTY_CONSUMER_PID_IRI, "consumerPid") + .add(DSPACE_PROPERTY_PROVIDER_PID_IRI, "providerPid") .build(); var result = transformer.transform(getExpanded(message), context); diff --git a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractOfferMessageTransformerTest.java b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractOfferMessageTransformerTest.java similarity index 89% rename from data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractOfferMessageTransformerTest.java rename to data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractOfferMessageTransformerTest.java index 974cf430634..4ec9ef3ea5d 100644 --- a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractOfferMessageTransformerTest.java +++ b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractOfferMessageTransformerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Fraunhofer Institute for Software and Systems Engineering + * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) * * This program and the accompanying materials are made available under the * terms of the Apache License, Version 2.0 which is available at @@ -8,7 +8,7 @@ * SPDX-License-Identifier: Apache-2.0 * * Contributors: - * Fraunhofer Institute for Software and Systems Engineering - initial API and implementation + * Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation * */ @@ -33,8 +33,8 @@ import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_PROPERTY_OFFER_IRI; import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_OFFER_MESSAGE_IRI; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CALLBACK_ADDRESS_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_IRI; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID_IRI; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.eq; @@ -66,8 +66,8 @@ void transform_shouldReturnMessage_whenValidJsonObject() { var message = jsonFactory.createObjectBuilder() .add(ID, MESSAGE_ID) .add(JsonLdKeywords.TYPE, DSPACE_TYPE_CONTRACT_OFFER_MESSAGE_IRI) - .add(DSPACE_PROPERTY_CONSUMER_PID, "consumerPid") - .add(DSPACE_PROPERTY_PROVIDER_PID, "providerPid") + .add(DSPACE_PROPERTY_CONSUMER_PID_IRI, "consumerPid") + .add(DSPACE_PROPERTY_PROVIDER_PID_IRI, "providerPid") .add(DSPACE_PROPERTY_CALLBACK_ADDRESS_IRI, CALLBACK_ADDRESS) .add(DSPACE_PROPERTY_OFFER_IRI, jsonFactory.createObjectBuilder() .add(ID, CONTRACT_OFFER_ID) @@ -117,8 +117,8 @@ void transform_shouldReportProblem_whenMissingContractOffer() { var message = jsonFactory.createObjectBuilder() .add(ID, MESSAGE_ID) .add(JsonLdKeywords.TYPE, DSPACE_TYPE_CONTRACT_OFFER_MESSAGE_IRI) - .add(DSPACE_PROPERTY_CONSUMER_PID, "consumerPid") - .add(DSPACE_PROPERTY_PROVIDER_PID, "providerPid") + .add(DSPACE_PROPERTY_CONSUMER_PID_IRI, "consumerPid") + .add(DSPACE_PROPERTY_PROVIDER_PID_IRI, "providerPid") .add(DSPACE_PROPERTY_CALLBACK_ADDRESS_IRI, CALLBACK_ADDRESS) .build(); @@ -133,8 +133,8 @@ void transform_shouldReportProblem_whenMissingContractOfferId() { var message = jsonFactory.createObjectBuilder() .add(ID, MESSAGE_ID) .add(JsonLdKeywords.TYPE, DSPACE_TYPE_CONTRACT_OFFER_MESSAGE_IRI) - .add(DSPACE_PROPERTY_CONSUMER_PID, "consumerPid") - .add(DSPACE_PROPERTY_PROVIDER_PID, "providerPid") + .add(DSPACE_PROPERTY_CONSUMER_PID_IRI, "consumerPid") + .add(DSPACE_PROPERTY_PROVIDER_PID_IRI, "providerPid") .add(DSPACE_PROPERTY_CALLBACK_ADDRESS_IRI, CALLBACK_ADDRESS) .add(DSPACE_PROPERTY_OFFER_IRI, jsonFactory.createObjectBuilder().build()) .build(); @@ -153,8 +153,8 @@ void transform_shouldReportProblem_whenPolicyTransformationFails() { var message = jsonFactory.createObjectBuilder() .add(ID, MESSAGE_ID) .add(JsonLdKeywords.TYPE, DSPACE_TYPE_CONTRACT_OFFER_MESSAGE_IRI) - .add(DSPACE_PROPERTY_CONSUMER_PID, "consumerPid") - .add(DSPACE_PROPERTY_PROVIDER_PID, "providerPid") + .add(DSPACE_PROPERTY_CONSUMER_PID_IRI, "consumerPid") + .add(DSPACE_PROPERTY_PROVIDER_PID_IRI, "providerPid") .add(DSPACE_PROPERTY_CALLBACK_ADDRESS_IRI, CALLBACK_ADDRESS) .add(DSPACE_PROPERTY_OFFER_IRI, jsonFactory.createObjectBuilder() .add(ID, CONTRACT_OFFER_ID) diff --git a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractRequestMessageTransformerTest.java b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractRequestMessageTransformerTest.java similarity index 88% rename from data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractRequestMessageTransformerTest.java rename to data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractRequestMessageTransformerTest.java index 2c5f1a11f20..0c4a1490040 100644 --- a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractRequestMessageTransformerTest.java +++ b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractRequestMessageTransformerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Fraunhofer Institute for Software and Systems Engineering + * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) * * This program and the accompanying materials are made available under the * terms of the Apache License, Version 2.0 which is available at @@ -8,7 +8,7 @@ * SPDX-License-Identifier: Apache-2.0 * * Contributors: - * Fraunhofer Institute for Software and Systems Engineering - initial API and implementation + * Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation * */ @@ -36,8 +36,8 @@ import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_PROPERTY_OFFER_IRI; import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE_IRI; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CALLBACK_ADDRESS_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_IRI; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID_IRI; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.eq; @@ -69,8 +69,8 @@ void verify_usingOffer() { var message = jsonFactory.createObjectBuilder() .add(JsonLdKeywords.ID, OBJECT_ID) .add(JsonLdKeywords.TYPE, DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE_IRI) - .add(DSPACE_PROPERTY_CONSUMER_PID, "consumerPid") - .add(DSPACE_PROPERTY_PROVIDER_PID, "providerPid") + .add(DSPACE_PROPERTY_CONSUMER_PID_IRI, "consumerPid") + .add(DSPACE_PROPERTY_PROVIDER_PID_IRI, "providerPid") .add(DSPACE_PROPERTY_CALLBACK_ADDRESS_IRI, CALLBACK) .add(DSPACE_PROPERTY_OFFER_IRI, contractOffer()) .build(); @@ -99,8 +99,8 @@ void verify_noCallbackOrDatasetOk() { var message = jsonFactory.createObjectBuilder() .add(JsonLdKeywords.ID, OBJECT_ID) .add(JsonLdKeywords.TYPE, DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE_IRI) - .add(DSPACE_PROPERTY_CONSUMER_PID, "consumerPid") - .add(DSPACE_PROPERTY_PROVIDER_PID, "providerPid") + .add(DSPACE_PROPERTY_CONSUMER_PID_IRI, "consumerPid") + .add(DSPACE_PROPERTY_PROVIDER_PID_IRI, "providerPid") .add(DSPACE_PROPERTY_OFFER_IRI, contractOffer()) .build(); @@ -121,8 +121,8 @@ void verify_noIdContractOfferFails() { var message = jsonFactory.createObjectBuilder() .add(JsonLdKeywords.ID, OBJECT_ID) .add(JsonLdKeywords.TYPE, DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE_IRI) - .add(DSPACE_PROPERTY_CONSUMER_PID, "consumerPid") - .add(DSPACE_PROPERTY_PROVIDER_PID, "providerPid") + .add(DSPACE_PROPERTY_CONSUMER_PID_IRI, "consumerPid") + .add(DSPACE_PROPERTY_PROVIDER_PID_IRI, "providerPid") .add(DSPACE_PROPERTY_OFFER_IRI, offer) .build(); @@ -140,8 +140,8 @@ void transform_nullPolicyFails() { var message = jsonFactory.createObjectBuilder() .add(JsonLdKeywords.ID, OBJECT_ID) .add(JsonLdKeywords.TYPE, DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE_IRI) - .add(DSPACE_PROPERTY_CONSUMER_PID, "consumerPid") - .add(DSPACE_PROPERTY_PROVIDER_PID, "providerPid") + .add(DSPACE_PROPERTY_CONSUMER_PID_IRI, "consumerPid") + .add(DSPACE_PROPERTY_PROVIDER_PID_IRI, "providerPid") .add(DSPACE_PROPERTY_CALLBACK_ADDRESS_IRI, CALLBACK) .add(DSPACE_PROPERTY_OFFER_IRI, contractOffer()) .build(); diff --git a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/TestInput.java b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/TestInput.java similarity index 81% rename from data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/TestInput.java rename to data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/TestInput.java index d83f03e1104..1226e685de5 100644 --- a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/TestInput.java +++ b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/TestInput.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) * * This program and the accompanying materials are made available under the * terms of the Apache License, Version 2.0 which is available at @@ -14,27 +14,26 @@ package org.eclipse.edc.protocol.dsp.negotiation.transform.to; +import com.apicatalog.jsonld.JsonLd; import com.apicatalog.jsonld.document.JsonDocument; import jakarta.json.JsonObject; -import static com.apicatalog.jsonld.JsonLd.expand; - /** * Functions for shaping test input. */ public class TestInput { + private TestInput() { + } + /** * Expands test input as Json-ld is required to be in this form */ public static JsonObject getExpanded(JsonObject message) { try { - return expand(JsonDocument.of(message)).get().asJsonArray().getJsonObject(0); + return JsonLd.expand(JsonDocument.of(message)).get().asJsonArray().getJsonObject(0); } catch (Exception e) { throw new AssertionError(e); } } - - private TestInput() { - } } diff --git a/data-protocols/dsp/dsp-spi/src/main/java/org/eclipse/edc/protocol/dsp/spi/type/DspNegotiationPropertyAndTypeNames.java b/data-protocols/dsp/dsp-spi/src/main/java/org/eclipse/edc/protocol/dsp/spi/type/DspNegotiationPropertyAndTypeNames.java index 7a78e00d80a..1b904a020cc 100644 --- a/data-protocols/dsp/dsp-spi/src/main/java/org/eclipse/edc/protocol/dsp/spi/type/DspNegotiationPropertyAndTypeNames.java +++ b/data-protocols/dsp/dsp-spi/src/main/java/org/eclipse/edc/protocol/dsp/spi/type/DspNegotiationPropertyAndTypeNames.java @@ -20,9 +20,10 @@ public interface DspNegotiationPropertyAndTypeNames { // types - String DSPACE_TYPE_CONTRACT_NEGOTIATION = DSPACE_SCHEMA + "ContractNegotiation"; - String DSPACE_TYPE_CONTRACT_NEGOTIATION_ERROR = DSPACE_SCHEMA + "ContractNegotiationError"; - + String DSPACE_TYPE_CONTRACT_NEGOTIATION_TERM = "ContractNegotiation"; + String DSPACE_TYPE_CONTRACT_NEGOTIATION_IRI = DSPACE_SCHEMA + DSPACE_TYPE_CONTRACT_NEGOTIATION_TERM; + String DSPACE_TYPE_CONTRACT_NEGOTIATION_ERROR_TERM = "ContractNegotiationError"; + String DSPACE_TYPE_CONTRACT_NEGOTIATION_ERROR_IRI = DSPACE_SCHEMA + DSPACE_TYPE_CONTRACT_NEGOTIATION_ERROR_TERM; // messages String DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE_TERM = "ContractRequestMessage"; String DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE_IRI = DSPACE_SCHEMA + DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE_TERM; @@ -38,27 +39,38 @@ public interface DspNegotiationPropertyAndTypeNames { String DSPACE_TYPE_CONTRACT_NEGOTIATION_TERMINATION_MESSAGE_IRI = DSPACE_SCHEMA + DSPACE_TYPE_CONTRACT_NEGOTIATION_TERMINATION_MESSAGE_TERM; // properties - String DSPACE_PROPERTY_EVENT_TYPE = DSPACE_SCHEMA + "eventType"; - String DSPACE_PROPERTY_AGREEMENT = DSPACE_SCHEMA + "agreement"; + String DSPACE_PROPERTY_EVENT_TYPE_TERM = "eventType"; + String DSPACE_PROPERTY_EVENT_TYPE_IRI = DSPACE_SCHEMA + DSPACE_PROPERTY_EVENT_TYPE_TERM; + String DSPACE_PROPERTY_AGREEMENT_TERM = "agreement"; + String DSPACE_PROPERTY_AGREEMENT_IRI = DSPACE_SCHEMA + DSPACE_PROPERTY_AGREEMENT_TERM; String DSPACE_PROPERTY_OFFER_TERM = "offer"; String DSPACE_PROPERTY_OFFER_IRI = DSPACE_SCHEMA + DSPACE_PROPERTY_OFFER_TERM; - String DSPACE_PROPERTY_TIMESTAMP = DSPACE_SCHEMA + "timestamp"; - String DSPACE_PROPERTY_CONSUMER_ID = DSPACE_SCHEMA + "consumerId"; - String DSPACE_PROPERTY_PROVIDER_ID = DSPACE_SCHEMA + "providerId"; - + String DSPACE_PROPERTY_TIMESTAMP_TERM = "timestamp"; + String DSPACE_PROPERTY_TIMESTAMP_IRI = DSPACE_SCHEMA + DSPACE_PROPERTY_TIMESTAMP_TERM; + String DSPACE_PROPERTY_CONSUMER_ID_TERM = "consumerId"; + String DSPACE_PROPERTY_CONSUMER_ID_IRI = DSPACE_SCHEMA + DSPACE_PROPERTY_CONSUMER_ID_TERM; + String DSPACE_PROPERTY_PROVIDER_ID_TERM = "providerId"; + String DSPACE_PROPERTY_PROVIDER_ID_IRI = DSPACE_SCHEMA + DSPACE_PROPERTY_PROVIDER_ID_TERM; // event types - - String DSPACE_VALUE_NEGOTIATION_EVENT_TYPE_ACCEPTED = DSPACE_SCHEMA + "ACCEPTED"; - String DSPACE_VALUE_NEGOTIATION_EVENT_TYPE_FINALIZED = DSPACE_SCHEMA + "FINALIZED"; - + String DSPACE_VALUE_NEGOTIATION_EVENT_TYPE_ACCEPTED_TERM = "ACCEPTED"; + String DSPACE_VALUE_NEGOTIATION_EVENT_TYPE_ACCEPTED_IRI = DSPACE_SCHEMA + DSPACE_VALUE_NEGOTIATION_EVENT_TYPE_ACCEPTED_TERM; + String DSPACE_VALUE_NEGOTIATION_EVENT_TYPE_FINALIZED_TERM = "FINALIZED"; + String DSPACE_VALUE_NEGOTIATION_EVENT_TYPE_FINALIZED_IRI = DSPACE_SCHEMA + DSPACE_VALUE_NEGOTIATION_EVENT_TYPE_FINALIZED_TERM; // negotiation states - String DSPACE_VALUE_NEGOTIATION_STATE_REQUESTED = DSPACE_SCHEMA + "REQUESTED"; - String DSPACE_VALUE_NEGOTIATION_STATE_OFFERED = DSPACE_SCHEMA + "OFFERED"; - String DSPACE_VALUE_NEGOTIATION_STATE_ACCEPTED = DSPACE_SCHEMA + "ACCEPTED"; - String DSPACE_VALUE_NEGOTIATION_STATE_AGREED = DSPACE_SCHEMA + "AGREED"; - String DSPACE_VALUE_NEGOTIATION_STATE_VERIFIED = DSPACE_SCHEMA + "VERIFIED"; - String DSPACE_VALUE_NEGOTIATION_STATE_FINALIZED = DSPACE_SCHEMA + "FINALIZED"; - String DSPACE_VALUE_NEGOTIATION_STATE_TERMINATED = DSPACE_SCHEMA + "TERMINATED"; + String DSPACE_VALUE_NEGOTIATION_STATE_REQUESTED_TERM = "REQUESTED"; + String DSPACE_VALUE_NEGOTIATION_STATE_REQUESTED_IRI = DSPACE_SCHEMA + DSPACE_VALUE_NEGOTIATION_STATE_REQUESTED_TERM; + String DSPACE_VALUE_NEGOTIATION_STATE_OFFERED_TERM = "OFFERED"; + String DSPACE_VALUE_NEGOTIATION_STATE_OFFERED_IRI = DSPACE_SCHEMA + DSPACE_VALUE_NEGOTIATION_STATE_OFFERED_TERM; + String DSPACE_VALUE_NEGOTIATION_STATE_ACCEPTED_TERM = "ACCEPTED"; + String DSPACE_VALUE_NEGOTIATION_STATE_ACCEPTED_IRI = DSPACE_SCHEMA + DSPACE_VALUE_NEGOTIATION_STATE_ACCEPTED_TERM; + String DSPACE_VALUE_NEGOTIATION_STATE_AGREED_TERM = "AGREED"; + String DSPACE_VALUE_NEGOTIATION_STATE_AGREED_IRI = DSPACE_SCHEMA + DSPACE_VALUE_NEGOTIATION_STATE_AGREED_TERM; + String DSPACE_VALUE_NEGOTIATION_STATE_VERIFIED_TERM = "VERIFIED"; + String DSPACE_VALUE_NEGOTIATION_STATE_VERIFIED_IRI = DSPACE_SCHEMA + DSPACE_VALUE_NEGOTIATION_STATE_VERIFIED_TERM; + String DSPACE_VALUE_NEGOTIATION_STATE_FINALIZED_TERM = "FINALIZED"; + String DSPACE_VALUE_NEGOTIATION_STATE_FINALIZED_IRI = DSPACE_SCHEMA + DSPACE_VALUE_NEGOTIATION_STATE_FINALIZED_TERM; + String DSPACE_VALUE_NEGOTIATION_STATE_TERMINATED_TERM = "TERMINATED"; + String DSPACE_VALUE_NEGOTIATION_STATE_TERMINATED_IRI = DSPACE_SCHEMA + DSPACE_VALUE_NEGOTIATION_STATE_TERMINATED_TERM; } diff --git a/data-protocols/dsp/dsp-spi/src/main/java/org/eclipse/edc/protocol/dsp/spi/type/DspPropertyAndTypeNames.java b/data-protocols/dsp/dsp-spi/src/main/java/org/eclipse/edc/protocol/dsp/spi/type/DspPropertyAndTypeNames.java index 3e964378399..cff899af8f5 100644 --- a/data-protocols/dsp/dsp-spi/src/main/java/org/eclipse/edc/protocol/dsp/spi/type/DspPropertyAndTypeNames.java +++ b/data-protocols/dsp/dsp-spi/src/main/java/org/eclipse/edc/protocol/dsp/spi/type/DspPropertyAndTypeNames.java @@ -25,10 +25,13 @@ public interface DspPropertyAndTypeNames { String DSPACE_PROPERTY_CODE_IRI = DSPACE_SCHEMA + DSPACE_PROPERTY_CODE_TERM; String DSPACE_PROPERTY_REASON_TERM = "reason"; String DSPACE_PROPERTY_REASON_IRI = DSPACE_SCHEMA + DSPACE_PROPERTY_REASON_TERM; - String DSPACE_PROPERTY_CONSUMER_PID = DSPACE_SCHEMA + "consumerPid"; - String DSPACE_PROPERTY_PROVIDER_PID = DSPACE_SCHEMA + "providerPid"; + String DSPACE_PROPERTY_CONSUMER_PID_TERM = "consumerPid"; + String DSPACE_PROPERTY_CONSUMER_PID_IRI = DSPACE_SCHEMA + DSPACE_PROPERTY_CONSUMER_PID_TERM; + String DSPACE_PROPERTY_PROVIDER_PID_TERM = "providerPid"; + String DSPACE_PROPERTY_PROVIDER_PID_IRI = DSPACE_SCHEMA + DSPACE_PROPERTY_PROVIDER_PID_TERM; String DSPACE_PROPERTY_PROCESS_ID = DSPACE_SCHEMA + "processId"; String DSPACE_PROPERTY_CALLBACK_ADDRESS_TERM = "callbackAddress"; String DSPACE_PROPERTY_CALLBACK_ADDRESS_IRI = DSPACE_SCHEMA + DSPACE_PROPERTY_CALLBACK_ADDRESS_TERM; - String DSPACE_PROPERTY_STATE = DSPACE_SCHEMA + "state"; + String DSPACE_PROPERTY_STATE_TERM = "state"; + String DSPACE_PROPERTY_STATE_IRI = DSPACE_SCHEMA + DSPACE_PROPERTY_STATE_TERM; } diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/from/JsonObjectFromTransferCompletionMessageTransformer.java b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/from/JsonObjectFromTransferCompletionMessageTransformer.java index 20d4b6134d1..df08d226778 100644 --- a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/from/JsonObjectFromTransferCompletionMessageTransformer.java +++ b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/from/JsonObjectFromTransferCompletionMessageTransformer.java @@ -24,8 +24,8 @@ import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.ID; import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.TYPE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_IRI; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID_IRI; import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE_IRI; @@ -43,8 +43,8 @@ public JsonObjectFromTransferCompletionMessageTransformer(JsonBuilderFactory jso return jsonBuilderFactory.createObjectBuilder() .add(ID, transferCompletionMessage.getId()) .add(TYPE, DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE_IRI) - .add(DSPACE_PROPERTY_CONSUMER_PID, transferCompletionMessage.getConsumerPid()) - .add(DSPACE_PROPERTY_PROVIDER_PID, transferCompletionMessage.getProviderPid()) + .add(DSPACE_PROPERTY_CONSUMER_PID_IRI, transferCompletionMessage.getConsumerPid()) + .add(DSPACE_PROPERTY_PROVIDER_PID_IRI, transferCompletionMessage.getProviderPid()) .build(); } } diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/from/JsonObjectFromTransferProcessTransformer.java b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/from/JsonObjectFromTransferProcessTransformer.java index 64b72d2b46f..a19b46dc604 100644 --- a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/from/JsonObjectFromTransferProcessTransformer.java +++ b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/from/JsonObjectFromTransferProcessTransformer.java @@ -25,9 +25,9 @@ import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.ID; import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.TYPE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_STATE; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_IRI; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID_IRI; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_STATE_IRI; import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_PROCESS; public class JsonObjectFromTransferProcessTransformer extends AbstractJsonLdTransformer { @@ -44,14 +44,14 @@ public JsonObjectFromTransferProcessTransformer(JsonBuilderFactory jsonBuilderFa var builder = jsonBuilderFactory.createObjectBuilder() .add(ID, transferProcess.getId()) .add(TYPE, DSPACE_TYPE_TRANSFER_PROCESS) - .add(DSPACE_PROPERTY_STATE, TransferProcessStates.from(transferProcess.getState()).name()); + .add(DSPACE_PROPERTY_STATE_IRI, TransferProcessStates.from(transferProcess.getState()).name()); if (transferProcess.getType() == TransferProcess.Type.PROVIDER) { - builder.add(DSPACE_PROPERTY_PROVIDER_PID, transferProcess.getId()); - addIfNotNull(transferProcess.getCorrelationId(), DSPACE_PROPERTY_CONSUMER_PID, builder); + builder.add(DSPACE_PROPERTY_PROVIDER_PID_IRI, transferProcess.getId()); + addIfNotNull(transferProcess.getCorrelationId(), DSPACE_PROPERTY_CONSUMER_PID_IRI, builder); } else { - builder.add(DSPACE_PROPERTY_CONSUMER_PID, transferProcess.getId()); - addIfNotNull(transferProcess.getCorrelationId(), DSPACE_PROPERTY_PROVIDER_PID, builder); + builder.add(DSPACE_PROPERTY_CONSUMER_PID_IRI, transferProcess.getId()); + addIfNotNull(transferProcess.getCorrelationId(), DSPACE_PROPERTY_PROVIDER_PID_IRI, builder); } return builder.build(); diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/from/JsonObjectFromTransferRequestMessageTransformer.java b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/from/JsonObjectFromTransferRequestMessageTransformer.java index 33c94c5fcf4..8c63e7c96b5 100644 --- a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/from/JsonObjectFromTransferRequestMessageTransformer.java +++ b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/from/JsonObjectFromTransferRequestMessageTransformer.java @@ -28,7 +28,7 @@ import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.TYPE; import static org.eclipse.edc.jsonld.spi.PropertyAndTypeNames.DCT_FORMAT_ATTRIBUTE; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CALLBACK_ADDRESS_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_IRI; import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_PROPERTY_CONTRACT_AGREEMENT_ID; import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_PROPERTY_DATA_ADDRESS; import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE_IRI; @@ -54,7 +54,7 @@ public JsonObjectFromTransferRequestMessageTransformer(JsonBuilderFactory jsonBu .add(DSPACE_PROPERTY_CONTRACT_AGREEMENT_ID, transferRequestMessage.getContractId()) .add(DCT_FORMAT_ATTRIBUTE, format) .add(DSPACE_PROPERTY_CALLBACK_ADDRESS_IRI, transferRequestMessage.getCallbackAddress()) - .add(DSPACE_PROPERTY_CONSUMER_PID, transferRequestMessage.getConsumerPid()); + .add(DSPACE_PROPERTY_CONSUMER_PID_IRI, transferRequestMessage.getConsumerPid()); if (transferRequestMessage.getDataDestination() != null && transferRequestMessage.getDataDestination().getProperties().size() > 1) { builder.add(DSPACE_PROPERTY_DATA_ADDRESS, context.transform(transferRequestMessage.getDataDestination(), JsonObject.class)); diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/from/JsonObjectFromTransferStartMessageTransformer.java b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/from/JsonObjectFromTransferStartMessageTransformer.java index 19cac8951ab..bad8a8e3c9b 100644 --- a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/from/JsonObjectFromTransferStartMessageTransformer.java +++ b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/from/JsonObjectFromTransferStartMessageTransformer.java @@ -24,8 +24,8 @@ import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.ID; import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.TYPE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_IRI; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID_IRI; import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_PROPERTY_DATA_ADDRESS; import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_START_MESSAGE_IRI; @@ -43,8 +43,8 @@ public JsonObjectFromTransferStartMessageTransformer(JsonBuilderFactory jsonBuil var builder = jsonBuilderFactory.createObjectBuilder() .add(ID, transferStartMessage.getId()) .add(TYPE, DSPACE_TYPE_TRANSFER_START_MESSAGE_IRI) - .add(DSPACE_PROPERTY_PROVIDER_PID, transferStartMessage.getProviderPid()) - .add(DSPACE_PROPERTY_CONSUMER_PID, transferStartMessage.getConsumerPid()); + .add(DSPACE_PROPERTY_PROVIDER_PID_IRI, transferStartMessage.getProviderPid()) + .add(DSPACE_PROPERTY_CONSUMER_PID_IRI, transferStartMessage.getConsumerPid()); if (transferStartMessage.getDataAddress() != null) { builder.add(DSPACE_PROPERTY_DATA_ADDRESS, context.transform(transferStartMessage.getDataAddress(), JsonObject.class)); diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/from/JsonObjectFromTransferSuspensionMessageTransformer.java b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/from/JsonObjectFromTransferSuspensionMessageTransformer.java index 0d1ed057a9b..81d9848dee9 100644 --- a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/from/JsonObjectFromTransferSuspensionMessageTransformer.java +++ b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/from/JsonObjectFromTransferSuspensionMessageTransformer.java @@ -25,8 +25,8 @@ import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.ID; import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.TYPE; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CODE_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_IRI; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID_IRI; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_REASON_IRI; import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_SUSPENSION_MESSAGE; @@ -44,8 +44,8 @@ public JsonObjectFromTransferSuspensionMessageTransformer(JsonBuilderFactory jso var builder = jsonBuilderFactory.createObjectBuilder() .add(ID, message.getId()) .add(TYPE, DSPACE_TYPE_TRANSFER_SUSPENSION_MESSAGE) - .add(DSPACE_PROPERTY_CONSUMER_PID, message.getConsumerPid()) - .add(DSPACE_PROPERTY_PROVIDER_PID, message.getProviderPid()) + .add(DSPACE_PROPERTY_CONSUMER_PID_IRI, message.getConsumerPid()) + .add(DSPACE_PROPERTY_PROVIDER_PID_IRI, message.getProviderPid()) .add(DSPACE_PROPERTY_REASON_IRI, jsonBuilderFactory.createArrayBuilder(message.getReason())); addIfNotNull(message.getCode(), DSPACE_PROPERTY_CODE_IRI, builder); diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/from/JsonObjectFromTransferTerminationMessageTransformer.java b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/from/JsonObjectFromTransferTerminationMessageTransformer.java index 9578b064ac7..8a2fbdf8c3a 100644 --- a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/from/JsonObjectFromTransferTerminationMessageTransformer.java +++ b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/from/JsonObjectFromTransferTerminationMessageTransformer.java @@ -25,8 +25,8 @@ import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.ID; import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.TYPE; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CODE_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_IRI; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID_IRI; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_REASON_IRI; import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE_IRI; @@ -44,8 +44,8 @@ public JsonObjectFromTransferTerminationMessageTransformer(JsonBuilderFactory js var builder = jsonBuilderFactory.createObjectBuilder() .add(ID, transferTerminationMessage.getId()) .add(TYPE, DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE_IRI) - .add(DSPACE_PROPERTY_CONSUMER_PID, transferTerminationMessage.getConsumerPid()) - .add(DSPACE_PROPERTY_PROVIDER_PID, transferTerminationMessage.getProviderPid()); + .add(DSPACE_PROPERTY_CONSUMER_PID_IRI, transferTerminationMessage.getConsumerPid()) + .add(DSPACE_PROPERTY_PROVIDER_PID_IRI, transferTerminationMessage.getProviderPid()); addIfNotNull(transferTerminationMessage.getCode(), DSPACE_PROPERTY_CODE_IRI, builder); addIfNotNull(transferTerminationMessage.getReason(), DSPACE_PROPERTY_REASON_IRI, builder); diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferCompletionMessageTransformer.java b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferCompletionMessageTransformer.java index 907d53ce32d..17320b06cec 100644 --- a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferCompletionMessageTransformer.java +++ b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferCompletionMessageTransformer.java @@ -21,8 +21,8 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_IRI; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID_IRI; import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE_IRI; public class JsonObjectToTransferCompletionMessageTransformer extends AbstractJsonLdTransformer { @@ -35,20 +35,20 @@ public JsonObjectToTransferCompletionMessageTransformer() { public @Nullable TransferCompletionMessage transform(@NotNull JsonObject messageObject, @NotNull TransformerContext context) { var builder = TransferCompletionMessage.Builder.newInstance(); - if (!transformMandatoryString(messageObject.get(DSPACE_PROPERTY_CONSUMER_PID), builder::consumerPid, context)) { + if (!transformMandatoryString(messageObject.get(DSPACE_PROPERTY_CONSUMER_PID_IRI), builder::consumerPid, context)) { context.problem() .missingProperty() .type(DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE_IRI) - .property(DSPACE_PROPERTY_CONSUMER_PID) + .property(DSPACE_PROPERTY_CONSUMER_PID_IRI) .report(); return null; } - if (!transformMandatoryString(messageObject.get(DSPACE_PROPERTY_PROVIDER_PID), builder::providerPid, context)) { + if (!transformMandatoryString(messageObject.get(DSPACE_PROPERTY_PROVIDER_PID_IRI), builder::providerPid, context)) { context.problem() .missingProperty() .type(DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE_IRI) - .property(DSPACE_PROPERTY_PROVIDER_PID) + .property(DSPACE_PROPERTY_PROVIDER_PID_IRI) .report(); return null; } diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferProcessAckTransformer.java b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferProcessAckTransformer.java index b6d40a9841a..a298db46703 100644 --- a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferProcessAckTransformer.java +++ b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferProcessAckTransformer.java @@ -21,9 +21,9 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_STATE; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_IRI; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID_IRI; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_STATE_IRI; /** * Create a {@link TransferProcessAck} from {@link JsonObject} @@ -37,11 +37,11 @@ public JsonObjectToTransferProcessAckTransformer() { @Override public @Nullable TransferProcessAck transform(@NotNull JsonObject jsonObject, @NotNull TransformerContext context) { var builder = TransferProcessAck.Builder.newInstance(); - transformMandatoryString(jsonObject.get(DSPACE_PROPERTY_CONSUMER_PID), builder::consumerPid, context); - transformMandatoryString(jsonObject.get(DSPACE_PROPERTY_PROVIDER_PID), builder::providerPid, context); + transformMandatoryString(jsonObject.get(DSPACE_PROPERTY_CONSUMER_PID_IRI), builder::consumerPid, context); + transformMandatoryString(jsonObject.get(DSPACE_PROPERTY_PROVIDER_PID_IRI), builder::providerPid, context); return builder - .state(transformString(jsonObject.get(DSPACE_PROPERTY_STATE), context)) + .state(transformString(jsonObject.get(DSPACE_PROPERTY_STATE_IRI), context)) .build(); } } diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferRequestMessageTransformer.java b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferRequestMessageTransformer.java index 8838819c6ce..42db4fd0ec1 100644 --- a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferRequestMessageTransformer.java +++ b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferRequestMessageTransformer.java @@ -24,7 +24,7 @@ import static org.eclipse.edc.jsonld.spi.PropertyAndTypeNames.DCT_FORMAT_ATTRIBUTE; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CALLBACK_ADDRESS_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_IRI; import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_PROPERTY_CONTRACT_AGREEMENT_ID; import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_PROPERTY_DATA_ADDRESS; import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE_IRI; @@ -39,11 +39,11 @@ public JsonObjectToTransferRequestMessageTransformer() { public @Nullable TransferRequestMessage transform(@NotNull JsonObject messageObject, @NotNull TransformerContext context) { var builder = TransferRequestMessage.Builder.newInstance(); - if (!transformMandatoryString(messageObject.get(DSPACE_PROPERTY_CONSUMER_PID), builder::consumerPid, context)) { + if (!transformMandatoryString(messageObject.get(DSPACE_PROPERTY_CONSUMER_PID_IRI), builder::consumerPid, context)) { context.problem() .missingProperty() .type(DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE_IRI) - .property(DSPACE_PROPERTY_CONSUMER_PID) + .property(DSPACE_PROPERTY_CONSUMER_PID_IRI) .report(); return null; } diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferStartMessageTransformer.java b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferStartMessageTransformer.java index dc4e6317990..60d76b65215 100644 --- a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferStartMessageTransformer.java +++ b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferStartMessageTransformer.java @@ -22,8 +22,8 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_IRI; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID_IRI; import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_PROPERTY_DATA_ADDRESS; import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_START_MESSAGE_IRI; @@ -37,20 +37,20 @@ public JsonObjectToTransferStartMessageTransformer() { public @Nullable TransferStartMessage transform(@NotNull JsonObject messageObject, @NotNull TransformerContext context) { var builder = TransferStartMessage.Builder.newInstance(); - if (!transformMandatoryString(messageObject.get(DSPACE_PROPERTY_CONSUMER_PID), builder::consumerPid, context)) { + if (!transformMandatoryString(messageObject.get(DSPACE_PROPERTY_CONSUMER_PID_IRI), builder::consumerPid, context)) { context.problem() .missingProperty() .type(DSPACE_TYPE_TRANSFER_START_MESSAGE_IRI) - .property(DSPACE_PROPERTY_CONSUMER_PID) + .property(DSPACE_PROPERTY_CONSUMER_PID_IRI) .report(); return null; } - if (!transformMandatoryString(messageObject.get(DSPACE_PROPERTY_PROVIDER_PID), builder::providerPid, context)) { + if (!transformMandatoryString(messageObject.get(DSPACE_PROPERTY_PROVIDER_PID_IRI), builder::providerPid, context)) { context.problem() .missingProperty() .type(DSPACE_TYPE_TRANSFER_START_MESSAGE_IRI) - .property(DSPACE_PROPERTY_PROVIDER_PID) + .property(DSPACE_PROPERTY_PROVIDER_PID_IRI) .report(); return null; } diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferSuspensionMessageTransformer.java b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferSuspensionMessageTransformer.java index 7a310593593..714706bbb23 100644 --- a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferSuspensionMessageTransformer.java +++ b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferSuspensionMessageTransformer.java @@ -30,8 +30,8 @@ import static jakarta.json.JsonValue.ValueType.ARRAY; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CODE_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_IRI; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID_IRI; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_REASON_IRI; import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_SUSPENSION_MESSAGE; import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE_IRI; @@ -49,20 +49,20 @@ public JsonObjectToTransferSuspensionMessageTransformer(ObjectMapper objectMappe public @Nullable TransferSuspensionMessage transform(@NotNull JsonObject messageObject, @NotNull TransformerContext context) { var builder = TransferSuspensionMessage.Builder.newInstance(); - if (!transformMandatoryString(messageObject.get(DSPACE_PROPERTY_CONSUMER_PID), builder::consumerPid, context)) { + if (!transformMandatoryString(messageObject.get(DSPACE_PROPERTY_CONSUMER_PID_IRI), builder::consumerPid, context)) { context.problem() .missingProperty() .type(DSPACE_TYPE_TRANSFER_SUSPENSION_MESSAGE) - .property(DSPACE_PROPERTY_CONSUMER_PID) + .property(DSPACE_PROPERTY_CONSUMER_PID_IRI) .report(); return null; } - if (!transformMandatoryString(messageObject.get(DSPACE_PROPERTY_PROVIDER_PID), builder::providerPid, context)) { + if (!transformMandatoryString(messageObject.get(DSPACE_PROPERTY_PROVIDER_PID_IRI), builder::providerPid, context)) { context.problem() .missingProperty() .type(DSPACE_TYPE_TRANSFER_SUSPENSION_MESSAGE) - .property(DSPACE_PROPERTY_PROVIDER_PID) + .property(DSPACE_PROPERTY_PROVIDER_PID_IRI) .report(); return null; } diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferTerminationMessageTransformer.java b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferTerminationMessageTransformer.java index b67ba35663e..f54170f1ad5 100644 --- a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferTerminationMessageTransformer.java +++ b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferTerminationMessageTransformer.java @@ -24,8 +24,8 @@ import static jakarta.json.JsonValue.ValueType.ARRAY; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CODE_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_IRI; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID_IRI; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_REASON_IRI; import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE_IRI; @@ -39,20 +39,20 @@ public JsonObjectToTransferTerminationMessageTransformer() { public @Nullable TransferTerminationMessage transform(@NotNull JsonObject messageObject, @NotNull TransformerContext context) { var builder = TransferTerminationMessage.Builder.newInstance(); - if (!transformMandatoryString(messageObject.get(DSPACE_PROPERTY_CONSUMER_PID), builder::consumerPid, context)) { + if (!transformMandatoryString(messageObject.get(DSPACE_PROPERTY_CONSUMER_PID_IRI), builder::consumerPid, context)) { context.problem() .missingProperty() .type(DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE_IRI) - .property(DSPACE_PROPERTY_CONSUMER_PID) + .property(DSPACE_PROPERTY_CONSUMER_PID_IRI) .report(); return null; } - if (!transformMandatoryString(messageObject.get(DSPACE_PROPERTY_PROVIDER_PID), builder::providerPid, context)) { + if (!transformMandatoryString(messageObject.get(DSPACE_PROPERTY_PROVIDER_PID_IRI), builder::providerPid, context)) { context.problem() .missingProperty() .type(DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE_IRI) - .property(DSPACE_PROPERTY_PROVIDER_PID) + .property(DSPACE_PROPERTY_PROVIDER_PID_IRI) .report(); return null; } diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/from/JsonObjectFromTransferCompletionMessageTransformerTest.java b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/from/JsonObjectFromTransferCompletionMessageTransformerTest.java index 9e6b478e40c..efea5e53b5b 100644 --- a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/from/JsonObjectFromTransferCompletionMessageTransformerTest.java +++ b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/from/JsonObjectFromTransferCompletionMessageTransformerTest.java @@ -25,8 +25,8 @@ import java.util.Map; import static org.assertj.core.api.Assertions.assertThat; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_IRI; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID_IRI; import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE_IRI; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.mock; @@ -55,8 +55,8 @@ void transformTransferCompletionMessage() { assertThat(result).isNotNull(); assertThat(result.getString(JsonLdKeywords.TYPE)).isEqualTo(DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE_IRI); - assertThat(result.getString(DSPACE_PROPERTY_CONSUMER_PID)).isEqualTo("consumerPid"); - assertThat(result.getString(DSPACE_PROPERTY_PROVIDER_PID)).isEqualTo("providerPid"); + assertThat(result.getString(DSPACE_PROPERTY_CONSUMER_PID_IRI)).isEqualTo("consumerPid"); + assertThat(result.getString(DSPACE_PROPERTY_PROVIDER_PID_IRI)).isEqualTo("providerPid"); verify(context, never()).reportProblem(anyString()); } diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/from/JsonObjectFromTransferProcessTransformerTest.java b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/from/JsonObjectFromTransferProcessTransformerTest.java index 835a9611ca3..4d68ce10c25 100644 --- a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/from/JsonObjectFromTransferProcessTransformerTest.java +++ b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/from/JsonObjectFromTransferProcessTransformerTest.java @@ -28,9 +28,9 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.ID; import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.TYPE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_STATE; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_IRI; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID_IRI; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_STATE_IRI; import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_PROCESS; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.mock; @@ -67,9 +67,9 @@ void transformTransferProcessProvider() { assertThat(result).isNotNull(); assertThat(result.getJsonString(TYPE).getString()).isEqualTo(DSPACE_TYPE_TRANSFER_PROCESS); assertThat(result.getJsonString(ID).getString()).isEqualTo("providerPid"); - assertThat(result.getJsonString(DSPACE_PROPERTY_STATE).getString()).isEqualTo("INITIAL"); - assertThat(result.getJsonString(DSPACE_PROPERTY_CONSUMER_PID).getString()).isEqualTo("consumerPid"); - assertThat(result.getJsonString(DSPACE_PROPERTY_PROVIDER_PID).getString()).isEqualTo("providerPid"); + assertThat(result.getJsonString(DSPACE_PROPERTY_STATE_IRI).getString()).isEqualTo("INITIAL"); + assertThat(result.getJsonString(DSPACE_PROPERTY_CONSUMER_PID_IRI).getString()).isEqualTo("consumerPid"); + assertThat(result.getJsonString(DSPACE_PROPERTY_PROVIDER_PID_IRI).getString()).isEqualTo("providerPid"); verify(context, never()).reportProblem(anyString()); } @@ -95,9 +95,9 @@ void transformTransferProcessConsumer() { assertThat(result).isNotNull(); assertThat(result.getJsonString(TYPE).getString()).isEqualTo(DSPACE_TYPE_TRANSFER_PROCESS); assertThat(result.getJsonString(ID).getString()).isEqualTo("consumerPid"); - assertThat(result.getJsonString(DSPACE_PROPERTY_STATE).getString()).isEqualTo("INITIAL"); - assertThat(result.getJsonString(DSPACE_PROPERTY_CONSUMER_PID).getString()).isEqualTo("consumerPid"); - assertThat(result.getJsonString(DSPACE_PROPERTY_PROVIDER_PID).getString()).isEqualTo("providerPid"); + assertThat(result.getJsonString(DSPACE_PROPERTY_STATE_IRI).getString()).isEqualTo("INITIAL"); + assertThat(result.getJsonString(DSPACE_PROPERTY_CONSUMER_PID_IRI).getString()).isEqualTo("consumerPid"); + assertThat(result.getJsonString(DSPACE_PROPERTY_PROVIDER_PID_IRI).getString()).isEqualTo("providerPid"); verify(context, never()).reportProblem(anyString()); } diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/from/JsonObjectFromTransferRequestMessageTransformerTest.java b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/from/JsonObjectFromTransferRequestMessageTransformerTest.java index 54eb8335f3f..942f7482573 100644 --- a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/from/JsonObjectFromTransferRequestMessageTransformerTest.java +++ b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/from/JsonObjectFromTransferRequestMessageTransformerTest.java @@ -30,7 +30,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.eclipse.edc.jsonld.spi.PropertyAndTypeNames.DCT_FORMAT_ATTRIBUTE; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CALLBACK_ADDRESS_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_IRI; import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_PROPERTY_CONTRACT_AGREEMENT_ID; import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_PROPERTY_DATA_ADDRESS; import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE_IRI; @@ -85,7 +85,7 @@ void transformTransferRequestMessageWithDataAddress() { assertThat(result.getJsonString(DSPACE_PROPERTY_CONTRACT_AGREEMENT_ID).getString()).isEqualTo(contractId); assertThat(result.getJsonString(DCT_FORMAT_ATTRIBUTE).getString()).isEqualTo(dataAddressType); assertThat(result.getJsonString(DSPACE_PROPERTY_CALLBACK_ADDRESS_IRI).getString()).isEqualTo(callbackAddress); - assertThat(result.getJsonString(DSPACE_PROPERTY_CONSUMER_PID).getString()).isEqualTo("consumerPid"); + assertThat(result.getJsonString(DSPACE_PROPERTY_CONSUMER_PID_IRI).getString()).isEqualTo("consumerPid"); assertThat(result.getJsonObject(DSPACE_PROPERTY_DATA_ADDRESS).getString("keyName")).isEqualTo(dataAddressKey); verify(context, never()).reportProblem(anyString()); diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/from/JsonObjectFromTransferStartMessageTransformerTest.java b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/from/JsonObjectFromTransferStartMessageTransformerTest.java index 2992b3b822b..e69000c80f8 100644 --- a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/from/JsonObjectFromTransferStartMessageTransformerTest.java +++ b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/from/JsonObjectFromTransferStartMessageTransformerTest.java @@ -27,8 +27,8 @@ import java.util.Map; import static org.assertj.core.api.Assertions.assertThat; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_IRI; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID_IRI; import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_PROPERTY_DATA_ADDRESS; import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_START_MESSAGE_IRI; import static org.mockito.ArgumentMatchers.anyString; @@ -63,8 +63,8 @@ void transformTransferStartMessage() { assertThat(result).isNotNull(); assertThat(result.getString(JsonLdKeywords.TYPE)).isEqualTo(DSPACE_TYPE_TRANSFER_START_MESSAGE_IRI); - assertThat(result.getString(DSPACE_PROPERTY_PROVIDER_PID)).isEqualTo("providerPid"); - assertThat(result.getString(DSPACE_PROPERTY_CONSUMER_PID)).isEqualTo("consumerPid"); + assertThat(result.getString(DSPACE_PROPERTY_PROVIDER_PID_IRI)).isEqualTo("providerPid"); + assertThat(result.getString(DSPACE_PROPERTY_CONSUMER_PID_IRI)).isEqualTo("consumerPid"); assertThat(result.getJsonObject(DSPACE_PROPERTY_DATA_ADDRESS)).isEqualTo(dataAddressJson); verify(context, times(1)).transform(dataAddress, JsonObject.class); diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/from/JsonObjectFromTransferSuspensionMessageTransformerTest.java b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/from/JsonObjectFromTransferSuspensionMessageTransformerTest.java index dde1ce9bb98..5dc4ef6150d 100644 --- a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/from/JsonObjectFromTransferSuspensionMessageTransformerTest.java +++ b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/from/JsonObjectFromTransferSuspensionMessageTransformerTest.java @@ -27,8 +27,8 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.TYPE; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CODE_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_IRI; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID_IRI; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_REASON_IRI; import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_SUSPENSION_MESSAGE; import static org.mockito.ArgumentMatchers.anyString; @@ -59,8 +59,8 @@ void transformTransferSuspensionMessage() { assertThat(result).isNotNull(); assertThat(result.getJsonString(TYPE).getString()).isEqualTo(DSPACE_TYPE_TRANSFER_SUSPENSION_MESSAGE); - assertThat(result.getJsonString(DSPACE_PROPERTY_CONSUMER_PID).getString()).isEqualTo("consumerPid"); - assertThat(result.getJsonString(DSPACE_PROPERTY_PROVIDER_PID).getString()).isEqualTo("providerPid"); + assertThat(result.getJsonString(DSPACE_PROPERTY_CONSUMER_PID_IRI).getString()).isEqualTo("consumerPid"); + assertThat(result.getJsonString(DSPACE_PROPERTY_PROVIDER_PID_IRI).getString()).isEqualTo("providerPid"); assertThat(result.getJsonString(DSPACE_PROPERTY_CODE_IRI).getString()).isEqualTo("testCode"); assertThat(result.getJsonArray(DSPACE_PROPERTY_REASON_IRI)).hasSize(1).first() .isInstanceOfSatisfying(JsonString.class, reason -> assertThat(reason.getString()).isEqualTo("testReason")); diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/from/JsonObjectFromTransferTerminationMessageTransformerTest.java b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/from/JsonObjectFromTransferTerminationMessageTransformerTest.java index 2ba6be8578c..810f6bc8ec3 100644 --- a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/from/JsonObjectFromTransferTerminationMessageTransformerTest.java +++ b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/from/JsonObjectFromTransferTerminationMessageTransformerTest.java @@ -26,8 +26,8 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CODE_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_IRI; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID_IRI; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_REASON_IRI; import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE_IRI; import static org.mockito.ArgumentMatchers.anyString; @@ -58,8 +58,8 @@ void transformTransferTerminationMessage() { assertThat(result).isNotNull(); assertThat(result.getJsonString(JsonLdKeywords.TYPE).getString()).isEqualTo(DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE_IRI); - assertThat(result.getJsonString(DSPACE_PROPERTY_CONSUMER_PID).getString()).isEqualTo("consumerPid"); - assertThat(result.getJsonString(DSPACE_PROPERTY_PROVIDER_PID).getString()).isEqualTo("providerPid"); + assertThat(result.getJsonString(DSPACE_PROPERTY_CONSUMER_PID_IRI).getString()).isEqualTo("consumerPid"); + assertThat(result.getJsonString(DSPACE_PROPERTY_PROVIDER_PID_IRI).getString()).isEqualTo("providerPid"); assertThat(result.getJsonString(DSPACE_PROPERTY_CODE_IRI).getString()).isEqualTo("testCode"); assertThat(result.getJsonString(DSPACE_PROPERTY_REASON_IRI).getString()).isEqualTo("testReason"); diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferCompletionMessageTransformerTest.java b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferCompletionMessageTransformerTest.java index ad0cd99cc0d..b7f57bb741d 100644 --- a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferCompletionMessageTransformerTest.java +++ b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferCompletionMessageTransformerTest.java @@ -22,8 +22,8 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.TYPE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_IRI; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID_IRI; import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE_IRI; import static org.eclipse.edc.protocol.dsp.transferprocess.transform.to.TestInput.getExpanded; import static org.mockito.ArgumentMatchers.anyString; @@ -43,8 +43,8 @@ class JsonObjectToTransferCompletionMessageTransformerTest { void shouldTransform() { var json = Json.createObjectBuilder() .add(TYPE, DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE_IRI) - .add(DSPACE_PROPERTY_PROVIDER_PID, "providerPid") - .add(DSPACE_PROPERTY_CONSUMER_PID, "consumerPid") + .add(DSPACE_PROPERTY_PROVIDER_PID_IRI, "providerPid") + .add(DSPACE_PROPERTY_CONSUMER_PID_IRI, "consumerPid") .build(); var result = transformer.transform(getExpanded(json), context); diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferProcessAckTransformerTest.java b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferProcessAckTransformerTest.java index f2707156ad5..385dbd5296d 100644 --- a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferProcessAckTransformerTest.java +++ b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferProcessAckTransformerTest.java @@ -24,9 +24,9 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.TYPE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_STATE; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_IRI; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID_IRI; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_STATE_IRI; import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_PROCESS; import static org.eclipse.edc.protocol.dsp.transferprocess.transform.to.TestInput.getExpanded; import static org.mockito.Mockito.mock; @@ -42,9 +42,9 @@ class JsonObjectToTransferProcessAckTransformerTest { void shouldTransform() { var message = jsonFactory.createObjectBuilder() .add(TYPE, DSPACE_TYPE_TRANSFER_PROCESS) - .add(DSPACE_PROPERTY_CONSUMER_PID, "consumerPid") - .add(DSPACE_PROPERTY_PROVIDER_PID, "providerPid") - .add(DSPACE_PROPERTY_STATE, "STATE") + .add(DSPACE_PROPERTY_CONSUMER_PID_IRI, "consumerPid") + .add(DSPACE_PROPERTY_PROVIDER_PID_IRI, "providerPid") + .add(DSPACE_PROPERTY_STATE_IRI, "STATE") .build(); var result = transformer.transform(getExpanded(message), context); diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferRequestMessageTransformerTest.java b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferRequestMessageTransformerTest.java index e101dc6500b..365c894a817 100644 --- a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferRequestMessageTransformerTest.java +++ b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferRequestMessageTransformerTest.java @@ -26,7 +26,7 @@ import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.TYPE; import static org.eclipse.edc.jsonld.spi.PropertyAndTypeNames.DCT_FORMAT_ATTRIBUTE; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CALLBACK_ADDRESS_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_IRI; import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_PROPERTY_CONTRACT_AGREEMENT_ID; import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_PROPERTY_DATA_ADDRESS; import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE_IRI; @@ -58,7 +58,7 @@ void jsonObjectToTransferRequestWithoutDataAddress() { .add(DSPACE_PROPERTY_CONTRACT_AGREEMENT_ID, contractId) .add(DCT_FORMAT_ATTRIBUTE, destinationType) .add(DSPACE_PROPERTY_CALLBACK_ADDRESS_IRI, callbackAddress) - .add(DSPACE_PROPERTY_CONSUMER_PID, "processId") + .add(DSPACE_PROPERTY_CONSUMER_PID_IRI, "processId") .build(); var result = transformer.transform(getExpanded(json), context); @@ -83,7 +83,7 @@ void jsonObjectToTransferRequestWithDataAddress() { .add(DCT_FORMAT_ATTRIBUTE, destinationType) .add(DSPACE_PROPERTY_DATA_ADDRESS, createDataAddress()) .add(DSPACE_PROPERTY_CALLBACK_ADDRESS_IRI, callbackAddress) - .add(DSPACE_PROPERTY_CONSUMER_PID, "processId") + .add(DSPACE_PROPERTY_CONSUMER_PID_IRI, "processId") .build(); var result = transformer.transform(getExpanded(json), context); diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferStartMessageTransformerTest.java b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferStartMessageTransformerTest.java index 80a6dd3bdaf..44d72161283 100644 --- a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferStartMessageTransformerTest.java +++ b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferStartMessageTransformerTest.java @@ -24,8 +24,8 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.TYPE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_IRI; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID_IRI; import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_PROPERTY_DATA_ADDRESS; import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_START_MESSAGE_IRI; import static org.eclipse.edc.protocol.dsp.transferprocess.transform.to.TestInput.getExpanded; @@ -49,8 +49,8 @@ class JsonObjectToTransferStartMessageTransformerTest { void jsonObjectToTransferStartMessage() { var json = Json.createObjectBuilder() .add(TYPE, DSPACE_TYPE_TRANSFER_START_MESSAGE_IRI) - .add(DSPACE_PROPERTY_CONSUMER_PID, "consumerPid") - .add(DSPACE_PROPERTY_PROVIDER_PID, "providerPid") + .add(DSPACE_PROPERTY_CONSUMER_PID_IRI, "consumerPid") + .add(DSPACE_PROPERTY_PROVIDER_PID_IRI, "providerPid") .build(); var result = transformer.transform(getExpanded(json), context); @@ -80,8 +80,8 @@ void jsonObjectToTransferStartMessageWithDataAddress() { var dataAddressObject = Json.createObjectBuilder().add(EDC_NAMESPACE + "type", "AWS").build(); var json = Json.createObjectBuilder() .add(TYPE, DSPACE_TYPE_TRANSFER_START_MESSAGE_IRI) - .add(DSPACE_PROPERTY_CONSUMER_PID, "consumerPid") - .add(DSPACE_PROPERTY_PROVIDER_PID, "providerPid") + .add(DSPACE_PROPERTY_CONSUMER_PID_IRI, "consumerPid") + .add(DSPACE_PROPERTY_PROVIDER_PID_IRI, "providerPid") .add(DSPACE_PROPERTY_DATA_ADDRESS, dataAddressObject) .build(); @@ -101,8 +101,8 @@ void jsonObjectToTransferStartMessageWithDataAddress() { void jsonObjectToTransferStartMessageWithEmptyDataAddress() { var json = Json.createObjectBuilder() .add(TYPE, DSPACE_TYPE_TRANSFER_START_MESSAGE_IRI) - .add(DSPACE_PROPERTY_CONSUMER_PID, "consumerPid") - .add(DSPACE_PROPERTY_PROVIDER_PID, "providerPid") + .add(DSPACE_PROPERTY_CONSUMER_PID_IRI, "consumerPid") + .add(DSPACE_PROPERTY_PROVIDER_PID_IRI, "providerPid") .add(DSPACE_PROPERTY_DATA_ADDRESS, Json.createObjectBuilder().build()) .build(); diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferSuspensionMessageTransformerTest.java b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferSuspensionMessageTransformerTest.java index 0a852e90765..c89dc4e6cd0 100644 --- a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferSuspensionMessageTransformerTest.java +++ b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferSuspensionMessageTransformerTest.java @@ -33,8 +33,8 @@ import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.VOCAB; import static org.eclipse.edc.jsonld.spi.Namespaces.DSPACE_SCHEMA; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CODE_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_IRI; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID_IRI; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_REASON_IRI; import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_SUSPENSION_MESSAGE; import static org.eclipse.edc.protocol.dsp.transferprocess.transform.to.TestInput.getExpanded; @@ -56,8 +56,8 @@ void shouldTransform() { var json = createObjectBuilder() .add(CONTEXT, createObjectBuilder().add(VOCAB, DSPACE_SCHEMA)) .add(TYPE, DSPACE_TYPE_TRANSFER_SUSPENSION_MESSAGE) - .add(DSPACE_PROPERTY_CONSUMER_PID, "consumerPid") - .add(DSPACE_PROPERTY_PROVIDER_PID, "providerPid") + .add(DSPACE_PROPERTY_CONSUMER_PID_IRI, "consumerPid") + .add(DSPACE_PROPERTY_PROVIDER_PID_IRI, "providerPid") .add(DSPACE_PROPERTY_CODE_IRI, "testCode") .add(DSPACE_PROPERTY_REASON_IRI, Json.createArrayBuilder() .add(createObjectBuilder().add("complex", "reason")) diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferTerminationMessageTransformerTest.java b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferTerminationMessageTransformerTest.java index 8e75d37906d..f1c35b09dc6 100644 --- a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferTerminationMessageTransformerTest.java +++ b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferTerminationMessageTransformerTest.java @@ -27,8 +27,8 @@ import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.TYPE; import static org.eclipse.edc.jsonld.spi.Namespaces.DSPACE_SCHEMA; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CODE_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_IRI; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID_IRI; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_REASON_IRI; import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE_IRI; import static org.mockito.ArgumentMatchers.anyString; @@ -50,8 +50,8 @@ void shouldTransform() { var json = Json.createObjectBuilder() .add(TYPE, DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE_IRI) - .add(DSPACE_PROPERTY_CONSUMER_PID, "consumerPid") - .add(DSPACE_PROPERTY_PROVIDER_PID, "providerPid") + .add(DSPACE_PROPERTY_CONSUMER_PID_IRI, "consumerPid") + .add(DSPACE_PROPERTY_PROVIDER_PID_IRI, "providerPid") .add(DSPACE_PROPERTY_CODE_IRI, "testCode") .add(DSPACE_PROPERTY_REASON_IRI, Json.createBuilderFactory(Map.of()).createArrayBuilder().add(reasonArray).build()) .build(); diff --git a/settings.gradle.kts b/settings.gradle.kts index 711eb86b5e7..a7f82d1c2c8 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -92,6 +92,7 @@ include(":data-protocols:dsp:dsp-negotiation:dsp-negotiation-http-api") include(":data-protocols:dsp:dsp-negotiation:dsp-negotiation-http-dispatcher") include(":data-protocols:dsp:dsp-negotiation:dsp-negotiation-transform") include(":data-protocols:dsp:dsp-negotiation:lib:dsp-negotiation-validation-lib") +include(":data-protocols:dsp:dsp-negotiation:lib:dsp-negotiation-transform-lib") include(":data-protocols:dsp:dsp-http-core") include(":data-protocols:dsp:dsp-http-spi") include(":data-protocols:dsp:dsp-transfer-process")