From ff29df56ace587ee722e9a3576d6aa9a2c920349 Mon Sep 17 00:00:00 2001 From: Enrico Risa Date: Mon, 14 Oct 2024 10:57:27 +0200 Subject: [PATCH 1/5] refactor: extract dsp catalog validation lib --- data-protocols/dsp/dsp-catalog/build.gradle.kts | 1 + .../dsp-catalog-http-api/build.gradle.kts | 1 + .../http/api/DspCatalogApiExtension.java | 6 +++--- .../api/controller/DspCatalogApiController.java | 4 ++-- .../decorator/ContinuationTokenManagerImpl.java | 14 +++++++------- .../http/api/DspCatalogApiExtensionTest.java | 4 ++-- .../controller/DspCatalogApiControllerTest.java | 10 +++++----- .../ContinuationTokenManagerImplTest.java | 4 ++-- ...ectFromCatalogRequestMessageTransformer.java | 8 ++++---- ...bjectToCatalogRequestMessageTransformer.java | 4 ++-- ...romCatalogRequestMessageTransformerTest.java | 8 ++++---- ...tToCatalogRequestMessageTransformerTest.java | 8 ++++---- .../dsp-catalog-validation-lib/build.gradle.kts | 10 ++++++++++ .../CatalogRequestMessageValidator.java | 17 +++++++++++------ .../CatalogRequestMessageValidatorTest.java | 12 ++++++------ .../type/DspCatalogPropertyAndTypeNames.java | 6 ++++-- settings.gradle.kts | 1 + .../e2e/protocol/DspCatalogApiEndToEndTest.java | 16 ++++++++-------- 18 files changed, 77 insertions(+), 57 deletions(-) create mode 100644 data-protocols/dsp/dsp-catalog/lib/dsp-catalog-validation-lib/build.gradle.kts rename data-protocols/dsp/dsp-catalog/{dsp-catalog-http-api/src/main/java/org/eclipse/edc/protocol/dsp/catalog/http/api => lib/dsp-catalog-validation-lib/src/main/java/org/eclipse/edc/protocol/dsp/catalog}/validation/CatalogRequestMessageValidator.java (61%) rename data-protocols/dsp/dsp-catalog/{dsp-catalog-http-api/src/test/java/org/eclipse/edc/protocol/dsp/catalog/http/api => lib/dsp-catalog-validation-lib/src/test/java/org/eclipse/edc/protocol/dsp/catalog}/validation/CatalogRequestMessageValidatorTest.java (76%) 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..f32c7b6cfda 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 @@ -25,6 +25,7 @@ dependencies { 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..aede9501265 --- /dev/null +++ b/data-protocols/dsp/dsp-catalog/lib/dsp-catalog-validation-lib/build.gradle.kts @@ -0,0 +1,10 @@ +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 61% 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..868bdcf48c9 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 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) * * This program and the accompanying materials are made available under the * terms of the Apache License, Version 2.0 which is available at @@ -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 76% 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..e56cecb4dce 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 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) * * This program and the accompanying materials are made available under the * terms of the Apache License, Version 2.0 which is available at @@ -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-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/settings.gradle.kts b/settings.gradle.kts index 44c688fac76..6d809ba31b0 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -84,6 +84,7 @@ 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") 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() From fb3494347bb3458f03491e40cf44be3c0e1075c1 Mon Sep 17 00:00:00 2001 From: Enrico Risa Date: Mon, 14 Oct 2024 12:53:49 +0200 Subject: [PATCH 2/5] refactor: extract dsp negotiation validation lib --- .../dsp/dsp-negotiation/build.gradle.kts | 1 + .../dsp-negotiation-http-api/build.gradle.kts | 1 + .../http/api/DspNegotiationApiExtension.java | 36 +++++++++--------- .../DspNegotiationApiController.java | 28 +++++++------- .../api/DspNegotiationApiExtensionTest.java | 24 ++++++------ .../DspNegotiationApiControllerTest.java | 32 ++++++++-------- ...omContractAgreementMessageTransformer.java | 4 +- ...reementVerificationMessageTransformer.java | 4 +- ...actNegotiationEventMessageTransformer.java | 4 +- ...otiationTerminationMessageTransformer.java | 4 +- ...ctFromContractOfferMessageTransformer.java | 12 +++--- ...FromContractRequestMessageTransformer.java | 12 +++--- ...ToContractAgreementMessageTransformer.java | 14 +++---- ...reementVerificationMessageTransformer.java | 6 +-- ...actNegotiationEventMessageTransformer.java | 8 ++-- ...otiationTerminationMessageTransformer.java | 8 ++-- ...jectToContractOfferMessageTransformer.java | 18 ++++----- ...ctToContractRequestMessageTransformer.java | 22 +++++------ ...ntractAgreementMessageTransformerTest.java | 7 ++-- ...entVerificationMessageTransformerTest.java | 4 +- ...egotiationEventMessageTransformerTest.java | 4 +- ...tionTerminationMessageTransformerTest.java | 4 +- ...omContractOfferMessageTransformerTest.java | 16 ++++---- ...ContractRequestMessageTransformerTest.java | 14 +++---- ...ntractAgreementMessageTransformerTest.java | 38 +++++++++---------- ...entVerificationMessageTransformerTest.java | 6 +-- ...egotiationEventMessageTransformerTest.java | 10 ++--- ...tionTerminationMessageTransformerTest.java | 6 +-- ...ToContractOfferMessageTransformerTest.java | 34 ++++++++--------- ...ContractRequestMessageTransformerTest.java | 26 ++++++------- .../build.gradle.kts | 10 +++++ .../ContractAgreementMessageValidator.java | 14 +++++-- ...AgreementVerificationMessageValidator.java | 13 +++++-- ...tractNegotiationEventMessageValidator.java | 13 +++++-- ...egotiationTerminationMessageValidator.java | 13 +++++-- .../ContractOfferMessageValidator.java | 21 ++++++---- .../ContractRequestMessageValidator.java | 21 ++++++---- ...ContractAgreementMessageValidatorTest.java | 8 ++-- ...ementVerificationMessageValidatorTest.java | 8 ++-- ...tNegotiationEventMessageValidatorTest.java | 8 ++-- ...iationTerminationMessageValidatorTest.java | 8 ++-- .../ContractOfferMessageValidatorTest.java | 26 ++++++------- .../ContractRequestMessageValidatorTest.java | 34 ++++++++--------- .../DspNegotiationPropertyAndTypeNames.java | 23 ++++++----- .../dsp/spi/type/DspPropertyAndTypeNames.java | 3 +- ...FromTransferRequestMessageTransformer.java | 4 +- ...ctToTransferRequestMessageTransformer.java | 7 ++-- ...TransferRequestMessageTransformerTest.java | 8 ++-- ...TransferRequestMessageTransformerTest.java | 8 ++-- settings.gradle.kts | 1 + 50 files changed, 354 insertions(+), 304 deletions(-) create mode 100644 data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-validation-lib/build.gradle.kts rename data-protocols/dsp/dsp-negotiation/{dsp-negotiation-http-api/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/http/api => lib/dsp-negotiation-validation-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation}/validation/ContractAgreementMessageValidator.java (68%) rename data-protocols/dsp/dsp-negotiation/{dsp-negotiation-http-api/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/http/api => lib/dsp-negotiation-validation-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation}/validation/ContractAgreementVerificationMessageValidator.java (71%) rename data-protocols/dsp/dsp-negotiation/{dsp-negotiation-http-api/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/http/api => lib/dsp-negotiation-validation-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation}/validation/ContractNegotiationEventMessageValidator.java (72%) rename data-protocols/dsp/dsp-negotiation/{dsp-negotiation-http-api/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/http/api => lib/dsp-negotiation-validation-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation}/validation/ContractNegotiationTerminationMessageValidator.java (71%) rename data-protocols/dsp/dsp-negotiation/{dsp-negotiation-http-api/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/http/api => lib/dsp-negotiation-validation-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation}/validation/ContractOfferMessageValidator.java (69%) rename data-protocols/dsp/dsp-negotiation/{dsp-negotiation-http-api/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/http/api => lib/dsp-negotiation-validation-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation}/validation/ContractRequestMessageValidator.java (69%) rename data-protocols/dsp/dsp-negotiation/{dsp-negotiation-http-api/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/http/api => lib/dsp-negotiation-validation-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation}/validation/ContractAgreementMessageValidatorTest.java (88%) rename data-protocols/dsp/dsp-negotiation/{dsp-negotiation-http-api/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/http/api => lib/dsp-negotiation-validation-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation}/validation/ContractAgreementVerificationMessageValidatorTest.java (90%) rename data-protocols/dsp/dsp-negotiation/{dsp-negotiation-http-api/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/http/api => lib/dsp-negotiation-validation-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation}/validation/ContractNegotiationEventMessageValidatorTest.java (91%) rename data-protocols/dsp/dsp-negotiation/{dsp-negotiation-http-api/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/http/api => lib/dsp-negotiation-validation-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation}/validation/ContractNegotiationTerminationMessageValidatorTest.java (90%) rename data-protocols/dsp/dsp-negotiation/{dsp-negotiation-http-api/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/http/api => lib/dsp-negotiation-validation-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation}/validation/ContractOfferMessageValidatorTest.java (82%) rename data-protocols/dsp/dsp-negotiation/{dsp-negotiation-http-api/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/http/api => lib/dsp-negotiation-validation-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation}/validation/ContractRequestMessageValidatorTest.java (82%) 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..beefc7dbf88 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 @@ -26,6 +26,7 @@ dependencies { 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..aede9501265 --- /dev/null +++ b/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-validation-lib/build.gradle.kts @@ -0,0 +1,10 @@ +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 68% 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..33d3f15f6a9 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 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) * * This program and the accompanying materials are made available under the * terms of the Apache License, Version 2.0 which is available at @@ -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 71% 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..9a587d743c7 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 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) * * This program and the accompanying materials are made available under the * terms of the Apache License, Version 2.0 which is available at @@ -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 72% 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..5fa05c0d9bf 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 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) * * This program and the accompanying materials are made available under the * terms of the Apache License, Version 2.0 which is available at @@ -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 71% 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..9727e8a53c5 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 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) * * This program and the accompanying materials are made available under the * terms of the Apache License, Version 2.0 which is available at @@ -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 69% 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..dd7591486b6 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 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) * * This program and the accompanying materials are made available under the * terms of the Apache License, Version 2.0 which is available at @@ -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 69% 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..9709fa7238e 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 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) * * This program and the accompanying materials are made available under the * terms of the Apache License, Version 2.0 which is available at @@ -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 88% 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..82c8795db07 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 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) * * This program and the accompanying materials are made available under the * terms of the Apache License, Version 2.0 which is available at @@ -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 90% 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..2b8fb2f6b6e 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 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) * * This program and the accompanying materials are made available under the * terms of the Apache License, Version 2.0 which is available at @@ -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 91% 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..271e647415e 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 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) * * This program and the accompanying materials are made available under the * terms of the Apache License, Version 2.0 which is available at @@ -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 90% 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..37d5be6420f 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 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) * * This program and the accompanying materials are made available under the * terms of the Apache License, Version 2.0 which is available at @@ -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 82% 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..b7a6e2c3574 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 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) * * This program and the accompanying materials are made available under the * terms of the Apache License, Version 2.0 which is available at @@ -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 82% 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..82eac754526 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 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) * * This program and the accompanying materials are made available under the * terms of the Apache License, Version 2.0 which is available at @@ -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/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-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..ba5f4b7eaad 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,7 +27,7 @@ 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; @@ -53,7 +53,7 @@ public JsonObjectFromTransferRequestMessageTransformer(JsonBuilderFactory jsonBu .add(TYPE, DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE) .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/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..15177f19f2a 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,7 +23,7 @@ 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; @@ -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/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..1bd50b0457d 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,7 +29,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.eclipse.edc.jsonld.spi.PropertyAndTypeNames.DCT_FORMAT_ATTRIBUTE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CALLBACK_ADDRESS; +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; @@ -84,7 +84,7 @@ void transformTransferRequestMessageWithDataAddress() { assertThat(result.getJsonString(JsonLdKeywords.TYPE).getString()).isEqualTo(DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE); 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); @@ -108,7 +108,7 @@ void transformTransferRequestMessageWithoutDataAddress() { assertThat(result.getJsonString(JsonLdKeywords.TYPE).getString()).isEqualTo(DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE); 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()); @@ -132,7 +132,7 @@ void transformTransferRequestMessageWithTransferType() { assertThat(result.getJsonString(JsonLdKeywords.TYPE).getString()).isEqualTo(DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE); 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/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..6b3ca1cb8f0 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,7 +25,7 @@ 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; @@ -57,7 +57,7 @@ void jsonObjectToTransferRequestWithoutDataAddress() { .add(TYPE, DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE) .add(DSPACE_PROPERTY_CONTRACT_AGREEMENT_ID, contractId) .add(DCT_FORMAT_ATTRIBUTE, destinationType) - .add(DSPACE_PROPERTY_CALLBACK_ADDRESS, callbackAddress) + .add(DSPACE_PROPERTY_CALLBACK_ADDRESS_IRI, callbackAddress) .add(DSPACE_PROPERTY_CONSUMER_PID, "processId") .build(); @@ -82,7 +82,7 @@ void jsonObjectToTransferRequestWithDataAddress() { .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(); @@ -105,7 +105,7 @@ void shouldReturnNullAndReportError_whenConsumerPidNotSet() { .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/settings.gradle.kts b/settings.gradle.kts index 6d809ba31b0..5b10dfb446c 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -90,6 +90,7 @@ 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") From 096763f179cac8b89f28dee272a3e6c68f75579b Mon Sep 17 00:00:00 2001 From: Enrico Risa Date: Mon, 14 Oct 2024 13:34:27 +0200 Subject: [PATCH 3/5] refactor: extract dsp transfer process validation lib --- ...spTransferProcessPropertyAndTypeNames.java | 12 ++++++---- .../dsp/dsp-transfer-process/build.gradle.kts | 1 + .../build.gradle.kts | 1 + .../api/DspTransferProcessApiExtension.java | 24 +++++++++---------- .../DspTransferProcessApiController.java | 16 ++++++------- .../DspTransferProcessApiExtensionTest.java | 16 ++++++------- .../DspTransferProcessApiControllerTest.java | 18 +++++++------- ...mTransferCompletionMessageTransformer.java | 4 ++-- ...FromTransferRequestMessageTransformer.java | 4 ++-- ...ctFromTransferStartMessageTransformer.java | 4 ++-- ...TransferTerminationMessageTransformer.java | 4 ++-- ...oTransferCompletionMessageTransformer.java | 6 ++--- ...ctToTransferRequestMessageTransformer.java | 4 ++-- ...jectToTransferStartMessageTransformer.java | 6 ++--- ...oTransferSuspensionMessageTransformer.java | 4 ++-- ...TransferTerminationMessageTransformer.java | 8 +++---- ...nsferCompletionMessageTransformerTest.java | 4 ++-- ...TransferRequestMessageTransformerTest.java | 8 +++---- ...omTransferStartMessageTransformerTest.java | 4 ++-- ...sferTerminationMessageTransformerTest.java | 4 ++-- ...nsferCompletionMessageTransformerTest.java | 6 ++--- ...TransferRequestMessageTransformerTest.java | 8 +++---- ...ToTransferStartMessageTransformerTest.java | 10 ++++---- ...sferTerminationMessageTransformerTest.java | 6 ++--- .../build.gradle.kts | 10 ++++++++ .../TransferCompletionMessageValidator.java | 14 +++++++---- .../TransferRequestMessageValidator.java | 14 +++++++---- .../TransferStartMessageValidator.java | 14 +++++++---- .../TransferTerminationMessageValidator.java | 14 +++++++---- ...ransferCompletionMessageValidatorTest.java | 8 +++---- .../TransferRequestMessageValidatorTest.java | 8 +++---- .../TransferStartMessageValidatorTest.java | 8 +++---- ...ansferTerminationMessageValidatorTest.java | 8 +++---- settings.gradle.kts | 1 + 34 files changed, 161 insertions(+), 120 deletions(-) create mode 100644 data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-validation-lib/build.gradle.kts rename data-protocols/dsp/dsp-transfer-process/{dsp-transfer-process-http-api/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/http/api => lib/dsp-transfer-process-validation-lib/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess}/validation/TransferCompletionMessageValidator.java (71%) rename data-protocols/dsp/dsp-transfer-process/{dsp-transfer-process-http-api/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/http/api => lib/dsp-transfer-process-validation-lib/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess}/validation/TransferRequestMessageValidator.java (67%) rename data-protocols/dsp/dsp-transfer-process/{dsp-transfer-process-http-api/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/http/api => lib/dsp-transfer-process-validation-lib/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess}/validation/TransferStartMessageValidator.java (67%) rename data-protocols/dsp/dsp-transfer-process/{dsp-transfer-process-http-api/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/http/api => lib/dsp-transfer-process-validation-lib/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess}/validation/TransferTerminationMessageValidator.java (71%) rename data-protocols/dsp/dsp-transfer-process/{dsp-transfer-process-http-api/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/http/api => lib/dsp-transfer-process-validation-lib/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess}/validation/TransferCompletionMessageValidatorTest.java (91%) rename data-protocols/dsp/dsp-transfer-process/{dsp-transfer-process-http-api/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/http/api => lib/dsp-transfer-process-validation-lib/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess}/validation/TransferRequestMessageValidatorTest.java (88%) rename data-protocols/dsp/dsp-transfer-process/{dsp-transfer-process-http-api/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/http/api => lib/dsp-transfer-process-validation-lib/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess}/validation/TransferStartMessageValidatorTest.java (88%) rename data-protocols/dsp/dsp-transfer-process/{dsp-transfer-process-http-api/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/http/api => lib/dsp-transfer-process-validation-lib/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess}/validation/TransferTerminationMessageValidatorTest.java (91%) 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..849a5ee0e59 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 @@ -26,6 +26,7 @@ dependencies { 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 ba5f4b7eaad..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 @@ -31,7 +31,7 @@ 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,7 +50,7 @@ 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_IRI, transferRequestMessage.getCallbackAddress()) 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 15177f19f2a..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 @@ -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.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; 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 1bd50b0457d..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 @@ -33,7 +33,7 @@ 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,7 +81,7 @@ 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_IRI).getString()).isEqualTo(callbackAddress); @@ -105,7 +105,7 @@ 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_IRI).getString()).isEqualTo(callbackAddress); @@ -129,7 +129,7 @@ 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_IRI).getString()).isEqualTo(callbackAddress); 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 6b3ca1cb8f0..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 @@ -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.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,7 +54,7 @@ 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_IRI, callbackAddress) @@ -78,7 +78,7 @@ 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()) @@ -101,7 +101,7 @@ 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()) 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..aede9501265 --- /dev/null +++ b/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-validation-lib/build.gradle.kts @@ -0,0 +1,10 @@ +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 71% 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..99c0d0e668b 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 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) * * This program and the accompanying materials are made available under the * terms of the Apache License, Version 2.0 which is available at @@ -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 67% 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..f374f693751 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 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) * * This program and the accompanying materials are made available under the * terms of the Apache License, Version 2.0 which is available at @@ -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 67% 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..de0725a7209 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 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) * * This program and the accompanying materials are made available under the * terms of the Apache License, Version 2.0 which is available at @@ -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 71% 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..7dc289da0ab 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 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) * * This program and the accompanying materials are made available under the * terms of the Apache License, Version 2.0 which is available at @@ -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 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/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..915247708dd 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 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) * * This program and the accompanying materials are made available under the * terms of the Apache License, Version 2.0 which is available at @@ -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 88% 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..4704b6d498e 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 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) * * This program and the accompanying materials are made available under the * terms of the Apache License, Version 2.0 which is available at @@ -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 88% 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..f704d8688f1 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 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) * * This program and the accompanying materials are made available under the * terms of the Apache License, Version 2.0 which is available at @@ -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 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/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..149d1c170b6 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 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) * * This program and the accompanying materials are made available under the * terms of the Apache License, Version 2.0 which is available at @@ -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 5b10dfb446c..9c17d4fc8de 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -97,6 +97,7 @@ 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 -------------------------------------------- From 14e356f5959d09c8cf52f1aa74242a942aee65dd Mon Sep 17 00:00:00 2001 From: Enrico Risa Date: Mon, 14 Oct 2024 16:01:45 +0200 Subject: [PATCH 4/5] chore: copyright fix --- .../dsp-catalog-validation-lib/build.gradle.kts | 16 +++++++++++++++- .../CatalogRequestMessageValidator.java | 2 +- .../CatalogRequestMessageValidatorTest.java | 2 +- .../build.gradle.kts | 16 +++++++++++++++- .../ContractAgreementMessageValidator.java | 2 +- ...actAgreementVerificationMessageValidator.java | 2 +- ...ContractNegotiationEventMessageValidator.java | 2 +- ...ctNegotiationTerminationMessageValidator.java | 2 +- .../ContractOfferMessageValidator.java | 2 +- .../ContractRequestMessageValidator.java | 2 +- .../ContractAgreementMessageValidatorTest.java | 2 +- ...greementVerificationMessageValidatorTest.java | 2 +- ...ractNegotiationEventMessageValidatorTest.java | 2 +- ...gotiationTerminationMessageValidatorTest.java | 2 +- .../ContractOfferMessageValidatorTest.java | 2 +- .../ContractRequestMessageValidatorTest.java | 2 +- .../build.gradle.kts | 16 +++++++++++++++- .../TransferCompletionMessageValidator.java | 2 +- .../TransferRequestMessageValidator.java | 2 +- .../TransferStartMessageValidator.java | 2 +- .../TransferTerminationMessageValidator.java | 4 ++-- .../TransferCompletionMessageValidatorTest.java | 2 +- .../TransferRequestMessageValidatorTest.java | 2 +- .../TransferStartMessageValidatorTest.java | 2 +- .../TransferTerminationMessageValidatorTest.java | 2 +- 25 files changed, 68 insertions(+), 26 deletions(-) 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 index aede9501265..e9e1766c8f0 100644 --- 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 @@ -1,3 +1,17 @@ +/* + * 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` } @@ -5,6 +19,6 @@ plugins { 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/lib/dsp-catalog-validation-lib/src/main/java/org/eclipse/edc/protocol/dsp/catalog/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 index 868bdcf48c9..66b8d8d6d93 100644 --- a/data-protocols/dsp/dsp-catalog/lib/dsp-catalog-validation-lib/src/main/java/org/eclipse/edc/protocol/dsp/catalog/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 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * Copyright (c) 2023 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 diff --git a/data-protocols/dsp/dsp-catalog/lib/dsp-catalog-validation-lib/src/test/java/org/eclipse/edc/protocol/dsp/catalog/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 index e56cecb4dce..e890c4c4613 100644 --- a/data-protocols/dsp/dsp-catalog/lib/dsp-catalog-validation-lib/src/test/java/org/eclipse/edc/protocol/dsp/catalog/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 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * Copyright (c) 2023 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 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 index aede9501265..e9e1766c8f0 100644 --- 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 @@ -1,3 +1,17 @@ +/* + * 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` } @@ -5,6 +19,6 @@ plugins { 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/lib/dsp-negotiation-validation-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/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 index 33d3f15f6a9..f3517265cff 100644 --- a/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-validation-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/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 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * Copyright (c) 2023 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 diff --git a/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-validation-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/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 index 9a587d743c7..9a3db67aa3b 100644 --- a/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-validation-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/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 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * Copyright (c) 2023 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 diff --git a/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-validation-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/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 index 5fa05c0d9bf..28d39a7fb35 100644 --- a/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-validation-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/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 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * Copyright (c) 2023 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 diff --git a/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-validation-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/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 index 9727e8a53c5..932a7d2c77d 100644 --- a/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-validation-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/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 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * Copyright (c) 2023 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 diff --git a/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-validation-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/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 index dd7591486b6..914855b2e40 100644 --- a/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-validation-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/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 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * Copyright (c) 2023 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 diff --git a/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-validation-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/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 index 9709fa7238e..e03578f7ab3 100644 --- a/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-validation-lib/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/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 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * Copyright (c) 2023 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 diff --git a/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-validation-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/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 index 82c8795db07..4fa925469e5 100644 --- a/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-validation-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/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 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * Copyright (c) 2023 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 diff --git a/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-validation-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/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 index 2b8fb2f6b6e..abbc5fd05ad 100644 --- a/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-validation-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/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 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * Copyright (c) 2023 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 diff --git a/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-validation-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/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 index 271e647415e..31b0f6acc6c 100644 --- a/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-validation-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/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 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * Copyright (c) 2023 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 diff --git a/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-validation-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/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 index 37d5be6420f..3ac9600661b 100644 --- a/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-validation-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/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 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * Copyright (c) 2023 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 diff --git a/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-validation-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/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 index b7a6e2c3574..9d586f3d1b8 100644 --- a/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-validation-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/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 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * Copyright (c) 2023 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 diff --git a/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-validation-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/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 index 82eac754526..c1cf13bd836 100644 --- a/data-protocols/dsp/dsp-negotiation/lib/dsp-negotiation-validation-lib/src/test/java/org/eclipse/edc/protocol/dsp/negotiation/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 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * Copyright (c) 2023 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 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 index aede9501265..e9e1766c8f0 100644 --- 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 @@ -1,3 +1,17 @@ +/* + * 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` } @@ -5,6 +19,6 @@ plugins { 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/lib/dsp-transfer-process-validation-lib/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/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 index 99c0d0e668b..e7cca2b8744 100644 --- a/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-validation-lib/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/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 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * Copyright (c) 2023 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 diff --git a/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-validation-lib/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/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 index f374f693751..029f4caf3ed 100644 --- a/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-validation-lib/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/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 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * Copyright (c) 2023 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 diff --git a/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-validation-lib/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/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 index de0725a7209..dadf2a57788 100644 --- a/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-validation-lib/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/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 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * Copyright (c) 2023 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 diff --git a/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-validation-lib/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/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 index 7dc289da0ab..7a8f5f16913 100644 --- a/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-validation-lib/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/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 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * Copyright (c) 2023 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 @@ -27,7 +27,7 @@ * Validator for {@link TransferTerminationMessage} Json-LD representation */ public class TransferTerminationMessageValidator { - + public static Validator instance() { return instance(DSPACE_SCHEMA); } diff --git a/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-validation-lib/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/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 index 915247708dd..c54844963fd 100644 --- a/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-validation-lib/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/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 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * Copyright (c) 2023 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 diff --git a/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-validation-lib/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/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 index 4704b6d498e..dbdb9f4f0d8 100644 --- a/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-validation-lib/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/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 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * Copyright (c) 2023 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 diff --git a/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-validation-lib/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/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 index f704d8688f1..74725635a17 100644 --- a/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-validation-lib/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/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 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * Copyright (c) 2023 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 diff --git a/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-validation-lib/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/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 index 149d1c170b6..eb469b8c81b 100644 --- a/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-validation-lib/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/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 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * Copyright (c) 2023 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 From e42ed8004dc3a6d9fe0f732a3573c7015e3bedce Mon Sep 17 00:00:00 2001 From: Enrico Risa Date: Tue, 15 Oct 2024 11:26:36 +0200 Subject: [PATCH 5/5] chore: removed not needed deps --- .../dsp/dsp-catalog/dsp-catalog-http-api/build.gradle.kts | 3 ++- .../dsp-negotiation/dsp-negotiation-http-api/build.gradle.kts | 1 - .../dsp-transfer-process-http-api/build.gradle.kts | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) 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 f32c7b6cfda..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,10 @@ 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-negotiation/dsp-negotiation-http-api/build.gradle.kts b/data-protocols/dsp/dsp-negotiation/dsp-negotiation-http-api/build.gradle.kts index beefc7dbf88..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,6 @@ 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-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 849a5ee0e59..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,6 @@ 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)