diff --git a/data-protocols/dsp/dsp-catalog/build.gradle.kts b/data-protocols/dsp/dsp-catalog/build.gradle.kts index 0b4f9725477..bbac359bc3a 100644 --- a/data-protocols/dsp/dsp-catalog/build.gradle.kts +++ b/data-protocols/dsp/dsp-catalog/build.gradle.kts @@ -21,4 +21,5 @@ dependencies { api(project(":data-protocols:dsp:dsp-catalog:dsp-catalog-http-api")) api(project(":data-protocols:dsp:dsp-catalog:dsp-catalog-http-dispatcher")) api(project(":data-protocols:dsp:dsp-catalog:dsp-catalog-transform")) + api(project(":data-protocols:dsp:dsp-catalog:lib:dsp-catalog-validation-lib")) } diff --git a/data-protocols/dsp/dsp-catalog/dsp-catalog-http-api/build.gradle.kts b/data-protocols/dsp/dsp-catalog/dsp-catalog-http-api/build.gradle.kts index 70f6d4d21d9..ea483883ac8 100644 --- a/data-protocols/dsp/dsp-catalog/dsp-catalog-http-api/build.gradle.kts +++ b/data-protocols/dsp/dsp-catalog/dsp-catalog-http-api/build.gradle.kts @@ -22,9 +22,11 @@ dependencies { api(project(":data-protocols:dsp:dsp-http-spi")) api(project(":spi:common:core-spi")) api(project(":spi:common:web-spi")) + api(project(":spi:common:json-ld-spi")) + api(project(":spi:control-plane:control-plane-spi")) - implementation(project(":core:common:lib:validator-lib")) + implementation(project(":data-protocols:dsp:dsp-catalog:lib:dsp-catalog-validation-lib")) implementation(libs.jakarta.rsApi) diff --git a/data-protocols/dsp/dsp-catalog/dsp-catalog-http-api/src/main/java/org/eclipse/edc/protocol/dsp/catalog/http/api/DspCatalogApiExtension.java b/data-protocols/dsp/dsp-catalog/dsp-catalog-http-api/src/main/java/org/eclipse/edc/protocol/dsp/catalog/http/api/DspCatalogApiExtension.java index ff9c26e4e17..e2064e63e08 100644 --- a/data-protocols/dsp/dsp-catalog/dsp-catalog-http-api/src/main/java/org/eclipse/edc/protocol/dsp/catalog/http/api/DspCatalogApiExtension.java +++ b/data-protocols/dsp/dsp-catalog/dsp-catalog-http-api/src/main/java/org/eclipse/edc/protocol/dsp/catalog/http/api/DspCatalogApiExtension.java @@ -23,7 +23,7 @@ import org.eclipse.edc.protocol.dsp.catalog.http.api.controller.DspCatalogApiController20241; import org.eclipse.edc.protocol.dsp.catalog.http.api.decorator.Base64continuationTokenSerDes; import org.eclipse.edc.protocol.dsp.catalog.http.api.decorator.ContinuationTokenManagerImpl; -import org.eclipse.edc.protocol.dsp.catalog.http.api.validation.CatalogRequestMessageValidator; +import org.eclipse.edc.protocol.dsp.catalog.validation.CatalogRequestMessageValidator; import org.eclipse.edc.protocol.dsp.http.spi.message.ContinuationTokenManager; import org.eclipse.edc.protocol.dsp.http.spi.message.DspRequestHandler; import org.eclipse.edc.runtime.metamodel.annotation.Extension; @@ -38,7 +38,7 @@ import org.eclipse.edc.web.spi.WebService; import org.eclipse.edc.web.spi.configuration.ApiContext; -import static org.eclipse.edc.protocol.dsp.spi.type.DspCatalogPropertyAndTypeNames.DSPACE_TYPE_CATALOG_REQUEST_MESSAGE; +import static org.eclipse.edc.protocol.dsp.spi.type.DspCatalogPropertyAndTypeNames.DSPACE_TYPE_CATALOG_REQUEST_MESSAGE_IRI; import static org.eclipse.edc.protocol.dsp.spi.type.DspConstants.DSP_TRANSFORMER_CONTEXT_V_08; import static org.eclipse.edc.protocol.dsp.spi.type.DspConstants.DSP_TRANSFORMER_CONTEXT_V_2024_1; import static org.eclipse.edc.protocol.dsp.spi.version.DspVersions.V_08; @@ -83,7 +83,7 @@ public String name() { @Override public void initialize(ServiceExtensionContext context) { - validatorRegistry.register(DSPACE_TYPE_CATALOG_REQUEST_MESSAGE, CatalogRequestMessageValidator.instance(criterionOperatorRegistry)); + validatorRegistry.register(DSPACE_TYPE_CATALOG_REQUEST_MESSAGE_IRI, CatalogRequestMessageValidator.instance(criterionOperatorRegistry)); webService.registerResource(ApiContext.PROTOCOL, new DspCatalogApiController(service, dspRequestHandler, continuationTokenManager(monitor, DSP_TRANSFORMER_CONTEXT_V_08))); diff --git a/data-protocols/dsp/dsp-catalog/dsp-catalog-http-api/src/main/java/org/eclipse/edc/protocol/dsp/catalog/http/api/controller/DspCatalogApiController.java b/data-protocols/dsp/dsp-catalog/dsp-catalog-http-api/src/main/java/org/eclipse/edc/protocol/dsp/catalog/http/api/controller/DspCatalogApiController.java index ed54c8e4667..37c715a3747 100644 --- a/data-protocols/dsp/dsp-catalog/dsp-catalog-http-api/src/main/java/org/eclipse/edc/protocol/dsp/catalog/http/api/controller/DspCatalogApiController.java +++ b/data-protocols/dsp/dsp-catalog/dsp-catalog-http-api/src/main/java/org/eclipse/edc/protocol/dsp/catalog/http/api/controller/DspCatalogApiController.java @@ -43,7 +43,7 @@ import static org.eclipse.edc.protocol.dsp.catalog.http.api.CatalogApiPaths.CATALOG_REQUEST; import static org.eclipse.edc.protocol.dsp.catalog.http.api.CatalogApiPaths.DATASET_REQUEST; import static org.eclipse.edc.protocol.dsp.http.spi.types.HttpMessageProtocol.DATASPACE_PROTOCOL_HTTP; -import static org.eclipse.edc.protocol.dsp.spi.type.DspCatalogPropertyAndTypeNames.DSPACE_TYPE_CATALOG_REQUEST_MESSAGE; +import static org.eclipse.edc.protocol.dsp.spi.type.DspCatalogPropertyAndTypeNames.DSPACE_TYPE_CATALOG_REQUEST_MESSAGE_IRI; /** * Provides the HTTP endpoint for receiving catalog requests. @@ -83,7 +83,7 @@ public Response requestCatalog(JsonObject jsonObject, @HeaderParam(AUTHORIZATION var request = PostDspRequest.Builder.newInstance(CatalogRequestMessage.class, Catalog.class, CatalogError.class) .token(token) - .expectedMessageType(DSPACE_TYPE_CATALOG_REQUEST_MESSAGE) + .expectedMessageType(DSPACE_TYPE_CATALOG_REQUEST_MESSAGE_IRI) .message(messageJson) .serviceCall(service::getCatalog) .errorProvider(CatalogError.Builder::newInstance) diff --git a/data-protocols/dsp/dsp-catalog/dsp-catalog-http-api/src/main/java/org/eclipse/edc/protocol/dsp/catalog/http/api/decorator/ContinuationTokenManagerImpl.java b/data-protocols/dsp/dsp-catalog/dsp-catalog-http-api/src/main/java/org/eclipse/edc/protocol/dsp/catalog/http/api/decorator/ContinuationTokenManagerImpl.java index 42884425aea..b7c6cd56bc9 100644 --- a/data-protocols/dsp/dsp-catalog/dsp-catalog-http-api/src/main/java/org/eclipse/edc/protocol/dsp/catalog/http/api/decorator/ContinuationTokenManagerImpl.java +++ b/data-protocols/dsp/dsp-catalog/dsp-catalog-http-api/src/main/java/org/eclipse/edc/protocol/dsp/catalog/http/api/decorator/ContinuationTokenManagerImpl.java @@ -24,7 +24,7 @@ import org.eclipse.edc.spi.monitor.Monitor; import org.eclipse.edc.spi.result.Result; -import static org.eclipse.edc.protocol.dsp.spi.type.DspCatalogPropertyAndTypeNames.DSPACE_PROPERTY_FILTER; +import static org.eclipse.edc.protocol.dsp.spi.type.DspCatalogPropertyAndTypeNames.DSPACE_PROPERTY_FILTER_IRI; public class ContinuationTokenManagerImpl implements ContinuationTokenManager { @@ -36,16 +36,16 @@ public ContinuationTokenManagerImpl(Base64continuationTokenSerDes continuationTo this.monitor = monitor; } - @Override - public ResponseDecorator createResponseDecorator(String requestUrl) { - return new CatalogPaginationResponseDecorator(requestUrl, continuationTokenSerDes, monitor); - } - @Override public Result applyQueryFromToken(JsonObject requestMessage, String continuationToken) { return continuationTokenSerDes.deserialize(continuationToken) .map(query -> Json.createArrayBuilder().add(query)) - .map(filter -> Json.createObjectBuilder(requestMessage).add(DSPACE_PROPERTY_FILTER, filter)) + .map(filter -> Json.createObjectBuilder(requestMessage).add(DSPACE_PROPERTY_FILTER_IRI, filter)) .map(JsonObjectBuilder::build); } + + @Override + public ResponseDecorator createResponseDecorator(String requestUrl) { + return new CatalogPaginationResponseDecorator(requestUrl, continuationTokenSerDes, monitor); + } } diff --git a/data-protocols/dsp/dsp-catalog/dsp-catalog-http-api/src/test/java/org/eclipse/edc/protocol/dsp/catalog/http/api/DspCatalogApiExtensionTest.java b/data-protocols/dsp/dsp-catalog/dsp-catalog-http-api/src/test/java/org/eclipse/edc/protocol/dsp/catalog/http/api/DspCatalogApiExtensionTest.java index 46ffdb18487..9fffef8b456 100644 --- a/data-protocols/dsp/dsp-catalog/dsp-catalog-http-api/src/test/java/org/eclipse/edc/protocol/dsp/catalog/http/api/DspCatalogApiExtensionTest.java +++ b/data-protocols/dsp/dsp-catalog/dsp-catalog-http-api/src/test/java/org/eclipse/edc/protocol/dsp/catalog/http/api/DspCatalogApiExtensionTest.java @@ -24,7 +24,7 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; -import static org.eclipse.edc.protocol.dsp.spi.type.DspCatalogPropertyAndTypeNames.DSPACE_TYPE_CATALOG_REQUEST_MESSAGE; +import static org.eclipse.edc.protocol.dsp.spi.type.DspCatalogPropertyAndTypeNames.DSPACE_TYPE_CATALOG_REQUEST_MESSAGE_IRI; import static org.eclipse.edc.protocol.dsp.spi.version.DspVersions.V_08; import static org.eclipse.edc.protocol.dsp.spi.version.DspVersions.V_2024_1; import static org.mockito.ArgumentMatchers.any; @@ -53,7 +53,7 @@ void setUp(ServiceExtensionContext context) { void shouldRegisterMessageValidator(DspCatalogApiExtension extension, ServiceExtensionContext context) { extension.initialize(context); - verify(validatorRegistry).register(eq(DSPACE_TYPE_CATALOG_REQUEST_MESSAGE), any()); + verify(validatorRegistry).register(eq(DSPACE_TYPE_CATALOG_REQUEST_MESSAGE_IRI), any()); } @Test diff --git a/data-protocols/dsp/dsp-catalog/dsp-catalog-http-api/src/test/java/org/eclipse/edc/protocol/dsp/catalog/http/api/controller/DspCatalogApiControllerTest.java b/data-protocols/dsp/dsp-catalog/dsp-catalog-http-api/src/test/java/org/eclipse/edc/protocol/dsp/catalog/http/api/controller/DspCatalogApiControllerTest.java index c09aac00365..47d2d8a532d 100644 --- a/data-protocols/dsp/dsp-catalog/dsp-catalog-http-api/src/test/java/org/eclipse/edc/protocol/dsp/catalog/http/api/controller/DspCatalogApiControllerTest.java +++ b/data-protocols/dsp/dsp-catalog/dsp-catalog-http-api/src/test/java/org/eclipse/edc/protocol/dsp/catalog/http/api/controller/DspCatalogApiControllerTest.java @@ -47,7 +47,7 @@ import static org.eclipse.edc.protocol.dsp.catalog.http.api.CatalogApiPaths.BASE_PATH; import static org.eclipse.edc.protocol.dsp.catalog.http.api.CatalogApiPaths.CATALOG_REQUEST; import static org.eclipse.edc.protocol.dsp.catalog.http.api.CatalogApiPaths.DATASET_REQUEST; -import static org.eclipse.edc.protocol.dsp.spi.type.DspCatalogPropertyAndTypeNames.DSPACE_TYPE_CATALOG_REQUEST_MESSAGE; +import static org.eclipse.edc.protocol.dsp.spi.type.DspCatalogPropertyAndTypeNames.DSPACE_TYPE_CATALOG_REQUEST_MESSAGE_IRI; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.ArgumentMatchers.isA; @@ -100,7 +100,7 @@ class RequestCatalog { @Test void shouldCreateResource() { - var requestBody = createObjectBuilder().add(TYPE, DSPACE_TYPE_CATALOG_REQUEST_MESSAGE).build(); + var requestBody = createObjectBuilder().add(TYPE, DSPACE_TYPE_CATALOG_REQUEST_MESSAGE_IRI).build(); var catalog = createObjectBuilder().add(JsonLdKeywords.TYPE, "catalog").build(); when(transformerRegistry.transform(any(Catalog.class), eq(JsonObject.class))).thenReturn(Result.success(catalog)); when(dspRequestHandler.createResource(any(), any())).thenReturn(Response.ok().type(APPLICATION_JSON_TYPE).build()); @@ -119,7 +119,7 @@ void shouldCreateResource() { var request = captor.getValue(); assertThat(request.getInputClass()).isEqualTo(CatalogRequestMessage.class); assertThat(request.getResultClass()).isEqualTo(Catalog.class); - assertThat(request.getExpectedMessageType()).isEqualTo(DSPACE_TYPE_CATALOG_REQUEST_MESSAGE); + assertThat(request.getExpectedMessageType()).isEqualTo(DSPACE_TYPE_CATALOG_REQUEST_MESSAGE_IRI); assertThat(request.getProcessId()).isNull(); assertThat(request.getToken()).isEqualTo("auth"); assertThat(request.getMessage()).isEqualTo(requestBody); @@ -128,7 +128,7 @@ void shouldCreateResource() { @Test void shouldApplyContinuationToken_whenPassed() { - var requestBody = createObjectBuilder().add(TYPE, DSPACE_TYPE_CATALOG_REQUEST_MESSAGE).build(); + var requestBody = createObjectBuilder().add(TYPE, DSPACE_TYPE_CATALOG_REQUEST_MESSAGE_IRI).build(); var catalog = createObjectBuilder().add(JsonLdKeywords.TYPE, "catalog").build(); when(transformerRegistry.transform(any(Catalog.class), eq(JsonObject.class))).thenReturn(Result.success(catalog)); when(dspRequestHandler.createResource(any(), any())).thenReturn(Response.ok().type(APPLICATION_JSON_TYPE).build()); @@ -153,7 +153,7 @@ void shouldApplyContinuationToken_whenPassed() { @Test void shouldReturnBadRequest_whenContinuationTokenIsNotValid() { - var requestBody = createObjectBuilder().add(TYPE, DSPACE_TYPE_CATALOG_REQUEST_MESSAGE).build(); + var requestBody = createObjectBuilder().add(TYPE, DSPACE_TYPE_CATALOG_REQUEST_MESSAGE_IRI).build(); when(continuationTokenManager.applyQueryFromToken(any(), any())).thenReturn(Result.failure("error")); baseRequest() diff --git a/data-protocols/dsp/dsp-catalog/dsp-catalog-http-api/src/test/java/org/eclipse/edc/protocol/dsp/catalog/http/api/decorator/ContinuationTokenManagerImplTest.java b/data-protocols/dsp/dsp-catalog/dsp-catalog-http-api/src/test/java/org/eclipse/edc/protocol/dsp/catalog/http/api/decorator/ContinuationTokenManagerImplTest.java index c0ff5232217..a43399425b1 100644 --- a/data-protocols/dsp/dsp-catalog/dsp-catalog-http-api/src/test/java/org/eclipse/edc/protocol/dsp/catalog/http/api/decorator/ContinuationTokenManagerImplTest.java +++ b/data-protocols/dsp/dsp-catalog/dsp-catalog-http-api/src/test/java/org/eclipse/edc/protocol/dsp/catalog/http/api/decorator/ContinuationTokenManagerImplTest.java @@ -20,7 +20,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.eclipse.edc.junit.assertions.AbstractResultAssert.assertThat; -import static org.eclipse.edc.protocol.dsp.spi.type.DspCatalogPropertyAndTypeNames.DSPACE_PROPERTY_FILTER; +import static org.eclipse.edc.protocol.dsp.spi.type.DspCatalogPropertyAndTypeNames.DSPACE_PROPERTY_FILTER_IRI; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -38,7 +38,7 @@ void apply_shouldReplaceQueryWithTheOnePassedInTheToken() { var result = continuationTokenManager.applyQueryFromToken(Json.createObjectBuilder().build(), "token"); assertThat(result).isSucceeded().satisfies(jsonObject -> { - assertThat(jsonObject.getJsonArray(DSPACE_PROPERTY_FILTER)).hasSize(1).first().isEqualTo(filter); + assertThat(jsonObject.getJsonArray(DSPACE_PROPERTY_FILTER_IRI)).hasSize(1).first().isEqualTo(filter); }); } diff --git a/data-protocols/dsp/dsp-catalog/dsp-catalog-transform/src/main/java/org/eclipse/edc/protocol/dsp/catalog/transform/from/JsonObjectFromCatalogRequestMessageTransformer.java b/data-protocols/dsp/dsp-catalog/dsp-catalog-transform/src/main/java/org/eclipse/edc/protocol/dsp/catalog/transform/from/JsonObjectFromCatalogRequestMessageTransformer.java index 1548f594aac..94435fb006d 100644 --- a/data-protocols/dsp/dsp-catalog/dsp-catalog-transform/src/main/java/org/eclipse/edc/protocol/dsp/catalog/transform/from/JsonObjectFromCatalogRequestMessageTransformer.java +++ b/data-protocols/dsp/dsp-catalog/dsp-catalog-transform/src/main/java/org/eclipse/edc/protocol/dsp/catalog/transform/from/JsonObjectFromCatalogRequestMessageTransformer.java @@ -23,8 +23,8 @@ import org.jetbrains.annotations.Nullable; import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.TYPE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspCatalogPropertyAndTypeNames.DSPACE_PROPERTY_FILTER; -import static org.eclipse.edc.protocol.dsp.spi.type.DspCatalogPropertyAndTypeNames.DSPACE_TYPE_CATALOG_REQUEST_MESSAGE; +import static org.eclipse.edc.protocol.dsp.spi.type.DspCatalogPropertyAndTypeNames.DSPACE_PROPERTY_FILTER_IRI; +import static org.eclipse.edc.protocol.dsp.spi.type.DspCatalogPropertyAndTypeNames.DSPACE_TYPE_CATALOG_REQUEST_MESSAGE_IRI; /** * Transforms a {@link CatalogRequestMessage} to a {@link JsonObject} in JSON-LD expanded form. @@ -41,10 +41,10 @@ public JsonObjectFromCatalogRequestMessageTransformer(JsonBuilderFactory jsonFac @Override public @Nullable JsonObject transform(@NotNull CatalogRequestMessage message, @NotNull TransformerContext context) { var builder = jsonFactory.createObjectBuilder(); - builder.add(TYPE, DSPACE_TYPE_CATALOG_REQUEST_MESSAGE); + builder.add(TYPE, DSPACE_TYPE_CATALOG_REQUEST_MESSAGE_IRI); if (message.getQuerySpec() != null) { - builder.add(DSPACE_PROPERTY_FILTER, context.transform(message.getQuerySpec(), JsonObject.class)); + builder.add(DSPACE_PROPERTY_FILTER_IRI, context.transform(message.getQuerySpec(), JsonObject.class)); } return builder.build(); diff --git a/data-protocols/dsp/dsp-catalog/dsp-catalog-transform/src/main/java/org/eclipse/edc/protocol/dsp/catalog/transform/to/JsonObjectToCatalogRequestMessageTransformer.java b/data-protocols/dsp/dsp-catalog/dsp-catalog-transform/src/main/java/org/eclipse/edc/protocol/dsp/catalog/transform/to/JsonObjectToCatalogRequestMessageTransformer.java index 28777e6e85b..3346c27f99d 100644 --- a/data-protocols/dsp/dsp-catalog/dsp-catalog-transform/src/main/java/org/eclipse/edc/protocol/dsp/catalog/transform/to/JsonObjectToCatalogRequestMessageTransformer.java +++ b/data-protocols/dsp/dsp-catalog/dsp-catalog-transform/src/main/java/org/eclipse/edc/protocol/dsp/catalog/transform/to/JsonObjectToCatalogRequestMessageTransformer.java @@ -24,7 +24,7 @@ import java.util.Optional; -import static org.eclipse.edc.protocol.dsp.spi.type.DspCatalogPropertyAndTypeNames.DSPACE_PROPERTY_FILTER; +import static org.eclipse.edc.protocol.dsp.spi.type.DspCatalogPropertyAndTypeNames.DSPACE_PROPERTY_FILTER_IRI; /** * Transforms a {@link JsonObject} in JSON-LD expanded form to a {@link CatalogRequestMessage}. @@ -40,7 +40,7 @@ public JsonObjectToCatalogRequestMessageTransformer() { var builder = CatalogRequestMessage.Builder.newInstance(); Optional.of(object) - .map(it -> it.get(DSPACE_PROPERTY_FILTER)) + .map(it -> it.get(DSPACE_PROPERTY_FILTER_IRI)) .map(it -> transformObject(it, QuerySpec.class, context)) .ifPresent(builder::querySpec); diff --git a/data-protocols/dsp/dsp-catalog/dsp-catalog-transform/src/test/java/org/eclipse/edc/protocol/dsp/catalog/transform/from/JsonObjectFromCatalogRequestMessageTransformerTest.java b/data-protocols/dsp/dsp-catalog/dsp-catalog-transform/src/test/java/org/eclipse/edc/protocol/dsp/catalog/transform/from/JsonObjectFromCatalogRequestMessageTransformerTest.java index 9cb6f188032..68b69e15a5a 100644 --- a/data-protocols/dsp/dsp-catalog/dsp-catalog-transform/src/test/java/org/eclipse/edc/protocol/dsp/catalog/transform/from/JsonObjectFromCatalogRequestMessageTransformerTest.java +++ b/data-protocols/dsp/dsp-catalog/dsp-catalog-transform/src/test/java/org/eclipse/edc/protocol/dsp/catalog/transform/from/JsonObjectFromCatalogRequestMessageTransformerTest.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.DspCatalogPropertyAndTypeNames.DSPACE_PROPERTY_FILTER; -import static org.eclipse.edc.protocol.dsp.spi.type.DspCatalogPropertyAndTypeNames.DSPACE_TYPE_CATALOG_REQUEST_MESSAGE; +import static org.eclipse.edc.protocol.dsp.spi.type.DspCatalogPropertyAndTypeNames.DSPACE_PROPERTY_FILTER_IRI; +import static org.eclipse.edc.protocol.dsp.spi.type.DspCatalogPropertyAndTypeNames.DSPACE_TYPE_CATALOG_REQUEST_MESSAGE_IRI; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; @@ -61,8 +61,8 @@ void transform_returnJsonObject() { var result = transformer.transform(message, context); assertThat(result).isNotNull(); - assertThat(result.getJsonString(TYPE).getString()).isEqualTo(DSPACE_TYPE_CATALOG_REQUEST_MESSAGE); - assertThat(result.get(DSPACE_PROPERTY_FILTER)).isEqualTo(querySpecJson); + assertThat(result.getJsonString(TYPE).getString()).isEqualTo(DSPACE_TYPE_CATALOG_REQUEST_MESSAGE_IRI); + assertThat(result.get(DSPACE_PROPERTY_FILTER_IRI)).isEqualTo(querySpecJson); verify(context, never()).reportProblem(anyString()); } } diff --git a/data-protocols/dsp/dsp-catalog/dsp-catalog-transform/src/test/java/org/eclipse/edc/protocol/dsp/catalog/transform/to/JsonObjectToCatalogRequestMessageTransformerTest.java b/data-protocols/dsp/dsp-catalog/dsp-catalog-transform/src/test/java/org/eclipse/edc/protocol/dsp/catalog/transform/to/JsonObjectToCatalogRequestMessageTransformerTest.java index df865fd3d41..a61e90255b1 100644 --- a/data-protocols/dsp/dsp-catalog/dsp-catalog-transform/src/test/java/org/eclipse/edc/protocol/dsp/catalog/transform/to/JsonObjectToCatalogRequestMessageTransformerTest.java +++ b/data-protocols/dsp/dsp-catalog/dsp-catalog-transform/src/test/java/org/eclipse/edc/protocol/dsp/catalog/transform/to/JsonObjectToCatalogRequestMessageTransformerTest.java @@ -25,8 +25,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.DspCatalogPropertyAndTypeNames.DSPACE_PROPERTY_FILTER; -import static org.eclipse.edc.protocol.dsp.spi.type.DspCatalogPropertyAndTypeNames.DSPACE_TYPE_CATALOG_REQUEST_MESSAGE; +import static org.eclipse.edc.protocol.dsp.spi.type.DspCatalogPropertyAndTypeNames.DSPACE_PROPERTY_FILTER_IRI; +import static org.eclipse.edc.protocol.dsp.spi.type.DspCatalogPropertyAndTypeNames.DSPACE_TYPE_CATALOG_REQUEST_MESSAGE_IRI; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; @@ -52,8 +52,8 @@ void transform_returnCatalogRequestMessage() { when(context.transform(querySpecJson, QuerySpec.class)).thenReturn(querySpec); var message = jsonFactory.createObjectBuilder() - .add(TYPE, DSPACE_TYPE_CATALOG_REQUEST_MESSAGE) - .add(DSPACE_PROPERTY_FILTER, querySpecJson) + .add(TYPE, DSPACE_TYPE_CATALOG_REQUEST_MESSAGE_IRI) + .add(DSPACE_PROPERTY_FILTER_IRI, querySpecJson) .build(); var result = transformer.transform(message, context); diff --git a/data-protocols/dsp/dsp-catalog/lib/dsp-catalog-validation-lib/build.gradle.kts b/data-protocols/dsp/dsp-catalog/lib/dsp-catalog-validation-lib/build.gradle.kts new file mode 100644 index 00000000000..e9e1766c8f0 --- /dev/null +++ b/data-protocols/dsp/dsp-catalog/lib/dsp-catalog-validation-lib/build.gradle.kts @@ -0,0 +1,24 @@ +/* + * 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(":data-protocols:dsp:dsp-spi")) + implementation(project(":core:common:lib:validator-lib")) + + testImplementation(project(":core:common:junit")) +} \ No newline at end of file diff --git a/data-protocols/dsp/dsp-catalog/dsp-catalog-http-api/src/main/java/org/eclipse/edc/protocol/dsp/catalog/http/api/validation/CatalogRequestMessageValidator.java b/data-protocols/dsp/dsp-catalog/lib/dsp-catalog-validation-lib/src/main/java/org/eclipse/edc/protocol/dsp/catalog/validation/CatalogRequestMessageValidator.java similarity index 65% rename from data-protocols/dsp/dsp-catalog/dsp-catalog-http-api/src/main/java/org/eclipse/edc/protocol/dsp/catalog/http/api/validation/CatalogRequestMessageValidator.java rename to data-protocols/dsp/dsp-catalog/lib/dsp-catalog-validation-lib/src/main/java/org/eclipse/edc/protocol/dsp/catalog/validation/CatalogRequestMessageValidator.java index e9e8b92be1d..66b8d8d6d93 100644 --- a/data-protocols/dsp/dsp-catalog/dsp-catalog-http-api/src/main/java/org/eclipse/edc/protocol/dsp/catalog/http/api/validation/CatalogRequestMessageValidator.java +++ b/data-protocols/dsp/dsp-catalog/lib/dsp-catalog-validation-lib/src/main/java/org/eclipse/edc/protocol/dsp/catalog/validation/CatalogRequestMessageValidator.java @@ -12,7 +12,7 @@ * */ -package org.eclipse.edc.protocol.dsp.catalog.http.api.validation; +package org.eclipse.edc.protocol.dsp.catalog.validation; import jakarta.json.JsonObject; import org.eclipse.edc.spi.query.CriterionOperatorRegistry; @@ -21,17 +21,22 @@ import org.eclipse.edc.validator.jsonobject.validators.model.QuerySpecValidator; import org.eclipse.edc.validator.spi.Validator; -import static org.eclipse.edc.protocol.dsp.spi.type.DspCatalogPropertyAndTypeNames.DSPACE_PROPERTY_FILTER; -import static org.eclipse.edc.protocol.dsp.spi.type.DspCatalogPropertyAndTypeNames.DSPACE_TYPE_CATALOG_REQUEST_MESSAGE; +import static org.eclipse.edc.jsonld.spi.Namespaces.DSPACE_SCHEMA; +import static org.eclipse.edc.protocol.dsp.spi.type.DspCatalogPropertyAndTypeNames.DSPACE_PROPERTY_FILTER_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspCatalogPropertyAndTypeNames.DSPACE_TYPE_CATALOG_REQUEST_MESSAGE_TERM; /** * Validator for {@link CatalogRequestMessageValidator} Json-LD representation */ public class CatalogRequestMessageValidator { public static Validator instance(CriterionOperatorRegistry criterionOperatorRegistry) { + return instance(criterionOperatorRegistry, DSPACE_SCHEMA); + } + + public static Validator instance(CriterionOperatorRegistry criterionOperatorRegistry, String schema) { return JsonObjectValidator.newValidator() - .verify(path -> new TypeIs(path, DSPACE_TYPE_CATALOG_REQUEST_MESSAGE)) - .verifyObject(DSPACE_PROPERTY_FILTER, path -> QuerySpecValidator.instance(path, criterionOperatorRegistry)) + .verify(path -> new TypeIs(path, schema + DSPACE_TYPE_CATALOG_REQUEST_MESSAGE_TERM)) + .verifyObject(schema + DSPACE_PROPERTY_FILTER_TERM, path -> QuerySpecValidator.instance(path, criterionOperatorRegistry)) .build(); } } diff --git a/data-protocols/dsp/dsp-catalog/dsp-catalog-http-api/src/test/java/org/eclipse/edc/protocol/dsp/catalog/http/api/validation/CatalogRequestMessageValidatorTest.java b/data-protocols/dsp/dsp-catalog/lib/dsp-catalog-validation-lib/src/test/java/org/eclipse/edc/protocol/dsp/catalog/validation/CatalogRequestMessageValidatorTest.java similarity index 79% rename from data-protocols/dsp/dsp-catalog/dsp-catalog-http-api/src/test/java/org/eclipse/edc/protocol/dsp/catalog/http/api/validation/CatalogRequestMessageValidatorTest.java rename to data-protocols/dsp/dsp-catalog/lib/dsp-catalog-validation-lib/src/test/java/org/eclipse/edc/protocol/dsp/catalog/validation/CatalogRequestMessageValidatorTest.java index 859f9f6fbdd..e890c4c4613 100644 --- a/data-protocols/dsp/dsp-catalog/dsp-catalog-http-api/src/test/java/org/eclipse/edc/protocol/dsp/catalog/http/api/validation/CatalogRequestMessageValidatorTest.java +++ b/data-protocols/dsp/dsp-catalog/lib/dsp-catalog-validation-lib/src/test/java/org/eclipse/edc/protocol/dsp/catalog/validation/CatalogRequestMessageValidatorTest.java @@ -12,20 +12,20 @@ * */ -package org.eclipse.edc.protocol.dsp.catalog.http.api.validation; +package org.eclipse.edc.protocol.dsp.catalog.validation; import jakarta.json.Json; import jakarta.json.JsonObject; +import org.assertj.core.api.Assertions; +import org.eclipse.edc.protocol.dsp.spi.type.DspCatalogPropertyAndTypeNames; import org.eclipse.edc.validator.spi.ValidationFailure; import org.eclipse.edc.validator.spi.Validator; import org.eclipse.edc.validator.spi.Violation; import org.junit.jupiter.api.Test; -import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.InstanceOfAssertFactories.list; import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.TYPE; import static org.eclipse.edc.junit.assertions.AbstractResultAssert.assertThat; -import static org.eclipse.edc.protocol.dsp.spi.type.DspCatalogPropertyAndTypeNames.DSPACE_TYPE_CATALOG_REQUEST_MESSAGE; import static org.mockito.Mockito.mock; class CatalogRequestMessageValidatorTest { @@ -35,7 +35,7 @@ class CatalogRequestMessageValidatorTest { @Test void shouldSucceed_whenObjectIsValid() { var input = Json.createObjectBuilder() - .add(TYPE, Json.createArrayBuilder().add(DSPACE_TYPE_CATALOG_REQUEST_MESSAGE)) + .add(TYPE, Json.createArrayBuilder().add(DspCatalogPropertyAndTypeNames.DSPACE_TYPE_CATALOG_REQUEST_MESSAGE_IRI)) .build(); var result = validator.validate(input); @@ -52,6 +52,6 @@ void shouldFail_whenMandatoryFieldsAreMissing() { assertThat(result).isFailed().extracting(ValidationFailure::getViolations).asInstanceOf(list(Violation.class)) .hasSize(1) - .anySatisfy(violation -> assertThat(violation.path()).isEqualTo(TYPE)); + .anySatisfy(violation -> Assertions.assertThat(violation.path()).isEqualTo(TYPE)); } } diff --git a/data-protocols/dsp/dsp-negotiation/build.gradle.kts b/data-protocols/dsp/dsp-negotiation/build.gradle.kts index ae5a8e3a08f..def7fbfe44c 100644 --- a/data-protocols/dsp/dsp-negotiation/build.gradle.kts +++ b/data-protocols/dsp/dsp-negotiation/build.gradle.kts @@ -21,4 +21,5 @@ dependencies { api(project(":data-protocols:dsp:dsp-negotiation:dsp-negotiation-http-api")) 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")) } diff --git a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-http-api/build.gradle.kts b/data-protocols/dsp/dsp-negotiation/dsp-negotiation-http-api/build.gradle.kts index 5fc848c9307..f74d77730b8 100644 --- a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-http-api/build.gradle.kts +++ b/data-protocols/dsp/dsp-negotiation/dsp-negotiation-http-api/build.gradle.kts @@ -25,7 +25,7 @@ dependencies { api(project(":spi:control-plane:control-plane-spi")) api(project(":extensions:common:json-ld")) - implementation(project(":core:common:lib:validator-lib")) + implementation(project(":data-protocols:dsp:dsp-negotiation:lib:dsp-negotiation-validation-lib")) implementation(libs.jakarta.rsApi) diff --git a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-http-api/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/http/api/DspNegotiationApiExtension.java b/data-protocols/dsp/dsp-negotiation/dsp-negotiation-http-api/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/http/api/DspNegotiationApiExtension.java index 22ecd0d3da1..9cc6edd3d88 100644 --- a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-http-api/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/http/api/DspNegotiationApiExtension.java +++ b/data-protocols/dsp/dsp-negotiation/dsp-negotiation-http-api/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/http/api/DspNegotiationApiExtension.java @@ -19,12 +19,12 @@ import org.eclipse.edc.protocol.dsp.http.spi.message.DspRequestHandler; import org.eclipse.edc.protocol.dsp.negotiation.http.api.controller.DspNegotiationApiController; import org.eclipse.edc.protocol.dsp.negotiation.http.api.controller.DspNegotiationApiController20241; -import org.eclipse.edc.protocol.dsp.negotiation.http.api.validation.ContractAgreementMessageValidator; -import org.eclipse.edc.protocol.dsp.negotiation.http.api.validation.ContractAgreementVerificationMessageValidator; -import org.eclipse.edc.protocol.dsp.negotiation.http.api.validation.ContractNegotiationEventMessageValidator; -import org.eclipse.edc.protocol.dsp.negotiation.http.api.validation.ContractNegotiationTerminationMessageValidator; -import org.eclipse.edc.protocol.dsp.negotiation.http.api.validation.ContractOfferMessageValidator; -import org.eclipse.edc.protocol.dsp.negotiation.http.api.validation.ContractRequestMessageValidator; +import org.eclipse.edc.protocol.dsp.negotiation.validation.ContractAgreementMessageValidator; +import org.eclipse.edc.protocol.dsp.negotiation.validation.ContractAgreementVerificationMessageValidator; +import org.eclipse.edc.protocol.dsp.negotiation.validation.ContractNegotiationEventMessageValidator; +import org.eclipse.edc.protocol.dsp.negotiation.validation.ContractNegotiationTerminationMessageValidator; +import org.eclipse.edc.protocol.dsp.negotiation.validation.ContractOfferMessageValidator; +import org.eclipse.edc.protocol.dsp.negotiation.validation.ContractRequestMessageValidator; import org.eclipse.edc.runtime.metamodel.annotation.Extension; import org.eclipse.edc.runtime.metamodel.annotation.Inject; import org.eclipse.edc.spi.system.ServiceExtension; @@ -33,12 +33,12 @@ import org.eclipse.edc.web.spi.WebService; import org.eclipse.edc.web.spi.configuration.ApiContext; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_AGREEMENT_VERIFICATION_MESSAGE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_NEGOTIATION_EVENT_MESSAGE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_NEGOTIATION_TERMINATION_MESSAGE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_OFFER_MESSAGE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE; +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.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_AGREEMENT_VERIFICATION_MESSAGE_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_TYPE_CONTRACT_NEGOTIATION_TERMINATION_MESSAGE_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.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE_IRI; import static org.eclipse.edc.protocol.dsp.spi.version.DspVersions.V_08; import static org.eclipse.edc.protocol.dsp.spi.version.DspVersions.V_2024_1; @@ -68,12 +68,12 @@ public String name() { @Override public void initialize(ServiceExtensionContext context) { - validatorRegistry.register(DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE, ContractRequestMessageValidator.instance()); - validatorRegistry.register(DSPACE_TYPE_CONTRACT_OFFER_MESSAGE, ContractOfferMessageValidator.instance()); - validatorRegistry.register(DSPACE_TYPE_CONTRACT_NEGOTIATION_EVENT_MESSAGE, ContractNegotiationEventMessageValidator.instance()); - validatorRegistry.register(DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE, ContractAgreementMessageValidator.instance()); - validatorRegistry.register(DSPACE_TYPE_CONTRACT_AGREEMENT_VERIFICATION_MESSAGE, ContractAgreementVerificationMessageValidator.instance()); - validatorRegistry.register(DSPACE_TYPE_CONTRACT_NEGOTIATION_TERMINATION_MESSAGE, ContractNegotiationTerminationMessageValidator.instance()); + validatorRegistry.register(DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE_IRI, ContractRequestMessageValidator.instance()); + validatorRegistry.register(DSPACE_TYPE_CONTRACT_OFFER_MESSAGE_IRI, ContractOfferMessageValidator.instance()); + validatorRegistry.register(DSPACE_TYPE_CONTRACT_NEGOTIATION_EVENT_MESSAGE_IRI, ContractNegotiationEventMessageValidator.instance()); + validatorRegistry.register(DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE_IRI, ContractAgreementMessageValidator.instance()); + validatorRegistry.register(DSPACE_TYPE_CONTRACT_AGREEMENT_VERIFICATION_MESSAGE_IRI, ContractAgreementVerificationMessageValidator.instance()); + validatorRegistry.register(DSPACE_TYPE_CONTRACT_NEGOTIATION_TERMINATION_MESSAGE_IRI, ContractNegotiationTerminationMessageValidator.instance()); webService.registerResource(ApiContext.PROTOCOL, new DspNegotiationApiController(protocolService, dspRequestHandler)); webService.registerResource(ApiContext.PROTOCOL, new DspNegotiationApiController20241(protocolService, dspRequestHandler)); diff --git a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-http-api/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/http/api/controller/DspNegotiationApiController.java b/data-protocols/dsp/dsp-negotiation/dsp-negotiation-http-api/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/http/api/controller/DspNegotiationApiController.java index 93812c534e9..a4b9479224c 100644 --- a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-http-api/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/http/api/controller/DspNegotiationApiController.java +++ b/data-protocols/dsp/dsp-negotiation/dsp-negotiation-http-api/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/http/api/controller/DspNegotiationApiController.java @@ -48,12 +48,12 @@ import static org.eclipse.edc.protocol.dsp.negotiation.http.api.NegotiationApiPaths.INITIAL_CONTRACT_REQUEST; import static org.eclipse.edc.protocol.dsp.negotiation.http.api.NegotiationApiPaths.TERMINATION; import static org.eclipse.edc.protocol.dsp.negotiation.http.api.NegotiationApiPaths.VERIFICATION; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_AGREEMENT_VERIFICATION_MESSAGE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_NEGOTIATION_EVENT_MESSAGE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_NEGOTIATION_TERMINATION_MESSAGE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_OFFER_MESSAGE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE; +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.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_AGREEMENT_VERIFICATION_MESSAGE_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_TYPE_CONTRACT_NEGOTIATION_TERMINATION_MESSAGE_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.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE_IRI; /** * Provides consumer and provider endpoints for the contract negotiation according to the http binding @@ -112,7 +112,7 @@ public Response getNegotiation(@PathParam("id") String id, @HeaderParam(AUTHORIZ @Path(INITIAL_CONTRACT_REQUEST) public Response initialContractRequest(JsonObject jsonObject, @HeaderParam(AUTHORIZATION) String token) { var request = PostDspRequest.Builder.newInstance(ContractRequestMessage.class, ContractNegotiation.class, ContractNegotiationError.class) - .expectedMessageType(DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE) + .expectedMessageType(DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE_IRI) .message(jsonObject) .token(token) .serviceCall(protocolService::notifyRequested) @@ -134,7 +134,7 @@ public Response initialContractRequest(JsonObject jsonObject, @HeaderParam(AUTHO @Path(INITIAL_CONTRACT_OFFER) public Response initialContractOffer(JsonObject jsonObject, @HeaderParam(AUTHORIZATION) String token) { var request = PostDspRequest.Builder.newInstance(ContractOfferMessage.class, ContractNegotiation.class, ContractNegotiationError.class) - .expectedMessageType(DSPACE_TYPE_CONTRACT_OFFER_MESSAGE) + .expectedMessageType(DSPACE_TYPE_CONTRACT_OFFER_MESSAGE_IRI) .message(jsonObject) .token(token) .serviceCall(protocolService::notifyOffered) @@ -159,7 +159,7 @@ public Response contractRequest(@PathParam("id") String id, JsonObject jsonObject, @HeaderParam(AUTHORIZATION) String token) { var request = PostDspRequest.Builder.newInstance(ContractRequestMessage.class, ContractNegotiation.class, ContractNegotiationError.class) - .expectedMessageType(DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE) + .expectedMessageType(DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE_IRI) .processId(id) .message(jsonObject) .token(token) @@ -185,7 +185,7 @@ public Response createEvent(@PathParam("id") String id, JsonObject jsonObject, @HeaderParam(AUTHORIZATION) String token) { var request = PostDspRequest.Builder.newInstance(ContractNegotiationEventMessage.class, ContractNegotiation.class, ContractNegotiationError.class) - .expectedMessageType(DSPACE_TYPE_CONTRACT_NEGOTIATION_EVENT_MESSAGE) + .expectedMessageType(DSPACE_TYPE_CONTRACT_NEGOTIATION_EVENT_MESSAGE_IRI) .processId(id) .message(jsonObject) .token(token) @@ -214,7 +214,7 @@ public Response verifyAgreement(@PathParam("id") String id, JsonObject jsonObject, @HeaderParam(AUTHORIZATION) String token) { var request = PostDspRequest.Builder.newInstance(ContractAgreementVerificationMessage.class, ContractNegotiation.class, ContractNegotiationError.class) - .expectedMessageType(DSPACE_TYPE_CONTRACT_AGREEMENT_VERIFICATION_MESSAGE) + .expectedMessageType(DSPACE_TYPE_CONTRACT_AGREEMENT_VERIFICATION_MESSAGE_IRI) .processId(id) .message(jsonObject) .token(token) @@ -240,7 +240,7 @@ public Response terminateNegotiation(@PathParam("id") String id, JsonObject jsonObject, @HeaderParam(AUTHORIZATION) String token) { var request = PostDspRequest.Builder.newInstance(ContractNegotiationTerminationMessage.class, ContractNegotiation.class, ContractNegotiationError.class) - .expectedMessageType(DSPACE_TYPE_CONTRACT_NEGOTIATION_TERMINATION_MESSAGE) + .expectedMessageType(DSPACE_TYPE_CONTRACT_NEGOTIATION_TERMINATION_MESSAGE_IRI) .processId(id) .message(jsonObject) .token(token) @@ -266,7 +266,7 @@ public Response providerOffer(@PathParam("id") String id, JsonObject body, @HeaderParam(AUTHORIZATION) String token) { var request = PostDspRequest.Builder.newInstance(ContractOfferMessage.class, ContractNegotiation.class, ContractNegotiationError.class) - .expectedMessageType(DSPACE_TYPE_CONTRACT_OFFER_MESSAGE) + .expectedMessageType(DSPACE_TYPE_CONTRACT_OFFER_MESSAGE_IRI) .processId(id) .message(body) .token(token) @@ -292,7 +292,7 @@ public Response createAgreement(@PathParam("id") String id, JsonObject jsonObject, @HeaderParam(AUTHORIZATION) String token) { var request = PostDspRequest.Builder.newInstance(ContractAgreementMessage.class, ContractNegotiation.class, ContractNegotiationError.class) - .expectedMessageType(DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE) + .expectedMessageType(DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE_IRI) .processId(id) .message(jsonObject) .token(token) diff --git a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-http-api/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/http/api/DspNegotiationApiExtensionTest.java b/data-protocols/dsp/dsp-negotiation/dsp-negotiation-http-api/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/http/api/DspNegotiationApiExtensionTest.java index 2aac8cf721f..6b73b1a4d8a 100644 --- a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-http-api/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/http/api/DspNegotiationApiExtensionTest.java +++ b/data-protocols/dsp/dsp-negotiation/dsp-negotiation-http-api/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/http/api/DspNegotiationApiExtensionTest.java @@ -21,12 +21,12 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_AGREEMENT_VERIFICATION_MESSAGE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_NEGOTIATION_EVENT_MESSAGE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_NEGOTIATION_TERMINATION_MESSAGE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_OFFER_MESSAGE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE; +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.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_AGREEMENT_VERIFICATION_MESSAGE_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_TYPE_CONTRACT_NEGOTIATION_TERMINATION_MESSAGE_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.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE_IRI; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.mock; @@ -46,11 +46,11 @@ void setUp(ServiceExtensionContext context) { void shouldRegisterMessageValidators(DspNegotiationApiExtension extension, ServiceExtensionContext context) { extension.initialize(context); - verify(validatorRegistry).register(eq(DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE), any()); - verify(validatorRegistry).register(eq(DSPACE_TYPE_CONTRACT_OFFER_MESSAGE), any()); - verify(validatorRegistry).register(eq(DSPACE_TYPE_CONTRACT_NEGOTIATION_EVENT_MESSAGE), any()); - verify(validatorRegistry).register(eq(DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE), any()); - verify(validatorRegistry).register(eq(DSPACE_TYPE_CONTRACT_AGREEMENT_VERIFICATION_MESSAGE), any()); - verify(validatorRegistry).register(eq(DSPACE_TYPE_CONTRACT_NEGOTIATION_TERMINATION_MESSAGE), any()); + verify(validatorRegistry).register(eq(DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE_IRI), any()); + verify(validatorRegistry).register(eq(DSPACE_TYPE_CONTRACT_OFFER_MESSAGE_IRI), any()); + verify(validatorRegistry).register(eq(DSPACE_TYPE_CONTRACT_NEGOTIATION_EVENT_MESSAGE_IRI), any()); + verify(validatorRegistry).register(eq(DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE_IRI), any()); + verify(validatorRegistry).register(eq(DSPACE_TYPE_CONTRACT_AGREEMENT_VERIFICATION_MESSAGE_IRI), any()); + verify(validatorRegistry).register(eq(DSPACE_TYPE_CONTRACT_NEGOTIATION_TERMINATION_MESSAGE_IRI), any()); } } diff --git a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-http-api/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/http/api/controller/DspNegotiationApiControllerTest.java b/data-protocols/dsp/dsp-negotiation/dsp-negotiation-http-api/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/http/api/controller/DspNegotiationApiControllerTest.java index 46febed1f54..5d54785cd5d 100644 --- a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-http-api/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/http/api/controller/DspNegotiationApiControllerTest.java +++ b/data-protocols/dsp/dsp-negotiation/dsp-negotiation-http-api/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/http/api/controller/DspNegotiationApiControllerTest.java @@ -54,12 +54,12 @@ import static org.eclipse.edc.protocol.dsp.negotiation.http.api.NegotiationApiPaths.INITIAL_CONTRACT_REQUEST; import static org.eclipse.edc.protocol.dsp.negotiation.http.api.NegotiationApiPaths.TERMINATION; import static org.eclipse.edc.protocol.dsp.negotiation.http.api.NegotiationApiPaths.VERIFICATION; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_AGREEMENT_VERIFICATION_MESSAGE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_NEGOTIATION_EVENT_MESSAGE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_NEGOTIATION_TERMINATION_MESSAGE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_OFFER_MESSAGE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE; +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.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_AGREEMENT_VERIFICATION_MESSAGE_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_TYPE_CONTRACT_NEGOTIATION_TERMINATION_MESSAGE_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.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE_IRI; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; @@ -92,7 +92,7 @@ void getNegotiation_shouldGetResource() { @Test void initialContractRequest_shouldCreateResource() { - var requestBody = createObjectBuilder().add("@type", DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE).build(); + var requestBody = createObjectBuilder().add("@type", DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE_IRI).build(); when(dspRequestHandler.createResource(any())).thenReturn(Response.ok().type(APPLICATION_JSON_TYPE).build()); var result = baseRequest() @@ -112,12 +112,12 @@ void initialContractRequest_shouldCreateResource() { assertThat(request.getMessage()).isNotNull(); assertThat(request.getInputClass()).isEqualTo(ContractRequestMessage.class); assertThat(request.getResultClass()).isEqualTo(ContractNegotiation.class); - assertThat(request.getExpectedMessageType()).isEqualTo(DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE); + assertThat(request.getExpectedMessageType()).isEqualTo(DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE_IRI); } @Test void initialContractOffer_shouldCreateResource() { - var requestBody = createObjectBuilder().add("@type", DSPACE_TYPE_CONTRACT_OFFER_MESSAGE).build(); + var requestBody = createObjectBuilder().add("@type", DSPACE_TYPE_CONTRACT_OFFER_MESSAGE_IRI).build(); when(dspRequestHandler.createResource(any())).thenReturn(Response.ok().type(APPLICATION_JSON_TYPE).build()); var result = baseRequest() @@ -137,7 +137,7 @@ void initialContractOffer_shouldCreateResource() { assertThat(request.getMessage()).isNotNull(); assertThat(request.getInputClass()).isEqualTo(ContractOfferMessage.class); assertThat(request.getResultClass()).isEqualTo(ContractNegotiation.class); - assertThat(request.getExpectedMessageType()).isEqualTo(DSPACE_TYPE_CONTRACT_OFFER_MESSAGE); + assertThat(request.getExpectedMessageType()).isEqualTo(DSPACE_TYPE_CONTRACT_OFFER_MESSAGE_IRI); } /** @@ -192,27 +192,27 @@ public Stream provideArguments(ExtensionContext context) { Arguments.of( BASE_PATH + "testId" + CONTRACT_REQUEST, ContractRequestMessage.class, - DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE), + DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE_IRI), Arguments.of( BASE_PATH + "testId" + EVENT, ContractNegotiationEventMessage.class, - DSPACE_TYPE_CONTRACT_NEGOTIATION_EVENT_MESSAGE), + DSPACE_TYPE_CONTRACT_NEGOTIATION_EVENT_MESSAGE_IRI), Arguments.of( BASE_PATH + "testId" + AGREEMENT + VERIFICATION, ContractAgreementVerificationMessage.class, - DSPACE_TYPE_CONTRACT_AGREEMENT_VERIFICATION_MESSAGE), + DSPACE_TYPE_CONTRACT_AGREEMENT_VERIFICATION_MESSAGE_IRI), Arguments.of( BASE_PATH + "testId" + TERMINATION, ContractNegotiationTerminationMessage.class, - DSPACE_TYPE_CONTRACT_NEGOTIATION_TERMINATION_MESSAGE), + DSPACE_TYPE_CONTRACT_NEGOTIATION_TERMINATION_MESSAGE_IRI), Arguments.of( BASE_PATH + "testId" + AGREEMENT, ContractAgreementMessage.class, - DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE), + DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE_IRI), Arguments.of( BASE_PATH + "testId" + CONTRACT_OFFER, ContractOfferMessage.class, - DSPACE_TYPE_CONTRACT_OFFER_MESSAGE) + DSPACE_TYPE_CONTRACT_OFFER_MESSAGE_IRI) ); } } 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/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractAgreementMessageTransformer.java index 570aa3a1a80..c14b86c91d0 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/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractAgreementMessageTransformer.java @@ -30,7 +30,7 @@ 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; +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; @@ -72,7 +72,7 @@ public JsonObjectFromContractAgreementMessageTransformer(JsonBuilderFactory json return jsonFactory.createObjectBuilder() .add(ID, agreementMessage.getId()) - .add(TYPE, DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE) + .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) 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/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractAgreementVerificationMessageTransformer.java index 1f4f801ca70..f8eacf65b67 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/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractAgreementVerificationMessageTransformer.java @@ -24,7 +24,7 @@ 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; +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; @@ -44,7 +44,7 @@ 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) + .add(TYPE, DSPACE_TYPE_CONTRACT_AGREEMENT_VERIFICATION_MESSAGE_IRI) .add(DSPACE_PROPERTY_CONSUMER_PID, verificationMessage.getConsumerPid()) .add(DSPACE_PROPERTY_PROVIDER_PID, 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/JsonObjectFromContractNegotiationEventMessageTransformer.java b/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractNegotiationEventMessageTransformer.java index 99d0a241f10..41a1ebe8bd5 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/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractNegotiationEventMessageTransformer.java @@ -25,7 +25,7 @@ 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; +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; @@ -48,7 +48,7 @@ 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) + .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()) { 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/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractNegotiationTerminationMessageTransformer.java index 82393ef5654..3043bcc871b 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/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractNegotiationTerminationMessageTransformer.java @@ -24,7 +24,7 @@ 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; +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; 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; @@ -46,7 +46,7 @@ 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) + .add(TYPE, DSPACE_TYPE_CONTRACT_NEGOTIATION_TERMINATION_MESSAGE_IRI) .add(DSPACE_PROPERTY_CONSUMER_PID, terminationMessage.getConsumerPid()) .add(DSPACE_PROPERTY_PROVIDER_PID, terminationMessage.getProviderPid()); 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/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractOfferMessageTransformer.java index 5e80c30a23d..0e9d4532de9 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/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractOfferMessageTransformer.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.DspNegotiationPropertyAndTypeNames.DSPACE_PROPERTY_OFFER; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_OFFER_MESSAGE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CALLBACK_ADDRESS; +import static org.eclipse.edc.protocol.dsp.spi.type.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; @@ -47,11 +47,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) + .add(TYPE, DSPACE_TYPE_CONTRACT_OFFER_MESSAGE_IRI) .add(DSPACE_PROPERTY_PROVIDER_PID, message.getProviderPid()); addIfNotNull(message.getConsumerPid(), DSPACE_PROPERTY_CONSUMER_PID, builder); - addIfNotNull(message.getCallbackAddress(), DSPACE_PROPERTY_CALLBACK_ADDRESS, builder); + addIfNotNull(message.getCallbackAddress(), DSPACE_PROPERTY_CALLBACK_ADDRESS_IRI, builder); var offer = message.getContractOffer(); var policy = context.transform(offer.getPolicy(), JsonObject.class); @@ -66,7 +66,7 @@ public JsonObjectFromContractOfferMessageTransformer(JsonBuilderFactory jsonFact var enrichedPolicy = Json.createObjectBuilder(policy) .add(ID, offer.getId()) .build(); - builder.add(DSPACE_PROPERTY_OFFER, enrichedPolicy); + builder.add(DSPACE_PROPERTY_OFFER_IRI, 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/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractRequestMessageTransformer.java index 9147dd1d04e..d90e8310d6b 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/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractRequestMessageTransformer.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.DspNegotiationPropertyAndTypeNames.DSPACE_PROPERTY_OFFER; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CALLBACK_ADDRESS; +import static org.eclipse.edc.protocol.dsp.spi.type.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; @@ -48,11 +48,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) + .add(TYPE, DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE_IRI) .add(DSPACE_PROPERTY_CONSUMER_PID, requestMessage.getConsumerPid()); addIfNotNull(requestMessage.getProviderPid(), DSPACE_PROPERTY_PROVIDER_PID, builder); - addIfNotNull(requestMessage.getCallbackAddress(), DSPACE_PROPERTY_CALLBACK_ADDRESS, builder); + addIfNotNull(requestMessage.getCallbackAddress(), DSPACE_PROPERTY_CALLBACK_ADDRESS_IRI, builder); var policy = context.transform(requestMessage.getContractOffer().getPolicy(), JsonObject.class); if (policy == null) { @@ -67,7 +67,7 @@ public JsonObjectFromContractRequestMessageTransformer(JsonBuilderFactory jsonFa var enrichedPolicy = Json.createObjectBuilder(policy) .add(ID, requestMessage.getContractOffer().getId()) .build(); - builder.add(DSPACE_PROPERTY_OFFER, enrichedPolicy); + builder.add(DSPACE_PROPERTY_OFFER_IRI, 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/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractAgreementMessageTransformer.java index d511351543f..e219e15d021 100644 --- a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractAgreementMessageTransformer.java +++ b/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractAgreementMessageTransformer.java @@ -33,7 +33,7 @@ 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; +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; @@ -53,7 +53,7 @@ public JsonObjectToContractAgreementMessageTransformer() { if (!transformMandatoryString(object.get(DSPACE_PROPERTY_CONSUMER_PID), messageBuilder::consumerPid, context)) { context.problem() .missingProperty() - .type(DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE) + .type(DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE_IRI) .property(DSPACE_PROPERTY_CONSUMER_PID) .report(); return null; @@ -61,7 +61,7 @@ public JsonObjectToContractAgreementMessageTransformer() { if (!transformMandatoryString(object.get(DSPACE_PROPERTY_PROVIDER_PID), messageBuilder::providerPid, context)) { context.problem() .missingProperty() - .type(DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE) + .type(DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE_IRI) .property(DSPACE_PROPERTY_PROVIDER_PID) .report(); return null; @@ -78,7 +78,7 @@ public JsonObjectToContractAgreementMessageTransformer() { if (policy == null) { context.problem() .invalidProperty() - .type(DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE) + .type(DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE_IRI) .property(DSPACE_PROPERTY_AGREEMENT) .report(); return null; @@ -110,7 +110,7 @@ private ContractAgreement contractAgreement(JsonObject jsonAgreement, Policy pol if (agreementId == null) { context.problem() .missingProperty() - .type(DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE) + .type(DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE_IRI) .property(ID) .report(); return null; @@ -129,7 +129,7 @@ private ContractAgreement contractAgreement(JsonObject jsonAgreement, Policy pol if (timestamp == null) { context.problem() .missingProperty() - .type(DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE) + .type(DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE_IRI) .property(DSPACE_PROPERTY_TIMESTAMP) .report(); return null; @@ -139,7 +139,7 @@ private ContractAgreement contractAgreement(JsonObject jsonAgreement, Policy pol } catch (DateTimeParseException e) { context.problem() .invalidProperty() - .type(DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE) + .type(DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE_IRI) .property(DSPACE_PROPERTY_TIMESTAMP) .value(timestamp) .error(e.getMessage()) 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/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractAgreementVerificationMessageTransformer.java index 936edb5da82..55763e030d7 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/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractAgreementVerificationMessageTransformer.java @@ -21,7 +21,7 @@ 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; +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; @@ -40,7 +40,7 @@ public JsonObjectToContractAgreementVerificationMessageTransformer() { if (!transformMandatoryString(object.get(DSPACE_PROPERTY_CONSUMER_PID), builder::consumerPid, context)) { context.problem() .missingProperty() - .type(DSPACE_TYPE_CONTRACT_AGREEMENT_VERIFICATION_MESSAGE) + .type(DSPACE_TYPE_CONTRACT_AGREEMENT_VERIFICATION_MESSAGE_IRI) .property(DSPACE_PROPERTY_CONSUMER_PID) .report(); return null; @@ -48,7 +48,7 @@ public JsonObjectToContractAgreementVerificationMessageTransformer() { if (!transformMandatoryString(object.get(DSPACE_PROPERTY_PROVIDER_PID), builder::providerPid, context)) { context.problem() .missingProperty() - .type(DSPACE_TYPE_CONTRACT_AGREEMENT_VERIFICATION_MESSAGE) + .type(DSPACE_TYPE_CONTRACT_AGREEMENT_VERIFICATION_MESSAGE_IRI) .property(DSPACE_PROPERTY_PROVIDER_PID) .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/JsonObjectToContractNegotiationEventMessageTransformer.java b/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationEventMessageTransformer.java index c0c5dafba80..adbd9d403af 100644 --- a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationEventMessageTransformer.java +++ b/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationEventMessageTransformer.java @@ -24,7 +24,7 @@ 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; +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; @@ -46,7 +46,7 @@ public JsonObjectToContractNegotiationEventMessageTransformer() { if (!transformMandatoryString(object.get(DSPACE_PROPERTY_CONSUMER_PID), builder::consumerPid, context)) { context.problem() .missingProperty() - .type(DSPACE_TYPE_CONTRACT_NEGOTIATION_EVENT_MESSAGE) + .type(DSPACE_TYPE_CONTRACT_NEGOTIATION_EVENT_MESSAGE_IRI) .property(DSPACE_PROPERTY_CONSUMER_PID) .report(); return null; @@ -54,7 +54,7 @@ public JsonObjectToContractNegotiationEventMessageTransformer() { if (!transformMandatoryString(object.get(DSPACE_PROPERTY_PROVIDER_PID), builder::providerPid, context)) { context.problem() .missingProperty() - .type(DSPACE_TYPE_CONTRACT_NEGOTIATION_EVENT_MESSAGE) + .type(DSPACE_TYPE_CONTRACT_NEGOTIATION_EVENT_MESSAGE_IRI) .property(DSPACE_PROPERTY_PROVIDER_PID) .report(); return null; @@ -68,7 +68,7 @@ public JsonObjectToContractNegotiationEventMessageTransformer() { } else { context.problem() .unexpectedType() - .type(DSPACE_TYPE_CONTRACT_NEGOTIATION_EVENT_MESSAGE) + .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) diff --git a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationTerminationMessageTransformer.java b/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationTerminationMessageTransformer.java index 724ec2f5328..962270eceba 100644 --- a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationTerminationMessageTransformer.java +++ b/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationTerminationMessageTransformer.java @@ -23,7 +23,7 @@ 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; +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; 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; @@ -45,7 +45,7 @@ public JsonObjectToContractNegotiationTerminationMessageTransformer() { if (!transformMandatoryString(object.get(DSPACE_PROPERTY_CONSUMER_PID), builder::consumerPid, context)) { context.problem() .missingProperty() - .type(DSPACE_TYPE_CONTRACT_NEGOTIATION_TERMINATION_MESSAGE) + .type(DSPACE_TYPE_CONTRACT_NEGOTIATION_TERMINATION_MESSAGE_IRI) .property(DSPACE_PROPERTY_CONSUMER_PID) .report(); return null; @@ -53,7 +53,7 @@ public JsonObjectToContractNegotiationTerminationMessageTransformer() { if (!transformMandatoryString(object.get(DSPACE_PROPERTY_PROVIDER_PID), builder::providerPid, context)) { context.problem() .missingProperty() - .type(DSPACE_TYPE_CONTRACT_NEGOTIATION_TERMINATION_MESSAGE) + .type(DSPACE_TYPE_CONTRACT_NEGOTIATION_TERMINATION_MESSAGE_IRI) .property(DSPACE_PROPERTY_PROVIDER_PID) .report(); return null; @@ -74,7 +74,7 @@ public JsonObjectToContractNegotiationTerminationMessageTransformer() { } else { context.problem() .unexpectedType() - .type(DSPACE_TYPE_CONTRACT_NEGOTIATION_TERMINATION_MESSAGE) + .type(DSPACE_TYPE_CONTRACT_NEGOTIATION_TERMINATION_MESSAGE_IRI) .property(DSPACE_PROPERTY_REASON) .actual(reasons.getValueType().toString()) .expected(ARRAY) diff --git a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractOfferMessageTransformer.java b/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractOfferMessageTransformer.java index ad7494a0b60..3213daa86c0 100644 --- a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractOfferMessageTransformer.java +++ b/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractOfferMessageTransformer.java @@ -26,9 +26,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.DspNegotiationPropertyAndTypeNames.DSPACE_PROPERTY_OFFER; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_OFFER_MESSAGE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CALLBACK_ADDRESS; +import static org.eclipse.edc.protocol.dsp.spi.type.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; @@ -45,7 +45,7 @@ public JsonObjectToContractOfferMessageTransformer() { public @Nullable ContractOfferMessage transform(@NotNull JsonObject jsonObject, @NotNull TransformerContext context) { var builder = ContractOfferMessage.Builder.newInstance(); if (!transformMandatoryString(jsonObject.get(DSPACE_PROPERTY_PROVIDER_PID), builder::providerPid, context)) { - reportMissingProperty(DSPACE_TYPE_CONTRACT_OFFER_MESSAGE, DSPACE_PROPERTY_PROVIDER_PID, context); + reportMissingProperty(DSPACE_TYPE_CONTRACT_OFFER_MESSAGE_IRI, DSPACE_PROPERTY_PROVIDER_PID, context); return null; } @@ -54,22 +54,22 @@ public JsonObjectToContractOfferMessageTransformer() { builder.consumerPid(transformString(consumerPid, context)); } - var callback = jsonObject.get(DSPACE_PROPERTY_CALLBACK_ADDRESS); + var callback = jsonObject.get(DSPACE_PROPERTY_CALLBACK_ADDRESS_IRI); if (callback != null) { builder.callbackAddress(transformString(callback, context)); } - var contractOffer = returnJsonObject(jsonObject.get(DSPACE_PROPERTY_OFFER), context, DSPACE_PROPERTY_OFFER, false); + var contractOffer = returnJsonObject(jsonObject.get(DSPACE_PROPERTY_OFFER_IRI), context, DSPACE_PROPERTY_OFFER_IRI, 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, DSPACE_PROPERTY_OFFER, context); + reportMissingProperty(DSPACE_TYPE_CONTRACT_OFFER_MESSAGE_IRI, DSPACE_PROPERTY_OFFER_IRI, context); return null; } var id = nodeId(contractOffer); if (id == null) { - reportMissingProperty(DSPACE_PROPERTY_OFFER, ID, context); + reportMissingProperty(DSPACE_PROPERTY_OFFER_IRI, ID, context); return null; } var offer = ContractOffer.Builder.newInstance() @@ -79,7 +79,7 @@ public JsonObjectToContractOfferMessageTransformer() { .build(); builder.contractOffer(offer); } else { - reportMissingProperty(DSPACE_TYPE_CONTRACT_OFFER_MESSAGE, DSPACE_PROPERTY_OFFER, context); + reportMissingProperty(DSPACE_TYPE_CONTRACT_OFFER_MESSAGE_IRI, DSPACE_PROPERTY_OFFER_IRI, 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/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractRequestMessageTransformer.java index 23711ee5d8a..2dace6c43af 100644 --- a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractRequestMessageTransformer.java +++ b/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractRequestMessageTransformer.java @@ -24,9 +24,9 @@ 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; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CALLBACK_ADDRESS; +import static org.eclipse.edc.protocol.dsp.spi.type.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; @@ -46,7 +46,7 @@ public JsonObjectToContractRequestMessageTransformer() { if (!transformMandatoryString(requestObject.get(DSPACE_PROPERTY_CONSUMER_PID), builder::consumerPid, context)) { context.problem() .missingProperty() - .type(DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE) + .type(DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE_IRI) .property(DSPACE_PROPERTY_CONSUMER_PID) .report(); return null; @@ -57,19 +57,19 @@ public JsonObjectToContractRequestMessageTransformer() { builder.providerPid(transformString(providerPid, context)); } - var callback = requestObject.get(DSPACE_PROPERTY_CALLBACK_ADDRESS); + var callback = requestObject.get(DSPACE_PROPERTY_CALLBACK_ADDRESS_IRI); if (callback != null) { builder.callbackAddress(transformString(callback, context)); } - var contractOffer = returnJsonObject(requestObject.get(DSPACE_PROPERTY_OFFER), context, DSPACE_PROPERTY_OFFER, false); + var contractOffer = returnJsonObject(requestObject.get(DSPACE_PROPERTY_OFFER_IRI), context, DSPACE_PROPERTY_OFFER_IRI, false); if (contractOffer != null) { var policy = transformObject(contractOffer, Policy.class, context); if (policy == null) { context.problem() .missingProperty() - .type(DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE) - .property(DSPACE_PROPERTY_OFFER) + .type(DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE_IRI) + .property(DSPACE_PROPERTY_OFFER_IRI) .report(); return null; } @@ -77,7 +77,7 @@ public JsonObjectToContractRequestMessageTransformer() { if (id == null) { context.problem() .missingProperty() - .type(DSPACE_PROPERTY_OFFER) + .type(DSPACE_PROPERTY_OFFER_IRI) .property(ID) .report(); return null; @@ -89,8 +89,8 @@ public JsonObjectToContractRequestMessageTransformer() { } else { context.problem() .missingProperty() - .type(DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE) - .property(DSPACE_PROPERTY_OFFER) + .type(DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE_IRI) + .property(DSPACE_PROPERTY_OFFER_IRI) .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/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractAgreementMessageTransformerTest.java index f65c56b478d..1c298ff4f06 100644 --- a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractAgreementMessageTransformerTest.java +++ b/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractAgreementMessageTransformerTest.java @@ -39,7 +39,7 @@ 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; +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.mockito.ArgumentMatchers.any; @@ -53,12 +53,11 @@ class JsonObjectFromContractAgreementMessageTransformerTest { + public static final String AGREEMENT_ID = UUID.randomUUID().toString(); private static final String PROVIDER_ID = "providerId"; private static final String CONSUMER_ID = "consumerId"; private static final String TIMESTAMP = "1970-01-01T00:00:00Z"; private static final String DSP = "dsp"; - public static final String AGREEMENT_ID = UUID.randomUUID().toString(); - private final JsonBuilderFactory jsonFactory = Json.createBuilderFactory(Map.of()); private final TransformerContext context = mock(); @@ -95,7 +94,7 @@ void transform() { assertThat(result).isNotNull(); assertThat(result.getString(ID)).isNotNull(); assertThat(result.getString(ID)).isNotEmpty(); - assertThat(result.getString(TYPE)).isEqualTo(DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE); + 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"); 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/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractAgreementVerificationMessageTransformerTest.java index aa42da74849..7e42185dc6e 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/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractAgreementVerificationMessageTransformerTest.java @@ -25,7 +25,7 @@ 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.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_AGREEMENT_VERIFICATION_MESSAGE; +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.mockito.ArgumentMatchers.anyString; @@ -55,7 +55,7 @@ void transform() { assertThat(result).isNotNull(); assertThat(result.getJsonString(ID).getString()).isNotEmpty(); - assertThat(result.getJsonString(TYPE).getString()).isEqualTo(DSPACE_TYPE_CONTRACT_AGREEMENT_VERIFICATION_MESSAGE); + 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"); 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/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractNegotiationEventMessageTransformerTest.java index 59b60bafa2e..f11a54b0a42 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/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractNegotiationEventMessageTransformerTest.java @@ -28,7 +28,7 @@ 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; +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; @@ -61,7 +61,7 @@ void transform() { assertThat(result).isNotNull(); assertThat(result.getString(ID)).isNotEmpty(); - assertThat(result.getString(TYPE)).isEqualTo(DSPACE_TYPE_CONTRACT_NEGOTIATION_EVENT_MESSAGE); + 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); 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/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractNegotiationTerminationMessageTransformerTest.java index 8bc222a3fb7..437719250d9 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/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractNegotiationTerminationMessageTransformerTest.java @@ -25,7 +25,7 @@ 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.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_NEGOTIATION_TERMINATION_MESSAGE; +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; 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; @@ -61,7 +61,7 @@ void transform() { assertThat(result).isNotNull(); assertThat(result.getString(ID)).isNotEmpty(); - assertThat(result.getString(TYPE)).isEqualTo(DSPACE_TYPE_CONTRACT_NEGOTIATION_TERMINATION_MESSAGE); + 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_CODE)).isEqualTo(REJECTION_CODE); 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/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractOfferMessageTransformerTest.java index 2c76131e58a..1a5173a97cb 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/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractOfferMessageTransformerTest.java @@ -30,9 +30,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.DspNegotiationPropertyAndTypeNames.DSPACE_PROPERTY_OFFER; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_OFFER_MESSAGE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CALLBACK_ADDRESS; +import static org.eclipse.edc.protocol.dsp.spi.type.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.mockito.ArgumentMatchers.any; @@ -79,11 +79,11 @@ void transform_shouldReturnJsonObject_whenValidMessage() { assertThat(result).isNotNull(); assertThat(result.getJsonString(ID).getString()).isNotEmpty(); - assertThat(result.getJsonString(TYPE).getString()).isEqualTo(DSPACE_TYPE_CONTRACT_OFFER_MESSAGE); - assertThat(result.getJsonString(DSPACE_PROPERTY_CALLBACK_ADDRESS).getString()).isEqualTo(CALLBACK_ADDRESS); - assertThat(result.getJsonObject(DSPACE_PROPERTY_OFFER)).isNotNull(); - assertThat(result.getJsonObject(DSPACE_PROPERTY_OFFER)).isNotNull(); - assertThat(result.getJsonObject(DSPACE_PROPERTY_OFFER).getJsonString(ID).getString()).isEqualTo(CONTRACT_OFFER_ID); + assertThat(result.getJsonString(TYPE).getString()).isEqualTo(DSPACE_TYPE_CONTRACT_OFFER_MESSAGE_IRI); + 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)).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"); 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/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractRequestMessageTransformerTest.java index cd81460ee1e..232edd90e49 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/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/from/JsonObjectFromContractRequestMessageTransformerTest.java @@ -30,9 +30,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.DspNegotiationPropertyAndTypeNames.DSPACE_PROPERTY_OFFER; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CALLBACK_ADDRESS; +import static org.eclipse.edc.protocol.dsp.spi.type.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.mockito.ArgumentMatchers.any; @@ -77,10 +77,10 @@ void verify_contractOffer() { assertThat(result).isNotNull(); assertThat(result.getJsonString(ID).getString()).isNotEmpty(); - assertThat(result.getJsonString(TYPE).getString()).isEqualTo(DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE); - assertThat(result.getJsonString(DSPACE_PROPERTY_CALLBACK_ADDRESS).getString()).isEqualTo(CALLBACK_ADDRESS); - assertThat(result.getJsonObject(DSPACE_PROPERTY_OFFER)).isNotNull(); - assertThat(result.getJsonObject(DSPACE_PROPERTY_OFFER).getString(ID)).isEqualTo(CONTRACT_OFFER_ID); + assertThat(result.getJsonString(TYPE).getString()).isEqualTo(DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE_IRI); + 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"); diff --git a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractAgreementMessageTransformerTest.java b/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractAgreementMessageTransformerTest.java index 590f40a8446..175dc4d53b9 100644 --- a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractAgreementMessageTransformerTest.java +++ b/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractAgreementMessageTransformerTest.java @@ -41,7 +41,7 @@ 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_TYPE_CONTRACT_AGREEMENT_MESSAGE; +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.mockito.ArgumentMatchers.any; @@ -67,6 +67,20 @@ class JsonObjectToContractAgreementMessageTransformerTest { private JsonObjectToContractAgreementMessageTransformer transformer; + private static Policy.Builder policyBuilder() { + var action = Action.Builder.newInstance().type("use").build(); + var permission = Permission.Builder.newInstance().action(action).build(); + var prohibition = Prohibition.Builder.newInstance().action(action).build(); + var duty = Duty.Builder.newInstance().action(action).build(); + return Policy.Builder.newInstance() + .permission(permission) + .prohibition(prohibition) + .assigner("assigner") + .assignee("assignee") + .duty(duty) + .target(TARGET); + } + @BeforeEach void setUp() { transformer = new JsonObjectToContractAgreementMessageTransformer(); @@ -77,7 +91,7 @@ void setUp() { void transform() { var message = jsonFactory.createObjectBuilder() .add(ID, MESSAGE_ID) - .add(TYPE, DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE) + .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() @@ -116,7 +130,7 @@ void transform_nullPolicy() { var value = "example"; var message = jsonFactory.createObjectBuilder() .add(ID, value) - .add(TYPE, DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE) + .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() @@ -148,7 +162,7 @@ void transform_invalidTimestamp() { var message = jsonFactory.createObjectBuilder() .add(ID, "messageId") - .add(TYPE, DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE) + .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) @@ -172,7 +186,7 @@ void transform_missingTimestamp() { var message = jsonFactory.createObjectBuilder() .add(ID, "messageId") - .add(TYPE, DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE) + .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) @@ -189,19 +203,5 @@ private Policy policy() { return policyBuilder().build(); } - private static Policy.Builder policyBuilder() { - var action = Action.Builder.newInstance().type("use").build(); - var permission = Permission.Builder.newInstance().action(action).build(); - var prohibition = Prohibition.Builder.newInstance().action(action).build(); - var duty = Duty.Builder.newInstance().action(action).build(); - return Policy.Builder.newInstance() - .permission(permission) - .prohibition(prohibition) - .assigner("assigner") - .assignee("assignee") - .duty(duty) - .target(TARGET); - } - } 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/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractAgreementVerificationMessageTransformerTest.java index 71e6747b8c2..da0e21100f1 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/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractAgreementVerificationMessageTransformerTest.java @@ -27,7 +27,7 @@ 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; +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.mockito.ArgumentMatchers.anyString; @@ -55,7 +55,7 @@ void setUp() { void transform() { var message = jsonFactory.createObjectBuilder() .add(JsonLdKeywords.ID, "messageId") - .add(JsonLdKeywords.TYPE, DSPACE_TYPE_CONTRACT_AGREEMENT_VERIFICATION_MESSAGE) + .add(JsonLdKeywords.TYPE, DSPACE_TYPE_CONTRACT_AGREEMENT_VERIFICATION_MESSAGE_IRI) .add(DSPACE_PROPERTY_CONSUMER_PID, "consumerPid") .add(DSPACE_PROPERTY_PROVIDER_PID, "providerPid") .build(); @@ -75,7 +75,7 @@ void transform() { void verify_failTransformWhenConsumerPidMissing() { var message = jsonFactory.createObjectBuilder() .add(JsonLdKeywords.ID, "messageId") - .add(JsonLdKeywords.TYPE, DSPACE_TYPE_CONTRACT_AGREEMENT_VERIFICATION_MESSAGE) + .add(JsonLdKeywords.TYPE, DSPACE_TYPE_CONTRACT_AGREEMENT_VERIFICATION_MESSAGE_IRI) .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/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationEventMessageTransformerTest.java index aca4217f20b..876cc20c815 100644 --- a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationEventMessageTransformerTest.java +++ b/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationEventMessageTransformerTest.java @@ -28,7 +28,7 @@ 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_TYPE_CONTRACT_NEGOTIATION_EVENT_MESSAGE; +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; @@ -57,7 +57,7 @@ void setUp() { void transform() { var message = jsonFactory.createObjectBuilder() .add(JsonLdKeywords.ID, "id1") - .add(JsonLdKeywords.TYPE, DSPACE_TYPE_CONTRACT_NEGOTIATION_EVENT_MESSAGE) + .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) @@ -79,7 +79,7 @@ void transform() { void verify_failTransformWhenProcessIdMissing() { var message = jsonFactory.createObjectBuilder() .add(JsonLdKeywords.ID, "id1") - .add(JsonLdKeywords.TYPE, DSPACE_TYPE_CONTRACT_NEGOTIATION_EVENT_MESSAGE) + .add(JsonLdKeywords.TYPE, DSPACE_TYPE_CONTRACT_NEGOTIATION_EVENT_MESSAGE_IRI) .add(DSPACE_PROPERTY_EVENT_TYPE, DSPACE_VALUE_NEGOTIATION_EVENT_TYPE_ACCEPTED) .build(); @@ -94,7 +94,7 @@ void verify_failTransformWhenProcessIdMissing() { void verify_failTransformWhenEventTypeMissing() { var message = jsonFactory.createObjectBuilder() .add(JsonLdKeywords.ID, "id1") - .add(JsonLdKeywords.TYPE, DSPACE_TYPE_CONTRACT_NEGOTIATION_EVENT_MESSAGE) + .add(JsonLdKeywords.TYPE, DSPACE_TYPE_CONTRACT_NEGOTIATION_EVENT_MESSAGE_IRI) .add(DSPACE_PROPERTY_CONSUMER_PID, "consumerPid") .add(DSPACE_PROPERTY_PROVIDER_PID, "providerPid") .build(); @@ -110,7 +110,7 @@ void verify_failTransformWhenEventTypeMissing() { void verify_failTransformWhenEventTypeInvalid() { var message = jsonFactory.createObjectBuilder() .add(JsonLdKeywords.ID, "id1") - .add(JsonLdKeywords.TYPE, DSPACE_TYPE_CONTRACT_NEGOTIATION_EVENT_MESSAGE) + .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") diff --git a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationTerminationMessageTransformerTest.java b/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationTerminationMessageTransformerTest.java index 4e635f73ff6..ff539ed8e0e 100644 --- a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationTerminationMessageTransformerTest.java +++ b/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractNegotiationTerminationMessageTransformerTest.java @@ -26,7 +26,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.eclipse.edc.jsonld.spi.Namespaces.DSPACE_SCHEMA; 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; +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; 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; @@ -52,7 +52,7 @@ void transform() { var message = jsonFactory.createObjectBuilder() .add(JsonLdKeywords.ID, "id1") - .add(JsonLdKeywords.TYPE, DSPACE_TYPE_CONTRACT_NEGOTIATION_TERMINATION_MESSAGE) + .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_CODE, CODE) @@ -78,7 +78,7 @@ void transform() { void verify_noCodeNodReason() { var message = jsonFactory.createObjectBuilder() .add(JsonLdKeywords.ID, "id1") - .add(JsonLdKeywords.TYPE, DSPACE_TYPE_CONTRACT_NEGOTIATION_TERMINATION_MESSAGE) + .add(JsonLdKeywords.TYPE, DSPACE_TYPE_CONTRACT_NEGOTIATION_TERMINATION_MESSAGE_IRI) .add(DSPACE_PROPERTY_CONSUMER_PID, "consumerPid") .add(DSPACE_PROPERTY_PROVIDER_PID, "providerPid") .build(); diff --git a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractOfferMessageTransformerTest.java b/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractOfferMessageTransformerTest.java index ace7fc5e39d..974cf430634 100644 --- a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractOfferMessageTransformerTest.java +++ b/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractOfferMessageTransformerTest.java @@ -30,9 +30,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.DspNegotiationPropertyAndTypeNames.DSPACE_PROPERTY_OFFER; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_OFFER_MESSAGE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CALLBACK_ADDRESS; +import static org.eclipse.edc.protocol.dsp.spi.type.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.mockito.ArgumentMatchers.any; @@ -65,11 +65,11 @@ void setUp() { void transform_shouldReturnMessage_whenValidJsonObject() { var message = jsonFactory.createObjectBuilder() .add(ID, MESSAGE_ID) - .add(JsonLdKeywords.TYPE, DSPACE_TYPE_CONTRACT_OFFER_MESSAGE) + .add(JsonLdKeywords.TYPE, DSPACE_TYPE_CONTRACT_OFFER_MESSAGE_IRI) .add(DSPACE_PROPERTY_CONSUMER_PID, "consumerPid") .add(DSPACE_PROPERTY_PROVIDER_PID, "providerPid") - .add(DSPACE_PROPERTY_CALLBACK_ADDRESS, CALLBACK_ADDRESS) - .add(DSPACE_PROPERTY_OFFER, jsonFactory.createObjectBuilder() + .add(DSPACE_PROPERTY_CALLBACK_ADDRESS_IRI, CALLBACK_ADDRESS) + .add(DSPACE_PROPERTY_OFFER_IRI, jsonFactory.createObjectBuilder() .add(ID, CONTRACT_OFFER_ID) .build()) .build(); @@ -99,9 +99,9 @@ void transform_shouldReturnMessage_whenValidJsonObject() { void transform_shouldReportProblem_whenMissingProcessId() { var message = jsonFactory.createObjectBuilder() .add(ID, MESSAGE_ID) - .add(JsonLdKeywords.TYPE, DSPACE_TYPE_CONTRACT_OFFER_MESSAGE) - .add(DSPACE_PROPERTY_CALLBACK_ADDRESS, CALLBACK_ADDRESS) - .add(DSPACE_PROPERTY_OFFER, jsonFactory.createObjectBuilder() + .add(JsonLdKeywords.TYPE, DSPACE_TYPE_CONTRACT_OFFER_MESSAGE_IRI) + .add(DSPACE_PROPERTY_CALLBACK_ADDRESS_IRI, CALLBACK_ADDRESS) + .add(DSPACE_PROPERTY_OFFER_IRI, jsonFactory.createObjectBuilder() .add(ID, CONTRACT_OFFER_ID) .build()) .build(); @@ -116,10 +116,10 @@ void transform_shouldReportProblem_whenMissingProcessId() { void transform_shouldReportProblem_whenMissingContractOffer() { var message = jsonFactory.createObjectBuilder() .add(ID, MESSAGE_ID) - .add(JsonLdKeywords.TYPE, DSPACE_TYPE_CONTRACT_OFFER_MESSAGE) + .add(JsonLdKeywords.TYPE, DSPACE_TYPE_CONTRACT_OFFER_MESSAGE_IRI) .add(DSPACE_PROPERTY_CONSUMER_PID, "consumerPid") .add(DSPACE_PROPERTY_PROVIDER_PID, "providerPid") - .add(DSPACE_PROPERTY_CALLBACK_ADDRESS, CALLBACK_ADDRESS) + .add(DSPACE_PROPERTY_CALLBACK_ADDRESS_IRI, CALLBACK_ADDRESS) .build(); var result = transformer.transform(message, context); @@ -132,11 +132,11 @@ void transform_shouldReportProblem_whenMissingContractOffer() { void transform_shouldReportProblem_whenMissingContractOfferId() { var message = jsonFactory.createObjectBuilder() .add(ID, MESSAGE_ID) - .add(JsonLdKeywords.TYPE, DSPACE_TYPE_CONTRACT_OFFER_MESSAGE) + .add(JsonLdKeywords.TYPE, DSPACE_TYPE_CONTRACT_OFFER_MESSAGE_IRI) .add(DSPACE_PROPERTY_CONSUMER_PID, "consumerPid") .add(DSPACE_PROPERTY_PROVIDER_PID, "providerPid") - .add(DSPACE_PROPERTY_CALLBACK_ADDRESS, CALLBACK_ADDRESS) - .add(DSPACE_PROPERTY_OFFER, jsonFactory.createObjectBuilder().build()) + .add(DSPACE_PROPERTY_CALLBACK_ADDRESS_IRI, CALLBACK_ADDRESS) + .add(DSPACE_PROPERTY_OFFER_IRI, jsonFactory.createObjectBuilder().build()) .build(); var policy = policy(); @@ -152,11 +152,11 @@ void transform_shouldReportProblem_whenMissingContractOfferId() { void transform_shouldReportProblem_whenPolicyTransformationFails() { var message = jsonFactory.createObjectBuilder() .add(ID, MESSAGE_ID) - .add(JsonLdKeywords.TYPE, DSPACE_TYPE_CONTRACT_OFFER_MESSAGE) + .add(JsonLdKeywords.TYPE, DSPACE_TYPE_CONTRACT_OFFER_MESSAGE_IRI) .add(DSPACE_PROPERTY_CONSUMER_PID, "consumerPid") .add(DSPACE_PROPERTY_PROVIDER_PID, "providerPid") - .add(DSPACE_PROPERTY_CALLBACK_ADDRESS, CALLBACK_ADDRESS) - .add(DSPACE_PROPERTY_OFFER, jsonFactory.createObjectBuilder() + .add(DSPACE_PROPERTY_CALLBACK_ADDRESS_IRI, CALLBACK_ADDRESS) + .add(DSPACE_PROPERTY_OFFER_IRI, jsonFactory.createObjectBuilder() .add(ID, CONTRACT_OFFER_ID) .build()) .build(); diff --git a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractRequestMessageTransformerTest.java b/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractRequestMessageTransformerTest.java index 490c43d170a..2c5f1a11f20 100644 --- a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractRequestMessageTransformerTest.java +++ b/data-protocols/dsp/dsp-negotiation/dsp-negotiation-transform/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/transform/to/JsonObjectToContractRequestMessageTransformerTest.java @@ -33,9 +33,9 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.eclipse.edc.jsonld.spi.PropertyAndTypeNames.ODRL_POLICY_TYPE_OFFER; import static org.eclipse.edc.protocol.dsp.negotiation.transform.to.TestInput.getExpanded; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_PROPERTY_OFFER; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CALLBACK_ADDRESS; +import static org.eclipse.edc.protocol.dsp.spi.type.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.mockito.ArgumentMatchers.any; @@ -68,11 +68,11 @@ void setUp() { void verify_usingOffer() { var message = jsonFactory.createObjectBuilder() .add(JsonLdKeywords.ID, OBJECT_ID) - .add(JsonLdKeywords.TYPE, DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE) + .add(JsonLdKeywords.TYPE, DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE_IRI) .add(DSPACE_PROPERTY_CONSUMER_PID, "consumerPid") .add(DSPACE_PROPERTY_PROVIDER_PID, "providerPid") - .add(DSPACE_PROPERTY_CALLBACK_ADDRESS, CALLBACK) - .add(DSPACE_PROPERTY_OFFER, contractOffer()) + .add(DSPACE_PROPERTY_CALLBACK_ADDRESS_IRI, CALLBACK) + .add(DSPACE_PROPERTY_OFFER_IRI, contractOffer()) .build(); when(context.transform(any(JsonObject.class), eq(Policy.class))).thenReturn(policy()); @@ -98,10 +98,10 @@ void verify_usingOffer() { void verify_noCallbackOrDatasetOk() { var message = jsonFactory.createObjectBuilder() .add(JsonLdKeywords.ID, OBJECT_ID) - .add(JsonLdKeywords.TYPE, DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE) + .add(JsonLdKeywords.TYPE, DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE_IRI) .add(DSPACE_PROPERTY_CONSUMER_PID, "consumerPid") .add(DSPACE_PROPERTY_PROVIDER_PID, "providerPid") - .add(DSPACE_PROPERTY_OFFER, contractOffer()) + .add(DSPACE_PROPERTY_OFFER_IRI, contractOffer()) .build(); when(context.transform(any(JsonObject.class), eq(Policy.class))).thenReturn(policy()); @@ -120,10 +120,10 @@ void verify_noIdContractOfferFails() { var message = jsonFactory.createObjectBuilder() .add(JsonLdKeywords.ID, OBJECT_ID) - .add(JsonLdKeywords.TYPE, DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE) + .add(JsonLdKeywords.TYPE, DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE_IRI) .add(DSPACE_PROPERTY_CONSUMER_PID, "consumerPid") .add(DSPACE_PROPERTY_PROVIDER_PID, "providerPid") - .add(DSPACE_PROPERTY_OFFER, offer) + .add(DSPACE_PROPERTY_OFFER_IRI, offer) .build(); when(context.transform(any(JsonObject.class), eq(Policy.class))).thenReturn(policy()); @@ -139,11 +139,11 @@ void verify_noIdContractOfferFails() { void transform_nullPolicyFails() { var message = jsonFactory.createObjectBuilder() .add(JsonLdKeywords.ID, OBJECT_ID) - .add(JsonLdKeywords.TYPE, DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE) + .add(JsonLdKeywords.TYPE, DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE_IRI) .add(DSPACE_PROPERTY_CONSUMER_PID, "consumerPid") .add(DSPACE_PROPERTY_PROVIDER_PID, "providerPid") - .add(DSPACE_PROPERTY_CALLBACK_ADDRESS, CALLBACK) - .add(DSPACE_PROPERTY_OFFER, contractOffer()) + .add(DSPACE_PROPERTY_CALLBACK_ADDRESS_IRI, CALLBACK) + .add(DSPACE_PROPERTY_OFFER_IRI, contractOffer()) .build(); when(context.transform(any(JsonObject.class), eq(Policy.class))).thenReturn(null); diff --git a/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-validation-lib/build.gradle.kts b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-validation-lib/build.gradle.kts new file mode 100644 index 00000000000..e9e1766c8f0 --- /dev/null +++ b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-validation-lib/build.gradle.kts @@ -0,0 +1,24 @@ +/* + * 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(":data-protocols:dsp:dsp-spi")) + implementation(project(":core:common:lib:validator-lib")) + + testImplementation(project(":core:common:junit")) +} \ No newline at end of file diff --git a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-http-api/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/http/api/validation/ContractAgreementMessageValidator.java b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-validation-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/validation/ContractAgreementMessageValidator.java similarity index 72% rename from data-protocols/dsp/dsp-negotiation/dsp-negotiation-http-api/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/http/api/validation/ContractAgreementMessageValidator.java rename to data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-validation-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/validation/ContractAgreementMessageValidator.java index 1c9cdc842e4..f3517265cff 100644 --- a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-http-api/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/http/api/validation/ContractAgreementMessageValidator.java +++ b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-validation-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/validation/ContractAgreementMessageValidator.java @@ -12,7 +12,7 @@ * */ -package org.eclipse.edc.protocol.dsp.negotiation.http.api.validation; +package org.eclipse.edc.protocol.dsp.negotiation.validation; import jakarta.json.JsonObject; import org.eclipse.edc.connector.controlplane.contract.spi.types.agreement.ContractAgreementMessage; @@ -20,15 +20,21 @@ import org.eclipse.edc.validator.jsonobject.validators.TypeIs; import org.eclipse.edc.validator.spi.Validator; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE; +import static org.eclipse.edc.jsonld.spi.Namespaces.DSPACE_SCHEMA; +import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE_TERM; /** * Validator for {@link ContractAgreementMessage} Json-LD representation */ public class ContractAgreementMessageValidator { + public static Validator instance() { + return instance(DSPACE_SCHEMA); + } + + public static Validator instance(String schema) { return JsonObjectValidator.newValidator() - .verify(path -> new TypeIs(path, DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE)) + .verify(path -> new TypeIs(path, schema + DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE_TERM)) .build(); } } diff --git a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-http-api/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/http/api/validation/ContractAgreementVerificationMessageValidator.java b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-validation-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/validation/ContractAgreementVerificationMessageValidator.java similarity index 75% rename from data-protocols/dsp/dsp-negotiation/dsp-negotiation-http-api/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/http/api/validation/ContractAgreementVerificationMessageValidator.java rename to data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-validation-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/validation/ContractAgreementVerificationMessageValidator.java index 36fd97a1389..9a3db67aa3b 100644 --- a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-http-api/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/http/api/validation/ContractAgreementVerificationMessageValidator.java +++ b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-validation-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/validation/ContractAgreementVerificationMessageValidator.java @@ -12,7 +12,7 @@ * */ -package org.eclipse.edc.protocol.dsp.negotiation.http.api.validation; +package org.eclipse.edc.protocol.dsp.negotiation.validation; import jakarta.json.JsonObject; import org.eclipse.edc.connector.controlplane.contract.spi.types.agreement.ContractAgreementVerificationMessage; @@ -20,15 +20,20 @@ import org.eclipse.edc.validator.jsonobject.validators.TypeIs; import org.eclipse.edc.validator.spi.Validator; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_AGREEMENT_VERIFICATION_MESSAGE; +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; /** * Validator for {@link ContractAgreementVerificationMessage} Json-LD representation */ public class ContractAgreementVerificationMessageValidator { public static Validator instance() { + return instance(DSPACE_SCHEMA); + } + + public static Validator instance(String schema) { return JsonObjectValidator.newValidator() - .verify(path -> new TypeIs(path, DSPACE_TYPE_CONTRACT_AGREEMENT_VERIFICATION_MESSAGE)) + .verify(path -> new TypeIs(path, schema + DSPACE_TYPE_CONTRACT_AGREEMENT_VERIFICATION_MESSAGE_TERM)) .build(); } } diff --git a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-http-api/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/http/api/validation/ContractNegotiationEventMessageValidator.java b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-validation-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/validation/ContractNegotiationEventMessageValidator.java similarity index 76% rename from data-protocols/dsp/dsp-negotiation/dsp-negotiation-http-api/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/http/api/validation/ContractNegotiationEventMessageValidator.java rename to data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-validation-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/validation/ContractNegotiationEventMessageValidator.java index 94c1965712c..28d39a7fb35 100644 --- a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-http-api/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/http/api/validation/ContractNegotiationEventMessageValidator.java +++ b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-validation-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/validation/ContractNegotiationEventMessageValidator.java @@ -12,7 +12,7 @@ * */ -package org.eclipse.edc.protocol.dsp.negotiation.http.api.validation; +package org.eclipse.edc.protocol.dsp.negotiation.validation; import jakarta.json.JsonObject; import org.eclipse.edc.connector.controlplane.contract.spi.types.agreement.ContractNegotiationEventMessage; @@ -20,15 +20,20 @@ import org.eclipse.edc.validator.jsonobject.validators.TypeIs; import org.eclipse.edc.validator.spi.Validator; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_NEGOTIATION_EVENT_MESSAGE; +import static org.eclipse.edc.jsonld.spi.Namespaces.DSPACE_SCHEMA; +import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_NEGOTIATION_EVENT_MESSAGE_TERM; /** * Validator for {@link ContractNegotiationEventMessage} Json-LD representation */ public class ContractNegotiationEventMessageValidator { public static Validator instance() { + return instance(DSPACE_SCHEMA); + } + + public static Validator instance(String schema) { return JsonObjectValidator.newValidator() - .verify(path -> new TypeIs(path, DSPACE_TYPE_CONTRACT_NEGOTIATION_EVENT_MESSAGE)) + .verify(path -> new TypeIs(path, schema + DSPACE_TYPE_CONTRACT_NEGOTIATION_EVENT_MESSAGE_TERM)) .build(); } } diff --git a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-http-api/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/http/api/validation/ContractNegotiationTerminationMessageValidator.java b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-validation-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/validation/ContractNegotiationTerminationMessageValidator.java similarity index 75% rename from data-protocols/dsp/dsp-negotiation/dsp-negotiation-http-api/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/http/api/validation/ContractNegotiationTerminationMessageValidator.java rename to data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-validation-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/validation/ContractNegotiationTerminationMessageValidator.java index 00dc6d15adc..932a7d2c77d 100644 --- a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-http-api/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/http/api/validation/ContractNegotiationTerminationMessageValidator.java +++ b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-validation-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/validation/ContractNegotiationTerminationMessageValidator.java @@ -12,7 +12,7 @@ * */ -package org.eclipse.edc.protocol.dsp.negotiation.http.api.validation; +package org.eclipse.edc.protocol.dsp.negotiation.validation; import jakarta.json.JsonObject; import org.eclipse.edc.connector.controlplane.contract.spi.types.negotiation.ContractNegotiationTerminationMessage; @@ -20,15 +20,20 @@ import org.eclipse.edc.validator.jsonobject.validators.TypeIs; import org.eclipse.edc.validator.spi.Validator; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_NEGOTIATION_TERMINATION_MESSAGE; +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; /** * Validator for {@link ContractNegotiationTerminationMessage} Json-LD representation */ public class ContractNegotiationTerminationMessageValidator { public static Validator instance() { + return instance(DSPACE_SCHEMA); + } + + public static Validator instance(String schema) { return JsonObjectValidator.newValidator() - .verify(path -> new TypeIs(path, DSPACE_TYPE_CONTRACT_NEGOTIATION_TERMINATION_MESSAGE)) + .verify(path -> new TypeIs(path, schema + DSPACE_TYPE_CONTRACT_NEGOTIATION_TERMINATION_MESSAGE_TERM)) .build(); } } diff --git a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-http-api/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/http/api/validation/ContractOfferMessageValidator.java b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-validation-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/validation/ContractOfferMessageValidator.java similarity index 72% rename from data-protocols/dsp/dsp-negotiation/dsp-negotiation-http-api/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/http/api/validation/ContractOfferMessageValidator.java rename to data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-validation-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/validation/ContractOfferMessageValidator.java index f92b6e5f986..914855b2e40 100644 --- a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-http-api/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/http/api/validation/ContractOfferMessageValidator.java +++ b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-validation-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/validation/ContractOfferMessageValidator.java @@ -12,7 +12,7 @@ * */ -package org.eclipse.edc.protocol.dsp.negotiation.http.api.validation; +package org.eclipse.edc.protocol.dsp.negotiation.validation; import jakarta.json.JsonObject; import org.eclipse.edc.connector.controlplane.contract.spi.types.negotiation.ContractOfferMessage; @@ -23,24 +23,29 @@ import org.eclipse.edc.validator.jsonobject.validators.TypeIs; import org.eclipse.edc.validator.spi.Validator; +import static org.eclipse.edc.jsonld.spi.Namespaces.DSPACE_SCHEMA; import static org.eclipse.edc.jsonld.spi.PropertyAndTypeNames.ODRL_TARGET_ATTRIBUTE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_PROPERTY_OFFER; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_OFFER_MESSAGE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CALLBACK_ADDRESS; +import static org.eclipse.edc.protocol.dsp.spi.type.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; /** * Validator for {@link ContractOfferMessage} Json-LD representation */ public class ContractOfferMessageValidator { public static Validator instance() { + return instance(DSPACE_SCHEMA); + } + + public static Validator instance(String schema) { return JsonObjectValidator.newValidator() - .verify(path -> new TypeIs(path, DSPACE_TYPE_CONTRACT_OFFER_MESSAGE)) - .verifyObject(DSPACE_PROPERTY_OFFER, v -> v + .verify(path -> new TypeIs(path, schema + DSPACE_TYPE_CONTRACT_OFFER_MESSAGE_TERM)) + .verifyObject(schema + DSPACE_PROPERTY_OFFER_TERM, v -> v .verifyId(MandatoryIdNotBlank::new) .verify(ODRL_TARGET_ATTRIBUTE, MandatoryObject::new) .verifyObject(ODRL_TARGET_ATTRIBUTE, b -> b.verifyId(MandatoryIdNotBlank::new)) ) - .verify(DSPACE_PROPERTY_CALLBACK_ADDRESS, MandatoryValue::new) + .verify(schema + DSPACE_PROPERTY_CALLBACK_ADDRESS_TERM, MandatoryValue::new) .build(); } } diff --git a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-http-api/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/http/api/validation/ContractRequestMessageValidator.java b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-validation-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/validation/ContractRequestMessageValidator.java similarity index 72% rename from data-protocols/dsp/dsp-negotiation/dsp-negotiation-http-api/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/http/api/validation/ContractRequestMessageValidator.java rename to data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-validation-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/validation/ContractRequestMessageValidator.java index 4428f901df2..e03578f7ab3 100644 --- a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-http-api/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/http/api/validation/ContractRequestMessageValidator.java +++ b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-validation-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/validation/ContractRequestMessageValidator.java @@ -12,7 +12,7 @@ * */ -package org.eclipse.edc.protocol.dsp.negotiation.http.api.validation; +package org.eclipse.edc.protocol.dsp.negotiation.validation; import jakarta.json.JsonObject; import org.eclipse.edc.connector.controlplane.contract.spi.types.negotiation.ContractRequestMessage; @@ -23,24 +23,29 @@ import org.eclipse.edc.validator.jsonobject.validators.TypeIs; import org.eclipse.edc.validator.spi.Validator; +import static org.eclipse.edc.jsonld.spi.Namespaces.DSPACE_SCHEMA; import static org.eclipse.edc.jsonld.spi.PropertyAndTypeNames.ODRL_TARGET_ATTRIBUTE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_PROPERTY_OFFER; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CALLBACK_ADDRESS; +import static org.eclipse.edc.protocol.dsp.spi.type.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; /** * Validator for {@link ContractRequestMessage} Json-LD representation */ public class ContractRequestMessageValidator { public static Validator instance() { + return instance(DSPACE_SCHEMA); + } + + public static Validator instance(String schema) { return JsonObjectValidator.newValidator() - .verify(path -> new TypeIs(path, DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE)) - .verifyObject(DSPACE_PROPERTY_OFFER, v -> v + .verify(path -> new TypeIs(path, schema + DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE_TERM)) + .verifyObject(schema + DSPACE_PROPERTY_OFFER_TERM, v -> v .verifyId(MandatoryIdNotBlank::new) .verify(ODRL_TARGET_ATTRIBUTE, MandatoryObject::new) .verifyObject(ODRL_TARGET_ATTRIBUTE, b -> b.verifyId(MandatoryIdNotBlank::new)) ) - .verify(DSPACE_PROPERTY_CALLBACK_ADDRESS, MandatoryValue::new) + .verify(schema + DSPACE_PROPERTY_CALLBACK_ADDRESS_TERM, MandatoryValue::new) .build(); } } diff --git a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-http-api/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/http/api/validation/ContractAgreementMessageValidatorTest.java b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-validation-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/validation/ContractAgreementMessageValidatorTest.java similarity index 91% rename from data-protocols/dsp/dsp-negotiation/dsp-negotiation-http-api/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/http/api/validation/ContractAgreementMessageValidatorTest.java rename to data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-validation-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/validation/ContractAgreementMessageValidatorTest.java index 70fc6e7b739..4fa925469e5 100644 --- a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-http-api/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/http/api/validation/ContractAgreementMessageValidatorTest.java +++ b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-validation-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/validation/ContractAgreementMessageValidatorTest.java @@ -12,7 +12,7 @@ * */ -package org.eclipse.edc.protocol.dsp.negotiation.http.api.validation; +package org.eclipse.edc.protocol.dsp.negotiation.validation; import jakarta.json.Json; import jakarta.json.JsonObject; @@ -25,7 +25,7 @@ import static org.assertj.core.api.InstanceOfAssertFactories.list; import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.TYPE; import static org.eclipse.edc.junit.assertions.AbstractResultAssert.assertThat; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE; +import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE_IRI; class ContractAgreementMessageValidatorTest { @@ -34,7 +34,7 @@ class ContractAgreementMessageValidatorTest { @Test void shouldSucceed_whenObjectIsValid() { var input = Json.createObjectBuilder() - .add(TYPE, Json.createArrayBuilder().add(DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE)) + .add(TYPE, Json.createArrayBuilder().add(DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE_IRI)) .build(); var result = validator.validate(input); diff --git a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-http-api/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/http/api/validation/ContractAgreementVerificationMessageValidatorTest.java b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-validation-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/validation/ContractAgreementVerificationMessageValidatorTest.java similarity index 93% rename from data-protocols/dsp/dsp-negotiation/dsp-negotiation-http-api/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/http/api/validation/ContractAgreementVerificationMessageValidatorTest.java rename to data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-validation-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/validation/ContractAgreementVerificationMessageValidatorTest.java index 42235ce548e..abbc5fd05ad 100644 --- a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-http-api/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/http/api/validation/ContractAgreementVerificationMessageValidatorTest.java +++ b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-validation-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/validation/ContractAgreementVerificationMessageValidatorTest.java @@ -12,7 +12,7 @@ * */ -package org.eclipse.edc.protocol.dsp.negotiation.http.api.validation; +package org.eclipse.edc.protocol.dsp.negotiation.validation; import jakarta.json.Json; import jakarta.json.JsonObject; @@ -25,7 +25,7 @@ import static org.assertj.core.api.InstanceOfAssertFactories.list; import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.TYPE; import static org.eclipse.edc.junit.assertions.AbstractResultAssert.assertThat; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_AGREEMENT_VERIFICATION_MESSAGE; +import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_AGREEMENT_VERIFICATION_MESSAGE_IRI; class ContractAgreementVerificationMessageValidatorTest { @@ -34,7 +34,7 @@ class ContractAgreementVerificationMessageValidatorTest { @Test void shouldSucceed_whenObjectIsValid() { var input = Json.createObjectBuilder() - .add(TYPE, Json.createArrayBuilder().add(DSPACE_TYPE_CONTRACT_AGREEMENT_VERIFICATION_MESSAGE)) + .add(TYPE, Json.createArrayBuilder().add(DSPACE_TYPE_CONTRACT_AGREEMENT_VERIFICATION_MESSAGE_IRI)) .build(); var result = validator.validate(input); diff --git a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-http-api/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/http/api/validation/ContractNegotiationEventMessageValidatorTest.java b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-validation-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/validation/ContractNegotiationEventMessageValidatorTest.java similarity index 94% rename from data-protocols/dsp/dsp-negotiation/dsp-negotiation-http-api/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/http/api/validation/ContractNegotiationEventMessageValidatorTest.java rename to data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-validation-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/validation/ContractNegotiationEventMessageValidatorTest.java index 3963e096eda..31b0f6acc6c 100644 --- a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-http-api/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/http/api/validation/ContractNegotiationEventMessageValidatorTest.java +++ b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-validation-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/validation/ContractNegotiationEventMessageValidatorTest.java @@ -12,7 +12,7 @@ * */ -package org.eclipse.edc.protocol.dsp.negotiation.http.api.validation; +package org.eclipse.edc.protocol.dsp.negotiation.validation; import jakarta.json.Json; import jakarta.json.JsonObject; @@ -25,7 +25,7 @@ import static org.assertj.core.api.InstanceOfAssertFactories.list; import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.TYPE; import static org.eclipse.edc.junit.assertions.AbstractResultAssert.assertThat; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_NEGOTIATION_EVENT_MESSAGE; +import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_NEGOTIATION_EVENT_MESSAGE_IRI; class ContractNegotiationEventMessageValidatorTest { @@ -34,7 +34,7 @@ class ContractNegotiationEventMessageValidatorTest { @Test void shouldSucceed_whenObjectIsValid() { var input = Json.createObjectBuilder() - .add(TYPE, Json.createArrayBuilder().add(DSPACE_TYPE_CONTRACT_NEGOTIATION_EVENT_MESSAGE)) + .add(TYPE, Json.createArrayBuilder().add(DSPACE_TYPE_CONTRACT_NEGOTIATION_EVENT_MESSAGE_IRI)) .build(); var result = validator.validate(input); diff --git a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-http-api/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/http/api/validation/ContractNegotiationTerminationMessageValidatorTest.java b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-validation-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/validation/ContractNegotiationTerminationMessageValidatorTest.java similarity index 93% rename from data-protocols/dsp/dsp-negotiation/dsp-negotiation-http-api/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/http/api/validation/ContractNegotiationTerminationMessageValidatorTest.java rename to data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-validation-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/validation/ContractNegotiationTerminationMessageValidatorTest.java index 1a5658953f6..3ac9600661b 100644 --- a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-http-api/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/http/api/validation/ContractNegotiationTerminationMessageValidatorTest.java +++ b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-validation-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/validation/ContractNegotiationTerminationMessageValidatorTest.java @@ -12,7 +12,7 @@ * */ -package org.eclipse.edc.protocol.dsp.negotiation.http.api.validation; +package org.eclipse.edc.protocol.dsp.negotiation.validation; import jakarta.json.Json; import jakarta.json.JsonObject; @@ -25,7 +25,7 @@ import static org.assertj.core.api.InstanceOfAssertFactories.list; import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.TYPE; import static org.eclipse.edc.junit.assertions.AbstractResultAssert.assertThat; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_NEGOTIATION_TERMINATION_MESSAGE; +import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_NEGOTIATION_TERMINATION_MESSAGE_IRI; class ContractNegotiationTerminationMessageValidatorTest { @@ -34,7 +34,7 @@ class ContractNegotiationTerminationMessageValidatorTest { @Test void shouldSucceed_whenObjectIsValid() { var input = Json.createObjectBuilder() - .add(TYPE, Json.createArrayBuilder().add(DSPACE_TYPE_CONTRACT_NEGOTIATION_TERMINATION_MESSAGE)) + .add(TYPE, Json.createArrayBuilder().add(DSPACE_TYPE_CONTRACT_NEGOTIATION_TERMINATION_MESSAGE_IRI)) .build(); var result = validator.validate(input); diff --git a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-http-api/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/http/api/validation/ContractOfferMessageValidatorTest.java b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-validation-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/validation/ContractOfferMessageValidatorTest.java similarity index 83% rename from data-protocols/dsp/dsp-negotiation/dsp-negotiation-http-api/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/http/api/validation/ContractOfferMessageValidatorTest.java rename to data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-validation-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/validation/ContractOfferMessageValidatorTest.java index 39cd93d6a4b..9d586f3d1b8 100644 --- a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-http-api/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/http/api/validation/ContractOfferMessageValidatorTest.java +++ b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-validation-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/validation/ContractOfferMessageValidatorTest.java @@ -12,7 +12,7 @@ * */ -package org.eclipse.edc.protocol.dsp.negotiation.http.api.validation; +package org.eclipse.edc.protocol.dsp.negotiation.validation; import jakarta.json.Json; import jakarta.json.JsonArrayBuilder; @@ -34,9 +34,9 @@ import static org.eclipse.edc.jsonld.spi.PropertyAndTypeNames.ODRL_POLICY_TYPE_OFFER; import static org.eclipse.edc.jsonld.spi.PropertyAndTypeNames.ODRL_TARGET_ATTRIBUTE; import static org.eclipse.edc.junit.assertions.AbstractResultAssert.assertThat; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_PROPERTY_OFFER; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_OFFER_MESSAGE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CALLBACK_ADDRESS; +import static org.eclipse.edc.protocol.dsp.spi.type.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; class ContractOfferMessageValidatorTest { @@ -45,13 +45,13 @@ class ContractOfferMessageValidatorTest { @Test void shouldSucceed_whenObjectIsValid() { var input = Json.createObjectBuilder() - .add(TYPE, Json.createArrayBuilder().add(DSPACE_TYPE_CONTRACT_OFFER_MESSAGE)) - .add(DSPACE_PROPERTY_OFFER, createArrayBuilder() + .add(TYPE, Json.createArrayBuilder().add(DSPACE_TYPE_CONTRACT_OFFER_MESSAGE_IRI)) + .add(DSPACE_PROPERTY_OFFER_IRI, createArrayBuilder() .add(createObjectBuilder() .add(TYPE, ODRL_POLICY_TYPE_OFFER) .add(ID, UUID.randomUUID().toString()) .add(ODRL_TARGET_ATTRIBUTE, id("target")))) - .add(DSPACE_PROPERTY_CALLBACK_ADDRESS, value("http://any/address")) + .add(DSPACE_PROPERTY_CALLBACK_ADDRESS_IRI, value("http://any/address")) .build(); var result = validator.validate(input); @@ -69,22 +69,22 @@ void shouldFail_whenMandatoryFieldsAreMissing() { assertThat(result).isFailed().extracting(ValidationFailure::getViolations).asInstanceOf(list(Violation.class)) .hasSize(2) .anySatisfy(violation -> assertThat(violation.path()).isEqualTo(TYPE)) - .anySatisfy(violation -> assertThat(violation.path()).isEqualTo(DSPACE_PROPERTY_CALLBACK_ADDRESS)); + .anySatisfy(violation -> assertThat(violation.path()).isEqualTo(DSPACE_PROPERTY_CALLBACK_ADDRESS_IRI)); } @Test void shouldFail_whenOfferMissesIdAndTarget() { var input = createObjectBuilder() - .add(TYPE, createArrayBuilder().add(DSPACE_TYPE_CONTRACT_OFFER_MESSAGE)) - .add(DSPACE_PROPERTY_OFFER, createArrayBuilder().add(createObjectBuilder())) - .add(DSPACE_PROPERTY_CALLBACK_ADDRESS, value("http://any/address")) + .add(TYPE, createArrayBuilder().add(DSPACE_TYPE_CONTRACT_OFFER_MESSAGE_IRI)) + .add(DSPACE_PROPERTY_OFFER_IRI, createArrayBuilder().add(createObjectBuilder())) + .add(DSPACE_PROPERTY_CALLBACK_ADDRESS_IRI, value("http://any/address")) .build(); var result = validator.validate(input); assertThat(result).isFailed().extracting(ValidationFailure::getViolations).asInstanceOf(list(Violation.class)) .hasSize(2) - .allSatisfy(violation -> assertThat(violation.path()).startsWith(DSPACE_PROPERTY_OFFER)) + .allSatisfy(violation -> assertThat(violation.path()).startsWith(DSPACE_PROPERTY_OFFER_IRI)) .anySatisfy(violation -> assertThat(violation.path()).endsWith(ID)) .anySatisfy(violation -> assertThat(violation.path()).endsWith(ODRL_TARGET_ATTRIBUTE)); } diff --git a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-http-api/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/http/api/validation/ContractRequestMessageValidatorTest.java b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-validation-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/validation/ContractRequestMessageValidatorTest.java similarity index 83% rename from data-protocols/dsp/dsp-negotiation/dsp-negotiation-http-api/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/http/api/validation/ContractRequestMessageValidatorTest.java rename to data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-validation-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/validation/ContractRequestMessageValidatorTest.java index 1050f8b16ec..c1cf13bd836 100644 --- a/data-protocols/dsp/dsp-negotiation/dsp-negotiation-http-api/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/http/api/validation/ContractRequestMessageValidatorTest.java +++ b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-validation-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/validation/ContractRequestMessageValidatorTest.java @@ -12,7 +12,7 @@ * */ -package org.eclipse.edc.protocol.dsp.negotiation.http.api.validation; +package org.eclipse.edc.protocol.dsp.negotiation.validation; import jakarta.json.JsonArrayBuilder; import jakarta.json.JsonObject; @@ -33,9 +33,9 @@ import static org.eclipse.edc.jsonld.spi.PropertyAndTypeNames.ODRL_POLICY_TYPE_OFFER; import static org.eclipse.edc.jsonld.spi.PropertyAndTypeNames.ODRL_TARGET_ATTRIBUTE; import static org.eclipse.edc.junit.assertions.AbstractResultAssert.assertThat; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_PROPERTY_OFFER; -import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CALLBACK_ADDRESS; +import static org.eclipse.edc.protocol.dsp.spi.type.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; class ContractRequestMessageValidatorTest { @@ -44,13 +44,13 @@ class ContractRequestMessageValidatorTest { @Test void shouldSucceed_whenObjectIsValid() { var input = createObjectBuilder() - .add(TYPE, createArrayBuilder().add(DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE)) - .add(DSPACE_PROPERTY_OFFER, createArrayBuilder() + .add(TYPE, createArrayBuilder().add(DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE_IRI)) + .add(DSPACE_PROPERTY_OFFER_IRI, createArrayBuilder() .add(createObjectBuilder() .add(TYPE, ODRL_POLICY_TYPE_OFFER) .add(ID, UUID.randomUUID().toString()) .add(ODRL_TARGET_ATTRIBUTE, id("target")))) - .add(DSPACE_PROPERTY_CALLBACK_ADDRESS, value("http://any/address")) + .add(DSPACE_PROPERTY_CALLBACK_ADDRESS_IRI, value("http://any/address")) .build(); var result = validator.validate(input); @@ -68,30 +68,30 @@ void shouldFail_whenMandatoryFieldsAreMissing() { assertThat(result).isFailed().extracting(ValidationFailure::getViolations).asInstanceOf(list(Violation.class)) .hasSize(2) .anySatisfy(violation -> assertThat(violation.path()).isEqualTo(TYPE)) - .anySatisfy(violation -> assertThat(violation.path()).isEqualTo(DSPACE_PROPERTY_CALLBACK_ADDRESS)); - } - - private JsonArrayBuilder value(String value) { - return createArrayBuilder().add(createObjectBuilder().add(VALUE, value)); + .anySatisfy(violation -> assertThat(violation.path()).isEqualTo(DSPACE_PROPERTY_CALLBACK_ADDRESS_IRI)); } @Test void shouldFail_whenOfferMissesIdAndTarget() { var input = createObjectBuilder() - .add(TYPE, createArrayBuilder().add(DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE)) - .add(DSPACE_PROPERTY_OFFER, createArrayBuilder().add(createObjectBuilder())) - .add(DSPACE_PROPERTY_CALLBACK_ADDRESS, value("http://any/address")) + .add(TYPE, createArrayBuilder().add(DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE_IRI)) + .add(DSPACE_PROPERTY_OFFER_IRI, createArrayBuilder().add(createObjectBuilder())) + .add(DSPACE_PROPERTY_CALLBACK_ADDRESS_IRI, value("http://any/address")) .build(); var result = validator.validate(input); assertThat(result).isFailed().extracting(ValidationFailure::getViolations).asInstanceOf(list(Violation.class)) .hasSize(2) - .allSatisfy(violation -> assertThat(violation.path()).startsWith(DSPACE_PROPERTY_OFFER)) + .allSatisfy(violation -> assertThat(violation.path()).startsWith(DSPACE_PROPERTY_OFFER_IRI)) .anySatisfy(violation -> assertThat(violation.path()).endsWith(ID)) .anySatisfy(violation -> assertThat(violation.path()).endsWith(ODRL_TARGET_ATTRIBUTE)); } + private JsonArrayBuilder value(String value) { + return createArrayBuilder().add(createObjectBuilder().add(VALUE, value)); + } + private JsonArrayBuilder id(String id) { return createArrayBuilder().add(createObjectBuilder().add(ID, id)); } diff --git a/data-protocols/dsp/dsp-spi/src/main/java/org/eclipse/edc/protocol/dsp/spi/type/DspCatalogPropertyAndTypeNames.java b/data-protocols/dsp/dsp-spi/src/main/java/org/eclipse/edc/protocol/dsp/spi/type/DspCatalogPropertyAndTypeNames.java index aba1faf445b..e2cf3007e17 100644 --- a/data-protocols/dsp/dsp-spi/src/main/java/org/eclipse/edc/protocol/dsp/spi/type/DspCatalogPropertyAndTypeNames.java +++ b/data-protocols/dsp/dsp-spi/src/main/java/org/eclipse/edc/protocol/dsp/spi/type/DspCatalogPropertyAndTypeNames.java @@ -21,9 +21,11 @@ */ public interface DspCatalogPropertyAndTypeNames { - String DSPACE_TYPE_CATALOG_REQUEST_MESSAGE = DSPACE_SCHEMA + "CatalogRequestMessage"; + String DSPACE_TYPE_CATALOG_REQUEST_MESSAGE_TERM = "CatalogRequestMessage"; + String DSPACE_TYPE_CATALOG_REQUEST_MESSAGE_IRI = DSPACE_SCHEMA + DSPACE_TYPE_CATALOG_REQUEST_MESSAGE_TERM; String DSPACE_TYPE_CATALOG_ERROR = DSPACE_SCHEMA + "CatalogError"; - String DSPACE_PROPERTY_FILTER = DSPACE_SCHEMA + "filter"; + String DSPACE_PROPERTY_FILTER_TERM = "filter"; + String DSPACE_PROPERTY_FILTER_IRI = DSPACE_SCHEMA + DSPACE_PROPERTY_FILTER_TERM; } 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 b86bf8faa97..7a78e00d80a 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 @@ -24,19 +24,24 @@ public interface DspNegotiationPropertyAndTypeNames { String DSPACE_TYPE_CONTRACT_NEGOTIATION_ERROR = DSPACE_SCHEMA + "ContractNegotiationError"; // messages - - String DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE = DSPACE_SCHEMA + "ContractRequestMessage"; - String DSPACE_TYPE_CONTRACT_OFFER_MESSAGE = DSPACE_SCHEMA + "ContractOfferMessage"; - String DSPACE_TYPE_CONTRACT_NEGOTIATION_EVENT_MESSAGE = DSPACE_SCHEMA + "ContractNegotiationEventMessage"; - String DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE = DSPACE_SCHEMA + "ContractAgreementMessage"; - String DSPACE_TYPE_CONTRACT_AGREEMENT_VERIFICATION_MESSAGE = DSPACE_SCHEMA + "ContractAgreementVerificationMessage"; - String DSPACE_TYPE_CONTRACT_NEGOTIATION_TERMINATION_MESSAGE = DSPACE_SCHEMA + "ContractNegotiationTerminationMessage"; + String DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE_TERM = "ContractRequestMessage"; + String DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE_IRI = DSPACE_SCHEMA + DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE_TERM; + String DSPACE_TYPE_CONTRACT_OFFER_MESSAGE_TERM = "ContractOfferMessage"; + String DSPACE_TYPE_CONTRACT_OFFER_MESSAGE_IRI = DSPACE_SCHEMA + DSPACE_TYPE_CONTRACT_OFFER_MESSAGE_TERM; + String DSPACE_TYPE_CONTRACT_NEGOTIATION_EVENT_MESSAGE_TERM = "ContractNegotiationEventMessage"; + String DSPACE_TYPE_CONTRACT_NEGOTIATION_EVENT_MESSAGE_IRI = DSPACE_SCHEMA + DSPACE_TYPE_CONTRACT_NEGOTIATION_EVENT_MESSAGE_TERM; + String DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE_TERM = "ContractAgreementMessage"; + String DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE_IRI = DSPACE_SCHEMA + DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE_TERM; + String DSPACE_TYPE_CONTRACT_AGREEMENT_VERIFICATION_MESSAGE_TERM = "ContractAgreementVerificationMessage"; + String DSPACE_TYPE_CONTRACT_AGREEMENT_VERIFICATION_MESSAGE_IRI = DSPACE_SCHEMA + DSPACE_TYPE_CONTRACT_AGREEMENT_VERIFICATION_MESSAGE_TERM; + String DSPACE_TYPE_CONTRACT_NEGOTIATION_TERMINATION_MESSAGE_TERM = "ContractNegotiationTerminationMessage"; + 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_OFFER = DSPACE_SCHEMA + "offer"; + 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"; 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 1e8dd0c92ab..b793d5d9c63 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 @@ -26,6 +26,7 @@ public interface DspPropertyAndTypeNames { String DSPACE_PROPERTY_CONSUMER_PID = DSPACE_SCHEMA + "consumerPid"; String DSPACE_PROPERTY_PROVIDER_PID = DSPACE_SCHEMA + "providerPid"; String DSPACE_PROPERTY_PROCESS_ID = DSPACE_SCHEMA + "processId"; - String DSPACE_PROPERTY_CALLBACK_ADDRESS = DSPACE_SCHEMA + "callbackAddress"; + 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"; } diff --git a/data-protocols/dsp/dsp-spi/src/main/java/org/eclipse/edc/protocol/dsp/spi/type/DspTransferProcessPropertyAndTypeNames.java b/data-protocols/dsp/dsp-spi/src/main/java/org/eclipse/edc/protocol/dsp/spi/type/DspTransferProcessPropertyAndTypeNames.java index fc7d32ceabc..ee5e0530cf2 100644 --- a/data-protocols/dsp/dsp-spi/src/main/java/org/eclipse/edc/protocol/dsp/spi/type/DspTransferProcessPropertyAndTypeNames.java +++ b/data-protocols/dsp/dsp-spi/src/main/java/org/eclipse/edc/protocol/dsp/spi/type/DspTransferProcessPropertyAndTypeNames.java @@ -21,11 +21,15 @@ */ public interface DspTransferProcessPropertyAndTypeNames { - String DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE = DSPACE_SCHEMA + "TransferRequestMessage"; - String DSPACE_TYPE_TRANSFER_START_MESSAGE = DSPACE_SCHEMA + "TransferStartMessage"; - String DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE = DSPACE_SCHEMA + "TransferCompletionMessage"; + String DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE_TERM = DSPACE_SCHEMA + "TransferRequestMessage"; + String DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE_IRI = DSPACE_SCHEMA + DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE_TERM; + String DSPACE_TYPE_TRANSFER_START_MESSAGE_TERM = "TransferStartMessage"; + String DSPACE_TYPE_TRANSFER_START_MESSAGE_IRI = DSPACE_SCHEMA + DSPACE_TYPE_TRANSFER_START_MESSAGE_TERM; + String DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE_TERM = "TransferCompletionMessage"; + String DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE_IRI = DSPACE_SCHEMA + DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE_TERM; String DSPACE_TYPE_TRANSFER_SUSPENSION_MESSAGE = DSPACE_SCHEMA + "TransferSuspensionMessage"; - String DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE = DSPACE_SCHEMA + "TransferTerminationMessage"; + String DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE_TERM = "TransferTerminationMessage"; + String DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE_IRI = DSPACE_SCHEMA + DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE_TERM; String DSPACE_TYPE_TRANSFER_PROCESS = DSPACE_SCHEMA + "TransferProcess"; String DSPACE_TYPE_TRANSFER_ERROR = DSPACE_SCHEMA + "TransferError"; diff --git a/data-protocols/dsp/dsp-transfer-process/build.gradle.kts b/data-protocols/dsp/dsp-transfer-process/build.gradle.kts index cec0dd20412..dca105cc8f3 100644 --- a/data-protocols/dsp/dsp-transfer-process/build.gradle.kts +++ b/data-protocols/dsp/dsp-transfer-process/build.gradle.kts @@ -21,4 +21,5 @@ dependencies { api(project(":data-protocols:dsp:dsp-transfer-process:dsp-transfer-process-http-api")) api(project(":data-protocols:dsp:dsp-transfer-process:dsp-transfer-process-http-dispatcher")) api(project(":data-protocols:dsp:dsp-transfer-process:dsp-transfer-process-transform")) + api(project(":data-protocols:dsp:dsp-transfer-process:lib:dsp-transfer-process-validation-lib")) } diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-http-api/build.gradle.kts b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-http-api/build.gradle.kts index 15a263764c7..2ad64e51bf9 100644 --- a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-http-api/build.gradle.kts +++ b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-http-api/build.gradle.kts @@ -25,7 +25,7 @@ dependencies { api(project(":data-protocols:dsp:dsp-http-spi")) implementation(project(":spi:common:json-ld-spi")) - implementation(project(":core:common:lib:validator-lib")) + implementation(project(":data-protocols:dsp:dsp-transfer-process:lib:dsp-transfer-process-validation-lib")) implementation(libs.jakarta.rsApi) diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-http-api/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/http/api/DspTransferProcessApiExtension.java b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-http-api/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/http/api/DspTransferProcessApiExtension.java index 696ad8f4799..19f7cf84280 100644 --- a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-http-api/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/http/api/DspTransferProcessApiExtension.java +++ b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-http-api/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/http/api/DspTransferProcessApiExtension.java @@ -19,10 +19,10 @@ import org.eclipse.edc.protocol.dsp.http.spi.message.DspRequestHandler; import org.eclipse.edc.protocol.dsp.transferprocess.http.api.controller.DspTransferProcessApiController; import org.eclipse.edc.protocol.dsp.transferprocess.http.api.controller.DspTransferProcessApiController20241; -import org.eclipse.edc.protocol.dsp.transferprocess.http.api.validation.TransferCompletionMessageValidator; -import org.eclipse.edc.protocol.dsp.transferprocess.http.api.validation.TransferRequestMessageValidator; -import org.eclipse.edc.protocol.dsp.transferprocess.http.api.validation.TransferStartMessageValidator; -import org.eclipse.edc.protocol.dsp.transferprocess.http.api.validation.TransferTerminationMessageValidator; +import org.eclipse.edc.protocol.dsp.transferprocess.validation.TransferCompletionMessageValidator; +import org.eclipse.edc.protocol.dsp.transferprocess.validation.TransferRequestMessageValidator; +import org.eclipse.edc.protocol.dsp.transferprocess.validation.TransferStartMessageValidator; +import org.eclipse.edc.protocol.dsp.transferprocess.validation.TransferTerminationMessageValidator; import org.eclipse.edc.runtime.metamodel.annotation.Extension; import org.eclipse.edc.runtime.metamodel.annotation.Inject; import org.eclipse.edc.spi.system.ServiceExtension; @@ -31,10 +31,10 @@ import org.eclipse.edc.web.spi.WebService; import org.eclipse.edc.web.spi.configuration.ApiContext; -import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_START_MESSAGE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE; +import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE_IRI; +import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE_IRI; +import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_START_MESSAGE_IRI; +import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE_IRI; import static org.eclipse.edc.protocol.dsp.spi.version.DspVersions.V_08; import static org.eclipse.edc.protocol.dsp.spi.version.DspVersions.V_2024_1; @@ -58,10 +58,10 @@ public class DspTransferProcessApiExtension implements ServiceExtension { @Override public void initialize(ServiceExtensionContext context) { - validatorRegistry.register(DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE, TransferRequestMessageValidator.instance()); - validatorRegistry.register(DSPACE_TYPE_TRANSFER_START_MESSAGE, TransferStartMessageValidator.instance()); - validatorRegistry.register(DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE, TransferCompletionMessageValidator.instance()); - validatorRegistry.register(DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE, TransferTerminationMessageValidator.instance()); + validatorRegistry.register(DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE_IRI, TransferRequestMessageValidator.instance()); + validatorRegistry.register(DSPACE_TYPE_TRANSFER_START_MESSAGE_IRI, TransferStartMessageValidator.instance()); + validatorRegistry.register(DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE_IRI, TransferCompletionMessageValidator.instance()); + validatorRegistry.register(DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE_IRI, TransferTerminationMessageValidator.instance()); webService.registerResource(ApiContext.PROTOCOL, new DspTransferProcessApiController(transferProcessProtocolService, dspRequestHandler)); webService.registerResource(ApiContext.PROTOCOL, new DspTransferProcessApiController20241(transferProcessProtocolService, dspRequestHandler)); diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-http-api/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/http/api/controller/DspTransferProcessApiController.java b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-http-api/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/http/api/controller/DspTransferProcessApiController.java index 04c9dcc471f..832b0cc53f5 100644 --- a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-http-api/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/http/api/controller/DspTransferProcessApiController.java +++ b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-http-api/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/http/api/controller/DspTransferProcessApiController.java @@ -38,11 +38,11 @@ import static jakarta.ws.rs.core.HttpHeaders.AUTHORIZATION; import static org.eclipse.edc.protocol.dsp.http.spi.types.HttpMessageProtocol.DATASPACE_PROTOCOL_HTTP; -import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_START_MESSAGE; +import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE_IRI; +import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE_IRI; +import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_START_MESSAGE_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; +import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE_IRI; import static org.eclipse.edc.protocol.dsp.transferprocess.http.api.TransferProcessApiPaths.BASE_PATH; import static org.eclipse.edc.protocol.dsp.transferprocess.http.api.TransferProcessApiPaths.TRANSFER_COMPLETION; import static org.eclipse.edc.protocol.dsp.transferprocess.http.api.TransferProcessApiPaths.TRANSFER_INITIAL_REQUEST; @@ -106,7 +106,7 @@ public Response initiateTransferProcess(JsonObject jsonObject, @HeaderParam(AUTH var request = PostDspRequest.Builder.newInstance(TransferRequestMessage.class, TransferProcess.class, TransferError.class) .message(jsonObject) .token(token) - .expectedMessageType(DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE) + .expectedMessageType(DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE_IRI) .serviceCall(protocolService::notifyRequested) .errorProvider(TransferError.Builder::newInstance) .protocol(protocol) @@ -128,7 +128,7 @@ public Response initiateTransferProcess(JsonObject jsonObject, @HeaderParam(AUTH public Response transferProcessStart(@PathParam("id") String id, JsonObject jsonObject, @HeaderParam(AUTHORIZATION) String token) { var request = PostDspRequest.Builder.newInstance(TransferStartMessage.class, TransferProcess.class, TransferError.class) .processId(id) - .expectedMessageType(DSPACE_TYPE_TRANSFER_START_MESSAGE) + .expectedMessageType(DSPACE_TYPE_TRANSFER_START_MESSAGE_IRI) .message(jsonObject) .token(token) .serviceCall(protocolService::notifyStarted) @@ -152,7 +152,7 @@ public Response transferProcessStart(@PathParam("id") String id, JsonObject json public Response transferProcessCompletion(@PathParam("id") String id, JsonObject jsonObject, @HeaderParam(AUTHORIZATION) String token) { var request = PostDspRequest.Builder.newInstance(TransferCompletionMessage.class, TransferProcess.class, TransferError.class) .processId(id) - .expectedMessageType(DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE) + .expectedMessageType(DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE_IRI) .message(jsonObject) .token(token) .serviceCall(protocolService::notifyCompleted) @@ -176,7 +176,7 @@ public Response transferProcessCompletion(@PathParam("id") String id, JsonObject public Response transferProcessTermination(@PathParam("id") String id, JsonObject jsonObject, @HeaderParam(AUTHORIZATION) String token) { var request = PostDspRequest.Builder.newInstance(TransferTerminationMessage.class, TransferProcess.class, TransferError.class) .processId(id) - .expectedMessageType(DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE) + .expectedMessageType(DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE_IRI) .message(jsonObject) .token(token) .serviceCall(protocolService::notifyTerminated) diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-http-api/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/http/api/DspTransferProcessApiExtensionTest.java b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-http-api/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/http/api/DspTransferProcessApiExtensionTest.java index 91d9210ea7c..1668a9f1bf2 100644 --- a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-http-api/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/http/api/DspTransferProcessApiExtensionTest.java +++ b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-http-api/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/http/api/DspTransferProcessApiExtensionTest.java @@ -21,10 +21,10 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; -import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_START_MESSAGE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE; +import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE_IRI; +import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE_IRI; +import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_START_MESSAGE_IRI; +import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE_IRI; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.mock; @@ -44,10 +44,10 @@ void setUp(ServiceExtensionContext context) { void shouldRegisterMessageValidators(DspTransferProcessApiExtension extension, ServiceExtensionContext context) { extension.initialize(context); - verify(validatorRegistry).register(eq(DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE), any()); - verify(validatorRegistry).register(eq(DSPACE_TYPE_TRANSFER_START_MESSAGE), any()); - verify(validatorRegistry).register(eq(DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE), any()); - verify(validatorRegistry).register(eq(DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE), any()); + verify(validatorRegistry).register(eq(DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE_IRI), any()); + verify(validatorRegistry).register(eq(DSPACE_TYPE_TRANSFER_START_MESSAGE_IRI), any()); + verify(validatorRegistry).register(eq(DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE_IRI), any()); + verify(validatorRegistry).register(eq(DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE_IRI), any()); } } diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-http-api/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/http/api/controller/DspTransferProcessApiControllerTest.java b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-http-api/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/http/api/controller/DspTransferProcessApiControllerTest.java index 0f6d6f2c04b..00cea4a6941 100644 --- a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-http-api/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/http/api/controller/DspTransferProcessApiControllerTest.java +++ b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-http-api/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/http/api/controller/DspTransferProcessApiControllerTest.java @@ -46,11 +46,11 @@ import static jakarta.ws.rs.core.MediaType.APPLICATION_JSON_TYPE; 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.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_START_MESSAGE; +import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE_IRI; +import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE_IRI; +import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_START_MESSAGE_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; +import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE_IRI; import static org.eclipse.edc.protocol.dsp.transferprocess.http.api.TransferProcessApiPaths.BASE_PATH; import static org.eclipse.edc.protocol.dsp.transferprocess.http.api.TransferProcessApiPaths.TRANSFER_COMPLETION; import static org.eclipse.edc.protocol.dsp.transferprocess.http.api.TransferProcessApiPaths.TRANSFER_INITIAL_REQUEST; @@ -95,7 +95,7 @@ void initiateTransferProcess_shouldCreateResource() { var result = baseRequest() .contentType(MediaType.APPLICATION_JSON) - .body(Json.createObjectBuilder().add(TYPE, DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE).build()) + .body(Json.createObjectBuilder().add(TYPE, DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE_IRI).build()) .post(BASE_PATH + TRANSFER_INITIAL_REQUEST) .then() .statusCode(200) @@ -110,7 +110,7 @@ void initiateTransferProcess_shouldCreateResource() { assertThat(request.getInputClass()).isEqualTo(TransferRequestMessage.class); assertThat(request.getResultClass()).isEqualTo(TransferProcess.class); assertThat(request.getMessage()).isNotNull(); - assertThat(request.getExpectedMessageType()).isEqualTo(DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE); + assertThat(request.getExpectedMessageType()).isEqualTo(DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE_IRI); } /** @@ -163,11 +163,11 @@ public Stream provideArguments(ExtensionContext context) { Arguments.of( BASE_PATH + PROCESS_ID + TRANSFER_START, TransferStartMessage.class, - DSPACE_TYPE_TRANSFER_START_MESSAGE), + DSPACE_TYPE_TRANSFER_START_MESSAGE_IRI), Arguments.of( BASE_PATH + PROCESS_ID + TRANSFER_COMPLETION, TransferCompletionMessage.class, - DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE), + DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE_IRI), Arguments.of( BASE_PATH + PROCESS_ID + TRANSFER_SUSPENSION, TransferSuspensionMessage.class, @@ -175,7 +175,7 @@ public Stream provideArguments(ExtensionContext context) { Arguments.of( BASE_PATH + PROCESS_ID + TRANSFER_TERMINATION, TransferTerminationMessage.class, - DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE) + DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE_IRI) ); } } 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 eb9c70854d3..20d4b6134d1 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 @@ -26,7 +26,7 @@ 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.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE; +import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE_IRI; public class JsonObjectFromTransferCompletionMessageTransformer extends AbstractJsonLdTransformer { @@ -42,7 +42,7 @@ public JsonObjectFromTransferCompletionMessageTransformer(JsonBuilderFactory jso public @Nullable JsonObject transform(@NotNull TransferCompletionMessage transferCompletionMessage, @NotNull TransformerContext context) { return jsonBuilderFactory.createObjectBuilder() .add(ID, transferCompletionMessage.getId()) - .add(TYPE, DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE) + .add(TYPE, DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE_IRI) .add(DSPACE_PROPERTY_CONSUMER_PID, transferCompletionMessage.getConsumerPid()) .add(DSPACE_PROPERTY_PROVIDER_PID, 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/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 bc9866e349b..33c94c5fcf4 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 @@ -27,11 +27,11 @@ 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.PropertyAndTypeNames.DCT_FORMAT_ATTRIBUTE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CALLBACK_ADDRESS; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_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.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; +import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE_IRI; public class JsonObjectFromTransferRequestMessageTransformer extends AbstractJsonLdTransformer { @@ -50,10 +50,10 @@ public JsonObjectFromTransferRequestMessageTransformer(JsonBuilderFactory jsonBu var builder = jsonBuilderFactory.createObjectBuilder() .add(ID, transferRequestMessage.getId()) - .add(TYPE, DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE) + .add(TYPE, DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE_IRI) .add(DSPACE_PROPERTY_CONTRACT_AGREEMENT_ID, transferRequestMessage.getContractId()) .add(DCT_FORMAT_ATTRIBUTE, format) - .add(DSPACE_PROPERTY_CALLBACK_ADDRESS, transferRequestMessage.getCallbackAddress()) + .add(DSPACE_PROPERTY_CALLBACK_ADDRESS_IRI, transferRequestMessage.getCallbackAddress()) .add(DSPACE_PROPERTY_CONSUMER_PID, transferRequestMessage.getConsumerPid()); if (transferRequestMessage.getDataDestination() != null && transferRequestMessage.getDataDestination().getProperties().size() > 1) { 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 b991041e85d..19cac8951ab 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 @@ -27,7 +27,7 @@ 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.DspTransferProcessPropertyAndTypeNames.DSPACE_PROPERTY_DATA_ADDRESS; -import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_START_MESSAGE; +import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_START_MESSAGE_IRI; public class JsonObjectFromTransferStartMessageTransformer extends AbstractJsonLdTransformer { @@ -42,7 +42,7 @@ public JsonObjectFromTransferStartMessageTransformer(JsonBuilderFactory jsonBuil public @Nullable JsonObject transform(@NotNull TransferStartMessage transferStartMessage, @NotNull TransformerContext context) { var builder = jsonBuilderFactory.createObjectBuilder() .add(ID, transferStartMessage.getId()) - .add(TYPE, DSPACE_TYPE_TRANSFER_START_MESSAGE) + .add(TYPE, DSPACE_TYPE_TRANSFER_START_MESSAGE_IRI) .add(DSPACE_PROPERTY_PROVIDER_PID, transferStartMessage.getProviderPid()) .add(DSPACE_PROPERTY_CONSUMER_PID, transferStartMessage.getConsumerPid()); 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 eea1ea253fd..b4569753b53 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 @@ -28,7 +28,7 @@ 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; -import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE; +import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE_IRI; public class JsonObjectFromTransferTerminationMessageTransformer extends AbstractJsonLdTransformer { @@ -43,7 +43,7 @@ public JsonObjectFromTransferTerminationMessageTransformer(JsonBuilderFactory js public @Nullable JsonObject transform(@NotNull TransferTerminationMessage transferTerminationMessage, @NotNull TransformerContext context) { var builder = jsonBuilderFactory.createObjectBuilder() .add(ID, transferTerminationMessage.getId()) - .add(TYPE, DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE) + .add(TYPE, DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE_IRI) .add(DSPACE_PROPERTY_CONSUMER_PID, transferTerminationMessage.getConsumerPid()) .add(DSPACE_PROPERTY_PROVIDER_PID, transferTerminationMessage.getProviderPid()); 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 47e3a9db634..907d53ce32d 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 @@ -23,7 +23,7 @@ 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.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE; +import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE_IRI; public class JsonObjectToTransferCompletionMessageTransformer extends AbstractJsonLdTransformer { @@ -38,7 +38,7 @@ public JsonObjectToTransferCompletionMessageTransformer() { if (!transformMandatoryString(messageObject.get(DSPACE_PROPERTY_CONSUMER_PID), builder::consumerPid, context)) { context.problem() .missingProperty() - .type(DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE) + .type(DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE_IRI) .property(DSPACE_PROPERTY_CONSUMER_PID) .report(); return null; @@ -47,7 +47,7 @@ public JsonObjectToTransferCompletionMessageTransformer() { if (!transformMandatoryString(messageObject.get(DSPACE_PROPERTY_PROVIDER_PID), builder::providerPid, context)) { context.problem() .missingProperty() - .type(DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE) + .type(DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE_IRI) .property(DSPACE_PROPERTY_PROVIDER_PID) .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/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 536e9f6284a..8838819c6ce 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 @@ -23,11 +23,11 @@ import org.jetbrains.annotations.Nullable; 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; +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.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; +import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE_IRI; public class JsonObjectToTransferRequestMessageTransformer extends AbstractJsonLdTransformer { @@ -42,7 +42,7 @@ public JsonObjectToTransferRequestMessageTransformer() { if (!transformMandatoryString(messageObject.get(DSPACE_PROPERTY_CONSUMER_PID), builder::consumerPid, context)) { context.problem() .missingProperty() - .type(DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE) + .type(DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE_IRI) .property(DSPACE_PROPERTY_CONSUMER_PID) .report(); return null; @@ -50,8 +50,9 @@ public JsonObjectToTransferRequestMessageTransformer() { visitProperties(messageObject, k -> switch (k) { case DSPACE_PROPERTY_CONTRACT_AGREEMENT_ID -> v -> builder.contractId(transformString(v, context)); - case DSPACE_PROPERTY_CALLBACK_ADDRESS -> v -> builder.callbackAddress(transformString(v, context)); - case DSPACE_PROPERTY_DATA_ADDRESS -> v -> builder.dataDestination(transformObject(v, DataAddress.class, context)); + case DSPACE_PROPERTY_CALLBACK_ADDRESS_IRI -> v -> builder.callbackAddress(transformString(v, context)); + case DSPACE_PROPERTY_DATA_ADDRESS -> + v -> builder.dataDestination(transformObject(v, DataAddress.class, context)); case DCT_FORMAT_ATTRIBUTE -> v -> builder.transferType(transformString(v, context)); default -> doNothing(); }); 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 9e6309bc6ad..dc4e6317990 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 @@ -25,7 +25,7 @@ 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.DspTransferProcessPropertyAndTypeNames.DSPACE_PROPERTY_DATA_ADDRESS; -import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_START_MESSAGE; +import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_START_MESSAGE_IRI; public class JsonObjectToTransferStartMessageTransformer extends AbstractJsonLdTransformer { @@ -40,7 +40,7 @@ public JsonObjectToTransferStartMessageTransformer() { if (!transformMandatoryString(messageObject.get(DSPACE_PROPERTY_CONSUMER_PID), builder::consumerPid, context)) { context.problem() .missingProperty() - .type(DSPACE_TYPE_TRANSFER_START_MESSAGE) + .type(DSPACE_TYPE_TRANSFER_START_MESSAGE_IRI) .property(DSPACE_PROPERTY_CONSUMER_PID) .report(); return null; @@ -49,7 +49,7 @@ public JsonObjectToTransferStartMessageTransformer() { if (!transformMandatoryString(messageObject.get(DSPACE_PROPERTY_PROVIDER_PID), builder::providerPid, context)) { context.problem() .missingProperty() - .type(DSPACE_TYPE_TRANSFER_START_MESSAGE) + .type(DSPACE_TYPE_TRANSFER_START_MESSAGE_IRI) .property(DSPACE_PROPERTY_PROVIDER_PID) .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 6bee59caf24..6b4dcd4b31b 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 @@ -34,7 +34,7 @@ import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_REASON; import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_SUSPENSION_MESSAGE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE; +import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE_IRI; public class JsonObjectToTransferSuspensionMessageTransformer extends AbstractJsonLdTransformer { @@ -78,7 +78,7 @@ public JsonObjectToTransferSuspensionMessageTransformer(ObjectMapper objectMappe } else { context.problem() .unexpectedType() - .type(DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE) + .type(DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE_IRI) .property(DSPACE_PROPERTY_REASON) .actual(reasons.getValueType()) .expected(ARRAY) 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 b555f7e8895..a9f4cd23f3e 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 @@ -27,7 +27,7 @@ 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; -import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE; +import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE_IRI; public class JsonObjectToTransferTerminationMessageTransformer extends AbstractJsonLdTransformer { @@ -42,7 +42,7 @@ public JsonObjectToTransferTerminationMessageTransformer() { if (!transformMandatoryString(messageObject.get(DSPACE_PROPERTY_CONSUMER_PID), builder::consumerPid, context)) { context.problem() .missingProperty() - .type(DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE) + .type(DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE_IRI) .property(DSPACE_PROPERTY_CONSUMER_PID) .report(); return null; @@ -51,7 +51,7 @@ public JsonObjectToTransferTerminationMessageTransformer() { if (!transformMandatoryString(messageObject.get(DSPACE_PROPERTY_PROVIDER_PID), builder::providerPid, context)) { context.problem() .missingProperty() - .type(DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE) + .type(DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE_IRI) .property(DSPACE_PROPERTY_PROVIDER_PID) .report(); return null; @@ -66,7 +66,7 @@ public JsonObjectToTransferTerminationMessageTransformer() { if (!(reasons instanceof JsonArray)) { context.problem() .unexpectedType() - .type(DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE) + .type(DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE_IRI) .property(DSPACE_PROPERTY_REASON) .actual(reasons.getValueType()) .expected(ARRAY) 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 fbbf085d27e..9e6b478e40c 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 @@ -27,7 +27,7 @@ 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.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE; +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; import static org.mockito.Mockito.never; @@ -54,7 +54,7 @@ void transformTransferCompletionMessage() { var result = transformer.transform(message, context); assertThat(result).isNotNull(); - assertThat(result.getString(JsonLdKeywords.TYPE)).isEqualTo(DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE); + 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"); 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 bcb4c53f942..54eb8335f3f 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 @@ -29,11 +29,11 @@ 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; +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.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; +import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE_IRI; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.ArgumentMatchers.isA; @@ -81,10 +81,10 @@ void transformTransferRequestMessageWithDataAddress() { var result = transformer.transform(message, context); assertThat(result).isNotNull(); - assertThat(result.getJsonString(JsonLdKeywords.TYPE).getString()).isEqualTo(DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE); + assertThat(result.getJsonString(JsonLdKeywords.TYPE).getString()).isEqualTo(DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE_IRI); 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).getString()).isEqualTo(callbackAddress); + assertThat(result.getJsonString(DSPACE_PROPERTY_CALLBACK_ADDRESS_IRI).getString()).isEqualTo(callbackAddress); assertThat(result.getJsonString(DSPACE_PROPERTY_CONSUMER_PID).getString()).isEqualTo("consumerPid"); assertThat(result.getJsonObject(DSPACE_PROPERTY_DATA_ADDRESS).getString("keyName")).isEqualTo(dataAddressKey); @@ -105,10 +105,10 @@ void transformTransferRequestMessageWithoutDataAddress() { var result = transformer.transform(message, context); assertThat(result).isNotNull(); - assertThat(result.getJsonString(JsonLdKeywords.TYPE).getString()).isEqualTo(DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE); + assertThat(result.getJsonString(JsonLdKeywords.TYPE).getString()).isEqualTo(DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE_IRI); 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).getString()).isEqualTo(callbackAddress); + assertThat(result.getJsonString(DSPACE_PROPERTY_CALLBACK_ADDRESS_IRI).getString()).isEqualTo(callbackAddress); assertThat(result.getJsonObject(DSPACE_PROPERTY_DATA_ADDRESS)).isEqualTo(null); verify(context, never()).reportProblem(anyString()); @@ -129,10 +129,10 @@ void transformTransferRequestMessageWithTransferType() { var result = transformer.transform(message, context); assertThat(result).isNotNull(); - assertThat(result.getJsonString(JsonLdKeywords.TYPE).getString()).isEqualTo(DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE); + assertThat(result.getJsonString(JsonLdKeywords.TYPE).getString()).isEqualTo(DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE_IRI); assertThat(result.getJsonString(DSPACE_PROPERTY_CONTRACT_AGREEMENT_ID).getString()).isEqualTo(contractId); assertThat(result.getJsonString(DCT_FORMAT_ATTRIBUTE).getString()).isEqualTo(transferType); - assertThat(result.getJsonString(DSPACE_PROPERTY_CALLBACK_ADDRESS).getString()).isEqualTo(callbackAddress); + assertThat(result.getJsonString(DSPACE_PROPERTY_CALLBACK_ADDRESS_IRI).getString()).isEqualTo(callbackAddress); assertThat(result.getJsonObject(DSPACE_PROPERTY_DATA_ADDRESS)).isEqualTo(null); 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 d362a1b7c73..2992b3b822b 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 @@ -30,7 +30,7 @@ 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.DspTransferProcessPropertyAndTypeNames.DSPACE_PROPERTY_DATA_ADDRESS; -import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_START_MESSAGE; +import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_START_MESSAGE_IRI; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; @@ -62,7 +62,7 @@ void transformTransferStartMessage() { var result = transformer.transform(message, context); assertThat(result).isNotNull(); - assertThat(result.getString(JsonLdKeywords.TYPE)).isEqualTo(DSPACE_TYPE_TRANSFER_START_MESSAGE); + 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.getJsonObject(DSPACE_PROPERTY_DATA_ADDRESS)).isEqualTo(dataAddressJson); 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 2362134803d..9485fa891e9 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 @@ -29,7 +29,7 @@ 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; -import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE; +import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE_IRI; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; @@ -57,7 +57,7 @@ void transformTransferTerminationMessage() { var result = transformer.transform(message, context); assertThat(result).isNotNull(); - assertThat(result.getJsonString(JsonLdKeywords.TYPE).getString()).isEqualTo(DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE); + 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_CODE).getString()).isEqualTo("testCode"); 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 3e389675131..ad0cd99cc0d 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 @@ -24,7 +24,7 @@ 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.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE; +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; import static org.mockito.Mockito.mock; @@ -42,7 +42,7 @@ class JsonObjectToTransferCompletionMessageTransformerTest { @Test void shouldTransform() { var json = Json.createObjectBuilder() - .add(TYPE, DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE) + .add(TYPE, DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE_IRI) .add(DSPACE_PROPERTY_PROVIDER_PID, "providerPid") .add(DSPACE_PROPERTY_CONSUMER_PID, "consumerPid") .build(); @@ -60,7 +60,7 @@ void shouldTransform() { void shouldReportError_whenConsumerPidAndProviderPidNotSet() { when(context.problem()).thenReturn(new ProblemBuilder(context)); var json = Json.createObjectBuilder() - .add(TYPE, DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE) + .add(TYPE, DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE_IRI) .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/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 cdf5604bbc8..e101dc6500b 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 @@ -25,11 +25,11 @@ import static org.assertj.core.api.Assertions.assertThat; 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; +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.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; +import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE_IRI; import static org.eclipse.edc.protocol.dsp.transferprocess.transform.to.TestInput.getExpanded; import static org.eclipse.edc.spi.constants.CoreConstants.EDC_NAMESPACE; import static org.mockito.ArgumentMatchers.any; @@ -54,10 +54,10 @@ class JsonObjectToTransferRequestMessageTransformerTest { @Test void jsonObjectToTransferRequestWithoutDataAddress() { var json = Json.createObjectBuilder() - .add(TYPE, DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE) + .add(TYPE, DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE_IRI) .add(DSPACE_PROPERTY_CONTRACT_AGREEMENT_ID, contractId) .add(DCT_FORMAT_ATTRIBUTE, destinationType) - .add(DSPACE_PROPERTY_CALLBACK_ADDRESS, callbackAddress) + .add(DSPACE_PROPERTY_CALLBACK_ADDRESS_IRI, callbackAddress) .add(DSPACE_PROPERTY_CONSUMER_PID, "processId") .build(); @@ -78,11 +78,11 @@ void jsonObjectToTransferRequestWithDataAddress() { var dataDestination = DataAddress.Builder.newInstance().type("any").build(); when(context.transform(any(), eq(DataAddress.class))).thenReturn(dataDestination); var json = Json.createObjectBuilder() - .add(TYPE, DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE) + .add(TYPE, DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE_IRI) .add(DSPACE_PROPERTY_CONTRACT_AGREEMENT_ID, contractId) .add(DCT_FORMAT_ATTRIBUTE, destinationType) .add(DSPACE_PROPERTY_DATA_ADDRESS, createDataAddress()) - .add(DSPACE_PROPERTY_CALLBACK_ADDRESS, callbackAddress) + .add(DSPACE_PROPERTY_CALLBACK_ADDRESS_IRI, callbackAddress) .add(DSPACE_PROPERTY_CONSUMER_PID, "processId") .build(); @@ -101,11 +101,11 @@ void jsonObjectToTransferRequestWithDataAddress() { void shouldReturnNullAndReportError_whenConsumerPidNotSet() { when(context.problem()).thenReturn(new ProblemBuilder(context)); var json = Json.createObjectBuilder() - .add(TYPE, DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE) + .add(TYPE, DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE_IRI) .add(DSPACE_PROPERTY_CONTRACT_AGREEMENT_ID, contractId) .add(DCT_FORMAT_ATTRIBUTE, destinationType) .add(DSPACE_PROPERTY_DATA_ADDRESS, Json.createObjectBuilder().build()) - .add(DSPACE_PROPERTY_CALLBACK_ADDRESS, callbackAddress) + .add(DSPACE_PROPERTY_CALLBACK_ADDRESS_IRI, callbackAddress) .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 f95dd367940..80a6dd3bdaf 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 @@ -27,7 +27,7 @@ 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.DspTransferProcessPropertyAndTypeNames.DSPACE_PROPERTY_DATA_ADDRESS; -import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_START_MESSAGE; +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; import static org.eclipse.edc.spi.constants.CoreConstants.EDC_NAMESPACE; import static org.mockito.ArgumentMatchers.anyString; @@ -48,7 +48,7 @@ class JsonObjectToTransferStartMessageTransformerTest { @Test void jsonObjectToTransferStartMessage() { var json = Json.createObjectBuilder() - .add(TYPE, DSPACE_TYPE_TRANSFER_START_MESSAGE) + .add(TYPE, DSPACE_TYPE_TRANSFER_START_MESSAGE_IRI) .add(DSPACE_PROPERTY_CONSUMER_PID, "consumerPid") .add(DSPACE_PROPERTY_PROVIDER_PID, "providerPid") .build(); @@ -66,7 +66,7 @@ void jsonObjectToTransferStartMessage() { void shouldReturnNullAndReportError_whenConsumerAndProviderPidNotValid() { when(context.problem()).thenReturn(new ProblemBuilder(context)); var json = Json.createObjectBuilder() - .add(TYPE, DSPACE_TYPE_TRANSFER_START_MESSAGE) + .add(TYPE, DSPACE_TYPE_TRANSFER_START_MESSAGE_IRI) .build(); var result = transformer.transform(getExpanded(json), context); @@ -79,7 +79,7 @@ void shouldReturnNullAndReportError_whenConsumerAndProviderPidNotValid() { void jsonObjectToTransferStartMessageWithDataAddress() { var dataAddressObject = Json.createObjectBuilder().add(EDC_NAMESPACE + "type", "AWS").build(); var json = Json.createObjectBuilder() - .add(TYPE, DSPACE_TYPE_TRANSFER_START_MESSAGE) + .add(TYPE, DSPACE_TYPE_TRANSFER_START_MESSAGE_IRI) .add(DSPACE_PROPERTY_CONSUMER_PID, "consumerPid") .add(DSPACE_PROPERTY_PROVIDER_PID, "providerPid") .add(DSPACE_PROPERTY_DATA_ADDRESS, dataAddressObject) @@ -100,7 +100,7 @@ void jsonObjectToTransferStartMessageWithDataAddress() { @Test void jsonObjectToTransferStartMessageWithEmptyDataAddress() { var json = Json.createObjectBuilder() - .add(TYPE, DSPACE_TYPE_TRANSFER_START_MESSAGE) + .add(TYPE, DSPACE_TYPE_TRANSFER_START_MESSAGE_IRI) .add(DSPACE_PROPERTY_CONSUMER_PID, "consumerPid") .add(DSPACE_PROPERTY_PROVIDER_PID, "providerPid") .add(DSPACE_PROPERTY_DATA_ADDRESS, Json.createObjectBuilder().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/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 f82cc9acb49..9567941ac33 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 @@ -30,7 +30,7 @@ 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; -import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE; +import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE_IRI; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; @@ -49,7 +49,7 @@ void shouldTransform() { var reasonArray = Json.createBuilderFactory(Map.of()).createArrayBuilder().add(reason).build(); var json = Json.createObjectBuilder() - .add(TYPE, DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE) + .add(TYPE, DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE_IRI) .add(DSPACE_PROPERTY_CONSUMER_PID, "consumerPid") .add(DSPACE_PROPERTY_PROVIDER_PID, "providerPid") .add(DSPACE_PROPERTY_CODE, "testCode") @@ -75,7 +75,7 @@ void shouldReportError_whenMissingPids() { var reasonArray = Json.createBuilderFactory(Map.of()).createArrayBuilder().add(reason).build(); var json = Json.createObjectBuilder() - .add(TYPE, DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE) + .add(TYPE, DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE_IRI) .add(DSPACE_PROPERTY_CODE, "testCode") .add(DSPACE_PROPERTY_REASON, Json.createBuilderFactory(Map.of()).createArrayBuilder().add(reasonArray).build()) .build(); diff --git a/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-validation-lib/build.gradle.kts b/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-validation-lib/build.gradle.kts new file mode 100644 index 00000000000..e9e1766c8f0 --- /dev/null +++ b/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-validation-lib/build.gradle.kts @@ -0,0 +1,24 @@ +/* + * 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(":data-protocols:dsp:dsp-spi")) + implementation(project(":core:common:lib:validator-lib")) + + testImplementation(project(":core:common:junit")) +} \ No newline at end of file diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-http-api/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/http/api/validation/TransferCompletionMessageValidator.java b/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-validation-lib/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/validation/TransferCompletionMessageValidator.java similarity index 76% rename from data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-http-api/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/http/api/validation/TransferCompletionMessageValidator.java rename to data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-validation-lib/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/validation/TransferCompletionMessageValidator.java index ef2a4a85b4a..e7cca2b8744 100644 --- a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-http-api/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/http/api/validation/TransferCompletionMessageValidator.java +++ b/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-validation-lib/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/validation/TransferCompletionMessageValidator.java @@ -12,7 +12,7 @@ * */ -package org.eclipse.edc.protocol.dsp.transferprocess.http.api.validation; +package org.eclipse.edc.protocol.dsp.transferprocess.validation; import jakarta.json.JsonObject; import org.eclipse.edc.connector.controlplane.transfer.spi.types.protocol.TransferCompletionMessage; @@ -20,15 +20,21 @@ import org.eclipse.edc.validator.jsonobject.validators.TypeIs; import org.eclipse.edc.validator.spi.Validator; -import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE; +import static org.eclipse.edc.jsonld.spi.Namespaces.DSPACE_SCHEMA; +import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE_TERM; /** * Validator for {@link TransferCompletionMessage} Json-LD representation */ public class TransferCompletionMessageValidator { + public static Validator instance() { + return instance(DSPACE_SCHEMA); + } + + public static Validator instance(String schema) { return JsonObjectValidator.newValidator() - .verify(path -> new TypeIs(path, DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE)) + .verify(path -> new TypeIs(path, schema + DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE_TERM)) .build(); } } diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-http-api/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/http/api/validation/TransferRequestMessageValidator.java b/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-validation-lib/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/validation/TransferRequestMessageValidator.java similarity index 72% rename from data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-http-api/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/http/api/validation/TransferRequestMessageValidator.java rename to data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-validation-lib/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/validation/TransferRequestMessageValidator.java index b7aa44cbb19..029f4caf3ed 100644 --- a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-http-api/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/http/api/validation/TransferRequestMessageValidator.java +++ b/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-validation-lib/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/validation/TransferRequestMessageValidator.java @@ -12,7 +12,7 @@ * */ -package org.eclipse.edc.protocol.dsp.transferprocess.http.api.validation; +package org.eclipse.edc.protocol.dsp.transferprocess.validation; import jakarta.json.JsonObject; import org.eclipse.edc.connector.controlplane.transfer.spi.types.protocol.TransferRequestMessage; @@ -20,15 +20,21 @@ import org.eclipse.edc.validator.jsonobject.validators.TypeIs; import org.eclipse.edc.validator.spi.Validator; -import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE; +import static org.eclipse.edc.jsonld.spi.Namespaces.DSPACE_SCHEMA; +import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE_TERM; /** * Validator for {@link TransferRequestMessage} Json-LD representation */ public class TransferRequestMessageValidator { + public static Validator instance() { + return instance(DSPACE_SCHEMA); + } + + public static Validator instance(String schema) { return JsonObjectValidator.newValidator() - .verify(path -> new TypeIs(path, DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE)) + .verify(path -> new TypeIs(path, schema + DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE_TERM)) .build(); } } diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-http-api/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/http/api/validation/TransferStartMessageValidator.java b/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-validation-lib/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/validation/TransferStartMessageValidator.java similarity index 72% rename from data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-http-api/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/http/api/validation/TransferStartMessageValidator.java rename to data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-validation-lib/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/validation/TransferStartMessageValidator.java index 4d0f73c9638..dadf2a57788 100644 --- a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-http-api/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/http/api/validation/TransferStartMessageValidator.java +++ b/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-validation-lib/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/validation/TransferStartMessageValidator.java @@ -12,7 +12,7 @@ * */ -package org.eclipse.edc.protocol.dsp.transferprocess.http.api.validation; +package org.eclipse.edc.protocol.dsp.transferprocess.validation; import jakarta.json.JsonObject; import org.eclipse.edc.connector.controlplane.transfer.spi.types.protocol.TransferStartMessage; @@ -20,15 +20,21 @@ import org.eclipse.edc.validator.jsonobject.validators.TypeIs; import org.eclipse.edc.validator.spi.Validator; -import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_START_MESSAGE; +import static org.eclipse.edc.jsonld.spi.Namespaces.DSPACE_SCHEMA; +import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_START_MESSAGE_TERM; /** * Validator for {@link TransferStartMessage} Json-LD representation */ public class TransferStartMessageValidator { + public static Validator instance() { + return instance(DSPACE_SCHEMA); + } + + public static Validator instance(String schema) { return JsonObjectValidator.newValidator() - .verify(path -> new TypeIs(path, DSPACE_TYPE_TRANSFER_START_MESSAGE)) + .verify(path -> new TypeIs(path, schema + DSPACE_TYPE_TRANSFER_START_MESSAGE_TERM)) .build(); } } diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-http-api/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/http/api/validation/TransferTerminationMessageValidator.java b/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-validation-lib/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/validation/TransferTerminationMessageValidator.java similarity index 76% rename from data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-http-api/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/http/api/validation/TransferTerminationMessageValidator.java rename to data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-validation-lib/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/validation/TransferTerminationMessageValidator.java index 080bcdbfef2..7a8f5f16913 100644 --- a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-http-api/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/http/api/validation/TransferTerminationMessageValidator.java +++ b/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-validation-lib/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/validation/TransferTerminationMessageValidator.java @@ -12,7 +12,7 @@ * */ -package org.eclipse.edc.protocol.dsp.transferprocess.http.api.validation; +package org.eclipse.edc.protocol.dsp.transferprocess.validation; import jakarta.json.JsonObject; import org.eclipse.edc.connector.controlplane.transfer.spi.types.protocol.TransferTerminationMessage; @@ -20,15 +20,21 @@ import org.eclipse.edc.validator.jsonobject.validators.TypeIs; import org.eclipse.edc.validator.spi.Validator; -import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE; +import static org.eclipse.edc.jsonld.spi.Namespaces.DSPACE_SCHEMA; +import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE_TERM; /** * Validator for {@link TransferTerminationMessage} Json-LD representation */ public class TransferTerminationMessageValidator { + public static Validator instance() { + return instance(DSPACE_SCHEMA); + } + + public static Validator instance(String schema) { return JsonObjectValidator.newValidator() - .verify(path -> new TypeIs(path, DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE)) + .verify(path -> new TypeIs(path, schema + DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE_TERM)) .build(); } } diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-http-api/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/http/api/validation/TransferCompletionMessageValidatorTest.java b/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-validation-lib/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/validation/TransferCompletionMessageValidatorTest.java similarity index 94% rename from data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-http-api/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/http/api/validation/TransferCompletionMessageValidatorTest.java rename to data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-validation-lib/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/validation/TransferCompletionMessageValidatorTest.java index c60f4a6d491..c54844963fd 100644 --- a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-http-api/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/http/api/validation/TransferCompletionMessageValidatorTest.java +++ b/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-validation-lib/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/validation/TransferCompletionMessageValidatorTest.java @@ -12,7 +12,7 @@ * */ -package org.eclipse.edc.protocol.dsp.transferprocess.http.api.validation; +package org.eclipse.edc.protocol.dsp.transferprocess.validation; import jakarta.json.Json; import jakarta.json.JsonObject; @@ -25,7 +25,7 @@ import static org.assertj.core.api.InstanceOfAssertFactories.list; import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.TYPE; import static org.eclipse.edc.junit.assertions.AbstractResultAssert.assertThat; -import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE; +import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE_IRI; class TransferCompletionMessageValidatorTest { @@ -34,7 +34,7 @@ class TransferCompletionMessageValidatorTest { @Test void shouldSucceed_whenObjectIsValid() { var input = Json.createObjectBuilder() - .add(TYPE, Json.createArrayBuilder().add(DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE)) + .add(TYPE, Json.createArrayBuilder().add(DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE_IRI)) .build(); var result = validator.validate(input); diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-http-api/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/http/api/validation/TransferRequestMessageValidatorTest.java b/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-validation-lib/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/validation/TransferRequestMessageValidatorTest.java similarity index 91% rename from data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-http-api/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/http/api/validation/TransferRequestMessageValidatorTest.java rename to data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-validation-lib/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/validation/TransferRequestMessageValidatorTest.java index 7c0f1b0cfa7..dbdb9f4f0d8 100644 --- a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-http-api/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/http/api/validation/TransferRequestMessageValidatorTest.java +++ b/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-validation-lib/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/validation/TransferRequestMessageValidatorTest.java @@ -12,7 +12,7 @@ * */ -package org.eclipse.edc.protocol.dsp.transferprocess.http.api.validation; +package org.eclipse.edc.protocol.dsp.transferprocess.validation; import jakarta.json.Json; import jakarta.json.JsonObject; @@ -25,7 +25,7 @@ import static org.assertj.core.api.InstanceOfAssertFactories.list; import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.TYPE; import static org.eclipse.edc.junit.assertions.AbstractResultAssert.assertThat; -import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE; +import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE_IRI; class TransferRequestMessageValidatorTest { @@ -34,7 +34,7 @@ class TransferRequestMessageValidatorTest { @Test void shouldSucceed_whenObjectIsValid() { var input = Json.createObjectBuilder() - .add(TYPE, Json.createArrayBuilder().add(DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE)) + .add(TYPE, Json.createArrayBuilder().add(DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE_IRI)) .build(); var result = validator.validate(input); diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-http-api/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/http/api/validation/TransferStartMessageValidatorTest.java b/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-validation-lib/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/validation/TransferStartMessageValidatorTest.java similarity index 91% rename from data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-http-api/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/http/api/validation/TransferStartMessageValidatorTest.java rename to data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-validation-lib/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/validation/TransferStartMessageValidatorTest.java index f0af1436a7e..74725635a17 100644 --- a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-http-api/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/http/api/validation/TransferStartMessageValidatorTest.java +++ b/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-validation-lib/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/validation/TransferStartMessageValidatorTest.java @@ -12,7 +12,7 @@ * */ -package org.eclipse.edc.protocol.dsp.transferprocess.http.api.validation; +package org.eclipse.edc.protocol.dsp.transferprocess.validation; import jakarta.json.Json; import jakarta.json.JsonObject; @@ -25,7 +25,7 @@ import static org.assertj.core.api.InstanceOfAssertFactories.list; import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.TYPE; import static org.eclipse.edc.junit.assertions.AbstractResultAssert.assertThat; -import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_START_MESSAGE; +import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_START_MESSAGE_IRI; class TransferStartMessageValidatorTest { @@ -34,7 +34,7 @@ class TransferStartMessageValidatorTest { @Test void shouldSucceed_whenObjectIsValid() { var input = Json.createObjectBuilder() - .add(TYPE, Json.createArrayBuilder().add(DSPACE_TYPE_TRANSFER_START_MESSAGE)) + .add(TYPE, Json.createArrayBuilder().add(DSPACE_TYPE_TRANSFER_START_MESSAGE_IRI)) .build(); var result = validator.validate(input); diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-http-api/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/http/api/validation/TransferTerminationMessageValidatorTest.java b/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-validation-lib/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/validation/TransferTerminationMessageValidatorTest.java similarity index 94% rename from data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-http-api/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/http/api/validation/TransferTerminationMessageValidatorTest.java rename to data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-validation-lib/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/validation/TransferTerminationMessageValidatorTest.java index 7160a87d652..eb469b8c81b 100644 --- a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-http-api/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/http/api/validation/TransferTerminationMessageValidatorTest.java +++ b/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-validation-lib/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/validation/TransferTerminationMessageValidatorTest.java @@ -12,7 +12,7 @@ * */ -package org.eclipse.edc.protocol.dsp.transferprocess.http.api.validation; +package org.eclipse.edc.protocol.dsp.transferprocess.validation; import jakarta.json.Json; import jakarta.json.JsonObject; @@ -25,7 +25,7 @@ import static org.assertj.core.api.InstanceOfAssertFactories.list; import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.TYPE; import static org.eclipse.edc.junit.assertions.AbstractResultAssert.assertThat; -import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE; +import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE_IRI; class TransferTerminationMessageValidatorTest { @@ -34,7 +34,7 @@ class TransferTerminationMessageValidatorTest { @Test void shouldSucceed_whenObjectIsValid() { var input = Json.createObjectBuilder() - .add(TYPE, Json.createArrayBuilder().add(DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE)) + .add(TYPE, Json.createArrayBuilder().add(DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE_IRI)) .build(); var result = validator.validate(input); diff --git a/settings.gradle.kts b/settings.gradle.kts index 44c688fac76..9c17d4fc8de 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -84,17 +84,20 @@ include(":data-protocols:dsp:dsp-catalog") include(":data-protocols:dsp:dsp-catalog:dsp-catalog-http-api") include(":data-protocols:dsp:dsp-catalog:dsp-catalog-http-dispatcher") include(":data-protocols:dsp:dsp-catalog:dsp-catalog-transform") +include(":data-protocols:dsp:dsp-catalog:lib:dsp-catalog-validation-lib") include(":data-protocols:dsp:dsp-spi") include(":data-protocols:dsp:dsp-negotiation") 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-http-core") include(":data-protocols:dsp:dsp-http-spi") include(":data-protocols:dsp:dsp-transfer-process") include(":data-protocols:dsp:dsp-transfer-process:dsp-transfer-process-http-api") include(":data-protocols:dsp:dsp-transfer-process:dsp-transfer-process-http-dispatcher") include(":data-protocols:dsp:dsp-transfer-process:dsp-transfer-process-transform") +include(":data-protocols:dsp:dsp-transfer-process:lib:dsp-transfer-process-validation-lib") include(":data-protocols:dsp:dsp-version:dsp-version-http-api") // modules for technology- or cloud-provider extensions -------------------------------------------- diff --git a/system-tests/protocol-test/src/test/java/org/eclipse/edc/test/e2e/protocol/DspCatalogApiEndToEndTest.java b/system-tests/protocol-test/src/test/java/org/eclipse/edc/test/e2e/protocol/DspCatalogApiEndToEndTest.java index 7e0d5ce551a..7dbeb87a4c8 100644 --- a/system-tests/protocol-test/src/test/java/org/eclipse/edc/test/e2e/protocol/DspCatalogApiEndToEndTest.java +++ b/system-tests/protocol-test/src/test/java/org/eclipse/edc/test/e2e/protocol/DspCatalogApiEndToEndTest.java @@ -45,8 +45,8 @@ import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.TYPE; 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.DspCatalogPropertyAndTypeNames.DSPACE_PROPERTY_FILTER; -import static org.eclipse.edc.protocol.dsp.spi.type.DspCatalogPropertyAndTypeNames.DSPACE_TYPE_CATALOG_REQUEST_MESSAGE; +import static org.eclipse.edc.protocol.dsp.spi.type.DspCatalogPropertyAndTypeNames.DSPACE_PROPERTY_FILTER_IRI; +import static org.eclipse.edc.protocol.dsp.spi.type.DspCatalogPropertyAndTypeNames.DSPACE_TYPE_CATALOG_REQUEST_MESSAGE_IRI; import static org.eclipse.edc.protocol.dsp.spi.version.DspVersions.V_2024_1; import static org.eclipse.edc.spi.constants.CoreConstants.EDC_NAMESPACE; import static org.hamcrest.CoreMatchers.containsString; @@ -85,7 +85,7 @@ void shouldExposeVersion2024_1() { .header("Authorization", "{\"region\": \"any\", \"audience\": \"any\", \"clientId\":\"any\"}") .body(createObjectBuilder() .add(CONTEXT, createObjectBuilder().add(VOCAB, EDC_NAMESPACE)) - .add(TYPE, DSPACE_TYPE_CATALOG_REQUEST_MESSAGE) + .add(TYPE, DSPACE_TYPE_CATALOG_REQUEST_MESSAGE_IRI) .build()) .post("/2024/1/catalog/request") .then() @@ -118,8 +118,8 @@ void shouldPermitPaginationWithLinkHeader() { .header("Authorization", "{\"region\": \"any\", \"audience\": \"any\", \"clientId\":\"any\"}") .body(createObjectBuilder() .add(CONTEXT, createObjectBuilder().add(VOCAB, EDC_NAMESPACE)) - .add(TYPE, DSPACE_TYPE_CATALOG_REQUEST_MESSAGE) - .add(DSPACE_PROPERTY_FILTER, Json.createObjectBuilder() + .add(TYPE, DSPACE_TYPE_CATALOG_REQUEST_MESSAGE_IRI) + .add(DSPACE_PROPERTY_FILTER_IRI, Json.createObjectBuilder() .add("offset", 0) .add("limit", 5)) .build()) @@ -143,7 +143,7 @@ void shouldPermitPaginationWithLinkHeader() { .header("Authorization", "{\"region\": \"any\", \"audience\": \"any\", \"clientId\":\"any\"}") .body(createObjectBuilder() .add(CONTEXT, createObjectBuilder().add(VOCAB, EDC_NAMESPACE)) - .add(TYPE, DSPACE_TYPE_CATALOG_REQUEST_MESSAGE) + .add(TYPE, DSPACE_TYPE_CATALOG_REQUEST_MESSAGE_IRI) .build() ) .post(nextPageUrl) @@ -170,7 +170,7 @@ void catalogRequest_shouldReturnError_whenNotAuthorized() { .header("Authorization", authorizationHeader) .body(createObjectBuilder() .add(CONTEXT, createObjectBuilder().add(VOCAB, EDC_NAMESPACE)) - .add(TYPE, DSPACE_TYPE_CATALOG_REQUEST_MESSAGE) + .add(TYPE, DSPACE_TYPE_CATALOG_REQUEST_MESSAGE_IRI) .build()) .post("/catalog/request") .then() @@ -193,7 +193,7 @@ void catalogRequest_shouldReturnError_whenMissingToken() { .contentType(JSON) .body(createObjectBuilder() .add(CONTEXT, createObjectBuilder().add(VOCAB, EDC_NAMESPACE)) - .add(TYPE, DSPACE_TYPE_CATALOG_REQUEST_MESSAGE) + .add(TYPE, DSPACE_TYPE_CATALOG_REQUEST_MESSAGE_IRI) .build()) .post("/catalog/request") .then()