From 14e7b3680ee3371599f1f0f6a7975ed51c83bcc3 Mon Sep 17 00:00:00 2001 From: arnoweiss Date: Wed, 27 Nov 2024 20:24:04 +0100 Subject: [PATCH 1/2] fix: add artifacts for catalog request message --- .../catalog-request-message-schema.json | 32 +++++++++++++++ .../example/catalog-request-message.json | 7 ++++ .../context/catalog/CatalogContextTest.java | 6 +++ .../CatalogRequestMessageSchemaTest.java | 40 +++++++++++++++++++ 4 files changed, 85 insertions(+) create mode 100644 artifacts/src/main/resources/catalog/catalog-request-message-schema.json create mode 100644 artifacts/src/main/resources/catalog/example/catalog-request-message.json create mode 100644 artifacts/src/test/java/org/eclipse/dsp/schema/catalog/CatalogRequestMessageSchemaTest.java diff --git a/artifacts/src/main/resources/catalog/catalog-request-message-schema.json b/artifacts/src/main/resources/catalog/catalog-request-message-schema.json new file mode 100644 index 0000000..5b76b4e --- /dev/null +++ b/artifacts/src/main/resources/catalog/catalog-request-message-schema.json @@ -0,0 +1,32 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/schema", + "title": "CatalogRequestMessageSchema", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CatalogRequestMessage" + } + ], + "$id": "https://w3id.org/dspace/2024/1/catalog/catalog-request-message-schema.json", + "definitions": { + "CatalogRequestMessage": { + "type": "object", + "properties": { + "@context": { + "$ref": "https://w3id.org/dspace/2024/1/common/context-schema.json" + }, + "@type": { + "type": "string", + "const": "CatalogRequestMessage" + }, + "filter": { + "type": "array" + } + }, + "required": [ + "@context", + "@type" + ] + } + } +} diff --git a/artifacts/src/main/resources/catalog/example/catalog-request-message.json b/artifacts/src/main/resources/catalog/example/catalog-request-message.json new file mode 100644 index 0000000..3ad0c52 --- /dev/null +++ b/artifacts/src/main/resources/catalog/example/catalog-request-message.json @@ -0,0 +1,7 @@ +{ + "@context": [ + "https://w3id.org/dspace/2024/1/context.json" + ], + "@type": "CatalogRequestMessage", + "filter": [] +} diff --git a/artifacts/src/test/java/org/eclipse/dsp/context/catalog/CatalogContextTest.java b/artifacts/src/test/java/org/eclipse/dsp/context/catalog/CatalogContextTest.java index e3aab4f..e616327 100644 --- a/artifacts/src/test/java/org/eclipse/dsp/context/catalog/CatalogContextTest.java +++ b/artifacts/src/test/java/org/eclipse/dsp/context/catalog/CatalogContextTest.java @@ -48,4 +48,10 @@ void verifyNestedCatalog() { verifyRoundTrip("/catalog/example/nested-catalog.json", "/catalog/catalog-schema.json"); } + + @Test + void verifyCatalogRequestMessage() { + verifyRoundTrip("/catalog/example/catalog-request-message.json", + "/catalog/catalog-request-message-schema.json"); + } } diff --git a/artifacts/src/test/java/org/eclipse/dsp/schema/catalog/CatalogRequestMessageSchemaTest.java b/artifacts/src/test/java/org/eclipse/dsp/schema/catalog/CatalogRequestMessageSchemaTest.java new file mode 100644 index 0000000..b64fffc --- /dev/null +++ b/artifacts/src/test/java/org/eclipse/dsp/schema/catalog/CatalogRequestMessageSchemaTest.java @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2024 Metaform Systems, Inc. + * + * 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: + * Metaform Systems, Inc. - initial API and implementation + * SAP SE - extension to catalog request message + * + */ + +package org.eclipse.dsp.schema.catalog; + +import org.eclipse.dsp.schema.fixtures.AbstractSchemaTest; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import java.io.IOException; + +import static org.assertj.core.api.Assertions.assertThat; + +public class CatalogRequestMessageSchemaTest extends AbstractSchemaTest { + + @Test + void verifySchema() throws IOException { + var node = mapper.readTree(getClass().getResourceAsStream("/catalog/example/catalog-request-message.json")); + assertThat(schema.validate(node)).isEmpty(); + } + + @BeforeEach + void setUp() { + setUp("/catalog/catalog-request-message-schema.json"); + } + + +} From e82d39a7a87ae1e64e59f1b1b82025e75390ecd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arno=20Wei=C3=9F?= <86715435+arnoweiss@users.noreply.github.com> Date: Fri, 29 Nov 2024 14:54:13 +0100 Subject: [PATCH 2/2] fix: edit copyright header --- .../dsp/schema/catalog/CatalogRequestMessageSchemaTest.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/artifacts/src/test/java/org/eclipse/dsp/schema/catalog/CatalogRequestMessageSchemaTest.java b/artifacts/src/test/java/org/eclipse/dsp/schema/catalog/CatalogRequestMessageSchemaTest.java index b64fffc..014d3cc 100644 --- a/artifacts/src/test/java/org/eclipse/dsp/schema/catalog/CatalogRequestMessageSchemaTest.java +++ b/artifacts/src/test/java/org/eclipse/dsp/schema/catalog/CatalogRequestMessageSchemaTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Metaform Systems, Inc. + * Copyright (c) 2024 SAP SE * * This program and the accompanying materials are made available under the * terms of the Apache License, Version 2.0 which is available at @@ -8,7 +8,6 @@ * SPDX-License-Identifier: Apache-2.0 * * Contributors: - * Metaform Systems, Inc. - initial API and implementation * SAP SE - extension to catalog request message * */